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

📄 netif.lst.svn-base

📁 数字广播系统的开发源码
💻 SVN-BASE
字号:
C51 COMPILER V7.06   NETIF                                                                 07/24/2007 16:32:47 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE NETIF
OBJECT MODULE PLACED IN E:\NETBRO~1\TRUNK\NETBRO~1\VW\NETIF.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE E:\NETBRO~1\TRUNK\NETBRO~1\VW\NETIF.C DB SB OE

stmt level    source

   1          /*
   2           */
   3          
   4          #include "GloblDef.h"
   5          #include "TCPIPmem.h"
   6          #include "IP.h"
   7          #include "Netif.h"
   8          
   9          /* You can get a new netif from NetIfPool */
  10          static struct SNetIf xdata NetIfPool[NET_IF_MAX_NUM];
  11          
  12          /* list hearder of free Netifs buffer */
  13          static struct SNetIf xdata * xdata NetIfFreeList;
  14          
  15          /* list header of Netifs */
  16          static struct SNetIf xdata * xdata NetIfList;
  17          
  18          void NetIfInit() reentrant
  19          {
  20   1              unsigned int count;
  21   1      
  22   1              /* inti NetIfList */
  23   1              NetIfList = NULL;
  24   1      
  25   1              /* inti FreeList, chain up NetIfPool */
  26   1              for(count = 0, NetIfFreeList = NULL; count < NET_IF_MAX_NUM; count++)
  27   1              {
  28   2                      NetIfPool[count].pNext = NetIfFreeList;
  29   2                      NetIfFreeList = &NetIfPool[count];
  30   2              }
  31   1      }
  32          
  33          /* add a netif to list, return NULL if insufficient mem */
  34          struct SNetIf xdata * NetIfAdd(unsigned short IPAddr, unsigned short NetMask,unsigned short GateWay,
  35                                                           void (code * input)(struct SNetIf xdata * NetIf) reentrant,
  36                                                           BOOL (code * output)(struct SMemHead xdata *MemHead,struct SNetIf xdata* NetIf,unsigned short DestI
             -P) reentrant,
  37                                                           void xdata * Info) reentrant
  38          {
  39   1              struct SNetIf xdata * NetIf;
  40   1      
  41   1              /* get netif from free list */
  42   1              NetIf = NetIfFreeList;
  43   1              NetIfFreeList = NetIfFreeList->pNext;
  44   1      
  45   1              /* if add more than NET_IF_MAX_NUM return NULL */
  46   1              if(NetIf == NULL)
  47   1                      return NULL;
  48   1              else
  49   1              {
  50   2                      NetIf->IPAddr   = htonl(IPAddr);
  51   2                      NetIf->NetMask  = htonl(NetMask);
  52   2                      NetIf->GateWay  = htonl(GateWay);
  53   2                      NetIf->input    = input;
  54   2                      NetIf->output   = output;
C51 COMPILER V7.06   NETIF                                                                 07/24/2007 16:32:47 PAGE 2   

  55   2                      NetIf->Info             = Info;
  56   2      
  57   2                      /* add to the head of the list */
  58   2                      NetIf->pNext = NetIfList;
  59   2                      NetIfList = NetIf;
  60   2      
  61   2                      return NetIf;
  62   2              }
  63   1      }
  64          
  65          /* find a netif which NetIf->NetMask & NetIf->NetAddr ==
  66          NetIf->NetMask & IPAddr */
  67          struct SNetIf xdata * NetIfFindRout(IP_ADDR IPAddr) reentrant
  68          {
  69   1              struct SNetIf xdata *NetIf;
  70   1              for(NetIf = NetIfList; NetIf != NULL; NetIf = NetIf->pNext)
  71   1              {
  72   2                      if((NetIf->NetMask & NetIf->IPAddr) == (NetIf->NetMask & IPAddr))
  73   2                              return NetIf;
  74   2              }
  75   1      
  76   1              /* if can't find any suitable Netif, return NetIfList. That is the
  77   1              first netif is the default Netif*/
  78   1              return NetIfList;
  79   1      }
  80          
  81          struct SNetIf xdata * NetIfFindIP(IP_ADDR IPAddr) reentrant
  82          {
  83   1              struct SNetIf xdata *pNetIf;
  84   1              for(pNetIf = NetIfList; pNetIf != NULL; pNetIf = pNetIf->pNext)
  85   1              {
  86   2                      if(pNetIf->IPAddr == IPAddr)
  87   2                              break;
  88   2              }
  89   1              return pNetIf;
  90   1      }
  91          
  92          /* net inteftimer. use to packup packet from every net interface */
  93          void NetIfTimer() reentrant
  94          {
  95   1              struct SNetIf xdata * NetIf;
  96   1      
  97   1              /* if netif has data to come in */
  98   1              for(NetIf = NetIfList; NetIf != NULL; NetIf = NetIf->pNext)
  99   1                      NetIf->input(NetIf);
 100   1      }
C51 COMPILER V7.06   NETIF                                                                 07/24/2007 16:32:47 PAGE 3   

NAME                                    CLASS   MSPACE  TYPE    OFFSET  SIZE
====                                    =====   ======  ====    ======  ====


DWORD. . . . . . . . . . . . . . . . .  TYPEDEF  -----  U_INT    -----  2
_?NetIfAdd . . . . . . . . . . . . . .  PUBLIC   CODE   PROC     0000H  -----
  IPAddr . . . . . . . . . . . . . . .  AUTO     IDATA  U_INT    0002H  2
  NetMask. . . . . . . . . . . . . . .  AUTO     IDATA  U_INT    0004H  2
  GateWay. . . . . . . . . . . . . . .  AUTO     IDATA  U_INT    0006H  2
  input. . . . . . . . . . . . . . . .  AUTO     IDATA  PTR      0008H  2
  output . . . . . . . . . . . . . . .  AUTO     IDATA  PTR      000AH  2
  Info . . . . . . . . . . . . . . . .  AUTO     IDATA  VOID_PTR 000CH  2
  NetIf. . . . . . . . . . . . . . . .  AUTO     IDATA  PTR      0000H  2
_?NetIfInit. . . . . . . . . . . . . .  PUBLIC   CODE   PROC     0000H  -----
  count. . . . . . . . . . . . . . . .  AUTO     IDATA  U_INT    0000H  2
_?NetIfFindIP. . . . . . . . . . . . .  PUBLIC   CODE   PROC     0000H  -----
  IPAddr . . . . . . . . . . . . . . .  AUTO     IDATA  U_LONG   0002H  4
  pNetIf . . . . . . . . . . . . . . .  AUTO     IDATA  PTR      0000H  2
_?NetIfFindRout. . . . . . . . . . . .  PUBLIC   CODE   PROC     0000H  -----
  IPAddr . . . . . . . . . . . . . . .  AUTO     IDATA  U_LONG   0002H  4
  NetIf. . . . . . . . . . . . . . . .  AUTO     IDATA  PTR      0000H  2
SNetIf . . . . . . . . . . . . . . . .  * TAG *  -----  STRUCT   -----  20
  pNext. . . . . . . . . . . . . . . .  MEMBER   -----  PTR      0000H  2
  IPAddr . . . . . . . . . . . . . . .  MEMBER   -----  U_LONG   0002H  4
  NetMask. . . . . . . . . . . . . . .  MEMBER   -----  U_LONG   0006H  4
  GateWay. . . . . . . . . . . . . . .  MEMBER   -----  U_LONG   000AH  4
  input. . . . . . . . . . . . . . . .  MEMBER   -----  PTR      000EH  2
  output . . . . . . . . . . . . . . .  MEMBER   -----  PTR      0010H  2
  Info . . . . . . . . . . . . . . . .  MEMBER   -----  VOID_PTR 0012H  2
BOOL . . . . . . . . . . . . . . . . .  TYPEDEF  -----  U_CHAR   -----  1
BYTE . . . . . . . . . . . . . . . . .  TYPEDEF  -----  U_CHAR   -----  1
WORD . . . . . . . . . . . . . . . . .  TYPEDEF  -----  U_INT    -----  2
SIPHead. . . . . . . . . . . . . . . .  * TAG *  -----  STRUCT   -----  20
  Ver_HeadLen. . . . . . . . . . . . .  MEMBER   -----  U_CHAR   0000H  1
  ServeType. . . . . . . . . . . . . .  MEMBER   -----  U_CHAR   0001H  1
  TotalLen . . . . . . . . . . . . . .  MEMBER   -----  U_INT    0002H  2
  FragmentID . . . . . . . . . . . . .  MEMBER   -----  U_INT    0004H  2
  FragmentFlag_Offset. . . . . . . . .  MEMBER   -----  U_INT    0006H  2
  LifeLength . . . . . . . . . . . . .  MEMBER   -----  U_CHAR   0008H  1
  Protocol . . . . . . . . . . . . . .  MEMBER   -----  U_CHAR   0009H  1
  CheckSum . . . . . . . . . . . . . .  MEMBER   -----  U_INT    000AH  2
  IPScr. . . . . . . . . . . . . . . .  MEMBER   -----  U_LONG   000CH  4
  IPDest . . . . . . . . . . . . . . .  MEMBER   -----  U_LONG   0010H  4
SMemHead . . . . . . . . . . . . . . .  * TAG *  -----  STRUCT   -----  9
  pNext. . . . . . . . . . . . . . . .  MEMBER   -----  PTR      0000H  2
  pPre . . . . . . . . . . . . . . . .  MEMBER   -----  PTR      0002H  2
  used . . . . . . . . . . . . . . . .  MEMBER   -----  U_CHAR   0004H  1
  pStart . . . . . . . . . . . . . . .  MEMBER   -----  PTR      0005H  2
  pEnd . . . . . . . . . . . . . . . .  MEMBER   -----  PTR      0007H  2
NetIfPool. . . . . . . . . . . . . . .  STATIC   XDATA  ARRAY    0000H  20
NetIfList. . . . . . . . . . . . . . .  STATIC   XDATA  PTR      0014H  2
NetIfFreeList. . . . . . . . . . . . .  STATIC   XDATA  PTR      0016H  2
_?NetIfTimer . . . . . . . . . . . . .  PUBLIC   CODE   PROC     0000H  -----
  NetIf. . . . . . . . . . . . . . . .  AUTO     IDATA  PTR      0000H  2


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    776    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =     24    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
C51 COMPILER V7.06   NETIF                                                                 07/24/2007 16:32:47 PAGE 4   

   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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