*ret = TAKE_PTR(hostname);
return 0;
}
-
-static sd_dhcp_option* dhcp_option_free(sd_dhcp_option *i) {
- if (!i)
- return NULL;
-
- free(i->data);
- return mfree(i);
-}
-
-int sd_dhcp_option_new(uint8_t option, const void *data, size_t length, sd_dhcp_option **ret) {
- assert_return(ret, -EINVAL);
- assert_return(length == 0 || data, -EINVAL);
-
- _cleanup_free_ void *q = memdup(data, length);
- if (!q)
- return -ENOMEM;
-
- sd_dhcp_option *p = new(sd_dhcp_option, 1);
- if (!p)
- return -ENOMEM;
-
- *p = (sd_dhcp_option) {
- .n_ref = 1,
- .option = option,
- .length = length,
- .data = TAKE_PTR(q),
- };
-
- *ret = TAKE_PTR(p);
- return 0;
-}
-
-DEFINE_TRIVIAL_REF_UNREF_FUNC(sd_dhcp_option, sd_dhcp_option, dhcp_option_free);
-DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
- dhcp_option_hash_ops,
- void,
- trivial_hash_func,
- trivial_compare_func,
- sd_dhcp_option,
- sd_dhcp_option_unref);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-dhcp-option.h" /* IWYU pragma: export */
-
#include "dhcp-protocol.h"
#include "sd-forward.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;
'sd-dhcp-client.h',
'sd-dhcp-duid.h',
'sd-dhcp-lease.h',
- 'sd-dhcp-option.h',
'sd-dhcp-protocol.h',
'sd-dhcp-server-lease.h',
'sd-dhcp-server.h',
typedef struct sd_device sd_device;
typedef struct sd_dhcp_client_id sd_dhcp_client_id;
typedef struct sd_dhcp_lease sd_dhcp_lease;
-typedef struct sd_dhcp_option sd_dhcp_option;
typedef struct sd_event sd_event;
enum {
+++ /dev/null
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#ifndef foosddhcpoptionhfoo
-#define foosddhcpoptionhfoo
-
-/***
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <https://www.gnu.org/licenses/>.
-***/
-
-#include "_sd-common.h"
-#include "sd-dhcp-protocol.h" /* IWYU pragma: export */
-
-_SD_BEGIN_DECLARATIONS;
-
-typedef struct sd_dhcp_option sd_dhcp_option;
-
-int sd_dhcp_option_new(uint8_t option, const void *data, size_t length, sd_dhcp_option **ret);
-_SD_DECLARE_TRIVIAL_REF_UNREF_FUNC(sd_dhcp_option);
-
-_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_option, sd_dhcp_option_unref);
-
-_SD_END_DECLARATIONS;
-
-#endif
_SD_BEGIN_DECLARATIONS;
typedef struct sd_event sd_event;
-typedef struct sd_dhcp_option sd_dhcp_option;
typedef struct sd_dhcp_server sd_dhcp_server;
enum {