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

📄 libif.lst

📁 世纪民生公司的带网络功能的单片机CS6209开发http服务器的演示源代码。
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   LIBIF                                                                 10/12/2006 15:31:39 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE LIBIF
OBJECT MODULE PLACED IN .\Release\libif.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE libif.c LARGE OPTIMIZE(9,SIZE) BROWSE ORDER MODDP2 INCDIR(e:\releasePackage
                    -\release\inc\;..\..\inc\) DEBUG OBJECTEXTEND PRINT(.\Release\libif.lst) OBJECT(.\Release\libif.obj)

line level    source

   1          /*
   2           * 
   3           * libif.c
   4           * 
   5           * Part of the Myson Century CS620X     Ping demo program.
   6           *
   7           * Authors: LY Lin, WM Wang, IJ Chen, WH Lee
   8           *
   9           * libif.c contains ethernet and protocol stack interface routines.
  10           *
  11           * This program was developed using the Keil 8051 C uVision 2 system.
  12           * The Keil compiler MUST be used if working with Myson Century supplied
  13           * firmware.
  14           *
  15           * This program must be linked with the 620xlib.LIB library 
  16           * supplied     by Myson Century in object module form.  
  17           * 
  18           *
  19           * Note: Do not remove or rename any function or variable in this file.
  20          */
  21          
  22          #define LIBIF_C
  23          #include <stdio.h>
  24          #include <ctype.h>
  25          #include <stdlib.h>
  26          #include <string.h>
  27          
  28          #include "hpserver.h"
  29          #include "620xenet.h"
  30          #include "timer.h"
  31          #include "ether.h"
  32          #include "netutil.h"
  33          #include "net.h"
  34          #include "ip.h"
  35          #include "tcp.h"
  36          #include "config.h"
  37          #include "http.h"
  38          
  39          /* Frame for network Tx/Rx */
  40          GENFRAME genframe;                  
  41          
  42          /* My Ethernet and IP addresses */
  43          NODE  locnode;                      
  44          unsigned char gfp_buff_flag=0; 
  45          /************************************************************************
  46          /*      Function Name : locnode                                                                                         *
  47          /*                                                                                                                                              *
  48          /*      Arguments :                                                                                                             *
  49          /*                      int n :locnode index to get.                                                            * 
  50          /*                                                                                                                                              *
  51          /*      Return :                                                                                                                        *               
  52          /*                      Return ptr to local node 'n' (n=0 for first) or                         *
  53          /*                      return 0 if doesn't exist                                                                       *
  54          /*                                                                                                                                              *
C51 COMPILER V7.50   LIBIF                                                                 10/12/2006 15:31:39 PAGE 2   

  55          /*  Comment :                                                                                                                   *
  56          /*                      This function Used by IP functions to get netmask &             *
  57          /*                      gateway addresses.                                                                                      *
  58          /*                                                                                                                                              *
  59          /************************************************************************/
  60          NODE *locnode_n(int n)
  61          {
  62   1          return(n==0 ? &locnode : 0);
  63   1      }
  64          
  65          /************************************************************************
  66          /*      Function Name : server_action                                                                           *
  67          /*                                                                                                                                              *
  68          /*      Arguments :                                                                                                             *
  69          /*                      TSOCK *ts :Point to current socket.                                                     * 
  70          /*                      CONN_STATE conn : connect state of current socket.                      *
  71          /*                                                                                                                                              *
  72          /*      Return :                                                                                                                        *               
  73          /*                      Return 0 to prevent connection opening, or close                        *
  74          /*                      if connected.                                                                                           *
  75          /*                                                                                                                                              *
  76          /*  Comment :                                                                                                                   *
  77          /*                      This function upcall from TCP stack to server when opening, *
  78          /*                      connecting,receiving data or closing a port.                            *
  79          /*                                                                                                                                              *
  80          /************************************************************************/
  81          int server_action(TSOCK *ts, CONN_STATE conn)
  82          {
  83   1          WORD port;
  84   1      
  85   1              /* Uncomment this line to set the Urgent and Push Flag in the TCP/IP packet. */
  86   1              ts->connflags = ts->connflags|TURGE|TPUSH;
  87   1      
  88   1          port = ts->loc.port;
  89   1      
  90   1          switch (port){
  91   2              case 80: /*http*/
  92   2                      /*place code for HTTP server*/
  93   2                              return(http_server(ts, conn));
  94   2              case 23: /*telnet*/
  95   2                      /*place code for TELNET server*/
  96   2                              break;
  97   2              default:   
  98   2                              /*The port is not in our service. return 0 to close socket.*/
  99   2                      return 0;
 100   2              }
 101   1              return 0;
 102   1      }
 103          
 104          /************************************************************************
 105          /*      Function Name : server_action                                                                           *
 106          /*                                                                                                                                              *
 107          /*      Arguments :                                                                                                             *
 108          /*                      TSOCK *ts :Point to current socket.                                                     * 
 109          /*                      CONN_STATE conn : connect state of current socket.                      *
 110          /*                                                                                                                                              *
 111          /*      Return :                                                                                                                        *               
 112          /*                      Return 0 to prevent connection opening, or close                        *
 113          /*                      if connected.                                                                                           *
 114          /*                                                                                                                                              *
 115          /*  Comment :                                                                                                                   *
 116          /*                      This function upcall from TCP stack to client when opening, *
C51 COMPILER V7.50   LIBIF                                                                 10/12/2006 15:31:39 PAGE 3   

 117          /*                      connecting,receiving data or closing a port.                            *
 118          /*                                                                                                                                              *

⌨️ 快捷键说明

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