1 |
hedin |
15 |
/*********************************************************************
|
2 |
|
|
*
|
3 |
|
|
* HTTP definitions on Microchip TCP/IP Stack
|
4 |
|
|
*
|
5 |
|
|
*********************************************************************
|
6 |
|
|
* FileName: Http.h
|
7 |
|
|
* Dependencies: None
|
8 |
|
|
* Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
|
9 |
|
|
* Complier: Microchip C18 v3.02 or higher
|
10 |
|
|
* Microchip C30 v2.01 or higher
|
11 |
|
|
* Company: Microchip Technology, Inc.
|
12 |
|
|
*
|
13 |
|
|
* Software License Agreement
|
14 |
|
|
*
|
15 |
|
|
* Copyright © 2002-2007 Microchip Technology Inc. All rights
|
16 |
|
|
* reserved.
|
17 |
|
|
*
|
18 |
|
|
* Microchip licenses to you the right to use, modify, copy, and
|
19 |
|
|
* distribute:
|
20 |
|
|
* (i) the Software when embedded on a Microchip microcontroller or
|
21 |
|
|
* digital signal controller product (“Device”) which is
|
22 |
|
|
* integrated into Licensee’s product; or
|
23 |
|
|
* (ii) ONLY the Software driver source files ENC28J60.c and
|
24 |
|
|
* ENC28J60.h ported to a non-Microchip device used in
|
25 |
|
|
* conjunction with a Microchip ethernet controller for the
|
26 |
|
|
* sole purpose of interfacing with the ethernet controller.
|
27 |
|
|
*
|
28 |
|
|
* You should refer to the license agreement accompanying this
|
29 |
|
|
* Software for additional information regarding your rights and
|
30 |
|
|
* obligations.
|
31 |
|
|
*
|
32 |
|
|
* THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT
|
33 |
|
|
* WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
|
34 |
|
|
* LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
35 |
|
|
* PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
36 |
|
|
* MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
|
37 |
|
|
* CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
|
38 |
|
|
* PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
|
39 |
|
|
* BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
|
40 |
|
|
* THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
|
41 |
|
|
* SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
|
42 |
|
|
* (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
|
43 |
|
|
*
|
44 |
|
|
*
|
45 |
|
|
* Author Date Comment
|
46 |
|
|
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
47 |
|
|
* Nilesh Rajbharti 8/14/01 Original (Rev. 1.0)
|
48 |
|
|
* Nilesh Rajbharti 2/9/02 Cleanup
|
49 |
|
|
* Nilesh Rajbharti 5/22/02 Rev 2.0 (See version.log for detail)
|
50 |
|
|
********************************************************************/
|
51 |
|
|
#ifndef __HTTP_H
|
52 |
|
|
#define __HTTP_H
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
#define HTTP_PORT (80u)
|
56 |
|
|
|
57 |
|
|
#define HTTP_START_OF_VAR (0x0000u)
|
58 |
|
|
#define HTTP_END_OF_VAR (0xFFFFu)
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
/*********************************************************************
|
62 |
|
|
* Function: void HTTPInit(void)
|
63 |
|
|
*
|
64 |
|
|
* PreCondition: TCP must already be initialized.
|
65 |
|
|
*
|
66 |
|
|
* Input: None
|
67 |
|
|
*
|
68 |
|
|
* Output: HTTP FSM and connections are initialized
|
69 |
|
|
*
|
70 |
|
|
* Side Effects: None
|
71 |
|
|
*
|
72 |
|
|
* Overview: Set all HTTP connections to Listening state.
|
73 |
|
|
* Initialize FSM for each connection.
|
74 |
|
|
*
|
75 |
|
|
* Note: This function is called only one during lifetime
|
76 |
|
|
* of the application.
|
77 |
|
|
********************************************************************/
|
78 |
|
|
void HTTPInit(void);
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
/*********************************************************************
|
82 |
|
|
* Function: void HTTPServer(void)
|
83 |
|
|
*
|
84 |
|
|
* PreCondition: HTTPInit() must already be called.
|
85 |
|
|
*
|
86 |
|
|
* Input: None
|
87 |
|
|
*
|
88 |
|
|
* Output: Opened HTTP connections are served.
|
89 |
|
|
*
|
90 |
|
|
* Side Effects: None
|
91 |
|
|
*
|
92 |
|
|
* Overview: Browse through each connections and let it
|
93 |
|
|
* handle its connection.
|
94 |
|
|
* If a connection is not finished, do not process
|
95 |
|
|
* next connections. This must be done, all
|
96 |
|
|
* connections use some static variables that are
|
97 |
|
|
* common.
|
98 |
|
|
*
|
99 |
|
|
* Note: This function acts as a task (similar to one in
|
100 |
|
|
* RTOS). This function performs its task in
|
101 |
|
|
* co-operative manner. Main application must call
|
102 |
|
|
* this function repeatdly to ensure all open
|
103 |
|
|
* or new connections are served on time.
|
104 |
|
|
********************************************************************/
|
105 |
|
|
void HTTPServer(void);
|
106 |
|
|
|
107 |
|
|
#if defined(__HTTP_C)
|
108 |
|
|
/*
|
109 |
|
|
* Main application must implement these callback functions
|
110 |
|
|
* to complete Http.c implementation.
|
111 |
|
|
*/
|
112 |
|
|
extern WORD HTTPGetVar(BYTE var, WORD ref, BYTE* val);
|
113 |
|
|
extern void HTTPExecCmd(BYTE** argv, BYTE argc);
|
114 |
|
|
#endif
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
#endif
|