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

📄 zl5011xpacketrxtemplates.h

📁 Zalink50114----TDMoIP芯片驱动源码
💻 H
📖 第 1 页 / 共 5 页
字号:
/******************************************************************************
*
*  File name:              zl5011xPacketRxTemplates.h
*
*  Version:                40
*
*  Author:                 JFE
*
*  Date created:           04/09/2002
*
*  Copyright 2002, 2003, 2004, 2005, Zarlink Semiconductor Limited.
*  All rights reserved.
*
*  Module Description:
*
*  This file a global array of packet rx template structures - one for each
*  suppported protocol stack.
*
*  Revision History:
*
*  Rev:  Date:       Author:  Comments:
*  1     04/09/2002  JFE      Initial revision. Not many protocol stacks supported
*  2     06/09/2002  JFE      Check mask for ZL5011X_IP_UDP_RTP_PW changed
*  3     06/09/2002  JFE      Added a second array to differentiate IPv4 from IPv6.
*                             Added support for ZL5011X_IPV6_UDP_RTP_PW.
*  4     09/09/2002  JFE      Added support for ZL5011X_IP_UDP.
*                             Added support for ZL5011X_PW.
*                             Added support for ZL5011X_IP_UDP_L2TPV2_PW.
*                             Added support for ZL5011X_IP_L2TPV3_PW.
*                             Added support for ZL5011X_IP__L2TPV3_RTP_PW.
*                             Added support for ZL5011X_MPLS.
*                             Added support for ZL5011X_MPLS_PW.
*                             Added support for ZL5011X_MPLS_RTP_PW.
*  5     12/09/2002  JFE      Fixed the length modifier fields.
*                             Added #ifndef protection.
*                             Added support for _CD protocol stacks.
*  6     13/09/2002  JFE      L2TPv3 has optional cookie for which support is added to the structure
*  7     16/09/2002  JFE      Included length field as a check for some stacks
*  8     18/09/2002  JFE      Added control protocol stack templates.
*  9     24/09/2002  JFE      Added block comment about difference between protocol stacks pre-classification
*                             and classification fields.
*                             Changed endian of length / timestamp / sequence number inline with hardware.
*  10    26/09/2002  JFE      Added SSRC field for post verification of RTP/RTCP protocol stacks.
*  11    26/09/2002  JFE      Fixed ZL5011X_IP_UDP_RTCP_CTRL which tries to classify and post verify on RTP SSRC.
*  12    08/10/2002  JFE      Peer review actions.
*  13    10/10/2002  JFE      Changed templates for ZL5011X_IPV6_UDP shared stub stacks.
*  14    16/10/2002  JFE      Fixed sequence number bytes in ZL5011X_IP_UDP_L2TPV2_PW.
*  15    16/10/2002  JFE      Slight changes to some of the protocol stacks.
*  16    17/10/2002  SAC      MPLS_PW_ Descriptions updated (seq_num and timestamp extractions).
*  17    21/10/2002  JFE      Changed handling for L2TPv3 cookies to assume no cookie by default.
*  18    24/10/2002  SAC      Update
*  19    31/10/2002  SAC      ZL5011X_IP_UDP_L2TPV2_CTRL IPv4 Source address now extracted from correct location.
*  20    31/10/2002  MRC      Added variants + minor fixes
*  21    31/10/2002  JFE      Changed L2TPV2 Control stacks to not PV on IP Length
*  22    06/11/2002  JFE      Updated template for ZL5011X_IP_L2TPV3_RTCP_CTRL stack.
*  23    05/03/2003  MRC      Fairly big tweak
*  24    06/03/2003  MRC      IPv6 UDP->L2TP now classifies on the tunnel &
*                             session ID's
*  25    13/03/2003  MRC      Changed PW mask to accept packets with R, X set
*  26    19/05/2003  APL      L2TPv3 changes
*  27    22/05/2003  MRC      Reverted L2TPv3 changes
*  28    18/06/2003  ARW      Changed length modifier field in ZL5011X_IP_UDP (from 38 to 28)
*  29    18/07/2003  ARW      Updated classify mask fileds in protocol IPV6_UDP_CD
*  30    07/06/2004  MRC      Updated MPLS protocols
*  31    05/08/2004  MRC      Updated PW templates
*  32    25/08/2004  MRC      Protocol updates
*  33    05/10/2004  APL      Correct PW template for ZL5011X_MPLS
*  34    26/11/2004  MRC      Added extra packet protocols
*  35    10/02/2005  MRC      Updated comments on classification and fixed a few templates
*  36    01/03/2005  APL      Added ZL5011X_ETHERNET protocol
*  37    17/05/2005  MRC      Added custom 8 byte protocol header support
*  38    19/05/2005  MRC      Changed classification mask for custom headers
*  39    21/07/2005  MRC      Added templates for IP->UDP->RTP and
*                             IP->UDP->RTP->PW->ALT protcol headers
*  40    21/07/2005  MRC      Corrected IP->UDP->RTP template
*
******************************************************************************/

#ifndef _ZL5011X_PACKET_RX_TEMPLATES_H
#define _ZL5011X_PACKET_RX_TEMPLATES_H

/****************************************************************************
*
*  Packet classification procedure
*  ===============================
*
*  The following table gives a list of the protocols supported by the
*  packet functions and shows which fields from the various protocols are
*  used in the protocol detection, classification and checking stages.
*
*  Due to the differences between IPv4 and IPv6 there are some changes in
*  approach taken for some protocols. Any fields which are limited to either
*  IPv4 or IPv6 are shown with the IP protocol in paranthesis.
*
*  Protocol Stack       Protocol match fields                     Classification fields                  Checking fields
*  ----------------------------------------------------------------------------------------------------------------------
*  CD                   Destination MAC (optional)                CD Bytes
*                       Ethertype: CD                             VLAN ID (if VLAN enabled)
*
*  PW                   Destination MAC (optional)                VLAN ID                                PW bits
*                       Ethertype: PW
*  (VLAN must be used to provide a field for classification)
*
*  IP_CD                Destination MAC (optional)                IP Source Address (IPv4) (optional)    IP Length
*                       Ethertype: IP                             IP Source Address[3:0] (IPv6)
*                       IP Version                                CD Bytes
*                       IP Flags & Frags (IPv4)                   VLAN ID (if VLAN enabled)
*                       IP Protocol: CD (IPv4)
*                       IP Next Header: CD (IPv6)
*                       IP Dest Address (IPv4) (optional)
*
*  IP_PW_TS             Destination MAC (optional)                IP Source Address (IPv4) (optional)    PW bits
*                       Ethertype: IP                             IP Source Address[3:0] (IPv6)
*                       IP Version                                IP identification / flow
*                       IP Flags & Frags (IPv4)                   VLAN ID (if VLAN enabled)
*                       IP Protocol: CD (IPv4)                    IP Length
*                       IP Next Header: CD (IPv6)
*                       IP Dest Address (IPv4) (optional)
*
*  IP_UDP               Destination MAC (optional)                IP Source Address (IPv4) (optional)
*                       Ethertype: IP                             IP Source Address[3:0] (IPv6)
*                       IP Version                                UDP Source Port
*                       IP Flags & Frags (IPv4)                   UDP Destination Port
*                       IP Protocol: UDP (IPv4)                   VLAN ID (if VLAN enabled)
*                       IP Next Header: UDP (IPv6)                IP length
*                       IP Dest Address (IPv4) (optional)
*
*  IP_UDP_PW            Destination MAC (optional)                IP Source Address (IPv4) (optional)    PW bits
*                       Ethertype: IP                             IP Source Address[3:0] (IPv6)
*                       IP Version                                UDP Source Port
*                       IP Flags & Frags (IPv4)                   UDP Destination Port
*                       IP Protocol: UDP (IPv4)                   VLAN ID (if VLAN enabled)
*                       IP Next Header: UDP (IPv6)                IP length
*                       IP Dest Address (IPv4) (optional)
*                       UDP Source Port (optional)
*                       UDP Destination Port (optional)
*
*  IP_UDP_CD            Destination MAC (optional)                IP Source Address (IPv4) (optional)    IP Length
*                       Ethertype: IP                             IP Source Address [3:0] (IPv6)
*                       IP Version                                CD Bytes
*                       IP Flags & Frags (IPv4)                   UDP Source Port
*                       IP Protocol: UDP (IPv4)                   UDP Destination Port
*                       IP Next Header: UDP (IPv6)                VLAN ID (if VLAN enabled)
*                       IP Dest Address (IPv4) (optional)
*                       UDP Source Port (optional)
*                       UDP Destination Port (optional)
*                       CD start (IPv4)
*
*  IP_UDP_RTP           Destination MAC (optional)                IP Source Address (IPv4) (optional)    RTP SSRC (IPv4)
*                       Ethertype: IP                             IP Source Address [3:0] (IPv6)
*                       IP Version                                UDP Source Port
*                       IP Flags & Frags (IPv4)                   UDP Destination Port
*                       IP Protocol: UDP (IPv4)                   VLAN ID (if VLAN enabled)
*                       IP Next Header: UDP (IPv6)                IP Length
*                       IP Dest Address (IPv4) (optional)
*                       UDP Source Port (optional)
*                       UDP Destination Port (optional)
*                       RTP start (IPv4)
*
*  IP_UDP_RTP_PW        Destination MAC (optional)                IP Source Address (IPv4) (optional)    RTP SSRC (IPv4)
*                       Ethertype: IP                             IP Source Address [3:0] (IPv6)         PW bits (IPv4)
*                       IP Version                                UDP Source Port
*                       IP Flags & Frags (IPv4)                   UDP Destination Port
*                       IP Protocol: UDP (IPv4)                   VLAN ID (if VLAN enabled)
*                       IP Next Header: UDP (IPv6)                IP Length
*                       IP Dest Address (IPv4) (optional)
*                       UDP Source Port (optional)
*                       UDP Destination Port (optional)
*                       RTP start (IPv4)
*
*  IP_UDP_RTP_PW_ALT    Destination MAC (optional)                IP Source Address (IPv4) (optional)    VLAN ID (if VLAN enabled)
*                       Ethertype: IP                             IP Source Address [3:0] (IPv6)         PW bits (IPv4)
*                       IP Version                                UDP Source Port                        IP Length (IPv4)
*                       IP Flags & Frags (IPv4)                   UDP Destination Port
*                       IP Protocol: UDP (IPv4)                   RTP SSRC
*                       IP Next Header: UDP (IPv6)
*                       IP Dest Address (IPv4) (optional)
*                       UDP Source Port (optional)
*                       UDP Destination Port (optional)
*                       RTP start (IPv4)
*
*  IP_UDP_L2TPV2_PW     Destination MAC (optional)                IP Source Address (IPv4) (optional)    PW bits (IPv4)
*                       Ethertype: IP                             IP Source Address [3:0] (IPv6)         VLAN ID (if VLAN enabled)
*                       IP Version                                UDP Source Port                        IP Length (IPv4)
*                       IP Flags & Frags (IPv4)                   UDP Destinction Port
*                       IP Protocol: UDP (IPv4)                   L2TP Tunnel ID
*                       IP Next Header: UDP (IPv6)                L2TP Session ID
*                       IP Dest Address (IPv4) (optional)
*                       UDP Source Port (optional)
*                       UDP Destination Port (optional)
*                       L2TP start (IPv4)
*
*  IP_L2TPV3_PW         Destination MAC (optional)                IP Source Address (IPv4) (optional)    PW bits
*                       Ethertype: IP                             IP Source Address[3:0] (IPv6)          L2TP Cookie
*                       IP Version                                L2TP Session ID
*                       IP Flags & Frags (IPv4)                   VLAN ID (if VLAN enabled)
*                       IP Protocol: L2TPV3 (IPv4)                IP length
*                       IP Next Header: L2TPV3 (IPv6)
*                       IP Dest Address (IPv4) (optional)
*
*  IP_L2TPV3_RTP_PW     Destination MAC (optional)                IP Source Address (IPv4) (optional)    PW bits
*                       Ethertype: IP                             IP Source Address[3:0] (IPv6)          RTP SSRC
*                       IP Version                                L2TP Session ID                        L2TP Cookie
*                       IP Flags & Frags (IPv4)                   VLAN ID (if VLAN enabled)
*                       IP Protocol: L2TPV3 (IPv4)                IP length
*                       IP Next Header: L2TPV3 (IPv6)
*                       IP Dest Address (IPv4) (optional)
*                       RTP start
*
*  IP_UDP_RTCP_CTRL     Destination MAC (optional)                IP Source Address (IPv4) (optional)    RTCP SSRC (IPv4)
*                       Ethertype: IP                             IP Source Address [3:0] (IPv6)
*                       IP Version                                RTCP start (IPv6)
*                       IP Flags & Frags (IPv4)                   UDP Source Port
*                       IP Protocol: UDP (IPv4)                   UDP Destination Port
*                       IP Next Header: UDP (IPv6)                VLAN ID (if VLAN enabled)
*                       IP Dest Address (IPv4) (optional)
*                       UDP Source Port (optional)
*                       UDP Destination Port (optional)
*                       RTCP start (IPv4)
*
*  IP_UDP_L2TPV2_CTRL   Destination MAC (optional)                IP Source Address (IPv4) (optional)    VLAN ID (if VLAN enabled)
*                       Ethertype: IP                             IP Source Address [2:0] (IPv6)
*                       IP Version                                L2TPV2 start (IPv6)
*                       IP Flags & Frags (IPv4)                   UDP Source Port
*                       IP Protocol: UDP (IPv4)                   UDP Destination Port
*                       IP Next Header: UDP (IPv6)                L2TP Tunnel ID
*                       IP Dest Address (IPv4) (optional)         L2TP Session ID
*                       UDP Source Port (optional)
*                       UDP Destination Port (optional)
*                       L2TP start (IPv4)
*
*
*  IP_L2TPV3_CTRL       Destination MAC (optional)                IP Source Address (IPv4)
*                       Ethertype: IP                             IP Source Address[3:0] (IPv6)
*                       IP Version                                VLAN ID (if VLAN enabled)
*                       IP Flags & Frags (IPv4)
*                       IP Protocol: L2TPV3 (IPv4)
*                       IP Next Header: L2TPV3 (IPv6)
*                       IP Dest Address (IPv4) (optional)
*                       L2TP session ID = 0
*
*  IP_L2TPV3_RTCP_CTRL  Destination MAC (optional)                IP Source Address (IPv4) (optional)    RTCP SSRC
*                       Ethertype: IP                             IP Source Address[3:0] (IPv6)          L2TPv3 Cookie
*                       IP Version                                L2TP Session ID
*                       IP Flags & Frags (IPv4)                   VLAN ID (if VLAN enabled)
*                       IP Protocol: L2TPV3 (IPv4)
*                       IP Next Header: L2TPV3 (IPv6)
*                       IP Dest Address (IPv4) (optional)
*                       RTCP start
*
*  MPLS                 Destination MAC (optional)                MPLS Label
*                       Ethertype: MPLS                           VLAN ID (if VLAN enabled)
*                       MPLS S Bit: 1
*
*  MPLS_PW              Destination MAC (optional)                MPLS Label
*                       Ethertype: MPLS                           VLAN ID (if VLAN enabled)
*                       MPLS S Bit: 1                             PW bits
*
*
*  MPLS_PW_RTP          Destination MAC (optional)                MPLS Label
*                       Ethertype: MPLS                           VLAN ID (if VLAN enabled)
*                       MPLS S Bit: 1                             RTP SSRC
*                                                                 PW bits
*
*
*  MPLS_RTCP_CTRL       Destination MAC (optional)                MPLS Label
*                       Ethertype: MPLS                           VLAN ID (if VLAN enabled)
*                       MPLS S Bit: 1                             RTCP SSRC
*
*
*  MPLS_MPLS_PW         Destination MAC (optional)                MPLS1 Label
*                       Ethertype: MPLS                           MPLS2 Label
*                       MPLS1 S Bit: 0                            VLAN ID (if VLAN enabled)
*                       MPLS2 S Bit: 1                            PW bits
*
*  CUSTOM8_PW           Ethertype : top 4 bits                    Custom flowID                          PW bits
*                       Custom : 1st 8 bits                       Ethertype : low 12 bits
*                                                                 VLAN ID (if VLAN enabled)
*
*  CUSTOM8_RTP_PW       Ethertype : top 4 bits                    Custom flowID                          PW bits
*                       Custom : 1st 8 bits                       Ethertype : low 12 bits                RTP SSRC
*                       RTP start                                 VLAN ID (if VLAN enabled)
*
*  CUSTOM8_PW_RTP       Ethertype : top 4 bits                    Custom flowID                          PW bits
*                       Custom : 1st 8 bits                       Ethertype : low 12 bits                RTP SSRC
*                       RTP start                                 VLAN ID (if VLAN enabled)
*
*  ETHERNET             Destination MAC (optional)                Destination MAC
*                       Ethertype: Any                            Source MAC
*
* Notes :

*  The fields described above are used for the protocol detection and subsequent classification
*  of received packets. Due to the diversity of the protocols and the generic nature
*  of the mechanisms applied in these Packet functions there are some restrictions related to
*  which can interoperate. The restrictions are detailed below:-
*
*     IP_L2TPV3_CTRL    protocol stage matches the session ID to 0. Therefore the protocol rule
*                       must be defined with a higher priority than for IP_L2TPV3_PW which uses
*                       this field for classification and is hence ignored for protocol matching.
*                       This can be achieved by setting the CTRL protocol first using
*                       zl5011xPacketRxSetProtocol or by specifying the protocolMatchNumber
*                       explicitly during both calls (lower number = higher priority)
*
*     IP_L2TPV3_PW, IP_L2TPV3_CTRL  cannot interoperate with IP_L2TPV3_RTP_PW, IP_L2TPV3_RTCP_CTRL
*
*     UDP               there are restrictions with UDP since detecting the protocol beyond the UDP
*                       header is difficult - due to the fact that there isn't a next  protocol field.
*                       There are also more restrictions for IPv6 due to the fact that the header
*                       following UDP can be up to 66 bytes into the packet when VLAN tagging is
*                       used (14 + 4 + 40 + 8), which exceeds the 64 bytes available for protocol matching.
*
*           IPv4_UDP_*  only one of IP_UDP, IP_UDP_PW or IP_UDP_others can be supported
*
*           IPv6_UDP_*  only one of the following can be supported
*                          ZL5011X_IP_UDP

⌨️ 快捷键说明

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