00001 #ifndef _PRO_HTTPD_H_
00002 #define _PRO_HTTPD_H_
00003
00004 #include <sys/device.h>
00005
00015
00016 #define METHOD_GET 1
00017 #define METHOD_POST 2
00018 #define METHOD_HEAD 3
00019
00020 typedef struct _REQUEST REQUEST;
00025 struct _REQUEST {
00026 int req_method;
00027 int req_version;
00028 int req_length;
00029 char *req_url;
00030 char *req_query;
00031 char *req_type;
00032 char *req_cookie;
00033 char *req_auth;
00034 char *req_agent;
00035 };
00036
00037 extern void NutHttpProcessRequest(NUTDEVICE *sostream);
00038
00039 extern void NutHttpSendHeaderTop(NUTDEVICE *sostream, REQUEST *req, int status, char* title);
00040 extern void NutHttpSendHeaderBot(NUTDEVICE *sostream, char* mime_type, int bytes);
00041 extern void NutHttpSendError(NUTDEVICE *sostream, REQUEST *req, int status);
00042 extern char *NutGetMimeType(char* name);
00043
00044
00045
00046
00047
00048 typedef struct _AUTHINFO AUTHINFO;
00049
00054 struct _AUTHINFO {
00055 AUTHINFO *auth_next;
00056 CONST char *auth_dirname;
00057 CONST char *auth_login;
00058 };
00059
00060 extern int NutHttpAuthValidate(REQUEST *req);
00061 extern int NutRegisterAuth(CONST char *dirname, CONST char *login);
00062
00063
00064
00065
00066 typedef struct _CGIFUNCTION CGIFUNCTION;
00067
00072 struct _CGIFUNCTION {
00073 CGIFUNCTION *cgi_next;
00074 CONST char *cgi_name;
00075 int (*cgi_func)(NUTDEVICE *, REQUEST *);
00076 };
00077
00081 extern int NutRegisterCgi(char *name, int (*func)(NUTDEVICE *, REQUEST *));
00082 extern void NutCgiProcessRequest(NUTDEVICE *sostream, REQUEST *req);
00083
00084 #endif