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

📄 zl5011xpacketrxtemplates.h

📁 Zalink50114----TDMoIP芯片驱动源码
💻 H
📖 第 1 页 / 共 5 页
字号:
*                          ZL5011X_IP_UDP_PW
*                          ZL5011X_IP_UDP_CD
*                          ZL5011X_IP_UDP_RTP_PW / ZL5011X_IP_UDP_RTCP_CTRL
*                          ZL5011X_IP_UDP_L2TPV2_PW / ZL5011X_IP_UDP_L2TPV2_CTRL
*
*                       With more knowledge of the target system, it would be possible to overcome
*                       these limitations, by using UDP port ranges in the protocol detection.
*                       It is relatively simple to add this functionality to the templates presented
*                       below, by adjusting the protocol mask to include some of the bits in the
*                       UDP ports. For each protocol, the UDP header is identified in the protocolMaskBytes
*                       initialiser values. To provide a range of 256 destination ports for each protocol,
*                       simply change the 3rd byte in the UDP header to 0. This will match the upper
*                       8 bits of the UDP dest port in classification. The function zl5011xPacketRxSetProtocolFunc
*                       handles this mutual exclusion and will need to be modified to now allow the
*                       conflicting protocols to be configured. The switch statement a few lines after
*                       the function call zl5011xLanRxSetProtocolMatch is used to update protocols that are
*                       excluded by setting the current protocol. Simply removing all of the IP_UDP protocol
*                       switch statements will allow the default behaviour and hence allow the protocols to
*                       interoperate. A similare change is needed to function zl5011xPacketRxDeleteHeader
*                       if it is required to remove a protocol.
*
*     ETHERNET          If used, this should always occupy the highest numbered (lowest priority) of any
*                       protocol match(es) used as it is intended as a catch-all for packets that do not
*                       match anyother protocol match.
*                       If matchDestMacAddress is set then only packets destined for a particular MAC
*                       will match. Otherwise any Ethernet packet will match this protocol.
*
****************************************************************************/

/* Structure array for IPv4 Protocol stacks. */
zl5011xPacketRxTemplateS zl5011xPacketRxTemplatesIPv4[] =
{
/****************************************************************************/
/* protocol ZL5011X_CD fields */
/****************************************************************************/
   {
      /* protocol Mask bytes */
      {
         /* ethernet header */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /*  0 to  7 */
         0xff, 0xff, 0xff, 0xff,    0x00, 0x00,                /*  8 to 13 */

         /* CD header */
                                                0xff, 0xff,    /* 14 to 15 */

         /* END OF PROTOCOL HEADER */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 16 to 23 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 24 to 31 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 32 to 39 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 40 to 47 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 48 to 55 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff },  /* 56 to 63 */

      /* extract classify bytes */
      {    0,    0,    0,    0,        0,    0,    0,    0,        0,    0,    0,    0 },
      /* classify mask */
      { 0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff, 0xff },

      /* VLAN classify positions - which of the extract classify bytes to use */
      {   10, 11 },

      /* CD classify positions - which of the extract classify bytes to use */
      {    0,    1 },

      /* extract check bytes */
      {    0,    0,    0,    0,        0,    0,    0,    0,        0,    0,    0 },
      /* check mask */
      { 0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff },

      /* VLAN check positions - which of the extract check bytes to use */
      { 0xff, 0xff },

      /* L2TPv3 Cookie check positions */
      { 0xff, 0xff, 0xff, 0xff },

      /* PW byte position */
      0,

      /* extract seq bytes */
      {  0,  0 },

      /* extract timestamp bytes */
      {  0,  0,  0,  0 },

      /* extract length bytes */
      {  0,  0 },

      /* timestamp shift */
      0,

      /* seq number length 2 bytes */
      ZL5011X_TRUE,

      /* length modifier */
      0,

      /* length no calc */
      ZL5011X_TRUE,

      /* two byte length */
      ZL5011X_TRUE
   },

/****************************************************************************/
/* protocol ZL5011X_PW fields */
/****************************************************************************/
   {
      /* protocol Mask bytes */
      {
         /* ethernet header */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /*  0 to  7 */
         0xff, 0xff, 0xff, 0xff,    0x00, 0x00,                /*  8 to 13 */

         /* pseudo wire header */
                                                0xff, 0xff,    /* 14 to 15 */
         0xff, 0xff,                                           /* 16 to 17 */

         /* Remaining header unused */
                     0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 18 to 23 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 24 to 31 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 32 to 39 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 40 to 47 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 48 to 55 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff },  /* 56 to 63 */

      /* extract classify bytes */
      {    0,    0,    0,    0,        0,    0,    0,    0,        0,    0,    0,    0 },
      /* classify mask */
      { 0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff, 0xff },

      /* VLAN classify positions - which of the extract classify bytes to use */
      { 10, 11 },

      /* CD classify positions - which of the extract classify bytes to use */
      { 0xff, 0xff },

      /* extract check bytes */
      {   14,    0,    0,    0,        0,    0,    0,    0,        0,    0,    0 },
      /* check mask */
      { 0x0f, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff },

      /* VLAN check positions - which of the extract check bytes to use */
      { 0xff, 0xff },

      /* L2TPv3 Cookie check positions */
      { 0xff, 0xff, 0xff, 0xff },

      /* PW byte position */
      14,

      /* extract seq bytes */
      {  17,  16 },

      /* extract timestamp bytes */
      {  0,  0,  0,  0 },

      /* extract length bytes */
      {  0,  0 },

      /* timestamp shift */
      0,

      /* seq number length 2 bytes */
      ZL5011X_TRUE,

      /* length modifier */
      0,

      /* length no calc */
      ZL5011X_TRUE,

      /* two byte length */
      ZL5011X_TRUE
   },

/****************************************************************************/
/* protocol ZL5011X_IP_CD fields */
/****************************************************************************/
   {
      /* protocol Mask bytes */
      {
         /* ethernet header */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /*  0 to  7 */
         0xff, 0xff, 0xff, 0xff,    0x00, 0x00,                /*  8 to 13 */

         /* ip header */
                                                0x0f, 0xff,    /* 14 to 15 */
         0xff, 0xff, 0xff, 0xff,    0x00, 0x00, 0xff, 0x00,    /* 16 to 23 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 24 to 31 */
         0xff, 0xff,                                           /* 32 to 33 */

         /* unused header */
                     0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 34 to 39 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 40 to 47 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 48 to 55 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff },  /* 56 to 63 */

      /* extract classify bytes */
      {   26,   27,   28,   29,        0,    0,    0,    0,        0,    0,    0,    0 },
      /* classify mask */
      { 0x00, 0x00, 0x00, 0x00,     0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff, 0xff },

      /* VLAN classify positions - which of the extract classify bytes to use */
      {   10,   11 },

      /* CD classify positions - which of the extract classify bytes to use */
      {    4,    5 },

      /* extract check bytes */
      {    16,    17,    0,    0,        0,    0,    0,    0,        0,    0,    0 },
      /* check mask */
      { 0x00, 0x00, 0xff, 0xff,     0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff },

      /* VLAN check positions - which of the extract check bytes to use */
      { 0xff, 0xff },

      /* L2TPv3 Cookie check positions */
      { 0xff, 0xff, 0xff, 0xff },

      /* PW byte position */
      0,

      /* extract seq bytes */
      {  0,  0 },

      /* extract timestamp bytes */
      {  0,  0,  0,  0 },

      /* extract length bytes */
      {  17,  16 },

      /* timestamp shift */
      0,

      /* seq number length 2 bytes */
      ZL5011X_TRUE,

      /* length modifier */
      22,

      /* length no calc */
      ZL5011X_FALSE,

      /* two byte length */
      ZL5011X_TRUE
   },

/****************************************************************************/
/* protocol ZL5011X_IP_UDP fields */
/****************************************************************************/
   {
      /* protocol Mask bytes */
      {
         /* Ethernet Header */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /*  0 to  7 */
         0xff, 0xff, 0xff, 0xff,    0x00, 0x00,                /*  8 to 13 */

         /* IP Header */
                                                0x0f, 0xff,    /* 14 to 15 */
         0xff, 0xff, 0xff, 0xff,    0x00, 0x00, 0xff, 0x00,    /* 16 to 23 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 24 to 31 */
         0xff, 0xff,                                           /* 32 to 33 */

         /* UDP Header */
                     0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 34 to 39 */
         0xff, 0xff,                                           /* 40 to 41 */

         /* Unused bytes */
                     0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 42 to 47 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff,    /* 48 to 55 */
         0xff, 0xff, 0xff, 0xff,    0xff, 0xff, 0xff, 0xff },  /* 56 to 63 */

        /* extract classify bytes */
      {   26,   27,   28,   29,       34,   35,   36,   37,       17,   16,    0,    0 },
      /* classify mask */
      { 0x00, 0x00, 0x00, 0x00,     0x00, 0x00, 0x00, 0x00,     0x00, 0x00, 0xff, 0xff },

      /* VLAN classify positions - which of the extract classify bytes to use */
      { 10, 11 },

      /* CD classify positions - which of the extract classify bytes to use */
      { 0xff, 0xff },

      /* extract check bytes */
      {    0,    0,    0,    0,        0,    0,    0,    0,        0,    0,    0 },
      /* check mask */
      { 0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff, 0xff,     0xff, 0xff, 0xff },

      /* VLAN check positions - which of the extract check bytes to use */
      { 0xff, 0xff },

      /* L2TPv3 Cookie check positions */
      { 0xff, 0xff, 0xff, 0xff },

      /* PW byte position */
      0,

      /* extract seq bytes */
      {  0,  0 },

      /* extract timestamp bytes */
      {  0,  0,  0,  0 },

      /* extract length bytes */
      {  17,  16 },

      /* timestamp shift */
      0,

      /* seq number length 2 bytes */
      ZL5011X_TRUE,

      /* length modifier */
      28,

      /* length no calc */

⌨️ 快捷键说明

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