]> git.proxmox.com Git - ovs.git/blame - lib/ovs-lldp.h
lockfile: Support \-delimited file names in lockfile_name().
[ovs.git] / lib / ovs-lldp.h
CommitLineData
be53a5c4 1/*
72c642e5 2 * Copyright (c) 2015 Nicira, Inc.
be53a5c4
DF
3 * Copyright (c) 2014 Wind River Systems, Inc.
4 * Copyright (c) 2015 Avaya, Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef OVS_LLDP_H
20#define OVS_LLDP_H
21
22#include <stdint.h>
0477baa9 23#include "dp-packet.h"
be53a5c4
DF
24#include "hmap.h"
25#include "list.h"
26#include "lldp/lldpd.h"
5617ae6a 27#include "ovs-atomic.h"
be53a5c4
DF
28#include "packets.h"
29#include "timer.h"
30
31/* Transmit every LLDPD_TX_INTERVAL seconds. */
ac211bdd 32#define LLDP_DEFAULT_TRANSMIT_INTERVAL_MS (LLDPD_TX_INTERVAL * 1000)
be53a5c4 33
be53a5c4
DF
34struct flow;
35struct netdev;
36struct smap;
37
be53a5c4
DF
38/* Structure per LLDP instance (at the moment per port when enabled).
39 */
40struct lldp {
41 struct hmap_node hmap_node; /* Node in all_lldps list. */
42 struct lldpd *lldpd;
43 char *name; /* Name of the port. */
44 struct timer tx_timer; /* Send LLDP when expired. */
45 struct hmap mappings_by_isid; /* "struct" indexed by ISID */
46 struct hmap mappings_by_aux; /* "struct" indexed by aux */
47 struct ovs_list active_mapping_queue;
48 struct ovs_refcount ref_cnt;
49};
50
51/* Configuration specific to Auto Attach.
52 */
53struct aa_settings {
54 char *system_description;
55 char *system_name;
56};
57
58/* Configuration of Auto Attach mappings.
59 */
60struct aa_mapping_settings {
72c642e5
BP
61 uint32_t isid;
62 uint16_t vlan;
be53a5c4
DF
63};
64
65enum bridge_aa_vlan_oper {
66 BRIDGE_AA_VLAN_OPER_UNDEF,
67 BRIDGE_AA_VLAN_OPER_ADD,
68 BRIDGE_AA_VLAN_OPER_REMOVE
69};
70
71/* Bridge Auto Attach operations. Mostly for adding/removing VLAN on
72 * the trunk port connected to the Auto Attach server.
73 */
74struct bridge_aa_vlan {
75 struct ovs_list list_node;
76 char *port_name;
72c642e5 77 uint16_t vlan;
be53a5c4
DF
78 enum bridge_aa_vlan_oper oper;
79};
80
81void lldp_init(void);
82long long int lldp_wait(struct lldp *lldp);
83long long int lldp_wake_time(const struct lldp *lldp);
84void lldp_run(struct lldpd *cfg);
85bool lldp_should_send_packet(struct lldp *cfg);
86bool lldp_should_process_flow(const struct flow *flow);
87bool lldp_configure(struct lldp *lldp);
0477baa9
DF
88void lldp_process_packet(struct lldp *cfg, const struct dp_packet *);
89void lldp_put_packet(struct lldp *lldp, struct dp_packet *packet,
be53a5c4
DF
90 uint8_t eth_src[ETH_ADDR_LEN]);
91void lldpd_assign_cfg_to_protocols(struct lldpd *cfg);
92struct lldp * lldp_create(const struct netdev *netdev, const uint32_t mtu,
93 const struct smap *cfg);
94struct lldp * lldp_ref(const struct lldp *lldp_);
95void lldp_unref(struct lldp *lldp);
96
97int aa_get_vlan_queued(struct ovs_list *list);
98unsigned int aa_get_vlan_queue_size(void);
99int aa_configure(const struct aa_settings *s);
100int aa_mapping_register(void *aux, const struct aa_mapping_settings *s);
101int aa_mapping_unregister(void *aux);
102
103/* Used by unit tests */
104struct lldp * lldp_create_dummy(void);
105
106#endif /* OVS_LLDP_H */