summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/dhcp-internal.h
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-05-20 11:04:50 +0200
committerTom Gundersen <teg@jklm.no>2014-05-20 23:31:22 +0200
commit20b958bf157dfb2f521b191ef7158035bcaa3003 (patch)
treed5964a60f26aaa1aeb4b0771a1f2a2b0f0efed10 /src/libsystemd-network/dhcp-internal.h
parentece6e766cf89c8ec82ad135969dedf16cd7c1ee8 (diff)
sd-dhcp: refactor dhcp_option_append
Store a pointer to the options in the DHCPMessage struct, and pass this together with an offset around, rather than a uint8_t**. This avoids us having to (re)compute the pointer; and changes dhcp_option_append from adjusting both the pointer to the next option and the remaining size of the options, to just adjusting the current offset. This makes the code a bit simpler to follow IMHO, but there should be no functional change.
Diffstat (limited to 'src/libsystemd-network/dhcp-internal.h')
-rw-r--r--src/libsystemd-network/dhcp-internal.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd-network/dhcp-internal.h b/src/libsystemd-network/dhcp-internal.h
index eb4a6cdce2..56423a2cce 100644
--- a/src/libsystemd-network/dhcp-internal.h
+++ b/src/libsystemd-network/dhcp-internal.h
@@ -36,8 +36,8 @@ int dhcp_network_send_raw_socket(int s, const union sockaddr_union *link,
int dhcp_network_send_udp_socket(int s, be32_t address, uint16_t port,
const void *packet, size_t len);
-int dhcp_option_append(uint8_t **buf, size_t *buflen, uint8_t code,
- size_t optlen, const void *optval);
+int dhcp_option_append(uint8_t options[], size_t size, size_t *offset,
+ uint8_t code, size_t optlen, const void *optval);
typedef int (*dhcp_option_cb_t)(uint8_t code, uint8_t len,
const uint8_t *option, void *user_data);
@@ -46,7 +46,7 @@ int dhcp_option_parse(DHCPMessage *message, size_t len,
dhcp_option_cb_t cb, void *user_data);
int dhcp_message_init(DHCPMessage *message, uint8_t op, uint32_t xid, uint8_t type,
- uint8_t **opt, size_t *optlen);
+ uint8_t options[], size_t optlen, size_t *optoffset);
uint16_t dhcp_packet_checksum(void *buf, size_t len);