-#define PROTO_SEND_SIG struct lldpd *, struct lldpd_hardware *
-#define PROTO_DECODE_SIG struct lldpd *, char *, int, struct lldpd_hardware *, struct lldpd_chassis **, struct lldpd_port **
-#define PROTO_GUESS_SIG char *, int
-
-struct protocol {
-#define LLDPD_MODE_LLDP 1
-#define LLDPD_MODE_CDPV1 2
-#define LLDPD_MODE_CDPV2 3
-#define LLDPD_MODE_SONMP 4
-#define LLDPD_MODE_EDP 5
-#define LLDPD_MODE_FDP 6
-#define LLDPD_MODE_MAX LLDPD_MODE_FDP
- int mode; /* > 0 mode identifier (unique per protocol) */
- int enabled; /* Is this protocol enabled? */
- char *name; /* Name of protocol */
- char arg; /* Argument to enable this protocol */
- int(*send)(PROTO_SEND_SIG); /* How to send a frame */
- int(*decode)(PROTO_DECODE_SIG); /* How to decode a frame */
- int(*guess)(PROTO_GUESS_SIG); /* Can be NULL, use MAC address in this case */
- u_int8_t mac[ETH_ALEN]; /* Destination MAC address used by this protocol */
-};
-
-/* Smart mode / Hide mode */
-#define SMART_INCOMING_FILTER (1<<0) /* Incoming filtering enabled */
-#define SMART_INCOMING_ONE_PROTO (1<<1) /* On reception, keep only one proto */
-#define SMART_INCOMING_ONE_NEIGH (1<<2) /* On reception, keep only one neighbor */
-#define SMART_OUTGOING_FILTER (1<<3) /* Outgoing filtering enabled */
-#define SMART_OUTGOING_ONE_PROTO (1<<4) /* On emission, keep only one proto */
-#define SMART_OUTGOING_ONE_NEIGH (1<<5) /* On emission, consider only one neighbor */
-#define SMART_INCOMING (SMART_INCOMING_FILTER | \
- SMART_INCOMING_ONE_PROTO | \
- SMART_INCOMING_ONE_NEIGH)
-#define SMART_OUTGOING (SMART_OUTGOING_FILTER | \
- SMART_OUTGOING_ONE_PROTO | \
- SMART_OUTGOING_ONE_NEIGH)
-#define SMART_HIDDEN(port) (port->p_hidden_in)
-
-struct lldpd {
- int g_sock;
- int g_delay;
-
- struct event_base *g_base;
-#ifdef USE_SNMP
-#endif
-
- struct protocol *g_protocols;
- time_t g_lastsent;
- int g_lastrid;
- int g_smart;
- int g_receiveonly;
- struct event *g_main_loop;
-#ifdef USE_SNMP
- int g_snmp;
- struct event *g_snmp_timeout;
- void *g_snmp_fds;
- char *g_snmp_agentx;
-#endif /* USE_SNMP */
-
- /* Unix socket handling */
- int g_ctl;
- struct event *g_ctl_event;
-
- char *g_mgmt_pattern;
- char *g_cid_pattern;
- char *g_interfaces;
-
- char *g_descr_override;
- char *g_platform_override;
- char *g_lsb_release;
- int g_advertise_version;
-#ifdef ENABLE_LLDPMED
- int g_noinventory;
-#endif
-
-#define LOCAL_CHASSIS(cfg) ((struct lldpd_chassis *)(TAILQ_FIRST(&cfg->g_chassis)))
- TAILQ_HEAD(, lldpd_chassis) g_chassis;
- TAILQ_HEAD(, lldpd_hardware) g_hardware;
-};
-
-typedef void(*lldpd_ifhandlers)(struct lldpd *, struct ifaddrs *);
-
-enum hmsg_type {
- NONE,
- GET_INTERFACES, /* Get list of interfaces */
- GET_INTERFACE, /* Get all information related to an interface */
- SET_PORT, /* Set port-related information (location, power, policy) */
-};
-
-/* lldpd.c */
-struct lldpd_hardware *lldpd_get_hardware(struct lldpd *,
- char *, int, struct lldpd_ops *);
-struct lldpd_hardware *lldpd_alloc_hardware(struct lldpd *, char *);
-void lldpd_hardware_cleanup(struct lldpd*, struct lldpd_hardware *);