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

📄 zl5011xpacket.h

📁 Zalink50114----TDMoIP芯片驱动源码
💻 H
📖 第 1 页 / 共 2 页
字号:
   zl5011xBooleanE rtpForceSeqNumber;

   /* Position of the Context Descriptor field in the header - this defaults to
      the last two bytes in the header */
   Uint32T contextDescriptorOffset;
   Uint8T contextDescriptorNumber;
   zl5011xBooleanE contextDescriptorTeardown;

   zl5011xBooleanE osExclusionEnable;
} zl5011xPacketTxSetHeaderS;

/********************************/

/* the following enumeration provides various options for how the packet
   length is used. */
typedef enum
{
   /* check length field in the packet using the specified payload length */
   ZL5011X_PACKET_LENGTH_CHECK,

   /* use the length field from the protocol header to determine payload length */
   ZL5011X_PACKET_LENGTH_FROM_FIELD,

   /* use the packet length to derive the payload length - note that packets MUST
      not contain any padding bytes */
   ZL5011X_PACKET_LENGTH_FROM_PKT,

   /* use to pass the complete packet - the header is not removed as
      for previous option */
   ZL5011X_PACKET_LENGTH_OF_PKT,

   /* ignore the length field and specify the payload explicitly */
   ZL5011X_PACKET_LENGTH_SPECIFIED
} zl5011xPacketRxLengthUsageE;

typedef struct
{
   Uint32T context;
   zl5011xProtocolTypeE   protocolType;

   /* Ethernet Control Structure members: */
   zl5011xBooleanE enableVlan;
   zl5011xBooleanE enableSnap;

   /* IP version - ZL5011X_TRUE for IPv4 and ZL5011X_FALSE for IPv6 */
   zl5011xBooleanE ipVer4;

   /* UDP Control Structure members: */
   zl5011xBooleanE discardUdpCheckFails;

   /* L2TP Control Structure Members */
   zl5011xBooleanE enableL2TPCookie;

   /* Position of the Context Descriptor field in the header */
   Uint32T contextDescriptorOffset;
   Uint8T contextDescriptorNumber;

   Uint8T *header;
   Uint8T headerLength;

   /* match destination MAC address during the Protocol matching stage */
   zl5011xBooleanE matchDestMacAddress;

   /* match destination IPv4 address during the Protocol matching stage */
   zl5011xBooleanE matchDestIpv4Address;

   /* match source IP address during the classification stage */
   zl5011xBooleanE matchSrcIpv4Address;

   /* the following masks can be used to mask in / out the src and dest UDP
      ports during the classification phase. This primarily allows the
      reception of control packets using a single classification rule */
   Uint16T srcUdpPortMask;
   Uint16T destUdpPortMask;

   /* once packet classification has been completed, additional checks are generally
      performed, but can be enabled/disabled using the following variable */
   zl5011xBooleanE enableClassificationChecks;

   /* If the protocol header contains no length field but it is desired to classify on length then
      the payload length to match against must be specified here. */
   Uint16T payloadLength;
   zl5011xPacketRxLengthUsageE lengthUsage;

   /* mask to apply to the Pseudo Wire Status byte
      - changes in the status are ignored if mask bit is set to 1 */
   Uint32T statusByteMask;

   /* in the presence of both RTP and PW headers, this can be used to control
      which of the two sequence numbers gets used */
   zl5011xBooleanE rtpForceSeqNumber;

   zl5011xBooleanE forceOneByteSeq;
   zl5011xBooleanE disableTimestamp;

   /* Control flows require a cpu queue number */
   zl5011xQueueE cpuQueue;

   /* Protocol match number */
   Uint32T protocolMatchNumber;
   /* classify match number */
   Uint32T classifyMatchNumber;

   /* Normally TRUE for packet data from LAN to TDM but may be FALSE if packet
      encapsulation is required, e.g. for tunnelling */
   zl5011xBooleanE removeHeader;

   /* MPID can be explicitly specified rather than derived from the context number */
   Uint32T classifyMpid;

   zl5011xBooleanE osExclusionEnable;

   /* use of the checkLengthValue parameter is deprecated and lengthUsage parameter should
      be used instead */
   zl5011xBooleanE checkLengthValue;
} zl5011xPacketRxSetHeaderS;

/********************************/

typedef struct
{
   Uint8T protocolMaskBytes[ZL5011X_PKC_PROTOCOL_NUM_MATCH_FIELDS];

   Uint8T extractClassifyBytes[ZL5011X_PKC_CLASSIFY_NUM_MATCH_FIELDS];
   Uint8T classifyMaskBytes[ZL5011X_PKC_CLASSIFY_NUM_MATCH_FIELDS];
   Uint8T vlanClassifyPos[2];
   Uint8T cdClassifyPos[2];

   Uint8T extractCheckBytes[ZL5011X_PKC_CLASSIFY_NUM_CHECK_FIELDS];
   Uint8T checkMask[ZL5011X_PKC_CLASSIFY_NUM_CHECK_FIELDS];
   Uint8T vlanCheckPos[2];
   Uint8T l2tpCookieCheckPos[ZL5011X_PKT_L2TPV3_COOKIE_LEN];

   Uint8T extractPwByte;
   Uint8T extractSequenceBytes[ZL5011X_PKC_PROTOCOL_MAX_SEQ_BYTES];
   Uint8T extractTimestampBytes[ZL5011X_PKC_PROTOCOL_MAX_TIMESTAMP_BYTES];
   Uint8T extractLengthBytes[ZL5011X_PKC_PROTOCOL_MAX_LENGTH_BYTES];

   Uint8T timestampShift;
   zl5011xBooleanE protocolSeqLength16Bits;
   Uint16T classifyLengthModifier;
   zl5011xBooleanE classifyLengthNoCalc;
   zl5011xBooleanE classifyTwoByteLength;
} zl5011xPacketRxTemplateS;

/********************************/

typedef struct
{
   zl5011xProtocolTypeE protocol;
   zl5011xBooleanE ipVer4;
   zl5011xBooleanE enableVlan;
   zl5011xBooleanE enableL2TPCookie;
   zl5011xBooleanE rtpForceSeqNumber;
   Uint16T contextDescriptorOffset;
} zl5011xPacketPkcProtocolEntryS;

typedef struct
{
   /* protocolMatchNumber contains a valid number when the protocol has been set up
      in the pre classifier. The first dimension of the array is for the presence
      or absence of VLAN and the second is for IPv4 or IPv6. If the protocol stack
      is not in use then the match number will be set to something higher than the
      maximum number of protocol stacks available.
      For example, a protocol stack is set up and has VLAN on, and the IP version
      in use is version 6. Therefore VLAN = ZL5011X_TRUE and IPv4 == ZL5011X_FALSE.
      This is setup in protocol match number 3 (in this example). Therefore:
      protocolMatchNumber[ZL5011X_TRUE][ZL5011X_FALSE] = 3.
      One of these 2-dimensional arrays exists for each supported protocol stack.
      Using this technique, the helper function is able to keep track of which
      protocol stacks have been set up and which haven't. Also which protocol match
      number corresponds with the protocol stacks that have been set up is recorded. */
   Uint32T matchNum[2][2];
} zl5011xPacketProtocolStackS;

typedef struct
{
   /* the parameter structure pointer is used to index the the device currently in use */
   zl5011xParamsS *paramStructPointer;
   zl5011xPacketProtocolStackS protocol[ZL5011X_PKT_NUM_PROTOCOL_STACKS];
   zl5011xPacketPkcProtocolEntryS entry[ZL5011X_PKC_NUM_PROTOCOL_ENTRIES];
} zl5011xProtocolTableS;

/********************************/

typedef struct
{
   Uint32T context;
   Uint8T statusByte;
   zl5011xBooleanE osExclusionEnable;
} zl5011xPacketTxUpdateStatusByteS;

zlStatusE zl5011xPacketTxUpdateStatusByteStructInit(zl5011xParamsS *zl5011xParams, zl5011xPacketTxUpdateStatusByteS *par);
zlStatusE zl5011xPacketTxUpdateStatusByte(zl5011xParamsS *zl5011xParams, zl5011xPacketTxUpdateStatusByteS *par);

/********************************/

typedef struct
{
   zl5011xBooleanE osExclusionEnable;
} zl5011xPacketRxFreeDeviceS;

zlStatusE zl5011xPacketRxFreeDeviceStructInit(zl5011xParamsS * zl5011xParams, zl5011xPacketRxFreeDeviceS *par);
zlStatusE zl5011xPacketRxFreeDevice(zl5011xParamsS * zl5011xParams, zl5011xPacketRxFreeDeviceS *par);

/********************************/

/* Functions to delete specific protocol matches by number */
typedef struct
{
   Uint8T protocolMatchNum;
   zl5011xBooleanE osExclusionEnable;
} zl5011xPacketRxDeleteProtocolMatchNumS;

zlStatusE zl5011xPacketRxDeleteProtocolMatchNumStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xPacketRxDeleteProtocolMatchNumS *par);
zlStatusE zl5011xPacketRxDeleteProtocolMatchNum(zl5011xParamsS *zl5011xParams,
      zl5011xPacketRxDeleteProtocolMatchNumS *par);


/*****************   FUNCTION PROTOTYPES   ***********************************/
zlStatusE zl5011xPacketTxSetHeaderStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xPacketTxSetHeaderS *par);
zlStatusE zl5011xPacketTxSetHeader(zl5011xParamsS *zl5011xParams,
      zl5011xPacketTxSetHeaderS *par);
zlStatusE zl5011xPacketRxSetHeaderStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xPacketRxSetHeaderS *par);
zlStatusE zl5011xPacketRxSetHeader(zl5011xParamsS * zl5011xParams,
      zl5011xPacketRxSetHeaderS *par);
zlStatusE zl5011xPacketRxSetProtocol(zl5011xParamsS * zl5011xParams,
      zl5011xPacketRxSetHeaderS *par);
zlStatusE zl5011xPacketRxSetControlHeader(zl5011xParamsS * zl5011xParams,
      zl5011xPacketRxSetHeaderS *par);
zlStatusE zl5011xPacketRxDeleteHeader(zl5011xParamsS *zl5011xParams,
      zl5011xPacketRxSetHeaderS *par);

/* Statics called by zl5011xPacketTxSetHeader */
zlStatusE zl5011xAddEthernetHeader(zl5011xLanTxSetLayer2and3HeaderS *layer2and3Header,
      zl5011xPacketTxSetHeaderS * par);
zlStatusE zl5011xAddMPLSHeader(zl5011xLanTxSetLayer2and3HeaderS *layer2and3Header,
      zl5011xPacketTxSetHeaderS * par);
zlStatusE zl5011xAddIPHeader(zl5011xLanTxSetLayer2and3HeaderS *
      layer2and3Header,zl5011xPacketTxSetHeaderS * par);
zlStatusE zl5011xAddUDPHeader(zl5011xLanTxSetLayer4and5HeaderS *
      layer4and5Header,zl5011xPacketTxSetHeaderS * par);
zlStatusE zl5011xAddCDHeader(zl5011xLanTxSetLayer2and3HeaderS *layer2and3Header,
      zl5011xLanTxSetLayer4and5HeaderS *layer4and5Header, zl5011xPacketTxSetHeaderS * par,
      Uint8T *cdPos);

zlStatusE zl5011xUpdateIPChecksum(zl5011xLanTxSetLayer2and3HeaderS *layer2and3Header,
      zl5011xLanTxSetLayer4and5HeaderS *layer4and5Header,
      zl5011xPacketTxSetHeaderS * par);
zlStatusE zl5011xUpdateUDPChecksum(zl5011xLanTxSetLayer4and5HeaderS *layer4and5Header,
      zl5011xLanTxSetLayer2and3HeaderS *layer2and3Header, zl5011xPacketTxSetHeaderS *par);

zlStatusE zl5011xCopyHeaders(zl5011xLanTxSetLayer2and3HeaderS *layer2and3Header,
      zl5011xLanTxSetLayer4and5HeaderS *layer4and5Header,
      zl5011xPacketTxSetHeaderS *par);

zlStatusE zl5011xPacketGetWanRxCDHeader(zl5011xParamsS *zl5011xParams,
      zl5011xPacketTxSetHeaderS *par, Uint16T *cdHeader, Uint8T cdPos);

/* Statics called by zl5011xPacketRxSetHeader */
Uint32T zl5011xGetHeaderLength(zl5011xPacketRxSetHeaderS * par);

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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