5106a51b90b435bcedf23dad891ef5350ba45f32
[sliver-openvswitch.git] / lib / cfm.h
1 /* Copyright (c) 2010, 2011 Nicira Networks.
2  *
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 #ifndef CFM_H
17 #define CFM_H 1
18
19 #include <stdint.h>
20
21 #include "hmap.h"
22 #include "openvswitch/types.h"
23
24 struct flow;
25 struct ofpbuf;
26
27 struct cfm_settings {
28     uint64_t mpid;              /* The MPID of this CFM. */
29     int interval;               /* The requested transmission interval. */
30     bool extended;              /* Run in extended mode. */
31     bool opup;                  /* Operational State. */
32     uint16_t ccm_vlan;          /* CCM Vlan tag. Zero if none. */
33     uint8_t ccm_pcp;            /* CCM Priority. Zero if none. */
34 };
35
36 void cfm_init(void);
37 struct cfm *cfm_create(const char *name);
38 void cfm_destroy(struct cfm *);
39 void cfm_run(struct cfm *);
40 bool cfm_should_send_ccm(struct cfm *);
41 void cfm_compose_ccm(struct cfm *, struct ofpbuf *packet, uint8_t eth_src[6]);
42 void cfm_wait(struct cfm *);
43 bool cfm_configure(struct cfm *, const struct cfm_settings *);
44 bool cfm_should_process_flow(const struct cfm *cfm, const struct flow *);
45 void cfm_process_heartbeat(struct cfm *, const struct ofpbuf *packet);
46 bool cfm_get_fault(const struct cfm *);
47 bool cfm_get_opup(const struct cfm *);
48 void cfm_get_remote_mpids(const struct cfm *, const uint64_t **rmps,
49                           size_t *n_rmps);
50
51 #endif /* cfm.h */