1 /* -*- mode: c; c-file-style: "openbsd" -*- */
2 /*
3  * Copyright (c) 2008 Vincent Bernat <bernat@luffy.cx>
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #ifndef _LLDPD_STRUCTS_H
19 #define _LLDPD_STRUCTS_H
20 
21 #if HAVE_CONFIG_H
22 #  include <config.h>
23 #endif
24 
25 #include <sys/types.h>
26 #include <sys/socket.h>
27 
28 /* This is not very convenient, but we need net/if.h for IFNAMSIZ and others but
29  * we may also need linux/if.h in some modules. And they conflict each others.
30  */
31 #ifdef HOST_OS_LINUX
32 # include <linux/if.h>
33 #else
34 # include <net/if.h>
35 #endif
36 
37 #include <netinet/in.h>
38 #include <netinet/if_ether.h>
39 #include <sys/queue.h>
40 
41 #include "compat/compat.h"
42 #include "marshal.h"
43 #include "lldp-const.h"
44 
45 #ifdef ENABLE_DOT1
46 struct lldpd_ppvid {
47 	TAILQ_ENTRY(lldpd_ppvid) p_entries;
48 	u_int8_t		p_cap_status;
49 	u_int16_t		p_ppvid;
50 };
51 MARSHAL_BEGIN(lldpd_ppvid)
52 MARSHAL_TQE(lldpd_ppvid, p_entries)
53 MARSHAL_END(lldpd_ppvid);
54 
55 struct lldpd_vlan {
56 	TAILQ_ENTRY(lldpd_vlan)  v_entries;
57 	char			*v_name;
58 	u_int16_t		 v_vid;
59 };
60 MARSHAL_BEGIN(lldpd_vlan)
61 MARSHAL_TQE(lldpd_vlan, v_entries)
62 MARSHAL_STR(lldpd_vlan, v_name)
63 MARSHAL_END(lldpd_vlan);
64 
65 struct lldpd_pi {
66 	TAILQ_ENTRY(lldpd_pi)  p_entries;
67 	char			*p_pi;
68 	int			 p_pi_len;
69 };
70 MARSHAL_BEGIN(lldpd_pi)
71 MARSHAL_TQE(lldpd_pi, p_entries)
72 MARSHAL_FSTR(lldpd_pi, p_pi, p_pi_len)
73 MARSHAL_END(lldpd_pi);
74 #endif
75 
76 #ifdef ENABLE_LLDPMED
77 struct lldpd_med_policy {
78 	u_int8_t		 index; /* Not used. */
79 	u_int8_t		 type;
80 	u_int8_t		 unknown;
81 	u_int8_t		 tagged;
82 	u_int16_t		 vid;
83 	u_int8_t		 priority;
84 	u_int8_t		 dscp;
85 };
86 MARSHAL(lldpd_med_policy);
87 
88 struct lldpd_med_loc {
89 	u_int8_t		 index; /* Not used. */
90 	u_int8_t		 format;
91 	char			*data;
92 	int			 data_len;
93 };
94 MARSHAL_BEGIN(lldpd_med_loc)
95 MARSHAL_FSTR(lldpd_med_loc, data, data_len)
96 MARSHAL_END(lldpd_med_loc);
97 
98 struct lldpd_med_power {
99 	u_int8_t		 devicetype; /* PD or PSE */
100 	u_int8_t		 source;
101 	u_int8_t		 priority;
102 	u_int16_t		 val;
103 };
104 MARSHAL(lldpd_med_power);
105 #endif
106 
107 #ifdef ENABLE_DOT3
108 struct lldpd_dot3_macphy {
109 	u_int8_t		 autoneg_support;
110 	u_int8_t		 autoneg_enabled;
111 	u_int16_t		 autoneg_advertised;
112 	u_int16_t		 mau_type;
113 };
114 
115 struct lldpd_dot3_power {
116 	u_int8_t		devicetype;
117 	u_int8_t		supported;
118 	u_int8_t		enabled;
119 	u_int8_t		paircontrol;
120 	u_int8_t		pairs;
121 	u_int8_t		class;
122 	u_int8_t		powertype; /* If set to LLDP_DOT3_POWER_8023AT_OFF,
123 					      following fields have no meaning */
124 	u_int8_t		source;
125 	u_int8_t		priority;
126 	u_int16_t		requested;
127 	u_int16_t		allocated;
128 
129 	/* For 802.3BT */
130 	u_int8_t		pd_4pid;
131 	u_int16_t		requested_a;
132 	u_int16_t		requested_b;
133 	u_int16_t		allocated_a;
134 	u_int16_t		allocated_b;
135 	u_int16_t		pse_status;
136 	u_int8_t		pd_status;
137 	u_int8_t		pse_pairs_ext;
138 	u_int8_t		class_a;
139 	u_int8_t		class_b;
140 	u_int8_t		class_ext;
141 	u_int8_t		type_ext;
142 	u_int8_t		pd_load;
143 	u_int16_t		pse_max;
144 };
145 MARSHAL(lldpd_dot3_power);
146 #endif
147 
148 #if defined (ENABLE_CDP) || defined (ENABLE_FDP)
149 struct cdpv2_power {
150 	u_int16_t request_id;
151 	u_int16_t management_id;
152 };
153 #endif
154 
155 enum {
156 	LLDPD_AF_UNSPEC = 0,
157 	LLDPD_AF_IPV4,
158 	LLDPD_AF_IPV6,
159 	LLDPD_AF_LAST
160 };
161 
162 #define LLDPD_MGMT_MAXADDRSIZE	16 /* sizeof(struct in6_addr) */
163 union lldpd_address {
164 	struct in_addr		inet;
165 	struct in6_addr		inet6;
166 	u_int8_t		octets[LLDPD_MGMT_MAXADDRSIZE]; /* network byte order! */
167 };
168 struct lldpd_mgmt {
169 	TAILQ_ENTRY(lldpd_mgmt) m_entries;
170 	int			m_family;
171 	union lldpd_address	m_addr;
172 	size_t 			m_addrsize;
173 	u_int32_t		m_iface;
174 };
175 MARSHAL_BEGIN(lldpd_mgmt)
176 MARSHAL_TQE(lldpd_mgmt, m_entries)
177 MARSHAL_END(lldpd_mgmt);
178 
179 struct lldpd_chassis {
180 	TAILQ_ENTRY(lldpd_chassis) c_entries;
181 	u_int16_t		 c_refcount; /* Reference count by ports */
182 	u_int16_t		 c_index;    /* Monotonic index */
183 	u_int8_t		 c_protocol; /* Protocol used to get this chassis */
184 	u_int8_t	 	 c_id_subtype;
185 	char			*c_id;
186 	int			 c_id_len;
187 	char			*c_name;
188 	char			*c_descr;
189 
190 	u_int16_t		 c_cap_available;
191 	u_int16_t		 c_cap_enabled;
192 
193 	TAILQ_HEAD(, lldpd_mgmt) c_mgmt;
194 
195 #ifdef ENABLE_LLDPMED
196 	u_int16_t		 c_med_cap_available;
197 	u_int8_t		 c_med_type;
198 	char			*c_med_hw;
199 	char			*c_med_fw;
200 	char			*c_med_sw;
201 	char			*c_med_sn;
202 	char			*c_med_manuf;
203 	char			*c_med_model;
204 	char			*c_med_asset;
205 #endif
206 
207 };
208 /* WARNING: any change to this structure should also be reflected into
209    `lldpd_copy_chassis()` which is not using marshaling. */
210 MARSHAL_BEGIN(lldpd_chassis)
211 MARSHAL_IGNORE(lldpd_chassis, c_entries.tqe_next)
212 MARSHAL_IGNORE(lldpd_chassis, c_entries.tqe_prev)
213 MARSHAL_FSTR(lldpd_chassis, c_id, c_id_len)
214 MARSHAL_STR(lldpd_chassis, c_name)
215 MARSHAL_STR(lldpd_chassis, c_descr)
216 MARSHAL_SUBTQ(lldpd_chassis, lldpd_mgmt, c_mgmt)
217 #ifdef ENABLE_LLDPMED
218 MARSHAL_STR(lldpd_chassis, c_med_hw)
219 MARSHAL_STR(lldpd_chassis, c_med_fw)
220 MARSHAL_STR(lldpd_chassis, c_med_sw)
221 MARSHAL_STR(lldpd_chassis, c_med_sn)
222 MARSHAL_STR(lldpd_chassis, c_med_manuf)
223 MARSHAL_STR(lldpd_chassis, c_med_model)
224 MARSHAL_STR(lldpd_chassis, c_med_asset)
225 #endif
226 MARSHAL_END(lldpd_chassis);
227 
228 #ifdef ENABLE_CUSTOM
229 
230 #define CUSTOM_TLV_ADD 		1
231 #define CUSTOM_TLV_REPLACE	2
232 #define CUSTOM_TLV_REMOVE	3
233 
234 /* Custom TLV struct as defined on page 35 of IEEE 802.1AB-2005 */
235 struct lldpd_custom {
236 	TAILQ_ENTRY(lldpd_custom)	next;	/* Pointer to next custom TLV */
237 
238 	/* Organizationally Unique Identifier */
239 	u_int8_t		oui[LLDP_TLV_ORG_OUI_LEN];
240 	/* Organizationally Defined Subtype */
241 	u_int8_t		subtype;
242 	/* Organizationally Defined Information String */
243 	u_int8_t		*oui_info;
244 	/* Organizationally Defined Information String length */
245 	int			oui_info_len;
246 };
247 MARSHAL_BEGIN(lldpd_custom)
248 MARSHAL_TQE(lldpd_custom, next)
249 MARSHAL_FSTR(lldpd_custom, oui_info, oui_info_len)
250 MARSHAL_END(lldpd_custom);
251 #endif
252 
253 struct lldpd_port {
254 	TAILQ_ENTRY(lldpd_port)	 p_entries;
255 	struct lldpd_chassis	*p_chassis;    /* Attached chassis */
256 	time_t			 p_lastchange; /* Time of last change of values */
257 	time_t			 p_lastupdate; /* Time of last update received */
258 	time_t			 p_lastremove;	/* Time of last removal of a remote port. Used for local ports only
259 						 * Used for deciding lldpStatsRemTablesLastChangeTime */
260 	struct lldpd_frame	*p_lastframe;  /* Frame received during last update */
261 	u_int8_t		 p_protocol;   /* Protocol used to get this port */
262 	u_int8_t		 p_hidden_in:1; /* Considered as hidden for reception */
263 	u_int8_t		 p_hidden_out:1; /* Considered as hidden for emission */
264 	u_int8_t		 p_disable_rx:1; /* Should RX be disabled for this port? */
265 	u_int8_t		 p_disable_tx:1; /* Should TX be disabled for this port? */
266 	/* Important: all fields that should be ignored to check if a port has
267 	 * been changed should be before this mark. */
268 #define LLDPD_PORT_START_MARKER (offsetof(struct lldpd_port, _p_hardware_flags))
269 	int			 _p_hardware_flags; /* This is a copy of hardware flags. Do not use it! */
270 	u_int8_t		 p_id_subtype;
271 	char			*p_id;
272 	int			 p_id_len;
273 	char			*p_descr;
274 	int			 p_descr_force; /* Description has been forced by user */
275 	u_int16_t		 p_mfs;
276 	u_int16_t		 p_ttl; /* TTL for remote port */
277 	int			 p_vlan_tx_tag;
278 	int			 p_vlan_tx_enabled;
279 
280 #ifdef ENABLE_DOT3
281 	/* Dot3 stuff */
282 	u_int32_t		 p_aggregid;
283 	struct lldpd_dot3_macphy p_macphy;
284 	struct lldpd_dot3_power	 p_power;
285 #endif
286 
287 #ifdef ENABLE_LLDPMED
288 	u_int16_t		 p_med_cap_enabled;
289 	struct lldpd_med_policy	 p_med_policy[LLDP_MED_APPTYPE_LAST];
290 	struct lldpd_med_loc	 p_med_location[LLDP_MED_LOCFORMAT_LAST];
291 	struct lldpd_med_power	 p_med_power;
292 #endif
293 
294 #if defined (ENABLE_CDP) || defined (ENABLE_FDP)
295 	struct cdpv2_power p_cdp_power;
296 #endif
297 
298 #ifdef ENABLE_DOT1
299 	u_int16_t		 p_pvid;
300 	TAILQ_HEAD(, lldpd_vlan) p_vlans;
301 	TAILQ_HEAD(, lldpd_ppvid) p_ppvids;
302 	TAILQ_HEAD(, lldpd_pi)	  p_pids;
303 #endif
304 #ifdef ENABLE_CUSTOM
305 	TAILQ_HEAD(, lldpd_custom) p_custom_list;
306 #endif
307 };
308 MARSHAL_BEGIN(lldpd_port)
309 MARSHAL_TQE(lldpd_port, p_entries)
310 MARSHAL_POINTER(lldpd_port, lldpd_chassis, p_chassis)
311 MARSHAL_IGNORE(lldpd_port, p_lastframe)
312 MARSHAL_FSTR(lldpd_port, p_id, p_id_len)
313 MARSHAL_STR(lldpd_port, p_descr)
314 #ifdef ENABLE_LLDPMED
315 MARSHAL_SUBSTRUCT(lldpd_port, lldpd_med_loc, p_med_location[0])
316 MARSHAL_SUBSTRUCT(lldpd_port, lldpd_med_loc, p_med_location[1])
317 MARSHAL_SUBSTRUCT(lldpd_port, lldpd_med_loc, p_med_location[2])
318 #endif
319 #ifdef ENABLE_DOT1
320 MARSHAL_SUBTQ(lldpd_port, lldpd_vlan, p_vlans)
321 MARSHAL_SUBTQ(lldpd_port, lldpd_ppvid, p_ppvids)
322 MARSHAL_SUBTQ(lldpd_port, lldpd_pi, p_pids)
323 #endif
324 #ifdef ENABLE_CUSTOM
325 MARSHAL_SUBTQ(lldpd_port, lldpd_custom, p_custom_list)
326 #endif
327 MARSHAL_END(lldpd_port);
328 
329 /* Used to modify some port related settings */
330 #define LLDPD_RXTX_UNCHANGED 0
331 #define LLDPD_RXTX_TXONLY 1
332 #define LLDPD_RXTX_RXONLY 2
333 #define LLDPD_RXTX_DISABLED 3
334 #define LLDPD_RXTX_BOTH 4
335 #define LLDPD_RXTX_FROM_PORT(p) (((p)->p_disable_rx && (p)->p_disable_tx)?LLDPD_RXTX_DISABLED: \
336 	    ((p)->p_disable_rx && !(p)->p_disable_tx)?LLDPD_RXTX_TXONLY:	\
337 	    (!(p)->p_disable_rx && (p)->p_disable_tx)?LLDPD_RXTX_RXONLY:	\
338 	    LLDPD_RXTX_BOTH)
339 #define LLDPD_RXTX_RXENABLED(v) ((v) == LLDPD_RXTX_RXONLY || (v) == LLDPD_RXTX_BOTH)
340 #define LLDPD_RXTX_TXENABLED(v) ((v) == LLDPD_RXTX_TXONLY || (v) == LLDPD_RXTX_BOTH)
341 struct lldpd_port_set {
342 	char *ifname;
343 	char *local_id;
344 	char *local_descr;
345 	int rxtx;
346 	int vlan_tx_tag;
347 	int vlan_tx_enabled;
348 #ifdef ENABLE_LLDPMED
349 	struct lldpd_med_policy *med_policy;
350 	struct lldpd_med_loc    *med_location;
351 	struct lldpd_med_power  *med_power;
352 #endif
353 #ifdef ENABLE_DOT3
354 	struct lldpd_dot3_power *dot3_power;
355 #endif
356 #ifdef ENABLE_CUSTOM
357 	struct lldpd_custom     *custom;
358 	int custom_list_clear;
359 	int custom_tlv_op;
360 #endif
361 };
362 MARSHAL_BEGIN(lldpd_port_set)
363 MARSHAL_STR(lldpd_port_set, ifname)
364 MARSHAL_STR(lldpd_port_set, local_id)
365 MARSHAL_STR(lldpd_port_set, local_descr)
366 #ifdef ENABLE_LLDPMED
367 MARSHAL_POINTER(lldpd_port_set, lldpd_med_policy, med_policy)
368 MARSHAL_POINTER(lldpd_port_set, lldpd_med_loc,    med_location)
369 MARSHAL_POINTER(lldpd_port_set, lldpd_med_power,  med_power)
370 #endif
371 #ifdef ENABLE_DOT3
372 MARSHAL_POINTER(lldpd_port_set, lldpd_dot3_power, dot3_power)
373 #endif
374 #ifdef ENABLE_CUSTOM
375 MARSHAL_POINTER(lldpd_port_set, lldpd_custom,     custom)
376 #endif
377 MARSHAL_END(lldpd_port_set);
378 
379 /* Smart mode / Hide mode */
380 #define SMART_INCOMING_FILTER		(1<<0) /* Incoming filtering enabled */
381 #define SMART_INCOMING_ONE_PROTO	(1<<1) /* On reception, keep only one proto */
382 #define SMART_INCOMING_ONE_NEIGH	(1<<2) /* On reception, keep only one neighbor */
383 #define SMART_OUTGOING_FILTER		(1<<3) /* Outgoing filtering enabled */
384 #define SMART_OUTGOING_ONE_PROTO	(1<<4) /* On emission, keep only one proto */
385 #define SMART_OUTGOING_ONE_NEIGH	(1<<5) /* On emission, consider only one neighbor */
386 #define SMART_INCOMING (SMART_INCOMING_FILTER |    \
387 			 SMART_INCOMING_ONE_PROTO | \
388 			 SMART_INCOMING_ONE_NEIGH)
389 #define SMART_OUTGOING (SMART_OUTGOING_FILTER |		\
390 			SMART_OUTGOING_ONE_PROTO |	\
391 			SMART_OUTGOING_ONE_NEIGH)
392 
393 struct lldpd_config {
394 	int c_paused;	        /* lldpd is paused */
395 	int c_tx_interval;	/* Transmit interval (in ms) */
396 	int c_ttl;		/* TTL */
397 	int c_smart;		/* Bitmask for smart configuration (see SMART_*) */
398 	int c_receiveonly;	/* Receive only mode */
399 	int c_max_neighbors;	/* Maximum number of neighbors (per protocol) */
400 
401 	char *c_mgmt_pattern;	/* Pattern to match a management address */
402 	char *c_cid_pattern;	/* Pattern to match interfaces to use for chassis ID */
403 	char *c_cid_string;     /* User defined string for chassis ID */
404 	char *c_iface_pattern;	/* Pattern to match interfaces to use */
405 	char *c_perm_ifaces;	/* Pattern to match interfaces to keep */
406 
407 	char *c_platform;	/* Override platform description (for CDP) */
408 	char *c_description;	/* Override chassis description */
409 	char *c_hostname;	/* Override system name */
410 	int c_advertise_version; /* Should the precise version be advertised? */
411 	int c_set_ifdescr;	 /* Set interface description */
412 	int c_promisc;		 /* Interfaces should be in promiscuous mode */
413 	int c_cap_advertise;	 /* Chassis capabilities advertisement */
414 	int c_mgmt_advertise;	 /* Management addresses advertisement */
415 
416 #ifdef ENABLE_LLDPMED
417 	int c_noinventory;	/* Don't send inventory with LLDP-MED */
418 	int c_enable_fast_start; /* enable fast start */
419 	int c_tx_fast_init;	/* Num of lldpd lldppdu's for fast start */
420 	int c_tx_fast_interval;	/* Time intr between sends during fast start */
421 #endif
422 	int c_tx_hold;		/* Transmit hold */
423 	int c_bond_slave_src_mac_type; /* Src mac type in lldp frames over bond
424 					  slaves */
425 	int c_lldp_portid_type; /* The PortID type */
426 	int c_lldp_agent_type;	/* The agent type */
427 };
428 MARSHAL_BEGIN(lldpd_config)
429 MARSHAL_STR(lldpd_config, c_mgmt_pattern)
430 MARSHAL_STR(lldpd_config, c_cid_pattern)
431 MARSHAL_STR(lldpd_config, c_cid_string)
432 MARSHAL_STR(lldpd_config, c_iface_pattern)
433 MARSHAL_STR(lldpd_config, c_perm_ifaces)
434 MARSHAL_STR(lldpd_config, c_hostname)
435 MARSHAL_STR(lldpd_config, c_platform)
436 MARSHAL_STR(lldpd_config, c_description)
437 MARSHAL_END(lldpd_config);
438 
439 struct lldpd_frame {
440 	int size;
441 	unsigned char frame[1];
442 };
443 
444 struct lldpd_hardware;
445 struct lldpd;
446 struct lldpd_ops {
447 	int(*send)(struct lldpd *,
448 		   struct lldpd_hardware*,
449 		   char *, size_t); /* Function to send a frame */
450 	int(*recv)(struct lldpd *,
451 		   struct lldpd_hardware*,
452 		   int, char *, size_t); /* Function to receive a frame */
453 	int(*cleanup)(struct lldpd *, struct lldpd_hardware *); /* Cleanup function. */
454 };
455 
456 /* An interface is uniquely identified by h_ifindex, h_ifname and h_ops. This
457  * means if an interface becomes enslaved, it will be considered as a new
458  * interface. The same applies for renaming and we include the index in case of
459  * renaming to an existing interface. */
460 struct lldpd_hardware {
461 	TAILQ_ENTRY(lldpd_hardware)	 h_entries;
462 
463 	struct lldpd		*h_cfg;	    /* Pointer to main configuration */
464 	void			*h_recv;    /* FD for reception */
465 	int			 h_sendfd;  /* FD for sending, only used by h_ops */
466 	int			 h_mangle;  /* 1 if we have to mangle the MAC address */
467 	struct lldpd_ops	*h_ops;	    /* Hardware-dependent functions */
468 	void			*h_data;    /* Hardware-dependent data */
469 	void			*h_timer;   /* Timer for this port */
470 
471 	int			 h_mtu;
472 	int			 h_flags; /* Packets will be sent only
473 					     if IFF_RUNNING. Will be
474 					     removed if this is left
475 					     to 0. */
476 	int			 h_ifindex; /* Interface index, used by SNMP */
477 	char			 h_ifname[IFNAMSIZ]; /* Should be unique */
478 	u_int8_t		 h_lladdr[ETHER_ADDR_LEN];
479 
480 	u_int64_t		 h_tx_cnt;
481 	u_int64_t		 h_rx_cnt;
482 	u_int64_t		 h_rx_discarded_cnt;
483 	u_int64_t		 h_rx_unrecognized_cnt;
484 	u_int64_t		 h_ageout_cnt;
485 	u_int64_t		 h_insert_cnt;
486 	u_int64_t		 h_delete_cnt;
487 	u_int64_t		 h_drop_cnt;
488 
489 	/* Previous values of different stuff. */
490 	/* Backup of the previous local port. Used to check if there was a
491 	 * change to send an immediate update. All those are not marshalled to
492 	 * the client. */
493 	void			*h_lport_previous;
494 	ssize_t			 h_lport_previous_len;
495 	/* Backup of the previous chassis ID. Used to check if there was a
496 	 * change and send an LLDP shutdown. */
497 	u_int8_t	 	 h_lchassis_previous_id_subtype;
498 	char			*h_lchassis_previous_id;
499 	int			 h_lchassis_previous_id_len;
500 	/* Backup of the previous port ID. Used to check if there was a change
501 	 * and send an LLDP shutdown. */
502 	u_int8_t		 h_lport_previous_id_subtype;
503 	char			*h_lport_previous_id;
504 	int			 h_lport_previous_id_len;
505 
506 	struct lldpd_port	 h_lport;  /* Port attached to this hardware port */
507 	TAILQ_HEAD(, lldpd_port) h_rports; /* Remote ports */
508 
509 #ifdef ENABLE_LLDPMED
510 	int			h_tx_fast; /* current tx fast start count */
511 #endif
512 };
513 MARSHAL_BEGIN(lldpd_hardware)
514 MARSHAL_IGNORE(lldpd_hardware, h_entries.tqe_next)
515 MARSHAL_IGNORE(lldpd_hardware, h_entries.tqe_prev)
516 MARSHAL_IGNORE(lldpd_hardware, h_ops)
517 MARSHAL_IGNORE(lldpd_hardware, h_data)
518 MARSHAL_IGNORE(lldpd_hardware, h_cfg)
519 MARSHAL_IGNORE(lldpd_hardware, h_lport_previous)
520 MARSHAL_IGNORE(lldpd_hardware, h_lport_previous_len)
521 MARSHAL_IGNORE(lldpd_hardware, h_lchassis_previous_id_subtype)
522 MARSHAL_IGNORE(lldpd_hardware, h_lchassis_previous_id)
523 MARSHAL_IGNORE(lldpd_hardware, h_lchassis_previous_id_len)
524 MARSHAL_IGNORE(lldpd_hardware, h_lport_previous_id_subtype)
525 MARSHAL_IGNORE(lldpd_hardware, h_lport_previous_id)
526 MARSHAL_IGNORE(lldpd_hardware, h_lport_previous_id_len)
527 MARSHAL_SUBSTRUCT(lldpd_hardware, lldpd_port, h_lport)
528 MARSHAL_SUBTQ(lldpd_hardware, lldpd_port, h_rports)
529 MARSHAL_END(lldpd_hardware);
530 
531 struct lldpd_interface {
532 	TAILQ_ENTRY(lldpd_interface) next;
533 	char			*name;
534 };
535 MARSHAL_BEGIN(lldpd_interface)
536 MARSHAL_TQE(lldpd_interface, next)
537 MARSHAL_STR(lldpd_interface, name)
538 MARSHAL_END(lldpd_interface);
539 TAILQ_HEAD(lldpd_interface_list, lldpd_interface);
540 MARSHAL_TQ(lldpd_interface_list, lldpd_interface);
541 
542 struct lldpd_neighbor_change {
543 	char *ifname;
544 #define NEIGHBOR_CHANGE_DELETED -1
545 #define NEIGHBOR_CHANGE_ADDED    1
546 #define NEIGHBOR_CHANGE_UPDATED  0
547 	int state;
548 	struct lldpd_port *neighbor;
549 };
550 MARSHAL_BEGIN(lldpd_neighbor_change)
551 MARSHAL_STR(lldpd_neighbor_change, ifname)
552 MARSHAL_POINTER(lldpd_neighbor_change, lldpd_port, neighbor)
553 MARSHAL_END(lldpd_neighbor_change);
554 
555 /* Cleanup functions */
556 void	 lldpd_chassis_mgmt_cleanup(struct lldpd_chassis *);
557 void	 lldpd_chassis_cleanup(struct lldpd_chassis *, int);
558 void	 lldpd_remote_cleanup(struct lldpd_hardware *,
559     void(*expire)(struct lldpd_hardware *, struct lldpd_port *),
560     int);
561 void	 lldpd_port_cleanup(struct lldpd_port *, int);
562 void	 lldpd_config_cleanup(struct lldpd_config *);
563 #ifdef ENABLE_DOT1
564 void	 lldpd_ppvid_cleanup(struct lldpd_port *);
565 void	 lldpd_vlan_cleanup(struct lldpd_port *);
566 void	 lldpd_pi_cleanup(struct lldpd_port *);
567 #endif
568 #ifdef ENABLE_CUSTOM
569 void     lldpd_custom_tlv_cleanup(struct lldpd_port *, struct lldpd_custom *);
570 void     lldpd_custom_tlv_add(struct lldpd_port *, struct lldpd_custom *);
571 void     lldpd_custom_list_cleanup(struct lldpd_port *);
572 #endif
573 
574 #endif
575