diff options
Diffstat (limited to 'src/libsystemd-network')
l--------- | src/libsystemd-network/Makefile | 1 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/arp-util.h (renamed from src/libsystemd-network/arp-util.h) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp-identifier.h (renamed from src/libsystemd-network/dhcp-identifier.h) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp-internal.h (renamed from src/libsystemd-network/dhcp-internal.h) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp-lease-internal.h (renamed from src/libsystemd-network/dhcp-lease-internal.h) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp-protocol.h (renamed from src/libsystemd-network/dhcp-protocol.h) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp-server-internal.h (renamed from src/libsystemd-network/dhcp-server-internal.h) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp6-internal.h (renamed from src/libsystemd-network/dhcp6-internal.h) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp6-lease-internal.h (renamed from src/libsystemd-network/dhcp6-lease-internal.h) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/dhcp6-protocol.h (renamed from src/libsystemd-network/dhcp6-protocol.h) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/icmp6-util.h (renamed from src/libsystemd-network/icmp6-util.h) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/lldp-internal.h (renamed from src/libsystemd-network/lldp-internal.h) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/lldp-neighbor.h (renamed from src/libsystemd-network/lldp-neighbor.h) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/lldp-network.h (renamed from src/libsystemd-network/lldp-network.h) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/network-internal.h (renamed from src/libsystemd-network/network-internal.h) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-dhcp-client.h | 158 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-dhcp-lease.h | 67 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-dhcp-server.h | 65 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-dhcp6-client.h | 135 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-dhcp6-lease.h | 52 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-ipv4acd.h | 60 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-ipv4ll.h | 60 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-lldp.h | 177 | ||||
-rw-r--r-- | src/libsystemd-network/include/systemd-network/sd-ndisc.h | 84 | ||||
-rw-r--r-- | src/libsystemd-network/src/arp-util.c (renamed from src/libsystemd-network/arp-util.c) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp-identifier.c (renamed from src/libsystemd-network/dhcp-identifier.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp-network.c (renamed from src/libsystemd-network/dhcp-network.c) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp-option.c (renamed from src/libsystemd-network/dhcp-option.c) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp-packet.c (renamed from src/libsystemd-network/dhcp-packet.c) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp6-network.c (renamed from src/libsystemd-network/dhcp6-network.c) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/src/dhcp6-option.c (renamed from src/libsystemd-network/dhcp6-option.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/src/icmp6-util.c (renamed from src/libsystemd-network/icmp6-util.c) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/src/lldp-neighbor.c (renamed from src/libsystemd-network/lldp-neighbor.c) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/src/lldp-network.c (renamed from src/libsystemd-network/lldp-network.c) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/src/network-internal.c (renamed from src/libsystemd-network/network-internal.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-dhcp-client.c (renamed from src/libsystemd-network/sd-dhcp-client.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-dhcp-lease.c (renamed from src/libsystemd-network/sd-dhcp-lease.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-dhcp-server.c (renamed from src/libsystemd-network/sd-dhcp-server.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-dhcp6-client.c (renamed from src/libsystemd-network/sd-dhcp6-client.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-dhcp6-lease.c (renamed from src/libsystemd-network/sd-dhcp6-lease.c) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-ipv4acd.c (renamed from src/libsystemd-network/sd-ipv4acd.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-ipv4ll.c (renamed from src/libsystemd-network/sd-ipv4ll.c) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-lldp.c (renamed from src/libsystemd-network/sd-lldp.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/src/sd-ndisc.c (renamed from src/libsystemd-network/sd-ndisc.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-acd.c (renamed from src/libsystemd-network/test-acd.c) | 6 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-dhcp-client.c (renamed from src/libsystemd-network/test-dhcp-client.c) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-dhcp-option.c (renamed from src/libsystemd-network/test-dhcp-option.c) | 0 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-dhcp-server.c (renamed from src/libsystemd-network/test-dhcp-server.c) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-dhcp6-client.c (renamed from src/libsystemd-network/test-dhcp6-client.c) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-ipv4ll-manual.c (renamed from src/libsystemd-network/test-ipv4ll-manual.c) | 6 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-ipv4ll.c (renamed from src/libsystemd-network/test-ipv4ll.c) | 2 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-lldp.c (renamed from src/libsystemd-network/test-lldp.c) | 4 | ||||
-rw-r--r-- | src/libsystemd-network/test/test-ndisc-rs.c (renamed from src/libsystemd-network/test-ndisc-rs.c) | 2 |
53 files changed, 898 insertions, 41 deletions
diff --git a/src/libsystemd-network/Makefile b/src/libsystemd-network/Makefile deleted file mode 120000 index d0b0e8e008..0000000000 --- a/src/libsystemd-network/Makefile +++ /dev/null @@ -1 +0,0 @@ -../Makefile
\ No newline at end of file diff --git a/src/libsystemd-network/arp-util.h b/src/libsystemd-network/include/systemd-network/arp-util.h index 3ef56b002a..3ef56b002a 100644 --- a/src/libsystemd-network/arp-util.h +++ b/src/libsystemd-network/include/systemd-network/arp-util.h diff --git a/src/libsystemd-network/dhcp-identifier.h b/src/libsystemd-network/include/systemd-network/dhcp-identifier.h index 1cc0f9fb71..802a0d6bc2 100644 --- a/src/libsystemd-network/dhcp-identifier.h +++ b/src/libsystemd-network/include/systemd-network/dhcp-identifier.h @@ -19,7 +19,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-id128.h" +#include <systemd/sd-id128.h> #include "macro.h" #include "sparse-endian.h" diff --git a/src/libsystemd-network/dhcp-internal.h b/src/libsystemd-network/include/systemd-network/dhcp-internal.h index 4662b0d847..dda4c13919 100644 --- a/src/libsystemd-network/dhcp-internal.h +++ b/src/libsystemd-network/include/systemd-network/dhcp-internal.h @@ -25,7 +25,7 @@ #include <net/if_arp.h> #include <stdint.h> -#include "sd-dhcp-client.h" +#include <systemd/sd-dhcp-client.h> #include "dhcp-protocol.h" #include "socket-util.h" diff --git a/src/libsystemd-network/dhcp-lease-internal.h b/src/libsystemd-network/include/systemd-network/dhcp-lease-internal.h index 82cae2300a..646e612cee 100644 --- a/src/libsystemd-network/dhcp-lease-internal.h +++ b/src/libsystemd-network/include/systemd-network/dhcp-lease-internal.h @@ -23,7 +23,7 @@ #include <stdint.h> #include <linux/if_packet.h> -#include "sd-dhcp-client.h" +#include <systemd/sd-dhcp-client.h> #include "dhcp-protocol.h" #include "list.h" diff --git a/src/libsystemd-network/dhcp-protocol.h b/src/libsystemd-network/include/systemd-network/dhcp-protocol.h index 3e32484c1d..3e32484c1d 100644 --- a/src/libsystemd-network/dhcp-protocol.h +++ b/src/libsystemd-network/include/systemd-network/dhcp-protocol.h diff --git a/src/libsystemd-network/dhcp-server-internal.h b/src/libsystemd-network/include/systemd-network/dhcp-server-internal.h index 0c76956fad..7ba1e72155 100644 --- a/src/libsystemd-network/dhcp-server-internal.h +++ b/src/libsystemd-network/include/systemd-network/dhcp-server-internal.h @@ -20,8 +20,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-dhcp-server.h" -#include "sd-event.h" +#include <systemd/sd-dhcp-server.h> +#include <systemd/sd-event.h> #include "dhcp-internal.h" #include "hashmap.h" diff --git a/src/libsystemd-network/dhcp6-internal.h b/src/libsystemd-network/include/systemd-network/dhcp6-internal.h index 945c3b9721..4228053ade 100644 --- a/src/libsystemd-network/dhcp6-internal.h +++ b/src/libsystemd-network/include/systemd-network/dhcp6-internal.h @@ -22,7 +22,7 @@ #include <net/ethernet.h> #include <netinet/in.h> -#include "sd-event.h" +#include <systemd/sd-event.h> #include "list.h" #include "macro.h" diff --git a/src/libsystemd-network/dhcp6-lease-internal.h b/src/libsystemd-network/include/systemd-network/dhcp6-lease-internal.h index 14e708ef63..8e9a6f8e8c 100644 --- a/src/libsystemd-network/dhcp6-lease-internal.h +++ b/src/libsystemd-network/include/systemd-network/dhcp6-lease-internal.h @@ -22,7 +22,7 @@ #include <stdint.h> -#include "sd-dhcp6-lease.h" +#include <systemd/sd-dhcp6-lease.h> #include "dhcp6-internal.h" diff --git a/src/libsystemd-network/dhcp6-protocol.h b/src/libsystemd-network/include/systemd-network/dhcp6-protocol.h index 2487c470ab..2487c470ab 100644 --- a/src/libsystemd-network/dhcp6-protocol.h +++ b/src/libsystemd-network/include/systemd-network/dhcp6-protocol.h diff --git a/src/libsystemd-network/icmp6-util.h b/src/libsystemd-network/include/systemd-network/icmp6-util.h index 2b4dbc76ce..2b4dbc76ce 100644 --- a/src/libsystemd-network/icmp6-util.h +++ b/src/libsystemd-network/include/systemd-network/icmp6-util.h diff --git a/src/libsystemd-network/lldp-internal.h b/src/libsystemd-network/include/systemd-network/lldp-internal.h index 7592bc4305..a6be995e3b 100644 --- a/src/libsystemd-network/lldp-internal.h +++ b/src/libsystemd-network/include/systemd-network/lldp-internal.h @@ -20,8 +20,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-event.h" -#include "sd-lldp.h" +#include <systemd/sd-event.h> +#include <systemd/sd-lldp.h> #include "hashmap.h" #include "log.h" diff --git a/src/libsystemd-network/lldp-neighbor.h b/src/libsystemd-network/include/systemd-network/lldp-neighbor.h index f203bfa604..050159ab73 100644 --- a/src/libsystemd-network/lldp-neighbor.h +++ b/src/libsystemd-network/include/systemd-network/lldp-neighbor.h @@ -23,7 +23,7 @@ #include <stdbool.h> #include <sys/types.h> -#include "sd-lldp.h" +#include <systemd/sd-lldp.h> #include "hash-funcs.h" #include "lldp-internal.h" diff --git a/src/libsystemd-network/lldp-network.h b/src/libsystemd-network/include/systemd-network/lldp-network.h index c4cf8c79f1..43ed54b3b2 100644 --- a/src/libsystemd-network/lldp-network.h +++ b/src/libsystemd-network/include/systemd-network/lldp-network.h @@ -20,6 +20,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-event.h" +#include <systemd/sd-event.h> int lldp_network_bind_raw_socket(int ifindex); diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/include/systemd-network/network-internal.h index 5bcd577167..1cafb0747f 100644 --- a/src/libsystemd-network/network-internal.h +++ b/src/libsystemd-network/include/systemd-network/network-internal.h @@ -21,7 +21,7 @@ #include <stdbool.h> -#include "sd-dhcp-lease.h" +#include <systemd/sd-dhcp-lease.h> #include "condition.h" #include "udev.h" diff --git a/src/libsystemd-network/include/systemd-network/sd-dhcp-client.h b/src/libsystemd-network/include/systemd-network/sd-dhcp-client.h new file mode 100644 index 0000000000..f7bd5c4b7a --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-dhcp-client.h @@ -0,0 +1,158 @@ +#ifndef foosddhcpclienthfoo +#define foosddhcpclienthfoo + +/*** + This file is part of systemd. + + Copyright (C) 2013 Intel Corporation. All rights reserved. + + 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 <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <net/ethernet.h> +#include <netinet/in.h> +#include <sys/types.h> + +#include <systemd/sd-dhcp-lease.h> +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +enum { + SD_DHCP_CLIENT_EVENT_STOP = 0, + SD_DHCP_CLIENT_EVENT_IP_ACQUIRE = 1, + SD_DHCP_CLIENT_EVENT_IP_CHANGE = 2, + SD_DHCP_CLIENT_EVENT_EXPIRED = 3, + SD_DHCP_CLIENT_EVENT_RENEW = 4, +}; + +enum { + SD_DHCP_OPTION_PAD = 0, + SD_DHCP_OPTION_SUBNET_MASK = 1, + SD_DHCP_OPTION_TIME_OFFSET = 2, + SD_DHCP_OPTION_ROUTER = 3, + SD_DHCP_OPTION_DOMAIN_NAME_SERVER = 6, + SD_DHCP_OPTION_HOST_NAME = 12, + SD_DHCP_OPTION_BOOT_FILE_SIZE = 13, + SD_DHCP_OPTION_DOMAIN_NAME = 15, + SD_DHCP_OPTION_ROOT_PATH = 17, + SD_DHCP_OPTION_ENABLE_IP_FORWARDING = 19, + SD_DHCP_OPTION_ENABLE_IP_FORWARDING_NL = 20, + SD_DHCP_OPTION_POLICY_FILTER = 21, + SD_DHCP_OPTION_INTERFACE_MDR = 22, + SD_DHCP_OPTION_INTERFACE_TTL = 23, + SD_DHCP_OPTION_INTERFACE_MTU_AGING_TIMEOUT = 24, + SD_DHCP_OPTION_INTERFACE_MTU = 26, + SD_DHCP_OPTION_BROADCAST = 28, + SD_DHCP_OPTION_STATIC_ROUTE = 33, + SD_DHCP_OPTION_NTP_SERVER = 42, + SD_DHCP_OPTION_VENDOR_SPECIFIC = 43, + SD_DHCP_OPTION_REQUESTED_IP_ADDRESS = 50, + SD_DHCP_OPTION_IP_ADDRESS_LEASE_TIME = 51, + SD_DHCP_OPTION_OVERLOAD = 52, + SD_DHCP_OPTION_MESSAGE_TYPE = 53, + SD_DHCP_OPTION_SERVER_IDENTIFIER = 54, + SD_DHCP_OPTION_PARAMETER_REQUEST_LIST = 55, + SD_DHCP_OPTION_ERROR_MESSAGE = 56, + SD_DHCP_OPTION_MAXIMUM_MESSAGE_SIZE = 57, + SD_DHCP_OPTION_RENEWAL_T1_TIME = 58, + SD_DHCP_OPTION_REBINDING_T2_TIME = 59, + SD_DHCP_OPTION_VENDOR_CLASS_IDENTIFIER = 60, + SD_DHCP_OPTION_CLIENT_IDENTIFIER = 61, + SD_DHCP_OPTION_FQDN = 81, + SD_DHCP_OPTION_NEW_POSIX_TIMEZONE = 100, + SD_DHCP_OPTION_NEW_TZDB_TIMEZONE = 101, + SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE = 121, + SD_DHCP_OPTION_PRIVATE_BASE = 224, + SD_DHCP_OPTION_PRIVATE_LAST = 254, + SD_DHCP_OPTION_END = 255, +}; + +typedef struct sd_dhcp_client sd_dhcp_client; + +typedef void (*sd_dhcp_client_callback_t)(sd_dhcp_client *client, int event, void *userdata); +int sd_dhcp_client_set_callback( + sd_dhcp_client *client, + sd_dhcp_client_callback_t cb, + void *userdata); + +int sd_dhcp_client_set_request_option( + sd_dhcp_client *client, + uint8_t option); +int sd_dhcp_client_set_request_address( + sd_dhcp_client *client, + const struct in_addr *last_address); +int sd_dhcp_client_set_request_broadcast( + sd_dhcp_client *client, + int broadcast); +int sd_dhcp_client_set_index( + sd_dhcp_client *client, + int interface_index); +int sd_dhcp_client_set_mac( + sd_dhcp_client *client, + const uint8_t *addr, + size_t addr_len, + uint16_t arp_type); +int sd_dhcp_client_set_client_id( + sd_dhcp_client *client, + uint8_t type, + const uint8_t *data, + size_t data_len); +int sd_dhcp_client_set_iaid_duid( + sd_dhcp_client *client, + uint32_t iaid, + uint16_t duid_type, + const void *duid, + size_t duid_len); +int sd_dhcp_client_get_client_id( + sd_dhcp_client *client, + uint8_t *type, + const uint8_t **data, + size_t *data_len); +int sd_dhcp_client_set_mtu( + sd_dhcp_client *client, + uint32_t mtu); +int sd_dhcp_client_set_hostname( + sd_dhcp_client *client, + const char *hostname); +int sd_dhcp_client_set_vendor_class_identifier( + sd_dhcp_client *client, + const char *vci); +int sd_dhcp_client_get_lease( + sd_dhcp_client *client, + sd_dhcp_lease **ret); + +int sd_dhcp_client_stop(sd_dhcp_client *client); +int sd_dhcp_client_start(sd_dhcp_client *client); + +sd_dhcp_client *sd_dhcp_client_ref(sd_dhcp_client *client); +sd_dhcp_client *sd_dhcp_client_unref(sd_dhcp_client *client); + +int sd_dhcp_client_new(sd_dhcp_client **ret); + +int sd_dhcp_client_attach_event( + sd_dhcp_client *client, + sd_event *event, + int64_t priority); +int sd_dhcp_client_detach_event(sd_dhcp_client *client); +sd_event *sd_dhcp_client_get_event(sd_dhcp_client *client); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_client, sd_dhcp_client_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-dhcp-lease.h b/src/libsystemd-network/include/systemd-network/sd-dhcp-lease.h new file mode 100644 index 0000000000..2f565ca825 --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-dhcp-lease.h @@ -0,0 +1,67 @@ +#ifndef foosddhcpleasehfoo +#define foosddhcpleasehfoo + +/*** + This file is part of systemd. + + Copyright (C) 2013 Intel Corporation. All rights reserved. + Copyright (C) 2014 Tom Gundersen + + 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 <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <net/ethernet.h> +#include <netinet/in.h> +#include <sys/types.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +typedef struct sd_dhcp_lease sd_dhcp_lease; +typedef struct sd_dhcp_route sd_dhcp_route; + +sd_dhcp_lease *sd_dhcp_lease_ref(sd_dhcp_lease *lease); +sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease); + +int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_lifetime(sd_dhcp_lease *lease, uint32_t *lifetime); +int sd_dhcp_lease_get_t1(sd_dhcp_lease *lease, uint32_t *t1); +int sd_dhcp_lease_get_t2(sd_dhcp_lease *lease, uint32_t *t2); +int sd_dhcp_lease_get_broadcast(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_netmask(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_router(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_next_server(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_server_identifier(sd_dhcp_lease *lease, struct in_addr *addr); +int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr); +int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr); +int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu); +int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname); +int sd_dhcp_lease_get_hostname(sd_dhcp_lease *lease, const char **hostname); +int sd_dhcp_lease_get_root_path(sd_dhcp_lease *lease, const char **root_path); +int sd_dhcp_lease_get_routes(sd_dhcp_lease *lease, sd_dhcp_route ***routes); +int sd_dhcp_lease_get_vendor_specific(sd_dhcp_lease *lease, const void **data, size_t *data_len); +int sd_dhcp_lease_get_client_id(sd_dhcp_lease *lease, const void **client_id, size_t *client_id_len); +int sd_dhcp_lease_get_timezone(sd_dhcp_lease *lease, const char **timezone); + +int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *destination); +int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *length); +int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_lease, sd_dhcp_lease_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-dhcp-server.h b/src/libsystemd-network/include/systemd-network/sd-dhcp-server.h new file mode 100644 index 0000000000..bbb2bb203c --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-dhcp-server.h @@ -0,0 +1,65 @@ +#ifndef foosddhcpserverhfoo +#define foosddhcpserverhfoo + +/*** + This file is part of systemd. + + Copyright (C) 2013 Intel Corporation. All rights reserved. + Copyright (C) 2014 Tom Gundersen + + 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 <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <netinet/in.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +typedef struct sd_dhcp_server sd_dhcp_server; + +int sd_dhcp_server_new(sd_dhcp_server **ret, int ifindex); + +sd_dhcp_server *sd_dhcp_server_ref(sd_dhcp_server *server); +sd_dhcp_server *sd_dhcp_server_unref(sd_dhcp_server *server); + +int sd_dhcp_server_attach_event(sd_dhcp_server *client, sd_event *event, int64_t priority); +int sd_dhcp_server_detach_event(sd_dhcp_server *client); +sd_event *sd_dhcp_server_get_event(sd_dhcp_server *client); + +int sd_dhcp_server_is_running(sd_dhcp_server *server); + +int sd_dhcp_server_start(sd_dhcp_server *server); +int sd_dhcp_server_stop(sd_dhcp_server *server); + +int sd_dhcp_server_configure_pool(sd_dhcp_server *server, struct in_addr *address, unsigned char prefixlen, uint32_t offset, uint32_t size); + +int sd_dhcp_server_set_timezone(sd_dhcp_server *server, const char *timezone); +int sd_dhcp_server_set_dns(sd_dhcp_server *server, const struct in_addr ntp[], unsigned n); +int sd_dhcp_server_set_ntp(sd_dhcp_server *server, const struct in_addr dns[], unsigned n); +int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled); + +int sd_dhcp_server_set_max_lease_time(sd_dhcp_server *server, uint32_t t); +int sd_dhcp_server_set_default_lease_time(sd_dhcp_server *server, uint32_t t); + +int sd_dhcp_server_forcerenew(sd_dhcp_server *server); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_server, sd_dhcp_server_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-dhcp6-client.h b/src/libsystemd-network/include/systemd-network/sd-dhcp6-client.h new file mode 100644 index 0000000000..6bcd9862c9 --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-dhcp6-client.h @@ -0,0 +1,135 @@ +#ifndef foosddhcp6clienthfoo +#define foosddhcp6clienthfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Intel Corporation. All rights reserved. + + 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 <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <net/ethernet.h> +#include <sys/types.h> + +#include <systemd/sd-dhcp6-lease.h> +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +enum { + SD_DHCP6_CLIENT_EVENT_STOP = 0, + SD_DHCP6_CLIENT_EVENT_RESEND_EXPIRE = 10, + SD_DHCP6_CLIENT_EVENT_RETRANS_MAX = 11, + SD_DHCP6_CLIENT_EVENT_IP_ACQUIRE = 12, + SD_DHCP6_CLIENT_EVENT_INFORMATION_REQUEST = 13, +}; + +enum { + SD_DHCP6_OPTION_CLIENTID = 1, + SD_DHCP6_OPTION_SERVERID = 2, + SD_DHCP6_OPTION_IA_NA = 3, + SD_DHCP6_OPTION_IA_TA = 4, + SD_DHCP6_OPTION_IAADDR = 5, + SD_DHCP6_OPTION_ORO = 6, + SD_DHCP6_OPTION_PREFERENCE = 7, + SD_DHCP6_OPTION_ELAPSED_TIME = 8, + SD_DHCP6_OPTION_RELAY_MSG = 9, + /* option code 10 is unassigned */ + SD_DHCP6_OPTION_AUTH = 11, + SD_DHCP6_OPTION_UNICAST = 12, + SD_DHCP6_OPTION_STATUS_CODE = 13, + SD_DHCP6_OPTION_RAPID_COMMIT = 14, + SD_DHCP6_OPTION_USER_CLASS = 15, + SD_DHCP6_OPTION_VENDOR_CLASS = 16, + SD_DHCP6_OPTION_VENDOR_OPTS = 17, + SD_DHCP6_OPTION_INTERFACE_ID = 18, + SD_DHCP6_OPTION_RECONF_MSG = 19, + SD_DHCP6_OPTION_RECONF_ACCEPT = 20, + + SD_DHCP6_OPTION_DNS_SERVERS = 23, /* RFC 3646 */ + SD_DHCP6_OPTION_DOMAIN_LIST = 24, /* RFC 3646 */ + + SD_DHCP6_OPTION_SNTP_SERVERS = 31, /* RFC 4075, deprecated */ + + /* option code 35 is unassigned */ + + SD_DHCP6_OPTION_NTP_SERVER = 56, /* RFC 5908 */ + + /* option codes 89-142 are unassigned */ + /* option codes 144-65535 are unassigned */ +}; + +typedef struct sd_dhcp6_client sd_dhcp6_client; + +typedef void (*sd_dhcp6_client_callback_t)(sd_dhcp6_client *client, int event, void *userdata); +int sd_dhcp6_client_set_callback( + sd_dhcp6_client *client, + sd_dhcp6_client_callback_t cb, + void *userdata); + +int sd_dhcp6_client_set_index( + sd_dhcp6_client *client, + int interface_index); +int sd_dhcp6_client_set_local_address( + sd_dhcp6_client *client, + const struct in6_addr *local_address); +int sd_dhcp6_client_set_mac( + sd_dhcp6_client *client, + const uint8_t *addr, + size_t addr_len, + uint16_t arp_type); +int sd_dhcp6_client_set_duid( + sd_dhcp6_client *client, + uint16_t duid_type, + const void *duid, + size_t duid_len); +int sd_dhcp6_client_set_iaid( + sd_dhcp6_client *client, + uint32_t iaid); +int sd_dhcp6_client_set_information_request( + sd_dhcp6_client *client, + int enabled); +int sd_dhcp6_client_get_information_request( + sd_dhcp6_client *client, + int *enabled); +int sd_dhcp6_client_set_request_option( + sd_dhcp6_client *client, + uint16_t option); + +int sd_dhcp6_client_get_lease( + sd_dhcp6_client *client, + sd_dhcp6_lease **ret); + +int sd_dhcp6_client_stop(sd_dhcp6_client *client); +int sd_dhcp6_client_start(sd_dhcp6_client *client); +int sd_dhcp6_client_is_running(sd_dhcp6_client *client); +int sd_dhcp6_client_attach_event( + sd_dhcp6_client *client, + sd_event *event, + int64_t priority); +int sd_dhcp6_client_detach_event(sd_dhcp6_client *client); +sd_event *sd_dhcp6_client_get_event(sd_dhcp6_client *client); +sd_dhcp6_client *sd_dhcp6_client_ref(sd_dhcp6_client *client); +sd_dhcp6_client *sd_dhcp6_client_unref(sd_dhcp6_client *client); +int sd_dhcp6_client_new(sd_dhcp6_client **ret); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp6_client, sd_dhcp6_client_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-dhcp6-lease.h b/src/libsystemd-network/include/systemd-network/sd-dhcp6-lease.h new file mode 100644 index 0000000000..184fbb8e0d --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-dhcp6-lease.h @@ -0,0 +1,52 @@ +#ifndef foosddhcp6leasehfoo +#define foosddhcp6leasehfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Tom Gundersen + Copyright (C) 2014-2015 Intel Corporation. All rights reserved. + + 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 <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <netinet/in.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +typedef struct sd_dhcp6_lease sd_dhcp6_lease; + +void sd_dhcp6_lease_reset_address_iter(sd_dhcp6_lease *lease); +int sd_dhcp6_lease_get_address(sd_dhcp6_lease *lease, + struct in6_addr *addr, + uint32_t *lifetime_preferred, + uint32_t *lifetime_valid); + +int sd_dhcp6_lease_get_dns(sd_dhcp6_lease *lease, struct in6_addr **addrs); +int sd_dhcp6_lease_get_domains(sd_dhcp6_lease *lease, char ***domains); +int sd_dhcp6_lease_get_ntp_addrs(sd_dhcp6_lease *lease, + struct in6_addr **addrs); +int sd_dhcp6_lease_get_ntp_fqdn(sd_dhcp6_lease *lease, char ***ntp_fqdn); + +sd_dhcp6_lease *sd_dhcp6_lease_ref(sd_dhcp6_lease *lease); +sd_dhcp6_lease *sd_dhcp6_lease_unref(sd_dhcp6_lease *lease); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp6_lease, sd_dhcp6_lease_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-ipv4acd.h b/src/libsystemd-network/include/systemd-network/sd-ipv4acd.h new file mode 100644 index 0000000000..93db7a4a6c --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-ipv4acd.h @@ -0,0 +1,60 @@ +#ifndef foosdipv4acdfoo +#define foosdipv4acdfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Axis Communications AB. All rights reserved. + Copyright (C) 2015 Tom Gundersen + + 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 <http://www.gnu.org/licenses/>. +***/ + +#include <net/ethernet.h> +#include <netinet/in.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +enum { + SD_IPV4ACD_EVENT_STOP = 0, + SD_IPV4ACD_EVENT_BIND = 1, + SD_IPV4ACD_EVENT_CONFLICT = 2, +}; + +typedef struct sd_ipv4acd sd_ipv4acd; +typedef void (*sd_ipv4acd_callback_t)(sd_ipv4acd *ll, int event, void *userdata); + +int sd_ipv4acd_detach_event(sd_ipv4acd *ll); +int sd_ipv4acd_attach_event(sd_ipv4acd *ll, sd_event *event, int64_t priority); +int sd_ipv4acd_get_address(sd_ipv4acd *ll, struct in_addr *address); +int sd_ipv4acd_set_callback(sd_ipv4acd *ll, sd_ipv4acd_callback_t cb, void *userdata); +int sd_ipv4acd_set_mac(sd_ipv4acd *ll, const struct ether_addr *addr); +int sd_ipv4acd_set_index(sd_ipv4acd *ll, int interface_index); +int sd_ipv4acd_set_address(sd_ipv4acd *ll, const struct in_addr *address); +int sd_ipv4acd_is_running(sd_ipv4acd *ll); +int sd_ipv4acd_start(sd_ipv4acd *ll); +int sd_ipv4acd_stop(sd_ipv4acd *ll); +sd_ipv4acd *sd_ipv4acd_ref(sd_ipv4acd *ll); +sd_ipv4acd *sd_ipv4acd_unref(sd_ipv4acd *ll); +int sd_ipv4acd_new(sd_ipv4acd **ret); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ipv4acd, sd_ipv4acd_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-ipv4ll.h b/src/libsystemd-network/include/systemd-network/sd-ipv4ll.h new file mode 100644 index 0000000000..9167623167 --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-ipv4ll.h @@ -0,0 +1,60 @@ +#ifndef foosdipv4llfoo +#define foosdipv4llfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Axis Communications AB. All rights reserved. + + 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 <http://www.gnu.org/licenses/>. +***/ + +#include <net/ethernet.h> +#include <netinet/in.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +enum { + SD_IPV4LL_EVENT_STOP = 0, + SD_IPV4LL_EVENT_BIND = 1, + SD_IPV4LL_EVENT_CONFLICT = 2, +}; + +typedef struct sd_ipv4ll sd_ipv4ll; +typedef void (*sd_ipv4ll_callback_t)(sd_ipv4ll *ll, int event, void *userdata); + +int sd_ipv4ll_detach_event(sd_ipv4ll *ll); +int sd_ipv4ll_attach_event(sd_ipv4ll *ll, sd_event *event, int64_t priority); +int sd_ipv4ll_get_address(sd_ipv4ll *ll, struct in_addr *address); +int sd_ipv4ll_set_callback(sd_ipv4ll *ll, sd_ipv4ll_callback_t cb, void *userdata); +int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr); +int sd_ipv4ll_set_index(sd_ipv4ll *ll, int interface_index); +int sd_ipv4ll_set_address(sd_ipv4ll *ll, const struct in_addr *address); +int sd_ipv4ll_set_address_seed(sd_ipv4ll *ll, unsigned seed); +int sd_ipv4ll_is_running(sd_ipv4ll *ll); +int sd_ipv4ll_start(sd_ipv4ll *ll); +int sd_ipv4ll_stop(sd_ipv4ll *ll); +sd_ipv4ll *sd_ipv4ll_ref(sd_ipv4ll *ll); +sd_ipv4ll *sd_ipv4ll_unref(sd_ipv4ll *ll); +int sd_ipv4ll_new (sd_ipv4ll **ret); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ipv4ll, sd_ipv4ll_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-lldp.h b/src/libsystemd-network/include/systemd-network/sd-lldp.h new file mode 100644 index 0000000000..391e7c2a2e --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-lldp.h @@ -0,0 +1,177 @@ +#ifndef foosdlldphfoo +#define foosdlldphfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Tom Gundersen + Copyright (C) 2014 Susant Sahani + + 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 <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <net/ethernet.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +typedef struct sd_lldp sd_lldp; +typedef struct sd_lldp_neighbor sd_lldp_neighbor; + +/* IEEE 802.3AB Clause 9: TLV Types */ +enum { + SD_LLDP_TYPE_END = 0, + SD_LLDP_TYPE_CHASSIS_ID = 1, + SD_LLDP_TYPE_PORT_ID = 2, + SD_LLDP_TYPE_TTL = 3, + SD_LLDP_TYPE_PORT_DESCRIPTION = 4, + SD_LLDP_TYPE_SYSTEM_NAME = 5, + SD_LLDP_TYPE_SYSTEM_DESCRIPTION = 6, + SD_LLDP_TYPE_SYSTEM_CAPABILITIES = 7, + SD_LLDP_TYPE_MGMT_ADDRESS = 8, + SD_LLDP_TYPE_PRIVATE = 127, +}; + +/* IEEE 802.3AB Clause 9.5.2: Chassis subtypes */ +enum { + SD_LLDP_CHASSIS_SUBTYPE_RESERVED = 0, + SD_LLDP_CHASSIS_SUBTYPE_CHASSIS_COMPONENT = 1, + SD_LLDP_CHASSIS_SUBTYPE_INTERFACE_ALIAS = 2, + SD_LLDP_CHASSIS_SUBTYPE_PORT_COMPONENT = 3, + SD_LLDP_CHASSIS_SUBTYPE_MAC_ADDRESS = 4, + SD_LLDP_CHASSIS_SUBTYPE_NETWORK_ADDRESS = 5, + SD_LLDP_CHASSIS_SUBTYPE_INTERFACE_NAME = 6, + SD_LLDP_CHASSIS_SUBTYPE_LOCALLY_ASSIGNED = 7, +}; + +/* IEEE 802.3AB Clause 9.5.3: Port subtype */ +enum { + SD_LLDP_PORT_SUBTYPE_RESERVED = 0, + SD_LLDP_PORT_SUBTYPE_INTERFACE_ALIAS = 1, + SD_LLDP_PORT_SUBTYPE_PORT_COMPONENT = 2, + SD_LLDP_PORT_SUBTYPE_MAC_ADDRESS = 3, + SD_LLDP_PORT_SUBTYPE_NETWORK_ADDRESS = 4, + SD_LLDP_PORT_SUBTYPE_INTERFACE_NAME = 5, + SD_LLDP_PORT_SUBTYPE_AGENT_CIRCUIT_ID = 6, + SD_LLDP_PORT_SUBTYPE_LOCALLY_ASSIGNED = 7, +}; + +enum { + SD_LLDP_SYSTEM_CAPABILITIES_OTHER = 1 << 0, + SD_LLDP_SYSTEM_CAPABILITIES_REPEATER = 1 << 1, + SD_LLDP_SYSTEM_CAPABILITIES_BRIDGE = 1 << 2, + SD_LLDP_SYSTEM_CAPABILITIES_WLAN_AP = 1 << 3, + SD_LLDP_SYSTEM_CAPABILITIES_ROUTER = 1 << 4, + SD_LLDP_SYSTEM_CAPABILITIES_PHONE = 1 << 5, + SD_LLDP_SYSTEM_CAPABILITIES_DOCSIS = 1 << 6, + SD_LLDP_SYSTEM_CAPABILITIES_STATION = 1 << 7, + SD_LLDP_SYSTEM_CAPABILITIES_CVLAN = 1 << 8, + SD_LLDP_SYSTEM_CAPABILITIES_SVLAN = 1 << 9, + SD_LLDP_SYSTEM_CAPABILITIES_TPMR = 1 << 10, +}; + +#define SD_LLDP_SYSTEM_CAPABILITIES_ALL ((uint16_t) -1) + +#define SD_LLDP_SYSTEM_CAPABILITIES_ALL_ROUTERS \ + ((uint16_t) \ + (SD_LLDP_SYSTEM_CAPABILITIES_REPEATER| \ + SD_LLDP_SYSTEM_CAPABILITIES_BRIDGE| \ + SD_LLDP_SYSTEM_CAPABILITIES_WLAN_AP| \ + SD_LLDP_SYSTEM_CAPABILITIES_ROUTER| \ + SD_LLDP_SYSTEM_CAPABILITIES_DOCSIS| \ + SD_LLDP_SYSTEM_CAPABILITIES_CVLAN| \ + SD_LLDP_SYSTEM_CAPABILITIES_SVLAN| \ + SD_LLDP_SYSTEM_CAPABILITIES_TPMR)) + +#define SD_LLDP_OUI_802_1 (uint8_t[]) { 0x00, 0x80, 0xc2 } +#define SD_LLDP_OUI_802_3 (uint8_t[]) { 0x00, 0x12, 0x0f } + +enum { + SD_LLDP_OUI_802_1_SUBTYPE_PORT_VLAN_ID = 1, + SD_LLDP_OUI_802_1_SUBTYPE_PORT_PROTOCOL_VLAN_ID = 2, + SD_LLDP_OUI_802_1_SUBTYPE_VLAN_NAME = 3, + SD_LLDP_OUI_802_1_SUBTYPE_PROTOCOL_IDENTITY = 4, + SD_LLDP_OUI_802_1_SUBTYPE_VID_USAGE_DIGEST = 5, + SD_LLDP_OUI_802_1_SUBTYPE_MANAGEMENT_VID = 6, + SD_LLDP_OUI_802_1_SUBTYPE_LINK_AGGREGATION = 7, +}; + +typedef enum sd_lldp_event { + SD_LLDP_EVENT_ADDED = 'a', + SD_LLDP_EVENT_REMOVED = 'r', + SD_LLDP_EVENT_UPDATED = 'u', + SD_LLDP_EVENT_REFRESHED = 'f', +} sd_lldp_event; + +typedef void (*sd_lldp_callback_t)(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata); + +int sd_lldp_new(sd_lldp **ret, int ifindex); +sd_lldp* sd_lldp_unref(sd_lldp *lldp); + +int sd_lldp_start(sd_lldp *lldp); +int sd_lldp_stop(sd_lldp *lldp); + +int sd_lldp_attach_event(sd_lldp *lldp, sd_event *event, int64_t priority); +int sd_lldp_detach_event(sd_lldp *lldp); + +int sd_lldp_set_callback(sd_lldp *lldp, sd_lldp_callback_t cb, void *userdata); + +/* Controls how much and what to store in the neighbors database */ +int sd_lldp_set_neighbors_max(sd_lldp *lldp, uint64_t n); +int sd_lldp_match_capabilities(sd_lldp *lldp, uint16_t mask); +int sd_lldp_set_filter_address(sd_lldp *lldp, const struct ether_addr *address); + +int sd_lldp_get_neighbors(sd_lldp *lldp, sd_lldp_neighbor ***neighbors); + +int sd_lldp_neighbor_from_raw(sd_lldp_neighbor **ret, const void *raw, size_t raw_size); +sd_lldp_neighbor *sd_lldp_neighbor_ref(sd_lldp_neighbor *n); +sd_lldp_neighbor *sd_lldp_neighbor_unref(sd_lldp_neighbor *n); + +/* Access to LLDP frame metadata */ +int sd_lldp_neighbor_get_source_address(sd_lldp_neighbor *n, struct ether_addr* address); +int sd_lldp_neighbor_get_destination_address(sd_lldp_neighbor *n, struct ether_addr* address); +int sd_lldp_neighbor_get_raw(sd_lldp_neighbor *n, const void **ret, size_t *size); + +/* High-level, direct, parsed out field access. These fields exist at most once, hence may be queried directly. */ +int sd_lldp_neighbor_get_chassis_id(sd_lldp_neighbor *n, uint8_t *type, const void **ret, size_t *size); +int sd_lldp_neighbor_get_chassis_id_as_string(sd_lldp_neighbor *n, const char **ret); +int sd_lldp_neighbor_get_port_id(sd_lldp_neighbor *n, uint8_t *type, const void **ret, size_t *size); +int sd_lldp_neighbor_get_port_id_as_string(sd_lldp_neighbor *n, const char **ret); +int sd_lldp_neighbor_get_ttl(sd_lldp_neighbor *n, uint16_t *ret); +int sd_lldp_neighbor_get_system_name(sd_lldp_neighbor *n, const char **ret); +int sd_lldp_neighbor_get_system_description(sd_lldp_neighbor *n, const char **ret); +int sd_lldp_neighbor_get_port_description(sd_lldp_neighbor *n, const char **ret); +int sd_lldp_neighbor_get_system_capabilities(sd_lldp_neighbor *n, uint16_t *ret); +int sd_lldp_neighbor_get_enabled_capabilities(sd_lldp_neighbor *n, uint16_t *ret); + +/* Low-level, iterative TLV access. This is for evertyhing else, it iteratively goes through all available TLVs + * (including the ones covered with the calls above), and allows multiple TLVs for the same fields. */ +int sd_lldp_neighbor_tlv_rewind(sd_lldp_neighbor *n); +int sd_lldp_neighbor_tlv_next(sd_lldp_neighbor *n); +int sd_lldp_neighbor_tlv_get_type(sd_lldp_neighbor *n, uint8_t *type); +int sd_lldp_neighbor_tlv_is_type(sd_lldp_neighbor *n, uint8_t type); +int sd_lldp_neighbor_tlv_get_oui(sd_lldp_neighbor *n, uint8_t oui[3], uint8_t *subtype); +int sd_lldp_neighbor_tlv_is_oui(sd_lldp_neighbor *n, const uint8_t oui[3], uint8_t subtype); +int sd_lldp_neighbor_tlv_get_raw(sd_lldp_neighbor *n, const void **ret, size_t *size); + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_lldp, sd_lldp_unref); +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_lldp_neighbor, sd_lldp_neighbor_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/include/systemd-network/sd-ndisc.h b/src/libsystemd-network/include/systemd-network/sd-ndisc.h new file mode 100644 index 0000000000..c77a435d17 --- /dev/null +++ b/src/libsystemd-network/include/systemd-network/sd-ndisc.h @@ -0,0 +1,84 @@ +#ifndef foosdndiscfoo +#define foosdndiscfoo + +/*** + This file is part of systemd. + + Copyright (C) 2014 Intel Corporation. All rights reserved. + + 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 <http://www.gnu.org/licenses/>. +***/ + +#include <inttypes.h> +#include <net/ethernet.h> + +#include <systemd/sd-event.h> + +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; + +enum { + SD_NDISC_EVENT_STOP = 0, + SD_NDISC_EVENT_TIMEOUT = 1, +}; + +typedef struct sd_ndisc sd_ndisc; + +typedef void(*sd_ndisc_router_callback_t)(sd_ndisc *nd, uint8_t flags, const struct in6_addr *gateway, unsigned lifetime, int pref, void *userdata); +typedef void(*sd_ndisc_prefix_onlink_callback_t)(sd_ndisc *nd, const struct in6_addr *prefix, unsigned prefixlen, + unsigned lifetime, void *userdata); +typedef void(*sd_ndisc_prefix_autonomous_callback_t)(sd_ndisc *nd, const struct in6_addr *prefix, unsigned prefixlen, + unsigned lifetime_prefered, unsigned lifetime_valid, void *userdata); +typedef void(*sd_ndisc_callback_t)(sd_ndisc *nd, int event, void *userdata); + +int sd_ndisc_set_callback(sd_ndisc *nd, + sd_ndisc_router_callback_t rcb, + sd_ndisc_prefix_onlink_callback_t plcb, + sd_ndisc_prefix_autonomous_callback_t pacb, + sd_ndisc_callback_t cb, + void *userdata); +int sd_ndisc_set_index(sd_ndisc *nd, int interface_index); +int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr); + +int sd_ndisc_attach_event(sd_ndisc *nd, sd_event *event, int64_t priority); +int sd_ndisc_detach_event(sd_ndisc *nd); +sd_event *sd_ndisc_get_event(sd_ndisc *nd); + +sd_ndisc *sd_ndisc_ref(sd_ndisc *nd); +sd_ndisc *sd_ndisc_unref(sd_ndisc *nd); +int sd_ndisc_new(sd_ndisc **ret); + +int sd_ndisc_get_mtu(sd_ndisc *nd, uint32_t *mtu); + +int sd_ndisc_stop(sd_ndisc *nd); +int sd_ndisc_router_discovery_start(sd_ndisc *nd); + +#define SD_NDISC_ADDRESS_FORMAT_STR "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" + +#define SD_NDISC_ADDRESS_FORMAT_VAL(address) \ + be16toh((address).s6_addr16[0]), \ + be16toh((address).s6_addr16[1]), \ + be16toh((address).s6_addr16[2]), \ + be16toh((address).s6_addr16[3]), \ + be16toh((address).s6_addr16[4]), \ + be16toh((address).s6_addr16[5]), \ + be16toh((address).s6_addr16[6]), \ + be16toh((address).s6_addr16[7]) + +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc, sd_ndisc_unref); + +_SD_END_DECLARATIONS; + +#endif diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/src/arp-util.c index 4660c7ea09..4660c7ea09 100644 --- a/src/libsystemd-network/arp-util.c +++ b/src/libsystemd-network/src/arp-util.c diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/src/dhcp-identifier.c index a21efc4d06..906d960171 100644 --- a/src/libsystemd-network/dhcp-identifier.c +++ b/src/libsystemd-network/src/dhcp-identifier.c @@ -18,7 +18,7 @@ ***/ #include "libudev.h" -#include "sd-id128.h" +#include <systemd/sd-id128.h> #include "dhcp-identifier.h" #include "dhcp6-protocol.h" diff --git a/src/libsystemd-network/dhcp-network.c b/src/libsystemd-network/src/dhcp-network.c index fac25e0fa2..fac25e0fa2 100644 --- a/src/libsystemd-network/dhcp-network.c +++ b/src/libsystemd-network/src/dhcp-network.c diff --git a/src/libsystemd-network/dhcp-option.c b/src/libsystemd-network/src/dhcp-option.c index c105196334..c105196334 100644 --- a/src/libsystemd-network/dhcp-option.c +++ b/src/libsystemd-network/src/dhcp-option.c diff --git a/src/libsystemd-network/dhcp-packet.c b/src/libsystemd-network/src/dhcp-packet.c index 8be774061d..8be774061d 100644 --- a/src/libsystemd-network/dhcp-packet.c +++ b/src/libsystemd-network/src/dhcp-packet.c diff --git a/src/libsystemd-network/dhcp6-network.c b/src/libsystemd-network/src/dhcp6-network.c index fd2d60c9d5..fd2d60c9d5 100644 --- a/src/libsystemd-network/dhcp6-network.c +++ b/src/libsystemd-network/src/dhcp6-network.c diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/src/dhcp6-option.c index 5462e03476..0ae381ad22 100644 --- a/src/libsystemd-network/dhcp6-option.c +++ b/src/libsystemd-network/src/dhcp6-option.c @@ -21,7 +21,7 @@ #include <netinet/in.h> #include <string.h> -#include "sd-dhcp6-client.h" +#include <systemd/sd-dhcp6-client.h> #include "alloc-util.h" #include "dhcp6-internal.h" diff --git a/src/libsystemd-network/icmp6-util.c b/src/libsystemd-network/src/icmp6-util.c index acad9d7d6a..acad9d7d6a 100644 --- a/src/libsystemd-network/icmp6-util.c +++ b/src/libsystemd-network/src/icmp6-util.c diff --git a/src/libsystemd-network/lldp-neighbor.c b/src/libsystemd-network/src/lldp-neighbor.c index 6a716430e3..6a716430e3 100644 --- a/src/libsystemd-network/lldp-neighbor.c +++ b/src/libsystemd-network/src/lldp-neighbor.c diff --git a/src/libsystemd-network/lldp-network.c b/src/libsystemd-network/src/lldp-network.c index f031760351..f031760351 100644 --- a/src/libsystemd-network/lldp-network.c +++ b/src/libsystemd-network/src/lldp-network.c diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/src/network-internal.c index 046b0f9393..d57baf8fff 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/src/network-internal.c @@ -21,7 +21,7 @@ #include <linux/if.h> #include <netinet/ether.h> -#include "sd-ndisc.h" +#include <systemd/sd-ndisc.h> #include "alloc-util.h" #include "condition.h" diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/src/sd-dhcp-client.c index ad79c6cc2c..193f31880f 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/src/sd-dhcp-client.c @@ -26,7 +26,7 @@ #include <sys/ioctl.h> #include <linux/if_infiniband.h> -#include "sd-dhcp-client.h" +#include <systemd/sd-dhcp-client.h> #include "alloc-util.h" #include "async.h" diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/src/sd-dhcp-lease.c index ef50ed17a1..d4c680d485 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/src/sd-dhcp-lease.c @@ -24,7 +24,7 @@ #include <stdlib.h> #include <string.h> -#include "sd-dhcp-lease.h" +#include <systemd/sd-dhcp-lease.h> #include "alloc-util.h" #include "dhcp-lease-internal.h" diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/src/sd-dhcp-server.c index fb335337c4..5e8b4e4823 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/src/sd-dhcp-server.c @@ -20,7 +20,7 @@ #include <sys/ioctl.h> -#include "sd-dhcp-server.h" +#include <systemd/sd-dhcp-server.h> #include "alloc-util.h" #include "dhcp-internal.h" diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/src/sd-dhcp6-client.c index 05972e01c9..2760b039ba 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/src/sd-dhcp6-client.c @@ -22,7 +22,7 @@ #include <sys/ioctl.h> #include <linux/if_infiniband.h> -#include "sd-dhcp6-client.h" +#include <systemd/sd-dhcp6-client.h> #include "alloc-util.h" #include "dhcp-identifier.h" diff --git a/src/libsystemd-network/sd-dhcp6-lease.c b/src/libsystemd-network/src/sd-dhcp6-lease.c index 5c10a6326a..5c10a6326a 100644 --- a/src/libsystemd-network/sd-dhcp6-lease.c +++ b/src/libsystemd-network/src/sd-dhcp6-lease.c diff --git a/src/libsystemd-network/sd-ipv4acd.c b/src/libsystemd-network/src/sd-ipv4acd.c index cc7436db6b..f1ed7ca747 100644 --- a/src/libsystemd-network/sd-ipv4acd.c +++ b/src/libsystemd-network/src/sd-ipv4acd.c @@ -24,7 +24,7 @@ #include <stdlib.h> #include <string.h> -#include "sd-ipv4acd.h" +#include <systemd/sd-ipv4acd.h> #include "alloc-util.h" #include "arp-util.h" diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/src/sd-ipv4ll.c index 2a06418c53..fc27408989 100644 --- a/src/libsystemd-network/sd-ipv4ll.c +++ b/src/libsystemd-network/src/sd-ipv4ll.c @@ -24,8 +24,8 @@ #include <stdlib.h> #include <string.h> -#include "sd-ipv4acd.h" -#include "sd-ipv4ll.h" +#include <systemd/sd-ipv4acd.h> +#include <systemd/sd-ipv4ll.h> #include "alloc-util.h" #include "in-addr-util.h" diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/src/sd-lldp.c index 9d4587c80e..5a7380cd3f 100644 --- a/src/libsystemd-network/sd-lldp.c +++ b/src/libsystemd-network/src/sd-lldp.c @@ -20,7 +20,7 @@ #include <arpa/inet.h> -#include "sd-lldp.h" +#include <systemd/sd-lldp.h> #include "alloc-util.h" #include "fd-util.h" diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/src/sd-ndisc.c index fb4ef55673..1c0d300cb3 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/src/sd-ndisc.c @@ -24,7 +24,7 @@ #include <string.h> #include <sys/ioctl.h> -#include "sd-ndisc.h" +#include <systemd/sd-ndisc.h> #include "alloc-util.h" #include "async.h" diff --git a/src/libsystemd-network/test-acd.c b/src/libsystemd-network/test/test-acd.c index 75564615b9..53ddfc3b62 100644 --- a/src/libsystemd-network/test-acd.c +++ b/src/libsystemd-network/test/test-acd.c @@ -24,9 +24,9 @@ #include <linux/veth.h> #include <net/if.h> -#include "sd-event.h" -#include "sd-ipv4acd.h" -#include "sd-netlink.h" +#include <systemd/sd-event.h> +#include <systemd/sd-ipv4acd.h> +#include <systemd/sd-netlink.h> #include "in-addr-util.h" #include "netlink-util.h" diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test/test-dhcp-client.c index c3c08fef5e..478b370c4c 100644 --- a/src/libsystemd-network/test-dhcp-client.c +++ b/src/libsystemd-network/test/test-dhcp-client.c @@ -22,8 +22,8 @@ #include <sys/socket.h> #include <unistd.h> -#include "sd-dhcp-client.h" -#include "sd-event.h" +#include <systemd/sd-dhcp-client.h> +#include <systemd/sd-event.h> #include "alloc-util.h" #include "dhcp-identifier.h" diff --git a/src/libsystemd-network/test-dhcp-option.c b/src/libsystemd-network/test/test-dhcp-option.c index d84859c053..d84859c053 100644 --- a/src/libsystemd-network/test-dhcp-option.c +++ b/src/libsystemd-network/test/test-dhcp-option.c diff --git a/src/libsystemd-network/test-dhcp-server.c b/src/libsystemd-network/test/test-dhcp-server.c index e81c508c7f..7dc315c07f 100644 --- a/src/libsystemd-network/test-dhcp-server.c +++ b/src/libsystemd-network/test/test-dhcp-server.c @@ -20,8 +20,8 @@ #include <errno.h> -#include "sd-dhcp-server.h" -#include "sd-event.h" +#include <systemd/sd-dhcp-server.h> +#include <systemd/sd-event.h> #include "dhcp-server-internal.h" diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test/test-dhcp6-client.c index e74c8c72db..0548e8381e 100644 --- a/src/libsystemd-network/test-dhcp6-client.c +++ b/src/libsystemd-network/test/test-dhcp6-client.c @@ -24,8 +24,8 @@ #include <sys/types.h> #include <unistd.h> -#include "sd-dhcp6-client.h" -#include "sd-event.h" +#include <systemd/sd-dhcp6-client.h> +#include <systemd/sd-event.h> #include "dhcp6-internal.h" #include "dhcp6-lease-internal.h" diff --git a/src/libsystemd-network/test-ipv4ll-manual.c b/src/libsystemd-network/test/test-ipv4ll-manual.c index 85dd61470d..caa315b210 100644 --- a/src/libsystemd-network/test-ipv4ll-manual.c +++ b/src/libsystemd-network/test/test-ipv4ll-manual.c @@ -23,9 +23,9 @@ #include <unistd.h> #include <linux/veth.h> -#include "sd-event.h" -#include "sd-ipv4ll.h" -#include "sd-netlink.h" +#include <systemd/sd-event.h> +#include <systemd/sd-ipv4ll.h> +#include <systemd/sd-netlink.h> #include "alloc-util.h" #include "in-addr-util.h" diff --git a/src/libsystemd-network/test-ipv4ll.c b/src/libsystemd-network/test/test-ipv4ll.c index a233e0378c..b7278834f2 100644 --- a/src/libsystemd-network/test-ipv4ll.c +++ b/src/libsystemd-network/test/test-ipv4ll.c @@ -25,7 +25,7 @@ #include <sys/types.h> #include <unistd.h> -#include "sd-ipv4ll.h" +#include <systemd/sd-ipv4ll.h> #include "arp-util.h" #include "fd-util.h" diff --git a/src/libsystemd-network/test-lldp.c b/src/libsystemd-network/test/test-lldp.c index 1aae2253c0..8c6d214d6f 100644 --- a/src/libsystemd-network/test-lldp.c +++ b/src/libsystemd-network/test/test-lldp.c @@ -24,8 +24,8 @@ #include <string.h> #include <unistd.h> -#include "sd-event.h" -#include "sd-lldp.h" +#include <systemd/sd-event.h> +#include <systemd/sd-lldp.h> #include "alloc-util.h" #include "fd-util.h" diff --git a/src/libsystemd-network/test-ndisc-rs.c b/src/libsystemd-network/test/test-ndisc-rs.c index f7b2eb8050..863a76637c 100644 --- a/src/libsystemd-network/test-ndisc-rs.c +++ b/src/libsystemd-network/test/test-ndisc-rs.c @@ -19,7 +19,7 @@ #include <netinet/icmp6.h> -#include "sd-ndisc.h" +#include <systemd/sd-ndisc.h> #include "icmp6-util.h" #include "socket-util.h" |