tcpdump  4.99.1
About: tcpdump is a tool for network monitoring and data acquisition.
  Fossies Dox: tcpdump-4.99.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

print-cfm.c File Reference
#include "netdissect-stdinc.h"
#include "netdissect.h"
#include "extract.h"
#include "addrtoname.h"
#include "oui.h"
#include "af.h"
Include dependency graph for print-cfm.c:

Go to the source code of this file.

Data Structures

struct  cfm_common_header_t
 
struct  cfm_ccm_t
 
struct  cfm_lbm_t
 
struct  cfm_ltm_t
 
struct  cfm_ltr_t
 
struct  cfm_tlv_header_t
 

Macros

#define CFM_VERSION   0
 
#define CFM_EXTRACT_VERSION(x)   ((x)&0x1f)
 
#define CFM_EXTRACT_MD_LEVEL(x)   (((x)&0xe0)>>5)
 
#define CFM_OPCODE_CCM   1
 
#define CFM_OPCODE_LBR   2
 
#define CFM_OPCODE_LBM   3
 
#define CFM_OPCODE_LTR   4
 
#define CFM_OPCODE_LTM   5
 
#define CCM_INTERVAL_MIN_MULTIPLIER   3.25
 
#define CCM_INTERVAL_MAX_MULTIPLIER   3.5
 
#define CFM_CCM_RDI_FLAG   0x80
 
#define CFM_EXTRACT_CCM_INTERVAL(x)   ((x)&0x07)
 
#define CFM_CCM_MD_FORMAT_8021   0
 
#define CFM_CCM_MD_FORMAT_NONE   1
 
#define CFM_CCM_MD_FORMAT_DNS   2
 
#define CFM_CCM_MD_FORMAT_MAC   3
 
#define CFM_CCM_MD_FORMAT_CHAR   4
 
#define CFM_CCM_MA_FORMAT_8021   0
 
#define CFM_CCM_MA_FORMAT_VID   1
 
#define CFM_CCM_MA_FORMAT_CHAR   2
 
#define CFM_CCM_MA_FORMAT_INT   3
 
#define CFM_CCM_MA_FORMAT_VPN   4
 
#define CFM_TLV_END   0
 
#define CFM_TLV_SENDER_ID   1
 
#define CFM_TLV_PORT_STATUS   2
 
#define CFM_TLV_INTERFACE_STATUS   3
 
#define CFM_TLV_DATA   4
 
#define CFM_TLV_REPLY_INGRESS   5
 
#define CFM_TLV_REPLY_EGRESS   6
 
#define CFM_TLV_PRIVATE   31
 
#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
 

Functions

static int cfm_network_addr_print (netdissect_options *ndo, const u_char *tptr, const u_int length)
 
void cfm_print (netdissect_options *ndo, const u_char *pptr, u_int length)
 

Variables

static const struct tok cfm_opcode_values []
 
static const float ccm_interval_base [8] = {0.0f, 0.003333f, 0.01f, 0.1f, 1.0f, 10.0f, 60.0f, 600.0f}
 
static const struct tok cfm_md_nameformat_values []
 
static const struct tok cfm_ma_nameformat_values []
 
static const struct tok cfm_ltm_flag_values []
 
static const struct tok cfm_ltr_flag_values []
 
static const struct tok cfm_ltr_replay_action_values []
 
static const struct tok cfm_tlv_values []
 
static const struct tok cfm_tlv_port_status_values []
 
static const struct tok cfm_tlv_interface_status_values []
 
static const struct tok cfm_tlv_senderid_chassisid_values []
 

Macro Definition Documentation

◆ CCM_INTERVAL_MAX_MULTIPLIER

#define CCM_INTERVAL_MAX_MULTIPLIER   3.5

Definition at line 75 of file print-cfm.c.

◆ CCM_INTERVAL_MIN_MULTIPLIER

#define CCM_INTERVAL_MIN_MULTIPLIER   3.25

Definition at line 74 of file print-cfm.c.

◆ CFM_CCM_MA_FORMAT_8021

#define CFM_CCM_MA_FORMAT_8021   0

Definition at line 95 of file print-cfm.c.

◆ CFM_CCM_MA_FORMAT_CHAR

#define CFM_CCM_MA_FORMAT_CHAR   2

Definition at line 97 of file print-cfm.c.

◆ CFM_CCM_MA_FORMAT_INT

#define CFM_CCM_MA_FORMAT_INT   3

Definition at line 98 of file print-cfm.c.

◆ CFM_CCM_MA_FORMAT_VID

#define CFM_CCM_MA_FORMAT_VID   1

Definition at line 96 of file print-cfm.c.

◆ CFM_CCM_MA_FORMAT_VPN

#define CFM_CCM_MA_FORMAT_VPN   4

Definition at line 99 of file print-cfm.c.

◆ CFM_CCM_MD_FORMAT_8021

#define CFM_CCM_MD_FORMAT_8021   0

Definition at line 80 of file print-cfm.c.

◆ CFM_CCM_MD_FORMAT_CHAR

#define CFM_CCM_MD_FORMAT_CHAR   4

Definition at line 84 of file print-cfm.c.

◆ CFM_CCM_MD_FORMAT_DNS

#define CFM_CCM_MD_FORMAT_DNS   2

Definition at line 82 of file print-cfm.c.

◆ CFM_CCM_MD_FORMAT_MAC

#define CFM_CCM_MD_FORMAT_MAC   3

Definition at line 83 of file print-cfm.c.

◆ CFM_CCM_MD_FORMAT_NONE

#define CFM_CCM_MD_FORMAT_NONE   1

Definition at line 81 of file print-cfm.c.

◆ CFM_CCM_RDI_FLAG

#define CFM_CCM_RDI_FLAG   0x80

Definition at line 77 of file print-cfm.c.

◆ CFM_CHASSIS_ID_CHASSIS_COMPONENT

#define CFM_CHASSIS_ID_CHASSIS_COMPONENT   1

Definition at line 195 of file print-cfm.c.

◆ CFM_CHASSIS_ID_INTERFACE_ALIAS

#define CFM_CHASSIS_ID_INTERFACE_ALIAS   2

Definition at line 196 of file print-cfm.c.

◆ CFM_CHASSIS_ID_INTERFACE_NAME

#define CFM_CHASSIS_ID_INTERFACE_NAME   6

Definition at line 200 of file print-cfm.c.

◆ CFM_CHASSIS_ID_LOCAL

#define CFM_CHASSIS_ID_LOCAL   7

Definition at line 201 of file print-cfm.c.

◆ CFM_CHASSIS_ID_MAC_ADDRESS

#define CFM_CHASSIS_ID_MAC_ADDRESS   4

Definition at line 198 of file print-cfm.c.

◆ CFM_CHASSIS_ID_NETWORK_ADDRESS

#define CFM_CHASSIS_ID_NETWORK_ADDRESS   5

Definition at line 199 of file print-cfm.c.

◆ CFM_CHASSIS_ID_PORT_COMPONENT

#define CFM_CHASSIS_ID_PORT_COMPONENT   3

Definition at line 197 of file print-cfm.c.

◆ CFM_EXTRACT_CCM_INTERVAL

#define CFM_EXTRACT_CCM_INTERVAL (   x)    ((x)&0x07)

Definition at line 78 of file print-cfm.c.

◆ CFM_EXTRACT_MD_LEVEL

#define CFM_EXTRACT_MD_LEVEL (   x)    (((x)&0xe0)>>5)

Definition at line 42 of file print-cfm.c.

◆ CFM_EXTRACT_VERSION

#define CFM_EXTRACT_VERSION (   x)    ((x)&0x1f)

Definition at line 41 of file print-cfm.c.

◆ CFM_OPCODE_CCM

#define CFM_OPCODE_CCM   1

Definition at line 44 of file print-cfm.c.

◆ CFM_OPCODE_LBM

#define CFM_OPCODE_LBM   3

Definition at line 46 of file print-cfm.c.

◆ CFM_OPCODE_LBR

#define CFM_OPCODE_LBR   2

Definition at line 45 of file print-cfm.c.

◆ CFM_OPCODE_LTM

#define CFM_OPCODE_LTM   5

Definition at line 48 of file print-cfm.c.

◆ CFM_OPCODE_LTR

#define CFM_OPCODE_LTR   4

Definition at line 47 of file print-cfm.c.

◆ CFM_TLV_DATA

#define CFM_TLV_DATA   4

Definition at line 151 of file print-cfm.c.

◆ CFM_TLV_END

#define CFM_TLV_END   0

Definition at line 147 of file print-cfm.c.

◆ CFM_TLV_INTERFACE_STATUS

#define CFM_TLV_INTERFACE_STATUS   3

Definition at line 150 of file print-cfm.c.

◆ CFM_TLV_PORT_STATUS

#define CFM_TLV_PORT_STATUS   2

Definition at line 149 of file print-cfm.c.

◆ CFM_TLV_PRIVATE

#define CFM_TLV_PRIVATE   31

Definition at line 154 of file print-cfm.c.

◆ CFM_TLV_REPLY_EGRESS

#define CFM_TLV_REPLY_EGRESS   6

Definition at line 153 of file print-cfm.c.

◆ CFM_TLV_REPLY_INGRESS

#define CFM_TLV_REPLY_INGRESS   5

Definition at line 152 of file print-cfm.c.

◆ CFM_TLV_SENDER_ID

#define CFM_TLV_SENDER_ID   1

Definition at line 148 of file print-cfm.c.

◆ CFM_VERSION

#define CFM_VERSION   0

Definition at line 40 of file print-cfm.c.

Function Documentation

◆ cfm_network_addr_print()

static int cfm_network_addr_print ( netdissect_options ndo,
const u_char *  tptr,
const u_int  length 
)
static

Definition at line 217 of file print-cfm.c.

References af_values, AFNUM_INET, AFNUM_INET6, FALSE, GET_IP6ADDR_STRING, GET_IPADDR_STRING, GET_U_1, ND_PRINT, tok2str(), and TRUE.

Referenced by cfm_print().

◆ cfm_print()

void cfm_print ( netdissect_options ndo,
const u_char *  pptr,
u_int  length 
)

Definition at line 269 of file print-cfm.c.

References bittok2str(), ccm_interval_base, CCM_INTERVAL_MAX_MULTIPLIER, CCM_INTERVAL_MIN_MULTIPLIER, CFM_CCM_MA_FORMAT_8021, CFM_CCM_MA_FORMAT_CHAR, CFM_CCM_MA_FORMAT_INT, CFM_CCM_MA_FORMAT_VID, CFM_CCM_MA_FORMAT_VPN, CFM_CCM_MD_FORMAT_CHAR, CFM_CCM_MD_FORMAT_DNS, CFM_CCM_MD_FORMAT_MAC, CFM_CCM_MD_FORMAT_NONE, CFM_CCM_RDI_FLAG, CFM_CHASSIS_ID_CHASSIS_COMPONENT, CFM_CHASSIS_ID_INTERFACE_ALIAS, CFM_CHASSIS_ID_INTERFACE_NAME, CFM_CHASSIS_ID_LOCAL, CFM_CHASSIS_ID_MAC_ADDRESS, CFM_CHASSIS_ID_NETWORK_ADDRESS, CFM_CHASSIS_ID_PORT_COMPONENT, CFM_EXTRACT_CCM_INTERVAL, CFM_EXTRACT_MD_LEVEL, CFM_EXTRACT_VERSION, cfm_ltm_flag_values, cfm_ltr_flag_values, cfm_ltr_replay_action_values, cfm_ma_nameformat_values, cfm_md_nameformat_values, cfm_network_addr_print(), CFM_OPCODE_CCM, CFM_OPCODE_LBM, CFM_OPCODE_LBR, CFM_OPCODE_LTM, CFM_OPCODE_LTR, cfm_opcode_values, CFM_TLV_DATA, CFM_TLV_END, CFM_TLV_INTERFACE_STATUS, cfm_tlv_interface_status_values, CFM_TLV_PORT_STATUS, cfm_tlv_port_status_values, CFM_TLV_PRIVATE, CFM_TLV_REPLY_EGRESS, CFM_TLV_REPLY_INGRESS, CFM_TLV_SENDER_ID, cfm_tlv_senderid_chassisid_values, cfm_tlv_values, CFM_VERSION, FALSE, cfm_common_header_t::first_tlv_offset, cfm_common_header_t::flags, GET_BE_U_2, GET_BE_U_3, GET_BE_U_4, GET_ETHERADDR_STRING, GET_U_1, hex_print(), cfm_tlv_header_t::length, MAC_ADDR_LEN, cfm_common_header_t::mdlevel_version, ND_PRINT, nd_print_trunc(), nd_printjnp(), ND_TCHECK_LEN, ND_TCHECK_SIZE, netdissect_options::ndo_protocol, netdissect_options::ndo_vflag, cfm_common_header_t::opcode, opcode, oui_values, print_unknown_data(), tok2str(), TRUE, and cfm_tlv_header_t::type.

Referenced by ethertype_print().

Variable Documentation

◆ ccm_interval_base

const float ccm_interval_base[8] = {0.0f, 0.003333f, 0.01f, 0.1f, 1.0f, 10.0f, 60.0f, 600.0f}
static

Definition at line 73 of file print-cfm.c.

Referenced by cfm_print().

◆ cfm_ltm_flag_values

const struct tok cfm_ltm_flag_values[]
static
Initial value:
= {
{ 0x80, "Use Forwarding-DB only"},
{ 0, NULL}
}

Definition at line 73 of file print-cfm.c.

Referenced by cfm_print().

◆ cfm_ltr_flag_values

const struct tok cfm_ltr_flag_values[]
static
Initial value:
= {
{ 0x80, "UseFDB Only"},
{ 0x40, "FwdYes"},
{ 0x20, "Terminal MEP"},
{ 0, NULL}
}

Definition at line 73 of file print-cfm.c.

Referenced by cfm_print().

◆ cfm_ltr_replay_action_values

const struct tok cfm_ltr_replay_action_values[]
static
Initial value:
= {
{ 1, "Exact Match"},
{ 2, "Filtering DB"},
{ 3, "MIP CCM DB"},
{ 0, NULL}
}

Definition at line 73 of file print-cfm.c.

Referenced by cfm_print().

◆ cfm_ma_nameformat_values

const struct tok cfm_ma_nameformat_values[]
static
Initial value:
= {
{ 0 , "IEEE 802.1"},
{ 1 , "Primary VID"},
{ 2 , "Character string"},
{ 3 , "16Bit Integer"},
{ 4 , "RFC2685 VPN-ID"},
{ 0, NULL}
}

Definition at line 73 of file print-cfm.c.

Referenced by cfm_print().

◆ cfm_md_nameformat_values

const struct tok cfm_md_nameformat_values[]
static
Initial value:
= {
{ 0 , "IEEE 802.1"},
{ 1 , "No MD Name present"},
{ 2 , "DNS string"},
{ 3 , "MAC + 16Bit Integer"},
{ 4 , "Character string"},
{ 0, NULL}
}

Definition at line 73 of file print-cfm.c.

Referenced by cfm_print().

◆ cfm_opcode_values

const struct tok cfm_opcode_values[]
static
Initial value:
= {
{ 1 , "Continuity Check Message"},
{ 2 , "Loopback Reply"},
{ 3 , "Loopback Message"},
{ 4 , "Linktrace Reply"},
{ 5 , "Linktrace Message"},
{ 0, NULL}
}

Definition at line 1 of file print-cfm.c.

Referenced by cfm_print().

◆ cfm_tlv_interface_status_values

const struct tok cfm_tlv_interface_status_values[]
static
Initial value:
= {
{ 1, "Up"},
{ 2, "Down"},
{ 3, "Testing"},
{ 5, "Dormant"},
{ 6, "not present"},
{ 7, "lower Layer down"},
{ 0, NULL}
}

Definition at line 73 of file print-cfm.c.

Referenced by cfm_print().

◆ cfm_tlv_port_status_values

const struct tok cfm_tlv_port_status_values[]
static
Initial value:
= {
{ 1, "Blocked"},
{ 2, "Up"},
{ 0, NULL}
}

Definition at line 73 of file print-cfm.c.

Referenced by cfm_print().

◆ cfm_tlv_senderid_chassisid_values

const struct tok cfm_tlv_senderid_chassisid_values[]
static
Initial value:
= {
{ 0, "Reserved"},
{ 1 , "Chassis component"},
{ 2 , "Interface alias"},
{ 3 , "Port component"},
{ 4 , "MAC address"},
{ 5 , "Network address"},
{ 6 , "Interface name"},
{ 7 , "Locally assigned"},
{ 0, NULL}
}

Definition at line 73 of file print-cfm.c.

Referenced by cfm_print().

◆ cfm_tlv_values

const struct tok cfm_tlv_values[]
static
Initial value:
= {
{ 0 , "End"},
{ 1 , "Sender ID"},
{ 2 , "Port status"},
{ 3 , "Interface status"},
{ 4 , "Data"},
{ 5 , "Reply Ingress"},
{ 6 , "Reply Egress"},
{ 31 , "Organization Specific"},
{ 0, NULL}
}

Definition at line 73 of file print-cfm.c.

Referenced by cfm_print().