]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/systemd/sd-dhcp6-client.h
1bedc941aa8670de337c741b6e71faf3e0a73468
[thirdparty/systemd.git] / src / systemd / sd-dhcp6-client.h
1 #ifndef foosddhcp6clienthfoo
2 #define foosddhcp6clienthfoo
3
4 /***
5 This file is part of systemd.
6
7 Copyright (C) 2014 Intel Corporation. All rights reserved.
8
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
13
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21 ***/
22
23 #include <inttypes.h>
24 #include <net/ethernet.h>
25 #include <sys/types.h>
26
27 #include "sd-dhcp6-lease.h"
28 #include "sd-event.h"
29
30 #include "_sd-common.h"
31
32 _SD_BEGIN_DECLARATIONS;
33
34 enum {
35 SD_DHCP6_CLIENT_EVENT_STOP = 0,
36 SD_DHCP6_CLIENT_EVENT_RESEND_EXPIRE = 10,
37 SD_DHCP6_CLIENT_EVENT_RETRANS_MAX = 11,
38 SD_DHCP6_CLIENT_EVENT_IP_ACQUIRE = 12,
39 SD_DHCP6_CLIENT_EVENT_INFORMATION_REQUEST = 13,
40 };
41
42 enum {
43 SD_DHCP6_OPTION_CLIENTID = 1,
44 SD_DHCP6_OPTION_SERVERID = 2,
45 SD_DHCP6_OPTION_IA_NA = 3,
46 SD_DHCP6_OPTION_IA_TA = 4,
47 SD_DHCP6_OPTION_IAADDR = 5,
48 SD_DHCP6_OPTION_ORO = 6,
49 SD_DHCP6_OPTION_PREFERENCE = 7,
50 SD_DHCP6_OPTION_ELAPSED_TIME = 8,
51 SD_DHCP6_OPTION_RELAY_MSG = 9,
52 /* option code 10 is unassigned */
53 SD_DHCP6_OPTION_AUTH = 11,
54 SD_DHCP6_OPTION_UNICAST = 12,
55 SD_DHCP6_OPTION_STATUS_CODE = 13,
56 SD_DHCP6_OPTION_RAPID_COMMIT = 14,
57 SD_DHCP6_OPTION_USER_CLASS = 15,
58 SD_DHCP6_OPTION_VENDOR_CLASS = 16,
59 SD_DHCP6_OPTION_VENDOR_OPTS = 17,
60 SD_DHCP6_OPTION_INTERFACE_ID = 18,
61 SD_DHCP6_OPTION_RECONF_MSG = 19,
62 SD_DHCP6_OPTION_RECONF_ACCEPT = 20,
63
64 SD_DHCP6_OPTION_DNS_SERVERS = 23, /* RFC 3646 */
65 SD_DHCP6_OPTION_DOMAIN_LIST = 24, /* RFC 3646 */
66
67 SD_DHCP6_OPTION_SNTP_SERVERS = 31, /* RFC 4075, deprecated */
68
69 /* option code 35 is unassigned */
70
71 SD_DHCP6_OPTION_NTP_SERVER = 56, /* RFC 5908 */
72
73 /* option codes 89-142 are unassigned */
74 /* option codes 144-65535 are unassigned */
75 };
76
77 typedef struct sd_dhcp6_client sd_dhcp6_client;
78
79 typedef void (*sd_dhcp6_client_callback_t)(sd_dhcp6_client *client, int event,
80 void *userdata);
81 int sd_dhcp6_client_set_callback(sd_dhcp6_client *client,
82 sd_dhcp6_client_callback_t cb, void *userdata);
83
84 int sd_dhcp6_client_set_index(sd_dhcp6_client *client, int interface_index);
85 int sd_dhcp6_client_set_local_address(sd_dhcp6_client *client, const struct in6_addr *local_address);
86 int sd_dhcp6_client_set_mac(sd_dhcp6_client *client, const uint8_t *addr,
87 size_t addr_len, uint16_t arp_type);
88 int sd_dhcp6_client_set_duid(sd_dhcp6_client *client, uint16_t type, uint8_t *duid,
89 size_t duid_len);
90 int sd_dhcp6_client_set_information_request(sd_dhcp6_client *client, int enabled);
91 int sd_dhcp6_client_get_information_request(sd_dhcp6_client *client, int *enabled);
92 int sd_dhcp6_client_set_request_option(sd_dhcp6_client *client,
93 uint16_t option);
94
95 int sd_dhcp6_client_get_lease(sd_dhcp6_client *client, sd_dhcp6_lease **ret);
96
97 int sd_dhcp6_client_stop(sd_dhcp6_client *client);
98 int sd_dhcp6_client_start(sd_dhcp6_client *client);
99 int sd_dhcp6_client_is_running(sd_dhcp6_client *client);
100 int sd_dhcp6_client_attach_event(sd_dhcp6_client *client, sd_event *event, int64_t priority);
101 int sd_dhcp6_client_detach_event(sd_dhcp6_client *client);
102 sd_event *sd_dhcp6_client_get_event(sd_dhcp6_client *client);
103 sd_dhcp6_client *sd_dhcp6_client_ref(sd_dhcp6_client *client);
104 sd_dhcp6_client *sd_dhcp6_client_unref(sd_dhcp6_client *client);
105 int sd_dhcp6_client_new(sd_dhcp6_client **ret);
106
107 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp6_client, sd_dhcp6_client_unref);
108
109 _SD_END_DECLARATIONS;
110
111 #endif