2 * Copyright (c) 2014 Wind River Systems, Inc.
3 * Copyright (c) 2015 Avaya, Inc.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
24 #include "lldp/lldpd.h"
26 #include "ovsdb-data.h"
27 #include "ovs-thread.h"
31 /* Transmit every LLDPD_TX_INTERVAL seconds. */
32 #define LLDP_DEFAULT_TRANSMIT_INTERVAL_MS LLDPD_TX_INTERVAL * 1000
34 struct flow_wildcards
;
40 /* TODO should reflect lldp stack detail */
41 char *stackdetail
; /* Added because MSVC doesn't like empty structs */
44 /* Structure per LLDP instance (at the moment per port when enabled).
47 struct hmap_node hmap_node
; /* Node in all_lldps list. */
49 char *name
; /* Name of the port. */
50 struct timer tx_timer
; /* Send LLDP when expired. */
51 struct hmap mappings_by_isid
; /* "struct" indexed by ISID */
52 struct hmap mappings_by_aux
; /* "struct" indexed by aux */
53 struct ovs_list active_mapping_queue
;
54 struct ovs_refcount ref_cnt
;
57 /* Configuration specific to Auto Attach.
60 char *system_description
;
64 /* Configuration of Auto Attach mappings.
66 struct aa_mapping_settings
{
71 enum bridge_aa_vlan_oper
{
72 BRIDGE_AA_VLAN_OPER_UNDEF
,
73 BRIDGE_AA_VLAN_OPER_ADD
,
74 BRIDGE_AA_VLAN_OPER_REMOVE
77 /* Bridge Auto Attach operations. Mostly for adding/removing VLAN on
78 * the trunk port connected to the Auto Attach server.
80 struct bridge_aa_vlan
{
81 struct ovs_list list_node
;
84 enum bridge_aa_vlan_oper oper
;
88 long long int lldp_wait(struct lldp
*lldp
);
89 long long int lldp_wake_time(const struct lldp
*lldp
);
90 void lldp_run(struct lldpd
*cfg
);
91 bool lldp_should_send_packet(struct lldp
*cfg
);
92 bool lldp_should_process_flow(const struct flow
*flow
);
93 bool lldp_configure(struct lldp
*lldp
);
94 void lldp_process_packet(struct lldp
*cfg
, const struct ofpbuf
*p
);
95 void lldp_put_packet(struct lldp
*lldp
, struct ofpbuf
*packet
,
96 uint8_t eth_src
[ETH_ADDR_LEN
]);
97 void lldpd_assign_cfg_to_protocols(struct lldpd
*cfg
);
98 struct lldp
* lldp_create(const struct netdev
*netdev
, const uint32_t mtu
,
99 const struct smap
*cfg
);
100 struct lldp
* lldp_ref(const struct lldp
*lldp_
);
101 void lldp_unref(struct lldp
*lldp
);
103 int aa_get_vlan_queued(struct ovs_list
*list
);
104 unsigned int aa_get_vlan_queue_size(void);
105 int aa_configure(const struct aa_settings
*s
);
106 int aa_mapping_register(void *aux
, const struct aa_mapping_settings
*s
);
107 int aa_mapping_unregister(void *aux
);
109 /* Used by unit tests */
110 struct lldp
* lldp_create_dummy(void);
112 #endif /* OVS_LLDP_H */