📄 mpls_encdec_02.c
字号:
u_char value[MPLS_VCIFPARAMMAXLEN]; } mplsLdpMartiniInterfaceParams_t; typedef struct mplsLdMartiniVcFlag_s { BITFIELDS_ASCENDING_4( u_int type:8, u_int control:1, /* C bit */ u_int vcType:15, /* VC type */ u_int vcInfoLen:8); } mplsLdMartiniVcFlag_t; typedef struct mplsLdpMartiniVcFec_s { union { struct mplsLdMartiniVcFlag_s flags; u_int mark; } flags; u_int groupId; u_int vcId; struct mplsLdpMartiniInterfaceParams_s vcIfParams[5]; int vcIfParamsLen; } mplsLdpMartiniVcFec_t;/*********************************************************************** FEC Tlv encoding 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |U|F| FEC (0x0100) | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | FEC Element 1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | ~ ~ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | FEC Element n | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+***********************************************************************/ typedef union mplsFecElement_u { struct mplsLdpAddressFec_s addressEl; /* prefix | host adr */ struct mplsLdpWildFec_s wildcardEl; /* for wilcard fec */ struct mplsLdpCrlspFec_s crlspEl; /* CRLSP fec elem */ struct mplsLdpMartiniVcFec_s martiniVcEl; /* Martini VC fec elem */ } mplsFecElement_t; typedef struct mplsLdpFecTlv_s { struct mplsLdpTlv_s baseTlv; union mplsFecElement_u fecElArray[MPLS_MAXNUMFECELEMENT]; u_short fecElemTypes[MPLS_MAXNUMFECELEMENT]; u_char wcElemExists:1; u_short numberFecElements; } mplsLdpFecTlv_t;/*********************************************************************** Generic Label Tlv encoding 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |U|F| Generic Label (0x0200) | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Label | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+***********************************************************************/ typedef struct mplsLdpGenLblTlv_s { struct mplsLdpTlv_s baseTlv; u_int label; /* 20-bit number in 4 octet field */ } mplsLdpGenLblTlv_t;/*********************************************************************** Atm Label Tlv encoding 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |U|F| ATM Label (0x0201) | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Res| V | VPI | VCI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+***********************************************************************/ typedef struct mplsLdpAtmLblFlag_s { BITFIELDS_ASCENDING_3( u_short res:2, u_short v :2, u_short vpi:12 ) } mplsLdpAtmLblFlag_t; typedef struct mplsLdpAtmLblTlv_s { struct mplsLdpTlv_s baseTlv; union { struct mplsLdpAtmLblFlag_s flags; u_short mark; } flags; u_short vci; } mplsLdpAtmLblTlv_t;/*********************************************************************** Frame Relay Label Tlv encoding 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |U|F| Frame Relay Label (0x0202)| Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved |Len| DLCI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+***********************************************************************/ typedef struct mplsLdpFrLblFlag_s { BITFIELDS_ASCENDING_3( u_int res :7, u_int len :2, u_int dlci:23 ) } mplsLdpFrLblFlag_t; typedef struct mplsLdpFrLblTlv_s { struct mplsLdpTlv_s baseTlv; union { struct mplsLdpFrLblFlag_s flags; u_int mark; } flags; } mplsLdpFrLblTlv_t;/*********************************************************************** Hop Count Tlv encoding 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |U|F| Hop Count (0x0103) | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | HC Value | +-+-+-+-+-+-+-+-+***********************************************************************/ typedef struct mplsLdpHopTlv_s { struct mplsLdpTlv_s baseTlv; u_char hcValue; /* hop count value */ } mplsLdpHopTlv_t;/*********************************************************************** Path Vector Tlv encoding 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |U|F| Path Vector (0x0104) | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LSR Id 1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | ~ ~ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LSR Id n | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+***********************************************************************/ typedef struct mplsLdpPathTlv_s { struct mplsLdpTlv_s baseTlv; u_int lsrId[MPLS_MAXHOPSNUMBER]; } mplsLdpPathTlv_t;/*********************************************************************** Lbl request message id Tlv encoding***********************************************************************/ typedef struct mplsLdpLblMsgIdTlv_s { struct mplsLdpTlv_s baseTlv; u_int msgId; } mplsLdpLblMsgIdTlv_t;/*********************************************************************** Preemption Tlv encoding 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |U|F| Preemption-TLV (0x0820) | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SetPrio | HoldPrio | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+***********************************************************************/ typedef struct mplsLdpPreemptTlv_s { struct mplsLdpTlv_s baseTlv; u_char setPrio; /* 0 => most important path */ u_char holdPrio; /* 0 => most important path */ u_short res; } mplsLdpPreemptTlv_t;/*********************************************************************** Resource class Tlv encoding 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |U|F| ResCls-TLV (0x0822) | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RsCls | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+***********************************************************************/ typedef struct mplsLdpResClsTlv_s { struct mplsLdpTlv_s baseTlv; u_int rsCls; /* resource class bit mask */ } mplsLdpResClsTlv_t;/*********************************************************************** Lbl return message id Tlv encoding***********************************************************************/ typedef struct mplsLdpRetMsgIdTlv_s { struct mplsLdpTlv_s baseTlv; } mplsLdpLblRetMsgIdTlv_t;/*********************************************************************** ER flag structure which is common to IPV4 and IPV6 ER TLV***********************************************************************/ typedef struct mplsLdpErIPFlag_s { BITFIELDS_ASCENDING_3( u_int l :1 , /* 0 => loose hop */ u_int res :23, u_int preLen:8 ) } mplsLdpErIPFlag_t;/*********************************************************************** ER flag structure which is common to AS and LSPID ER TLV***********************************************************************/ typedef struct mplsLdpErFlag_s { BITFIELDS_ASCENDING_2( u_short l :1 , /* 0 => loose hop */ u_short res :15 ) } mplsLdpErFlag_t;/*********************************************************************** Explicit Routing IPv4 Tlv encoding 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |U|F| 0x801 | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |L| Reserved | PreLen | +-+-+-+-+-+-+-+-+
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -