FD.io VPP
v17.07-30-g839fa73
Vector Packet Processing
Main Page
Related Pages
Data Structures
Source
Files
Symbols
lldp_node.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011-2016 Cisco and/or its affiliates.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at:
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
/**
16
* @file
17
* @brief LLDP global declarations
18
*/
19
#ifndef __included_lldp_node_h__
20
#define __included_lldp_node_h__
21
22
#include <
vlib/vlib.h
>
23
#include <
vlib/unix/unix.h
>
24
#include <
vnet/snap/snap.h
>
25
#include <
vppinfra/format.h
>
26
#include <
vppinfra/hash.h
>
27
28
#include <
vnet/lldp/lldp_protocol.h
>
29
30
typedef
struct
lldp_intf
31
{
32
/* hw interface index */
33
u32
hw_if_index
;
34
35
/* Timers */
36
f64
last_heard
;
37
f64
last_sent
;
38
39
/* Info received from peer */
40
u8
*
chassis_id
;
41
u8
*
port_id
;
42
u16
ttl
;
43
lldp_port_id_subtype_t
port_id_subtype
;
44
lldp_chassis_id_subtype_t
chassis_id_subtype
;
45
46
/* Local info */
47
u8
*
port_desc
;
48
49
}
lldp_intf_t
;
50
51
typedef
struct
52
{
53
/* pool of lldp-enabled interface context data */
54
lldp_intf_t
*
intfs
;
55
56
/* rapidly find an interface by vlib hw interface index */
57
uword
*
intf_by_hw_if_index
;
58
59
/* Background process node index */
60
u32
lldp_process_node_index
;
61
62
/* interface idxs (into intfs pool) in the order of timing out */
63
u32
*
intfs_timeouts
;
64
65
/* index of the interface which will time out next */
66
u32
intfs_timeouts_idx
;
67
68
/* packet template for sending out packets */
69
vlib_packet_template_t
packet_template
;
70
71
/* convenience variables */
72
vlib_main_t
*
vlib_main
;
73
vnet_main_t
*
vnet_main
;
74
75
/* system name advertised over LLDP (default is none) */
76
u8
*
sys_name
;
77
78
/* IEEE Std 802.1AB-2009:
79
* 9.2.5.6 msgTxHold
80
* This variable is used, as a multiplier of msgTxInterval, to determine the
81
* value of txTTL that is carried in LLDP frames transmitted by the LLDP
82
* agent. The recommended default value of msgTxHold is 4; this value can
83
* be changed by management to any value in the range 1 through 100.
84
*/
85
u8
msg_tx_hold
;
86
87
/* IEEE Std 802.1AB-2009:
88
* 9.2.5.7 msgTxInterval
89
* This variable defines the time interval in timer ticks between
90
* transmissions during normal transmission periods (i.e., txFast is zero).
91
* The recommended default value for msgTxInterval is 30 s; this value can
92
* be changed by management to any value in the range 1 through 3600.
93
*/
94
u16
msg_tx_interval
;
95
}
lldp_main_t
;
96
97
#define LLDP_MIN_TX_HOLD (1)
98
#define LLDP_MAX_TX_HOLD (100)
99
#define LLDP_MIN_TX_INTERVAL (1)
100
#define LLDP_MAX_TX_INTERVAL (3600)
101
102
extern
lldp_main_t
lldp_main
;
103
104
/* Packet counters */
105
#define foreach_lldp_error(F) \
106
F(NONE, "good lldp packets (processed)") \
107
F(CACHE_HIT, "good lldp packets (cache hit)") \
108
F(BAD_TLV, "lldp packets with bad TLVs") \
109
F(DISABLED, "lldp packets received on disabled interfaces")
110
111
typedef
enum
112
{
113
#define F(sym, str) LLDP_ERROR_##sym,
114
foreach_lldp_error
(
F
)
115
#undef F
116
LLDP_N_ERROR,
117
}
lldp_error_t
;
118
119
/* lldp packet trace capture */
120
typedef
struct
121
{
122
u32
len
;
123
u8
data[400];
124
}
lldp_input_trace_t
;
125
126
enum
127
{
128
LLDP_EVENT_RESCHEDULE
= 1,
129
}
lldp_process_event_t
;
130
131
lldp_intf_t
*
lldp_get_intf
(
lldp_main_t
* lm,
u32
hw_if_index
);
132
lldp_intf_t
*
lldp_create_intf
(
lldp_main_t
* lm,
u32
hw_if_index
);
133
void
lldp_delete_intf
(
lldp_main_t
* lm,
lldp_intf_t
* n);
134
lldp_error_t
lldp_input
(
vlib_main_t
* vm,
vlib_buffer_t
* b0,
u32
bi0);
135
u8
*
lldp_input_format_trace
(
u8
* s, va_list * args);
136
void
lldp_send_ethernet
(
lldp_main_t
* lm,
lldp_intf_t
* n,
int
shutdown);
137
void
lldp_schedule_intf
(
lldp_main_t
* lm,
lldp_intf_t
* n);
138
void
lldp_unschedule_intf
(
lldp_main_t
* lm,
lldp_intf_t
* n);
139
140
#endif
/* __included_lldp_node_h__ */
141
142
/*
143
* fd.io coding-style-patch-verification: ON
144
*
145
* Local Variables:
146
* eval: (c-set-style "gnu")
147
* End:
148
*/
lldp_main_t::vnet_main
vnet_main_t * vnet_main
Definition:
lldp_node.h:73
lldp_intf::hw_if_index
u32 hw_if_index
Definition:
lldp_node.h:33
lldp_chassis_id_subtype_t
lldp_chassis_id_subtype_t
Definition:
lldp_protocol.h:85
lldp_main_t::intfs_timeouts_idx
u32 intfs_timeouts_idx
Definition:
lldp_node.h:66
lldp_intf::chassis_id
u8 * chassis_id
Definition:
lldp_node.h:40
lldp_main_t::intfs
lldp_intf_t * intfs
Definition:
lldp_node.h:54
LLDP_EVENT_RESCHEDULE
Definition:
lldp_node.h:128
lldp_input_trace_t::len
u32 len
Definition:
lldp_node.h:122
lldp_intf::last_sent
f64 last_sent
Definition:
lldp_node.h:37
lldp_main_t::intfs_timeouts
u32 * intfs_timeouts
Definition:
lldp_node.h:63
lldp_intf::ttl
u16 ttl
Definition:
lldp_node.h:42
hash.h
lldp_unschedule_intf
void lldp_unschedule_intf(lldp_main_t *lm, lldp_intf_t *n)
Definition:
lldp_node.c:267
lldp_send_ethernet
void lldp_send_ethernet(lldp_main_t *lm, lldp_intf_t *n, int shutdown)
Definition:
lldp_output.c:130
lldp_main_t::msg_tx_hold
u8 msg_tx_hold
Definition:
lldp_node.h:85
lldp_main_t
Definition:
lldp_node.h:51
lldp_input_format_trace
u8 * lldp_input_format_trace(u8 *s, va_list *args)
Definition:
lldp_cli.c:624
lldp_intf::port_id
u8 * port_id
Definition:
lldp_node.h:41
lldp_input
lldp_error_t lldp_input(vlib_main_t *vm, vlib_buffer_t *b0, u32 bi0)
Definition:
lldp_input.c:249
vlib_packet_template_t
Definition:
buffer_funcs.h:708
lldp_delete_intf
void lldp_delete_intf(lldp_main_t *lm, lldp_intf_t *n)
Definition:
lldp_output.c:177
lldp_error_t
lldp_error_t
Definition:
lldp_node.h:111
lldp_main_t::msg_tx_interval
u16 msg_tx_interval
Definition:
lldp_node.h:94
lldp_main_t::intf_by_hw_if_index
uword * intf_by_hw_if_index
Definition:
lldp_node.h:57
unix.h
lldp_main
lldp_main_t lldp_main
Definition:
lldp_input.c:117
format.h
lldp_schedule_intf
void lldp_schedule_intf(lldp_main_t *lm, lldp_intf_t *n)
Definition:
lldp_node.c:242
lldp_intf::port_desc
u8 * port_desc
Definition:
lldp_node.h:47
lldp_process_event_t
enum @229 lldp_process_event_t
lldp_get_intf
lldp_intf_t * lldp_get_intf(lldp_main_t *lm, u32 hw_if_index)
Definition:
lldp_input.c:212
vlib_buffer_t
Definition:
buffer.h:61
lldp_protocol.h
LLDP protocol declarations.
vlib.h
vnet_main_t
Definition:
vnet.h:51
u32
unsigned int u32
Definition:
types.h:88
foreach_lldp_error
#define foreach_lldp_error(F)
Definition:
lldp_node.h:105
lldp_main_t::lldp_process_node_index
u32 lldp_process_node_index
Definition:
lldp_node.h:60
lldp_port_id_subtype_t
lldp_port_id_subtype_t
Definition:
lldp_protocol.h:114
uword
u64 uword
Definition:
types.h:112
lldp_main_t::vlib_main
vlib_main_t * vlib_main
Definition:
lldp_node.h:72
lldp_intf_t
struct lldp_intf lldp_intf_t
u16
unsigned short u16
Definition:
types.h:57
lldp_intf::port_id_subtype
lldp_port_id_subtype_t port_id_subtype
Definition:
lldp_node.h:43
f64
double f64
Definition:
types.h:142
u8
unsigned char u8
Definition:
types.h:56
lldp_input_trace_t
Definition:
lldp_node.h:120
F
#define F(sym, str)
Definition:
lldp_node.h:113
lldp_intf
Definition:
lldp_node.h:30
vlib_main_t
Definition:
main.h:59
lldp_intf::chassis_id_subtype
lldp_chassis_id_subtype_t chassis_id_subtype
Definition:
lldp_node.h:44
lldp_create_intf
lldp_intf_t * lldp_create_intf(lldp_main_t *lm, u32 hw_if_index)
Definition:
lldp_input.c:224
lldp_main_t::packet_template
vlib_packet_template_t packet_template
Definition:
lldp_node.h:69
snap.h
lldp_main_t::sys_name
u8 * sys_name
Definition:
lldp_node.h:76
lldp_intf::last_heard
f64 last_heard
Definition:
lldp_node.h:36
src
vnet
lldp
lldp_node.h
Generated on Fri Sep 8 2017 03:36:21 for FD.io VPP by
1.8.11