From 55944e5e40b1be2afc4855d8d2baf4b73d1876b5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 22:49:52 +0200 Subject: Adding upstream version 255.4. Signed-off-by: Daniel Baumann --- src/libsystemd-network/dhcp-option.h | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/libsystemd-network/dhcp-option.h (limited to 'src/libsystemd-network/dhcp-option.h') diff --git a/src/libsystemd-network/dhcp-option.h b/src/libsystemd-network/dhcp-option.h new file mode 100644 index 0000000..425f5b5 --- /dev/null +++ b/src/libsystemd-network/dhcp-option.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +#include + +#include "sd-dhcp-option.h" + +#include "dhcp-protocol.h" +#include "hash-funcs.h" + +struct sd_dhcp_option { + unsigned n_ref; + + uint8_t option; + void *data; + size_t length; +}; + +extern const struct hash_ops dhcp_option_hash_ops; + +typedef struct DHCPServerData { + struct in_addr *addr; + size_t size; +} DHCPServerData; + +int dhcp_option_append( + DHCPMessage *message, + size_t size, + size_t *offset, + uint8_t overload, + uint8_t code, + size_t optlen, + const void *optval); +int dhcp_option_find_option(uint8_t *options, size_t length, uint8_t wanted_code, size_t *ret_offset); +int dhcp_option_remove_option(uint8_t *options, size_t buflen, uint8_t option_code); + +typedef int (*dhcp_option_callback_t)(uint8_t code, uint8_t len, const void *option, void *userdata); + +int dhcp_option_parse( + DHCPMessage *message, + size_t len, + dhcp_option_callback_t cb, + void *userdata, + char **ret_error_message); + +int dhcp_option_parse_string(const uint8_t *option, size_t len, char **ret); -- cgit v1.2.3