+#define CFM_CHASSIS_ID_CHASSIS_COMPONENT 1
+#define CFM_CHASSIS_ID_INTERFACE_ALIAS 2
+#define CFM_CHASSIS_ID_PORT_COMPONENT 3
+#define CFM_CHASSIS_ID_MAC_ADDRESS 4
+#define CFM_CHASSIS_ID_NETWORK_ADDRESS 5
+#define CFM_CHASSIS_ID_INTERFACE_NAME 6
+#define CFM_CHASSIS_ID_LOCAL 7
+
+static const struct tok cfm_tlv_senderid_chassisid_values[] = {
+ { 0, "Reserved"},
+ { CFM_CHASSIS_ID_CHASSIS_COMPONENT, "Chassis component"},
+ { CFM_CHASSIS_ID_INTERFACE_ALIAS, "Interface alias"},
+ { CFM_CHASSIS_ID_PORT_COMPONENT, "Port component"},
+ { CFM_CHASSIS_ID_MAC_ADDRESS, "MAC address"},
+ { CFM_CHASSIS_ID_NETWORK_ADDRESS, "Network address"},
+ { CFM_CHASSIS_ID_INTERFACE_NAME, "Interface name"},
+ { CFM_CHASSIS_ID_LOCAL, "Locally assigned"},
+ { 0, NULL}
+};
+
+
+int
+cfm_mgmt_addr_print(register const u_char *tptr) {
+
+ u_int mgmt_addr_type;
+ u_int hexdump = FALSE;
+
+ /*
+ * Altough AFIs are tpically 2 octects wide,
+ * 802.1ab specifies that this field width
+ * is only once octet
+ */
+ mgmt_addr_type = *tptr;
+ printf("\n\t Management Address Type %s (%u)",
+ tok2str(af_values, "Unknown", mgmt_addr_type),
+ mgmt_addr_type);
+
+ /*
+ * Resolve the passed in Address.
+ */
+ switch(mgmt_addr_type) {
+ case AFNUM_INET:
+ printf(", %s", ipaddr_string(tptr + 1));
+ break;
+
+ case AFNUM_INET6:
+ printf(", %s", ip6addr_string(tptr + 1));
+ break;
+
+ default:
+ hexdump = TRUE;
+ break;
+ }
+
+ return hexdump;
+}
+
+/*
+ * The egress-ID string is a 16-Bit string plus a MAC address.
+ */
+const char *
+cfm_egress_id_string(register const u_char *tptr) {
+ static char egress_id_buffer[80];
+
+ snprintf(egress_id_buffer, sizeof(egress_id_buffer),
+ "MAC %0x4x-%s",
+ EXTRACT_16BITS(tptr),
+ etheraddr_string(tptr+2));
+
+ return egress_id_buffer;
+}
+