⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ldp_nortel.h

📁 实现了MPLS中的标签分发协议(LDP 3036 )的基本功能
💻 H
📖 第 1 页 / 共 5 页
字号:
#define MPLS_ERHOP_AS_TLVTYPE    0x803 /* explicit routing autonomous                                          system number tlv           */#define MPLS_ERHOP_LSPID_TLVTYPE 0x804 /* explicit routing lspid tlv  */#define MPLS_ERHOP_IPV4_FIXLEN   8 /* fix length in bytes         */#define MPLS_ERHOP_IPV6_FIXLEN   20 /* fix length in bytes         */#define MPLS_ERHOP_AS_FIXLEN     4 /* fix length in bytes         */#define MPLS_ERHOP_LSPID_FIXLEN  8 /* fix length in bytes         */#define MPLS_IPV6ADRLENGTH       16#define MPLS_MAX_ER_HOPS         20 /* decent number of hops;                                        change if required          */#define MPLS_PREEMPTTLV_FIXLEN   4 /* setPrio + holdPrio + res    */#define MPLS_LSPIDTLV_FIXLEN     8 /* res + crlspId + routerId    */#define MPLS_TRAFFICPARAMLENGTH  4 /* traffic parameters length   *//* for label abort request message */#define MPLS_LBLABORT_MSGTYPE 0x0404 /* label abort request msg     *//* * Error codes */#define MPLS_ENC_BUFFTOOSMALL    -1#define MPLS_DEC_BUFFTOOSMALL    -2#define MPLS_ENC_TLVERROR        -3#define MPLS_DEC_TLVERROR        -4#define MPLS_ENC_ATMLBLERROR     -5#define MPLS_DEC_ATMLBLERROR     -6#define MPLS_ENC_BASEMSGERROR    -7#define MPLS_DEC_BASEMSGERROR    -8#define MPLS_ENC_CSPERROR        -9#define MPLS_DEC_CSPERROR        -10#define MPLS_ENC_ASPERROR        -11#define MPLS_DEC_ASPERROR        -12#define MPLS_ENC_FSPERROR        -13#define MPLS_DEC_FSPERROR        -14#define MPLS_ENC_STATUSERROR     -16#define MPLS_DEC_STATUSERROR     -17#define MPLS_ENC_EXSTATERROR     -18#define MPLS_DEC_EXSTATERROR     -19#define MPLS_ENC_RETPDUERROR     -20#define MPLS_DEC_RETPDUERROR     -21#define MPLS_ENC_RETMSGERROR     -22#define MPLS_DEC_RETMSGERROR     -23#define MPLS_PDU_LENGTH_ERROR    -24#define MPLS_ENC_CHPERROR        -25#define MPLS_DEC_CHPERROR        -26#define MPLS_ENC_CSNERROR        -27#define MPLS_DEC_CSNERROR        -28#define MPLS_ENC_TRADRERROR      -29#define MPLS_DEC_TRADRERROR      -30#define MPLS_ENC_ADRLISTERROR    -31#define MPLS_DEC_ADRLISTERROR    -32#define MPLS_WC_FECERROR         -33#define MPLS_PATHVECTORERROR     -34#define MPLS_ENC_FECERROR        -35#define MPLS_DEC_FECERROR        -36#define MPLS_ENC_GENLBLERROR     -37#define MPLS_DEC_GENLBLERROR     -38#define MPLS_ENC_MAPATMERROR     -39#define MPLS_DEC_MAPATMERROR     -40#define MPLS_ENC_FRLBLERROR      -41#define MPLS_DEC_FRLBLERROR      -42#define MPLS_ENC_COSERROR        -43#define MPLS_DEC_COSERROR        -44#define MPLS_ENC_HOPCOUNTERROR   -45#define MPLS_DEC_HOPCOUNTERROR   -46#define MPLS_ENC_PATHVECERROR    -47#define MPLS_DEC_PATHVECERROR    -48#define MPLS_ENC_LBLMSGIDERROR   -49#define MPLS_DEC_LBLMSGIDERROR   -50#define MPLS_ENC_HDRTLVERROR     -51#define MPLS_DEC_HDRTLVERROR     -52#define MPLS_ENC_FECELEMERROR    -53#define MPLS_DEC_FECELEMERROR    -54#define MPLS_ENC_FSPLBLERROR     -55#define MPLS_DEC_FSPLBLERROR     -56#define MPLS_ENC_ERHOPERROR      -57#define MPLS_DEC_ERHOPERROR      -58#define MPLS_ENC_ERTLVERROR      -59#define MPLS_DEC_ERTLVERROR      -60#define MPLS_ENC_ERHOPLENERROR   -61#define MPLS_DEC_ERHOPLENERROR   -62#define MPLS_TLVTYPEERROR        -63#define MPLS_MSGTYPEERROR        -64#define MPLS_FECERROR            -65#define MPLS_ENC_TRAFFICERROR    -66#define MPLS_DEC_TRAFFICERROR    -67#define MPLS_ENC_LSPIDERROR      -68#define MPLS_DEC_LSPIDERROR      -69#define MPLS_ENC_RESCLSERROR     -70#define MPLS_DEC_RESCLSERROR     -71#define MPLS_ENC_PREEMPTERROR    -72#define MPLS_DEC_PREEMPTERROR    -73#define MPLS_ENC_PINNINGERROR    -74#define MPLS_DEC_PINNINGERROR    -75#define MPLS_FLOATTYPEERROR      -76#define MPLS_FECTLVERROR         -77#define MPLS_IPV4LENGTHERROR     -78#define MPLS_ER_HOPSNUMERROR     -79/**********************************************************************   LDP header      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   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |  Version                      |         PDU Length            |   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |                         LDP Identifier                        |   +                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |                               |   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+**********************************************************************/typedef struct mplsLdpHeader_s {  u_short protocolVersion;  u_short pduLength;            /* length excluding the version and length */  u_int lsrAddress;             /* IP address assigned to LSR              */  u_short labelSpace;           /* within LSR                              */} mplsLdpHeader_t;/**********************************************************************   LDP Messages (All LDP messages have the following format:)    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|   Message Type              |      Message Length           |   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |                     Message ID                                |   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |                                                               |   +                                                               +   |                     Mandatory Parameters                      |   +                                                               +   |                                                               |   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |                                                               |   +                                                               +   |                     Optional Parameters                       |   +                                                               +   |                                                               |   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Note: the U flag is ignored for now. There is not check for its value.**********************************************************************/typedef struct mplsLdpMsgFlag_s {  BITFIELDS_ASCENDING_2(u_short uBit:1, u_short msgType:15)} mplsLdpMsgFlag_t;typedef struct mplsLdpMsg_s {  union {    struct mplsLdpMsgFlag_s flags;    u_short mark;  } flags;  u_short msgLength;            /* msgId + mandatory param + optional param */  u_int msgId;                  /* used to identify the notification msg    */} mplsLdpMsg_t;typedef struct mplsLdpUnknownMsg_s {  struct mplsLdpMsg_s baseMsg;  u_char data[MPLS_NOT_MAXSIZE];} mplsLdpUnknownMsg_t;/**********************************************************************   Type-Length-Value 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|        Type               |            Length             |   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |                                                               |   |                             Value                             |   ~                                                               ~   |                                                               |   |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |                               |   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Note: the decode functions for tlv do not check the values for      F flag. They check only the value of the U flag; if      it is set will ignore the tlv and keep processing the message;      otherwise will ignore the message and return error. Please note       that the unknown tlv which is skipped will not be stored anywhere.**********************************************************************/typedef struct mplsLdpTlvFlag_s {  BITFIELDS_ASCENDING_3(u_short uBit:1, u_short fBit:1, u_short tBit:14)} mplsLdpTlvFlag_t;typedef struct mplsLdpTlv_s {  union {    struct mplsLdpTlvFlag_s flags;    u_short mark;  } flags;  u_short length;               /* length of the value field */} mplsLdpTlv_t;/**********************************************************************  Common Session Parameters TLV        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| Common Sess Parms (0x0500)|      Length                   |       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+       | Protocol Version              |      Keep Alive Time          |       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+       |A|D| Reserved  |     PVLim     |      Max PDU Length           |       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+       |                 Receiver LDP Identifer                        |       +                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+       |                               |       -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++***********************************************************************/typedef struct mplsLdpCspFlag_s {  BITFIELDS_ASCENDING_4(u_short lad:1, /* 1 = downstream on demand  */    u_short ld:1,               /* loop detection            */    u_short res:6,              /* reserved                  */    u_short pvl:8               /* path vec limit            */    )} mplsLdpCspFlag_t;typedef struct mplsLdpCspTlv_s {  struct mplsLdpTlv_s baseTlv;  u_short protocolVersion;  u_short holdTime;             /* proposed keep alive interval */  union {    struct mplsLdpCspFlag_s flags;    u_short mark;  } flags;  u_short maxPduLen;  u_int rcvLsrAddress;  u_short rcvLsId;} mplsLdpCspTlv_t;/***********************************************************************    ATM Label Range Component     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     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+     |  Res  |    Minimum VPI        |      Minimum VCI              |     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+     |  Res  |    Maximum VPI        |      Maximum VCI              |     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+***********************************************************************/typedef struct mplsLdpAtmLblRngFlag_s {  BITFIELDS_ASCENDING_3(u_int res1:4, /* reserved : 0 on transmision */    u_int minVpi:12,            /* if <12 bits right justified */    u_int minVci:16             /* if <16 bits right justified */    )  BITFIELDS_ASCENDING_3(u_int res2:4, /* reserved : 0 on transmision */    u_int maxVpi:12,            /* if <12 bits right justified */    u_int maxVci:16             /* if <16 bits right justified */    )} mplsLdpAtmLblRngFlag_t;typedef struct mplsLdpAtmLblRng_s {  union {    struct mplsLdpAtmLblRngFlag_s flags;    u_int mark[2];  } flags;} mplsLdpAtmLblRng_t;/***********************************************************************  Flags for ATM Session Parameters TLV and 	   Frame Relay Session Parameters TLV Note: both types of session parameters have the same type of flags;       use then the same struct***********************************************************************/typedef struct mplsLdpSPFlag_s {  BITFIELDS_ASCENDING_4(u_int mergeType:2, /* merge typ            */    u_int numLblRng:4,          /* # of label range com */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -