Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

# httpd.h

Go to the documentation of this file.

    00001 /*
    00002  *  Copyright (c) 2004, Dennis Kuschel.
    00003  *  All rights reserved.
    00004  *
    00005  *  Redistribution and use in source and binary forms, with or without
    00006  *  modification, are permitted provided that the following conditions
    00007  *  are met:
    00008  *
    00009  *   1. Redistributions of source code must retain the above copyright
    00010  *      notice, this list of conditions and the following disclaimer.
    00011  *   2. Redistributions in binary form must reproduce the above copyright
    00012  *      notice, this list of conditions and the following disclaimer in the
    00013  *      documentation and/or other materials provided with the distribution.
    00014  *   3. The name of the author may not be used to endorse or promote
    00015  *      products derived from this software without specific prior written
    00016  *      permission.
    00017  *
    00018  *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
    00019  *  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    00020  *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    00021  *  ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
    00022  *  INDIRECT,  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    00023  *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    00024  *  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00025  *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    00026  *  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    00027  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    00028  *  OF THE POSSIBILITY OF SUCH DAMAGE.
    00029  *
    00030  */
    00031
    00041 #ifndef _HTTPD_H_
    00042 #define _HTTPD_H_
    00043
    00044 #include "sys.h"
    00045
    00051 #ifndef HTTP_SERVLETS
    00052 #define HTTP_SERVLETS   1
    00053 #endif
    00054
    00055
    00056 #if HTTP_SERVLETS
    00057
    00059 typedef  void*      SERVLET_t;
    00060
    00062 typedef  sint_t (*SERVLETFUNC_t)(SERVLET_t slobj);
    00063
    00064 #define SLERR_OK            0
    00065 #define SLERR_FAIL          -1
    00066 #define SLERR_NEEDMEM       -2
    00067
    00068 #define SLERR_BADREQUEST    -3  /* 400 Bad Request */
    00069 #define SLERR_NOTFOUND      -4  /* 404 Not Found   */
    00070 #define SLERR_SERVER        -5  /* 500 Internal Server Error */
    00071 #define SLERR_CREATED       -6  /* 201 Created */
    00072 #define SLERR_ACCEPTED      -7  /* 202 ACCEPTED */
    00073 #define SLERR_PARTIAL       -8  /* 206 Partial Content */
    00074 #define SLERR_FORBIDDEN     -9  /* 403 Forbidden */
    00075 #define SLERR_TOOLARGE      -10 /* 413 Request Entity Too Large */
    00076 #define SLERR_UNAVAILABLE   -11 /* 503 Service Unavailable */
    00077 #define SLERR_BUSY          -12 /* 200 OK, but Server Busy */
    00078
    00079
    00090 sint_t hsl_create(SERVLETFUNC_t func, const char *filename);
    00091
    00099 sint_t hsl_destroy(SERVLETFUNC_t func);
    00100
    00110 char *hsl_getParameterByName(SERVLET_t *slobj, const char *name);
    00111
    00119 char *hsl_getOwnName(SERVLET_t *slobj);
    00120
    00136 sint_t hsl_setStreamBufSize(SERVLET_t *slobj, u32_t bufsize);
    00137
    00147 sint_t hsl_printf(SERVLET_t *slobj, const char *fmt, ...);
    00148
    00158 void* hsl_getSession(SERVLET_t *slobj);
    00159
    00174 void* hsl_newSession(SERVLET_t *slobj, u32_t memsize, u32_t timeout);
    00175
    00184 sint_t hsl_destroySession(SERVLET_t *slobj);
    00185
    00193 sint_t hsl_formAddSessionId(SERVLET_t *slobj);
    00194
    00195
    00196 #define HSL_LINK_RAW   0x00000001
    00197 #define HSL_LINK_SID   0x00000002
    00198 #define HSL_LINK_QM    0x80000000  /* internal, do not use */
    00199
    00200
    00223 sint_t hsl_linkCreate(SERVLET_t *slobj, const char* url, u32_t flags);
    00224
    00236 sint_t hsl_linkAddStringVal(SERVLET_t *slobj, const char *name,
    00237                             const char* val);
    00238
    00250 sint_t hsl_linkAddNumberVal(SERVLET_t *slobj, const char *name, u32_t val);
    00251
    00265 sint_t hsl_linkInsert(SERVLET_t *slobj, const char *linktext);
    00266
    00274 sint_t hsl_addSessionIdToForm(SERVLET_t *slobj);
    00275
    00276
    00277 #endif
    00278
    00279
    00302 sint_t httpd_start(const char *rootDirectory,
    00303                    u32_t maxServletMem, u32_t maxSessionMem);
    00304
    00311 sint_t httpd_stop(void);
    00312
    00318 sint_t httpd_running(void);
    00319
    00320
    00322 #endif /* _HTTPD_H_ */