📄 httpd.lst
字号:
C51 COMPILER V9.00 HTTPD 02/08/2010 20:58:33 PAGE 1
C51 COMPILER V9.00, COMPILATION OF MODULE HTTPD
OBJECT MODULE PLACED IN .\httpd.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\uip1.0\apps\httpd\httpd.c LARGE BROWSE INCDIR(..\uip1.0\apps;..\uip1.0\u
-ip;..\cp2200;..\cp2200;..\uip1.0\apps\dhcpc;..\uip1.0\apps\httpd) DEBUG OBJECTEXTEND PRINT(.\httpd.lst) OBJECT(.\httpd.o
-bj)
line level source
1 //*****************************************************************************
2 // HTTP server.
3 // Adam Dunkels <adam@dunkels.com>
4 //
5 // Copyright (c) 2001, Adam Dunkels.
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 // 1. Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 // 2. Redistributions in binary form must reproduce the above copyright
14 // notice, this list of conditions and the following disclaimer in the
15 // documentation and/or other materials provided with the distribution.
16 // 3. The name of the author may not be used to endorse or promote
17 // products derived from this software without specific prior
18 // written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
21 // OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 // ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
24 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 //
32 // This file is part of the uIP TCP/IP stack.
33 //
34 //*****************************************************************************
35
36 #include "uip.h"
37 #include "httpd.h"
38 #include "string.h" //包含NULL
39 #include "pt.h"
40
41 //*****************************************************************************
42 //
43 // Macro for easy access to buffer data
44 //
45 //*****************************************************************************
46 #define BUF_APPDATA ((u8_t *)uip_appdata)
47
48 //*****************************************************************************
49 //
50 // Definitions of HTTP Server States
51 //
52 //*****************************************************************************
53 #define HTTP_NOGET 0
C51 COMPILER V9.00 HTTPD 02/08/2010 20:58:33 PAGE 2
54 #define HTTP_FILE 1
55 #define HTTP_TEXT 2
56 #define HTTP_FUNC 3
57 #define HTTP_END 4
58
59 //*****************************************************************************
60 //
61 // Global for keeping up with web server state.
62 //
63 //*****************************************************************************
64 struct httpd_state *hs;
65 u16_t pass_flag;
66 static struct uip_udp_conn *udp_set_conn = NULL;
67
68 //*****************************************************************************
69 void
70 httpd_init(void)
71 {
72 1 //
73 1 // Listen to port 80.
74 1 //
75 1
76 1 uip_listen(HTONS(80));
77 1 }
78 //*****************************************************************************
79
80 //*****************************************************************************
81 //
82 // HTTP Application Callback Function
83 //
84 //*****************************************************************************
85 void
86 httpd_appcall(void)
87 {
88 1
89 1 hs = (struct httpd_state *)&(uip_conn->appstate);
90 1
91 1 if(uip_connected())
92 1 {
93 2 hs->count = 0;
94 2 uip_send(BUF_APPDATA,0);
95 2 return;
96 2 }
97 1
98 1 if(uip_newdata()||uip_rexmit())
99 1 {
100 2 if(uip_datalen()>0)
101 2 {
102 3 if((BUF_APPDATA[0]=='p')&&\
103 3 (BUF_APPDATA[1]=='a')&&\
104 3 (BUF_APPDATA[2]=='s')&&\
105 3 (BUF_APPDATA[3]=='s'))
106 3 {
107 4 pass_flag=1;
108 4 }
109 3 }
110 2 else
111 2 {
112 3 ;
113 3 }
114 2 }
115 1
C51 COMPILER V9.00 HTTPD 02/08/2010 20:58:33 PAGE 3
116 1 if (uip_poll())
117 1 {
118 2 if(pass_flag)
119 2 {
120 3 pass_flag=0;
121 3 BUF_APPDATA="Adam Dunkels <adam@dunkels.com> Copyright (c) 2001, Adam Dunkels. All rights res
-erved.";
122 3 uip_len=sizeof("Adam Dunkels <adam@dunkels.com> Copyright (c) 2001, Adam Dunkels. All rights res
-erved.");
123 3 hs->count = 0;
124 3 uip_send(BUF_APPDATA,uip_len);
125 3 return;
126 3 }
127 2 }
128 1
129 1
130 1 }
131
132
133
134
135
136
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 242 ----
CONSTANT SIZE = 87 ----
XDATA SIZE = 8 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
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 + -