亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
激情综合网av| 奇米影视一区二区三区| 99re这里都是精品| 1000精品久久久久久久久| 不卡影院免费观看| 亚洲已满18点击进入久久| 欧美精选午夜久久久乱码6080| 视频一区二区三区入口| 久久久亚洲精品石原莉奈| 成人av资源在线观看| 亚洲人成电影网站色mp4| 在线观看日韩av先锋影音电影院| 午夜精品国产更新| 精品sm捆绑视频| 不卡av免费在线观看| 亚洲成人免费视频| 精品成人在线观看| 色美美综合视频| 青娱乐精品视频在线| 亚洲国产精品t66y| 欧美婷婷六月丁香综合色| 久99久精品视频免费观看| 中文字幕免费不卡在线| 欧美日韩在线综合| 国产资源在线一区| 亚洲乱码一区二区三区在线观看| 欧美剧情电影在线观看完整版免费励志电影 | 久久这里都是精品| 99久久免费精品| 日韩精品久久理论片| 国产精品嫩草影院com| 欧美日韩高清一区二区三区| 国产一区二区在线观看免费| 亚洲精品成人少妇| 久久一二三国产| 欧美天天综合网| 国产高清不卡一区二区| 亚洲成人先锋电影| 国产精品女主播av| 日韩欧美国产精品| 一本色道久久综合亚洲精品按摩| 狠狠v欧美v日韩v亚洲ⅴ| 亚洲午夜一区二区三区| 国产精品全国免费观看高清| 欧美一区三区四区| 欧美亚洲综合网| 成人精品免费网站| 狠狠狠色丁香婷婷综合久久五月| 亚洲成人动漫精品| 依依成人精品视频| 亚洲国产精品精华液ab| xnxx国产精品| 日韩视频在线永久播放| 欧美午夜一区二区| 成人午夜精品一区二区三区| 九九九久久久精品| 午夜视频在线观看一区| 亚洲欧美日韩综合aⅴ视频| 国产丝袜美腿一区二区三区| 欧美一二三四在线| 欧美人体做爰大胆视频| 91国在线观看| 色综合久久久网| k8久久久一区二区三区 | 97久久超碰国产精品电影| 韩国av一区二区三区| 青草av.久久免费一区| 午夜激情一区二区三区| 亚洲gay无套男同| 亚洲成人自拍网| 亚洲狠狠爱一区二区三区| 亚洲免费av网站| 亚洲青青青在线视频| 综合在线观看色| 国产精品美女久久久久高潮| 国产精品蜜臀av| 国产精品不卡一区二区三区| 中文字幕中文字幕在线一区| 国产精品乱人伦| 中文字幕一区视频| 一区二区三区欧美| 亚洲国产成人porn| 日韩精彩视频在线观看| 麻豆精品一区二区三区| 国产在线麻豆精品观看| 粉嫩av一区二区三区在线播放| 成人18视频日本| 色猫猫国产区一区二在线视频| 91国模大尺度私拍在线视频| 欧美系列一区二区| 日韩午夜激情免费电影| 久久久影院官网| 自拍偷拍欧美激情| 亚洲一区二区三区小说| 天堂午夜影视日韩欧美一区二区| 免费高清在线视频一区·| 国模少妇一区二区三区| 国产成人精品亚洲日本在线桃色| yourporn久久国产精品| 色婷婷av一区二区三区软件| 欧美日韩国产大片| 精品国产91乱码一区二区三区| 久久精品这里都是精品| 日韩理论片一区二区| 亚洲一区影音先锋| 老色鬼精品视频在线观看播放| 国产主播一区二区| 日本韩国欧美一区| 日韩欧美精品在线视频| 欧美韩国一区二区| 亚洲午夜在线视频| 国产精品99久久不卡二区| 91久久精品一区二区三区| 精品区一区二区| 亚洲图片激情小说| 玖玖九九国产精品| 91在线看国产| 日韩欧美aaaaaa| 亚洲专区一二三| 国产在线精品一区二区不卡了| 色综合夜色一区| 日韩一级片网址| 亚洲精品va在线观看| 国产在线播放一区三区四| 欧美在线免费观看亚洲| 久久精品视频在线看| 亚洲图片自拍偷拍| 丁香天五香天堂综合| 日韩欧美国产一区二区三区 | 高清久久久久久| 欧美日韩精品一区二区在线播放| 国产蜜臀av在线一区二区三区| 婷婷丁香久久五月婷婷| 97se亚洲国产综合在线| 欧美刺激脚交jootjob| 一区二区久久久| av在线一区二区| 久久久久一区二区三区四区| 日韩国产一二三区| 在线观看不卡一区| 国产日韩欧美一区二区三区乱码| 免费成人美女在线观看.| 欧美在线观看视频在线| 亚洲色图都市小说| 国产成人午夜高潮毛片| 欧美一卡二卡三卡| 亚洲国产精品综合小说图片区| 白白色 亚洲乱淫| 欧美激情综合网| 国模一区二区三区白浆| 日韩午夜在线观看视频| 午夜精品久久久久久久99樱桃| 一本色道久久综合狠狠躁的推荐| 欧美国产1区2区| 国产激情一区二区三区| 精品国产欧美一区二区| 日本亚洲欧美天堂免费| 在线综合视频播放| 偷拍一区二区三区| 欧美日韩电影一区| 亚洲成人资源网| 91精品国产aⅴ一区二区| 偷拍亚洲欧洲综合| 4438成人网| 免费一级片91| 欧美白人最猛性xxxxx69交| 久久国内精品视频| 日韩欧美国产三级电影视频| 久99久精品视频免费观看| 日韩免费福利电影在线观看| 精品无码三级在线观看视频| 精品久久久久久久人人人人传媒 | 欧美日韩一区二区欧美激情| 亚洲va欧美va人人爽午夜| 欧美亚洲动漫另类| 午夜视频一区在线观看| 欧美一区二区三区在| 美女性感视频久久| 久久综合999| 99久久婷婷国产综合精品电影| 亚洲三级在线播放| 欧美亚洲一区二区在线观看| 视频一区二区三区入口| 精品久久久久久最新网址| 国产成人超碰人人澡人人澡| 成人欧美一区二区三区视频网页| 91麻豆免费观看| 丝袜亚洲另类丝袜在线| 精品久久久久一区二区国产| 成人综合婷婷国产精品久久| 亚洲精品成人少妇| 日韩三级电影网址| 懂色av中文字幕一区二区三区| 亚洲日本在线天堂| 91精品久久久久久久99蜜桃| 国内精品免费在线观看| 亚洲裸体在线观看| 日韩欧美区一区二| 色综合久久久网| 精品在线观看免费|