Nut/OS  4.10.3
API Reference
httpd.h File Reference

HTTP protocol definitions for daemons. More...

#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <compiler.h>
Include dependency graph for httpd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _REQUEST
 HTTP request information structure. More...
struct  _MIMETYPES
struct  _AUTHINFO
 HTTP authorization information structure. More...
struct  _CGIFUNCTION
 Registered CGI function. More...

Defines

#define METHOD_GET   1
#define METHOD_POST   2
#define METHOD_HEAD   3
#define HTTP_CONN_CLOSE   1
#define HTTP_CONN_KEEP_ALIVE   2
#define HTTP_OF_USE_HOST_TIME   0x00000001UL
#define HTTP_OF_USE_FILE_TIME   0x00000002UL

Typedefs

typedef struct _REQUEST REQUEST
typedef struct _MIMETYPES MIMETYPES
typedef typedef__END_DECLS
struct _AUTHINFO 
AUTHINFO
typedef typedef__END_DECLS
struct _CGIFUNCTION 
CGIFUNCTION

Functions

void NutHttpProcessRequest (FILE *stream)
 Process the next HTTP request.
void NutHttpProcessQueryString (REQUEST *req)
 Parses the QueryString.
void NutHttpSendHeaderTop (FILE *stream, REQUEST *req, int status, char *title)
 Send top lines of a standard HTML header.
void NutHttpSendHeaderBottom (FILE *stream, REQUEST *req, char *mime_type, long bytes)
 Send bottom lines of a standard HTML header.
void NutHttpSendHeaderBot (FILE *stream, char *mime_type, long bytes)
 Send bottom lines of a standard HTML header.
void NutHttpSendError (FILE *stream, REQUEST *req, int status)
 Send a HTTP error response.
char * NutGetMimeType (char *name)
 Return the mime type description of a specified file name.
void * NutGetMimeHandler (char *name)
 Return the mime type handler of a specified file name.
uint8_t NutSetMimeHandler (char *extension, void(*handler)(FILE *stream, int fd, int file_len, char *http_root, REQUEST *req))
 Set the mime type handler for a specified file extension.
int NutHttpAuthValidate (REQUEST *req)
 Validate an authorization request.
int NutRegisterAuth (CONST char *dirname, CONST char *login)
 Register an authorization entry.
void NutClearAuth (void)
 Clear all authorization entries.
void NutHttpSetOptionFlags (uint32_t flags)
 Set HTTP option flags.
uint32_t NutHttpGetOptionFlags (void)
 Retrieve HTTP option flags.
int NutRegisterHttpRoot (char *path)
 Register the HTTP server's root directory.
void NutRegisterCgiBinPath (char *path)
 Register a new cgi-bin path.
int NutRegisterCgi (char *name, int(*func)(FILE *, REQUEST *))
 Register a CGI function.
int NutCgiCheckRequest (FILE *stream, REQUEST *req)
 Check if request is a cgi call.
void NutCgiProcessRequest (FILE *stream, REQUEST *req, int name_pos)
 Process an incoming CGI request.
void NutHttpProcessPostQuery (FILE *stream, REQUEST *req)
 Parses the QueryString.
char * NutHttpURLEncode (char *str)
 URLEncodes a string.
void NutHttpURLDecode (char *str)
 URLDecodes a string.
char * NutHttpGetParameter (REQUEST *req, char *name)
 Gets a request parameter value by name.
int NutHttpGetParameterCount (REQUEST *req)
 Gets the number of request parameters.
char * NutHttpGetParameterName (REQUEST *req, int index)
 Gets the name of a request parameter.
char * NutHttpGetParameterValue (REQUEST *req, int index)
 Get the value of a request parameter.

Detailed Description

HTTP protocol definitions for daemons.

 *
 * $Log$
 * Revision 1.11  2008/08/11 07:00:24  haraldkipp
 * BSD types replaced by stdint types (feature request #1282721).
 *
 * Revision 1.10  2008/07/17 11:42:25  olereinhardt
 * Added prototype for new functions in cgi.c
 *
 * Revision 1.9  2008/01/31 09:28:18  haraldkipp
 * Expanded REQUEST structure to handle HTTP/1.1. Added MIMETYPES structure.
 *
 * Revision 1.8  2006/10/08 16:43:53  haraldkipp
 * Authentication info depended on static memory kept by the caller. Now a
 * local copy is held and NutClearAuth (which should have been named
 * NutHttpAuthClear, btw.) works correctly.
 *
 * Revision 1.7  2006/08/25 13:42:16  olereinhardt
 * added NutClearAuth(void); Thanks to Peter Sondermanns
 *
 * Revision 1.6  2006/03/16 15:25:34  haraldkipp
 * Changed human readable strings from u_char to char to stop GCC 4 from
 * nagging about signedness.
 *
 * Revision 1.5  2005/08/26 14:12:39  olereinhardt
 * Added NutHttpProcessPostQuery(FILE *stream, REQUEST * req)
 *
 * Revision 1.4  2005/08/05 11:23:11  olereinhardt
 * Added support to register a custom handler for mime types.
 * Added Server side include support and ASP support.
 *
 * Revision 1.3  2005/06/26 13:35:26  chaac
 * Added forgotten prototype for NutRegisterHttpRoot, fixes bug #1215853. Also fixed some prototypes when compiling with C++.
 *
 * Revision 1.2  2004/12/16 10:17:18  haraldkipp
 * Added Mikael Adolfsson's excellent parameter parsing routines.
 *
 * 

Definition in file httpd.h.