2 * Copyright (c) 2010 Nicira Networks.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
27 /* A 'cfm' represent a local Maintenance Point (MP) and its Connectivity Fault
28 * Management (CFM) state machine. Its configuration variables should be set
29 * by clients of the CFM library. */
31 /* Configuration Variables. */
32 uint16_t mpid; /* The MPID of this CFM. */
33 uint8_t maid[CCM_MAID_LEN]; /* The MAID of this CFM. */
34 int interval; /* The requested transmission interval. */
35 uint8_t eth_src[ETH_ADDR_LEN];
38 struct hmap remote_mps; /* Expected remote MPs. */
39 struct hmap x_remote_mps; /* Unexpected remote MPs. */
40 struct hmap x_remote_maids; /* Unexpected remote MAIDs. */
41 bool fault; /* Indicates connectivity vaults. */
44 /* Remote MPs represent foreign network entities that are configured to have
45 * the same MAID as this CFM instance. */
47 uint16_t mpid; /* The Maintenance Point ID of this 'remote_mp'. */
48 struct hmap_node node; /* In 'cfm' 'remote_mps' or 'x_remote_mps'. */
50 long long recv_time; /* Time the most recent CCM was received. */
51 bool fault; /* Indicates a connectivity fault. */
54 /* Remote MAIDs keep track of incoming CCM messages which have a different MAID
55 * than this CFM instance. */
57 uint8_t maid[CCM_MAID_LEN]; /* The remote MAID. */
58 struct hmap_node node; /* In 'cfm' 'x_remote_maids'. */
60 long long recv_time; /* Most recent receive time for this 'remote_maid'. */
63 struct cfm *cfm_create(void);
65 void cfm_destroy(struct cfm *);
67 struct ofpbuf *cfm_run(struct cfm *);
69 void cfm_wait(struct cfm *);
71 bool cfm_configure(struct cfm *);
73 void cfm_update_remote_mps(struct cfm *, const uint16_t *mpid, size_t n_mpids);
75 const struct remote_mp *cfm_get_remote_mp(const struct cfm *, uint16_t mpid);
77 bool cfm_generate_maid(const char *md_name, const char *ma_name,
78 uint8_t maid[CCM_MAID_LEN]);
80 bool cfm_should_process_flow(const struct flow *);
82 void cfm_process_heartbeat(struct cfm *, const struct ofpbuf *packet);