httpd.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006-2008, 2014  Internet Systems Consortium, Inc. ("ISC")
00003  *
00004  * Permission to use, copy, modify, and/or distribute this software for any
00005  * purpose with or without fee is hereby granted, provided that the above
00006  * copyright notice and this permission notice appear in all copies.
00007  *
00008  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00009  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00010  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00011  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00012  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00013  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00014  * PERFORMANCE OF THIS SOFTWARE.
00015  */
00016 
00017 /* $Id: httpd.h,v 1.9 2008/08/08 05:06:49 marka Exp $ */
00018 
00019 #ifndef ISC_HTTPD_H
00020 #define ISC_HTTPD_H 1
00021 
00022 /*! \file */
00023 
00024 #include <isc/event.h>
00025 #include <isc/eventclass.h>
00026 #include <isc/types.h>
00027 #include <isc/mutex.h>
00028 #include <isc/task.h>
00029 #include <isc/time.h>
00030 
00031 /*%
00032  * HTTP urls.  These are the URLs we manage, and the function to call to
00033  * provide the data for it.  We pass in the base url (so the same function
00034  * can handle multiple requests), and a structure to fill in to return a
00035  * result to the client.  We also pass in a pointer to be filled in for
00036  * the data cleanup function.
00037  */
00038 struct isc_httpdurl {
00039         char                           *url;
00040         isc_httpdaction_t              *action;
00041         void                           *action_arg;
00042         isc_boolean_t                   isstatic;
00043         isc_time_t                      loadtime;
00044         ISC_LINK(isc_httpdurl_t)        link;
00045 };
00046 
00047 #define HTTPD_EVENTCLASS                ISC_EVENTCLASS(4300)
00048 #define HTTPD_SHUTDOWN                  (HTTPD_EVENTCLASS + 0x0001)
00049 
00050 #define ISC_HTTPDMGR_FLAGSHUTTINGDOWN   0x00000001
00051 
00052 /*
00053  * Create a new http daemon which will send, once every time period,
00054  * a http-like header followed by HTTP data.
00055  */
00056 isc_result_t
00057 isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
00058                     isc_httpdclientok_t *client_ok,
00059                     isc_httpdondestroy_t *ondestory, void *cb_arg,
00060                     isc_timermgr_t *tmgr, isc_httpdmgr_t **httpdp);
00061 
00062 void
00063 isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdp);
00064 
00065 isc_result_t
00066 isc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url,
00067                     isc_httpdaction_t *func, void *arg);
00068 
00069 isc_result_t
00070 isc_httpdmgr_addurl2(isc_httpdmgr_t *httpdmgr, const char *url,
00071                      isc_boolean_t isstatic,
00072                      isc_httpdaction_t *func, void *arg);
00073 
00074 isc_result_t
00075 isc_httpd_response(isc_httpd_t *httpd);
00076 
00077 isc_result_t
00078 isc_httpd_addheader(isc_httpd_t *httpd, const char *name,
00079                     const char *val);
00080 
00081 isc_result_t
00082 isc_httpd_addheaderuint(isc_httpd_t *httpd, const char *name, int val);
00083 
00084 isc_result_t isc_httpd_endheaders(isc_httpd_t *httpd);
00085 
00086 #endif /* ISC_HTTPD_H */

Generated on Tue Apr 28 17:41:04 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha