+/* Remote MPs represent foreign network entities that are configured to have
+ * the same MAID as this CFM instance. */
+struct remote_mp {
+ uint16_t mpid; /* The Maintenance Point ID of this 'remote_mp'. */
+ struct hmap_node node; /* Node in 'remote_mps' map. */
+
+ bool recv; /* CCM was received since last fault check. */
+ bool rdi; /* Remote Defect Indicator. Indicates remote_mp isn't
+ receiving CCMs that it's expecting to. */
+};
+
+static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
+static struct hmap all_cfms = HMAP_INITIALIZER(&all_cfms);
+
+static void cfm_unixctl_show(struct unixctl_conn *, const char *args,
+ void *aux);
+
+static const uint8_t *
+cfm_ccm_addr(const struct cfm *cfm)
+{
+ return cfm->extended ? eth_addr_ccm_x : eth_addr_ccm;
+}
+
+static void
+cfm_generate_maid(struct cfm *cfm)
+{
+ const char *ovs_md_name = "ovs";
+ const char *ovs_ma_name = "ovs";
+ uint8_t *ma_p;
+ size_t md_len, ma_len;
+
+ memset(cfm->maid, 0, CCM_MAID_LEN);
+
+ md_len = strlen(ovs_md_name);
+ ma_len = strlen(ovs_ma_name);
+
+ assert(md_len && ma_len && md_len + ma_len + 4 <= CCM_MAID_LEN);
+
+ cfm->maid[0] = 4; /* MD name string format. */
+ cfm->maid[1] = md_len; /* MD name size. */
+ memcpy(&cfm->maid[2], ovs_md_name, md_len); /* MD name. */
+
+ ma_p = cfm->maid + 2 + md_len;
+ ma_p[0] = 2; /* MA name string format. */
+ ma_p[1] = ma_len; /* MA name size. */
+ memcpy(&ma_p[2], ovs_ma_name, ma_len); /* MA name. */
+}
+