1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #ifndef foosdlldptxhfoo 3 #define foosdlldptxhfoo 4 5 /*** 6 systemd is free software; you can redistribute it and/or modify it 7 under the terms of the GNU Lesser General Public License as published by 8 the Free Software Foundation; either version 2.1 of the License, or 9 (at your option) any later version. 10 11 systemd is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public License 17 along with systemd; If not, see <http://www.gnu.org/licenses/>. 18 ***/ 19 20 #include <errno.h> 21 #include <inttypes.h> 22 #include <net/ethernet.h> 23 #include <sys/types.h> 24 25 #include "sd-event.h" 26 #include "sd-lldp.h" 27 28 #include "_sd-common.h" 29 30 _SD_BEGIN_DECLARATIONS; 31 32 typedef struct sd_lldp_tx sd_lldp_tx; 33 34 typedef enum sd_lldp_multicast_mode_t { 35 SD_LLDP_MULTICAST_MODE_NEAREST_BRIDGE, 36 SD_LLDP_MULTICAST_MODE_NON_TPMR_BRIDGE, 37 SD_LLDP_MULTICAST_MODE_CUSTOMER_BRIDGE, 38 _SD_LLDP_MULTICAST_MODE_MAX, 39 _SD_LLDP_MULTICAST_MODE_INVALID = -EINVAL, 40 _SD_ENUM_FORCE_S64(LLDP_TX_MODE), 41 } sd_lldp_multicast_mode_t; 42 43 int sd_lldp_tx_new(sd_lldp_tx **ret); 44 sd_lldp_tx *sd_lldp_tx_ref(sd_lldp_tx *lldp_tx); 45 sd_lldp_tx *sd_lldp_tx_unref(sd_lldp_tx *lldp_tx); 46 47 int sd_lldp_tx_start(sd_lldp_tx *lldp_tx); 48 int sd_lldp_tx_stop(sd_lldp_tx *lldp_tx); 49 int sd_lldp_tx_is_running(sd_lldp_tx *lldp_tx); 50 51 int sd_lldp_tx_attach_event(sd_lldp_tx *lldp_tx, sd_event *event, int64_t priority); 52 int sd_lldp_tx_detach_event(sd_lldp_tx *lldp_tx); 53 54 int sd_lldp_tx_set_ifindex(sd_lldp_tx *lldp_tx, int ifindex); 55 int sd_lldp_tx_set_ifname(sd_lldp_tx *lldp_tx, const char *ifname); 56 int sd_lldp_tx_get_ifname(sd_lldp_tx *lldp_tx, const char **ret); 57 58 int sd_lldp_tx_set_multicast_mode(sd_lldp_tx *lldp_tx, sd_lldp_multicast_mode_t mode); 59 int sd_lldp_tx_set_hwaddr(sd_lldp_tx *lldp_tx, const struct ether_addr *hwaddr); 60 int sd_lldp_tx_set_port_description(sd_lldp_tx *lldp_tx, const char *port_description); 61 int sd_lldp_tx_set_hostname(sd_lldp_tx *lldp_tx, const char *hostname); 62 int sd_lldp_tx_set_pretty_hostname(sd_lldp_tx *lldp_tx, const char *pretty_hostname); 63 int sd_lldp_tx_set_mud_url(sd_lldp_tx *lldp_tx, const char *mud_url); 64 int sd_lldp_tx_set_capabilities(sd_lldp_tx *lldp_tx, uint16_t supported, uint16_t enabled); 65 66 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_lldp_tx, sd_lldp_tx_unref); 67 68 _SD_END_DECLARATIONS; 69 70 #endif 71