1 |
hedin |
62 |
/*********************************************************************
|
2 |
|
|
*
|
3 |
|
|
* HTTP definitions on Microchip TCP/IP Stack
|
4 |
|
|
*
|
5 |
|
|
*********************************************************************
|
6 |
|
|
* FileName: Http.h
|
7 |
|
|
* Dependencies: None
|
8 |
|
|
* Processor: PIC18
|
9 |
|
|
* Complier: MCC18 v1.00.50 or higher
|
10 |
|
|
* HITECH PICC-18 V8.10PL1 or higher
|
11 |
|
|
* Company: Microchip Technology, Inc.
|
12 |
|
|
*
|
13 |
|
|
* Software License Agreement
|
14 |
|
|
*
|
15 |
|
|
* The software supplied herewith by Microchip Technology Incorporated
|
16 |
|
|
* (the “Company”) for its PICmicro® Microcontroller is intended and
|
17 |
|
|
* supplied to you, the Company’s customer, for use solely and
|
18 |
|
|
* exclusively on Microchip PICmicro Microcontroller products. The
|
19 |
|
|
* software is owned by the Company and/or its supplier, and is
|
20 |
|
|
* protected under applicable copyright laws. All rights are reserved.
|
21 |
|
|
* Any use in violation of the foregoing restrictions may subject the
|
22 |
|
|
* user to criminal sanctions under applicable laws, as well as to
|
23 |
|
|
* civil liability for the breach of the terms and conditions of this
|
24 |
|
|
* license.
|
25 |
|
|
*
|
26 |
|
|
* THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
|
27 |
|
|
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
|
28 |
|
|
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
29 |
|
|
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
|
30 |
|
|
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
|
31 |
|
|
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
32 |
|
|
*
|
33 |
|
|
*
|
34 |
|
|
* Author Date Comment
|
35 |
|
|
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
36 |
|
|
* Nilesh Rajbharti 8/14/01 Original (Rev. 1.0)
|
37 |
|
|
* Nilesh Rajbharti 2/9/02 Cleanup
|
38 |
|
|
* Nilesh Rajbharti 5/22/02 Rev 2.0 (See version.log for detail)
|
39 |
|
|
********************************************************************/
|
40 |
|
|
|
41 |
|
|
#ifndef HTTP_H
|
42 |
|
|
#define HTTP_H
|
43 |
|
|
|
44 |
|
|
#define HTTP_PORT (80)
|
45 |
|
|
|
46 |
|
|
#define HTTP_START_OF_VAR (0x0000)
|
47 |
|
|
#define HTTP_END_OF_VAR (0xFFFF)
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
/*********************************************************************
|
51 |
|
|
* Function: void HTTPInit(void)
|
52 |
|
|
*
|
53 |
|
|
* PreCondition: TCP must already be initialized.
|
54 |
|
|
*
|
55 |
|
|
* Input: None
|
56 |
|
|
*
|
57 |
|
|
* Output: HTTP FSM and connections are initialized
|
58 |
|
|
*
|
59 |
|
|
* Side Effects: None
|
60 |
|
|
*
|
61 |
|
|
* Overview: Set all HTTP connections to Listening state.
|
62 |
|
|
* Initialize FSM for each connection.
|
63 |
|
|
*
|
64 |
|
|
* Note: This function is called only one during lifetime
|
65 |
|
|
* of the application.
|
66 |
|
|
********************************************************************/
|
67 |
|
|
void HTTPInit(void);
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
/*********************************************************************
|
71 |
|
|
* Function: void HTTPServer(void)
|
72 |
|
|
*
|
73 |
|
|
* PreCondition: HTTPInit() must already be called.
|
74 |
|
|
*
|
75 |
|
|
* Input: None
|
76 |
|
|
*
|
77 |
|
|
* Output: Opened HTTP connections are served.
|
78 |
|
|
*
|
79 |
|
|
* Side Effects: None
|
80 |
|
|
*
|
81 |
|
|
* Overview: Browse through each connections and let it
|
82 |
|
|
* handle its connection.
|
83 |
|
|
* If a connection is not finished, do not process
|
84 |
|
|
* next connections. This must be done, all
|
85 |
|
|
* connections use some static variables that are
|
86 |
|
|
* common.
|
87 |
|
|
*
|
88 |
|
|
* Note: This function acts as a task (similar to one in
|
89 |
|
|
* RTOS). This function performs its task in
|
90 |
|
|
* co-operative manner. Main application must call
|
91 |
|
|
* this function repeatdly to ensure all open
|
92 |
|
|
* or new connections are served on time.
|
93 |
|
|
********************************************************************/
|
94 |
|
|
void HTTPServer(void);
|
95 |
|
|
|
96 |
|
|
#if defined(THIS_IS_HTTP_SERVER)
|
97 |
|
|
/*
|
98 |
|
|
* Main application must implement these callback functions
|
99 |
|
|
* to complete Http.c implementation.
|
100 |
|
|
*/
|
101 |
|
|
extern WORD HTTPGetVar(BYTE var, WORD ref, BYTE* val);
|
102 |
|
|
extern void HTTPExecCmd(BYTE** argv, BYTE argc);
|
103 |
|
|
#endif
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
#endif
|