亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? zl5011xpackettx.c

?? Zalink50114----TDMoIP芯片驅動源碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/******************************************************************************
*
*  File name:              zl5011xPacketTx.c
*
*  Version:                57
*
*  Author:                 JFE
*
*  Date created:           19/06/2002
*
*  Copyright 2002, 2003, 2004, 2005, Zarlink Semiconductor Limited.
*  All rights reserved.
*
*  Module Description:
*
*  This file contains packet construction routines.
*
*  Revision History:
*
*  Rev:  Date:       Author:  Comments:
*  1     19/06/2002  JFE      Initial revision
*  2     27/06/2002  JFE      Added handling for more protocol stacks
*  3     08/07/2002  JFE      Added handling for VLAN
*                             Modified init function to initialise new
*                             structure member
*  4     09/07/2002  JFE      Added support for more protocol stacks
*  5     09/07/2002  JFE      Added support for more protocol stacks
*                             Changed structure member (contextID to context)
*                             Added range checking for unchecked members
*  6     10/07/2002  MRC      Added some new checksum functions
*  7     15/07/2002  JFE      Added new functions to handle receipt of packets
*                             programming the PKC.
*                             Code review actions.
*  8     06/08/2002  MRC      temporarily removed packet Rx functions. Removed
*                             references to emu880.
*  9     07/08/2002  MRC      Updated, adding in checksums calculations etc.
*  10    07/08/2002  MRC      Fixed copy header fn
*  11    14/08/2002  MRC      Updated
*  12    16/08/2002  MRC      Updated checksum functions
*  13    16/08/2002  MRC      Added control to allow the Tx RTP timestamp to be
*                             derived from the WAN interface.
*  14    28/08/2002  MRC      Added in support for CD header
*  15    28/08/2002  MRC      Fixed a problem in checking the position of the
*                             CD header
*  16    02/09/2002  MRC      Added some checks for the flow type etc.
*  17    03/09/2002  MRC      Added ethernet SNAP length field control
*  18    04/09/2002  MRC      Adding CD header, broke other protocols
*  19    04/09/2002  MRC      checksum modifier wasn't initialised
*  20    05/09/2002  MRC      UDP checksum not being recalculated
*  21    05/09/2002  MRC      update snap length calculation
*  22    05/09/2002  MRC      the context switch bit is now determined by
*                             examining the current header
*  23    06/09/2002  MRC      update snap length calculation
*  24    10/09/2002  MRC      CD header now uses context number if an outgoing
*                             context number is not provided
*  25    10/09/2002  MRC      L2TPv3 does not have a length field
*  26    13/09/2002  MRC      Changed include file
*  27    31/10/2002  MRC      Added variants + minor fixes
*  28    29/01/2003  MRC      Added rev A #define
*  29    31/01/2003  MRC      Renamed the rev A #define
*  30    21/02/2003  MRC      Moved packet checksum functions to apiHigh
*  31    27/02/2003  MRC      Added in support for cookie in L2TPv3
*  32    06/03/2003  MRC      Added OS exclusion
*  33    25/03/2003  MRC      IPv4 and UDP checksums are now computed from
*                             scratch and do not rely on the checksum being
*                             valid on calling the function
*  34    19/05/2003  APL      L2TPv3 changes
*  35    21/05/2003  MRC      L2TPv3 changes + option to fix IPv4 checksum
*  36    05/06/2003  JFE      Changed calls to calloc and free for macros
*  37    25/06/2003  MRC      CD header changed to be different when over UDP
*  38    25/06/2003  MRC      The CD header now immediately follows UDP
*  39    15/07/2003  JFE      IP_UDP_CD now works.
*  40    29/07/2003  APL      Added support for devices with no TDM interface
*                             Can now modify packet TX parameters without
*                                adding a header
*  41    04/08/2003  APL      Removed unused variable for some device variants
*  42    28/10/2003  AMS      Update
*  43    29/10/2003  AMS      Update
*  44    30/10/2003  AMS      Update
*  45    07/11/2003  AMS      Update
*  46    18/11/2003  AMS      Update
*  47    03/12/2003  APL      Update
*  48    06/01/2004  MRC      Reverted to revision 41
*  49    07/06/2004  MRC      Updated MPLS protocol headers
*  50    29/07/2004  MRC      Fixed some compiler warnings
*  51    25/08/2004  MRC      Protocol updates
*  52    27/09/2004  APL      Check correct flow is set for required protocol
*                             Tx Header for Lan-to-Lan contexts can only be
*                                changed in INIT state.
*  53    07/10/2004  APL      Lan-to-lan contexts can have a null header added.
*  54    26/11/2004  MRC      Added extra packet protocols
*  55    01/03/2005  APL      Added ZL5011X_ETHERNET protocol. Improved checking
*                             of invalid flows
*  56    17/05/2005  MRC      Added custom 8 byte protocol header support
*  57    21/07/2005  MRC      Added IP->UDP->RTP and IP->UDP->RTP->PW->ALT protcols
*
******************************************************************************/

/*****************   INCLUDE FILES                ****************************/

#include "zl5011xApi.h"
#include "zl5011xMisc.h"
#include "zl5011xLan.h"
#include "zl5011xPacket.h"

/*****************   EXTERNAL FUNCTION DEFINITIONS   *************************/

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

 Function:
    zl5011xPacketTxSetHeaderStructInit

 Description:
   Initialises structure used by zl5011xPacketTxSetHeader function.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   par            Pointer to the structure for configuration items.
                  See main function

 Returns:
   zlStatusE

 Remarks:
    None

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

zlStatusE zl5011xPacketTxSetHeaderStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xPacketTxSetHeaderS * par)
{
   zlStatusE status = ZL5011X_OK;

   /* do some parameter checking */
   status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);

   if (status == ZL5011X_OK)
   {
      ZL5011X_TRACE(ZL5011X_PACKET_FN_ID,
            "zl5011xPacketTxSetHeaderStructInit:",
            0, 0, 0, 0, 0, 0);

      par->context = (Uint32T)ZL5011X_INVALID_CONTEXT;
      par->protocolType = ZL5011X_INVALID_PROTOCOL;
      par->header = NULL;
      par->headerLength = 0;
      par->portNum = 0;
      par->queueNum = 0;
      par->enableVlan = ZL5011X_FALSE;
      par->enableSnap = ZL5011X_FALSE;
      par->ipVer4 = ZL5011X_TRUE;
      par->enableUDPChecksum = ZL5011X_TRUE;
      par->rtpForceSeqNumber = ZL5011X_TRUE;
      par->rtpTimestampInc = 0;
      par->rtpTimestampFromWan = ZL5011X_FALSE;

      par->enableL2TPCookie = ZL5011X_FALSE;

      par->contextDescriptorOffset = (Uint32T)ZL5011X_INVALID;
      par->contextDescriptorTeardown = ZL5011X_FALSE;
      par->contextDescriptorNumber = (Uint8T)ZL5011X_INVALID;

      par->fixIpv4Header = ZL5011X_TRUE;
      par->payloadLength = 0;

      /* MAC Writes Ethernet Src Add */
      par->ethernetSrcAddressFromMac = ZL5011X_TRUE;
      par->osExclusionEnable = ZL5011X_TRUE;
   }

   return(status);
}

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

 Function:
    zl5011xPacketTxSetHeader

 Description:
    This function calls the relevant API functions to setup PTX and PE headers
    as required by the indicated protocol type.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   par            Pointer to the structure for configuration items. See below:

 Structure inputs:
   context        context to setup header for
   portNum        Lan port to send these packets on
   queueNum       Lan queue to use for these packets
   protocolType   identifies protocol being set up
   header         pointer to a buffer containing header data. If NULL then no header
                  will be added
   headerLength   length of the header. If 0 then no header will be added
   enableVlan     ZL5011X_TRUE if this packet uses VLAN
   enableSnap     ZL5011X_TRUE if this packet uses SNAP
   ethernetSrcAddressFromMac  ZL5011X_TRUE for the ethernet source address to
                  be inserted by the LAN port
   ipVer4         ZL5011X_TRUE if the IP protocol is IPv4 (IPv6 = ZL5011X_FALSE)
   fixIpv4Header  ZL5011X_TRUE to use a fixed IPv4 header - payload length
                  must also be specified
   payloadLength  length of payload to use if the IPv4 header is fixed
   enableUDPChecksum ZL5011X_TRUE to enable UDP checksum insertion
                  (ZL5011X_FALSE fills the field with 0)
   enableL2TPCookie  ZL5011X_TRUE if the L2TPv3 header contains a cookie
   rtpForceSeqNumber set to ZL5011X_TRUE to force usage of the RTP sequence number
                     if the RTP and PW headers are both present.
                     (Note : in order to update the PW status byte, this must
                     be set to ZL5011X_TRUE when RTP is used)
   rtpTimestampInc   how much should the RTP timestamp increment by for
                  each packet
   rtpTimestampFromWan  ZL5011X_TRUE for the RTP timestamp to be sourced from the
                  WAN interface. ONLY for in-band differential clock recovery
   contextDescriptorOffset byte offset within the header for the CD header
                  (for MT90880 interoperation)
   contextDescriptorNumber context number to use for CD header
                  (for MT90880 interoperation)
   contextDescriptorTeardown ZL5011X_TRUE to form a teardown CD header
                  (for MT90880 interoperation)
   osExclusionEnable ZL5011X_TRUE to enable OS exclusion

 Structure outputs:
   None

 Returns:
   zlStatusE

 Remarks:
    It is the not the responsibility of this function to ensure that the fields
    in the header provided by the calling function are valid. Checks must be
    done at a higher level to ensure conformance to whatever protocol is
    required. This lack of checking in this function is desirable so that it
    won't require modification if a new, unknown protocol is used in the future.

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

extern zlStatusE zl5011xPacketTxSetHeader(zl5011xParamsS * zl5011xParams,
      zl5011xPacketTxSetHeaderS * par)
{
   zlStatusE status = ZL5011X_OK;
   zl5011xLanTxSetLayer2and3HeaderS  *layer2and3Header = NULL;
   zl5011xLanTxSetLayer4and5HeaderS  *layer4and5Header = NULL;
   zl5011xBooleanE udpEnable = ZL5011X_FALSE;
   zl5011xBooleanE cdEnable = ZL5011X_FALSE;
   Uint16T checksumMod = 0;
   Uint8T cdPos, pwStatusPos = (Uint8T)ZL5011X_INVALID;
   Uint8T pwShuffle = 0;

   Uint16T temp;

   /* do some parameter checking */
   status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);

   if (status == ZL5011X_OK)
   {
      if (par->rtpTimestampFromWan == ZL5011X_TRUE)
      {
         /* force the UDP checksum off if doing clock recovery using a PRS timestamp */
         par->enableUDPChecksum = ZL5011X_FALSE;
      }
   }

   if (status == ZL5011X_OK)
   {
      status = ZL5011X_CHECK_RUNNING(zl5011xParams);
   }

   if (status == ZL5011X_OK)
   {
      status = zl5011xLanPortCheck(zl5011xParams, par->portNum);
   }

   /* Check that the Wan Rx context is valid. */
   if (status == ZL5011X_OK)
   {
      /* The packet transmit headers for Lan-to-Lan contexts can only be changed in
         the INIT state */
      if (zl5011xParams->packetIf.lanLanContext[par->context] == ZL5011X_TRUE)
      {
         status = zl5011xContextCheckRx(zl5011xParams, par->context, ZL5011X_CHECK_CONTEXT_INIT);
      }
      else
      {  /* For Wan Rx contexts the layer 4/5 header can be changed whilst in in any state.
            This is because it is implemented using a dual header approach where the new header
            can be set up and then switched in one go. The layer 2/3 header does not support
            this and so cannot be changed except in the INIT state. This is checked further
            down this function. */
         status = zl5011xContextCheckRx(zl5011xParams, par->context, ZL5011X_CHECK_CONTEXT_IN_USE);
      }
   }

   /* main function code starts */

   if (status == ZL5011X_OK)
   {
      ZL5011X_TRACE(ZL5011X_PACKET_FN_ID,
            "zl5011xPacketTxSetHeader:",
            0, 0, 0, 0, 0, 0);
   }

   /* Perform range checking on structure members passed in */

   if (status == ZL5011X_OK)
   {
      if (par->queueNum >= ZL5011X_PKQ_NUM_QUEUES)
      {
         status = ZL5011X_PARAMETER_INVALID;
      }
   }

   if (status == ZL5011X_OK)
   {
      if (par->headerLength > ZL5011X_PACKET_HEADER_MAX)
      {
         status = ZL5011X_PKT_HEADER_SIZE_ERROR;
      }
   }

   if (status == ZL5011X_OK)
   {
      /* Allocate memory for the two structures required by the lower level API */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费看黄yyy456| 久久综合丝袜日本网| 国产成人精品免费| 激情综合色综合久久综合| 日韩电影在线观看网站| 亚洲aaa精品| 亚洲国产aⅴ天堂久久| 五月天视频一区| 日韩电影一区二区三区| 久久激情综合网| 国产成人aaa| 99热精品国产| 欧美在线观看18| 欧美一区二区在线视频| 欧美一级日韩免费不卡| 日韩久久久久久| 欧美大片一区二区| 日韩免费在线观看| 国产精品久久久久永久免费观看 | 一区二区三区免费看视频| 亚洲视频每日更新| 午夜精品成人在线视频| 偷拍一区二区三区四区| 国产中文字幕一区| av成人免费在线观看| 91视频一区二区| 91精品欧美久久久久久动漫| 久久女同互慰一区二区三区| 欧美韩日一区二区三区四区| 欧美国产国产综合| 亚洲国产精品久久久久秋霞影院| 午夜精品在线看| 国产91丝袜在线播放| 欧美裸体bbwbbwbbw| 国产午夜一区二区三区| 亚洲成人自拍偷拍| 成人黄色大片在线观看| 91精品视频网| 亚洲欧美偷拍三级| 国产一区二区0| 欧美日韩免费电影| 中文字幕一区二区三区不卡| 日韩高清电影一区| 日本道免费精品一区二区三区| 日韩欧美另类在线| 亚洲综合男人的天堂| 国产成人精品在线看| 欧美一区二区久久| 一区二区三区四区精品在线视频| 极品瑜伽女神91| 91麻豆精品国产91久久久久| 亚洲精品五月天| 国产99一区视频免费 | 91麻豆6部合集magnet| 日韩视频一区在线观看| 亚洲精品视频在线观看网站| 久久成人久久鬼色| 欧美老女人在线| 亚洲国产精华液网站w| 久久精品国产精品青草| 欧美肥妇bbw| 亚洲色图视频网站| 欧美日韩日本视频| 亚洲一区在线免费观看| 亚洲国产成人tv| 色综合天天综合狠狠| 国产精品免费久久久久| 久久机这里只有精品| 日韩一区二区不卡| 久久爱www久久做| 欧美一区三区二区| 日韩精品午夜视频| 在线成人免费观看| 亚洲v精品v日韩v欧美v专区| 在线观看一区二区精品视频| 一区二区三区不卡视频| 91麻豆视频网站| 亚洲欧美偷拍卡通变态| 色婷婷av久久久久久久| 久久久精品国产免费观看同学| 极品少妇一区二区三区精品视频| 日韩亚洲国产中文字幕欧美| 日本不卡在线视频| 欧美性色aⅴ视频一区日韩精品| 亚洲综合色丁香婷婷六月图片| 91热门视频在线观看| 亚洲午夜影视影院在线观看| 6080yy午夜一二三区久久| 蜜桃久久av一区| 91精品免费观看| 国产真实精品久久二三区| 欧美国产一区二区| 99r国产精品| 肉肉av福利一精品导航| 欧美zozozo| 不卡视频一二三| 一区二区三区精密机械公司| 欧美乱熟臀69xxxxxx| 日韩av中文在线观看| 欧美精品一区二区三区一线天视频 | 亚洲精品成人天堂一二三| 欧美综合一区二区三区| 性做久久久久久| 国产亚洲精品bt天堂精选| 色婷婷精品大在线视频| 亚洲精品伦理在线| 欧美一区二区三区婷婷月色| 懂色av一区二区三区蜜臀 | 久久精品国产久精国产爱| 国产欧美一区二区精品忘忧草| 91免费看`日韩一区二区| 天涯成人国产亚洲精品一区av| 国产亚洲精品中文字幕| 欧美日韩国产一级二级| 国产精品综合二区| 一区二区欧美精品| 久久久综合九色合综国产精品| 日本丶国产丶欧美色综合| 国产最新精品免费| 五月婷婷久久综合| 中文字幕一区日韩精品欧美| 欧美一区二区三区精品| 97se亚洲国产综合自在线观| 捆绑变态av一区二区三区| 亚洲综合久久久| 欧美激情一区二区三区| 日韩一区二区在线免费观看| 91色在线porny| 国产69精品久久久久毛片| 日韩和欧美一区二区三区| 亚洲视频一二三区| 国产日本欧美一区二区| 日韩精品一区在线观看| 欧美性大战xxxxx久久久| 波多野结衣亚洲一区| 美女网站色91| 五月婷婷欧美视频| 亚洲一卡二卡三卡四卡无卡久久| 久久久国产精品麻豆| 欧美日韩美少妇| 一本大道久久a久久精品综合| 国产福利91精品一区二区三区| 日日夜夜免费精品| 亚洲一区在线看| 国产精品丝袜黑色高跟| 日本一区二区三区国色天香| 精品国产麻豆免费人成网站| 91精品国产一区二区三区| 91极品视觉盛宴| 在线看国产一区二区| 91久久精品午夜一区二区| 99精品一区二区三区| av不卡免费电影| 色综合天天做天天爱| 91在线无精精品入口| 色婷婷久久久综合中文字幕| 色视频一区二区| 欧美视频在线播放| 欧美精品第1页| 日韩免费视频一区| 欧美电视剧免费观看| 久久久综合视频| 亚洲欧洲一区二区三区| 一区二区三区在线看| 视频一区二区中文字幕| 老司机精品视频在线| 国产一区二区三区高清播放| 成人久久视频在线观看| 色猫猫国产区一区二在线视频| 欧美性猛片xxxx免费看久爱| 在线综合+亚洲+欧美中文字幕| 日韩精品一区二区三区视频播放| 欧美精品一区二区三区蜜桃视频 | 欧美一区二区精品在线| 久久亚洲春色中文字幕久久久| 国产欧美精品区一区二区三区 | 成人午夜电影小说| 99这里只有久久精品视频| 色噜噜狠狠色综合中国| 欧美一a一片一级一片| 日韩欧美一卡二卡| 国产精品美女久久久久久久网站| 亚洲另类色综合网站| 日韩主播视频在线| 国产激情精品久久久第一区二区| 91日韩在线专区| 精品久久久久99| 一区二区三区精品视频在线| 久久电影网站中文字幕| 97aⅴ精品视频一二三区| 欧美一区日韩一区| 亚洲欧洲综合另类| 国产一区二区在线观看免费| 一本久道中文字幕精品亚洲嫩| 91精品久久久久久久99蜜桃| 国产精品美日韩| 日本亚洲最大的色成网站www| 韩日精品视频一区| 精品视频999| 国产精品久久久久影院亚瑟|