Prepare Open vSwitch 1.1.2 release.
[sliver-openvswitch.git] / lib / lacp.h
1 /*
2  * Copyright (c) 2011 Nicira Networks.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef LACP_H
18 #define LACP_H 1
19
20 #include <stdbool.h>
21 #include <stdint.h>
22
23 struct ds;
24 struct lacp;
25 struct lacp_pdu;
26 struct ofpbuf;
27
28 /* Function called when a LACP PDU is ready to be sent out the given slave */
29 typedef void lacp_send_pdu(void *slave, const struct lacp_pdu *);
30
31 void lacp_init(void);
32 struct lacp *lacp_create(void);
33 void lacp_destroy(struct lacp *);
34 void lacp_configure(struct lacp *, const char *name, uint8_t sys_id[8],
35                     uint16_t sys_priority, bool active, bool fast);
36 void lacp_process_pdu(struct lacp *, const void *slave,
37                       const struct lacp_pdu *);
38 bool lacp_negotiated(const struct lacp *);
39
40 void lacp_slave_register(struct lacp *, void *slave_, const char *name,
41                          uint16_t port_id, uint16_t port_priority);
42 void lacp_slave_unregister(struct lacp *, const void *slave);
43 void lacp_slave_enable(struct lacp *lacp, void *slave_, bool enabled);
44 void lacp_slave_carrier_changed(const struct lacp *, const void *slave);
45 bool lacp_slave_may_enable(const struct lacp *, const void *slave);
46
47 void lacp_run(struct lacp *, lacp_send_pdu *);
48 void lacp_wait(struct lacp *);
49
50 #endif /* lacp.h */