1193141Sdougb/* 2262706Serwin * Copyright (C) 2006-2008, 2014 Internet Systems Consortium, Inc. ("ISC") 3193141Sdougb * 4193141Sdougb * Permission to use, copy, modify, and/or distribute this software for any 5193141Sdougb * purpose with or without fee is hereby granted, provided that the above 6193141Sdougb * copyright notice and this permission notice appear in all copies. 7193141Sdougb * 8193141Sdougb * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 9193141Sdougb * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10193141Sdougb * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 11193141Sdougb * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12193141Sdougb * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 13193141Sdougb * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14193141Sdougb * PERFORMANCE OF THIS SOFTWARE. 15193141Sdougb */ 16193141Sdougb 17234010Sdougb/* $Id: httpd.h,v 1.9 2008/08/08 05:06:49 marka Exp $ */ 18193141Sdougb 19193141Sdougb#ifndef ISC_HTTPD_H 20193141Sdougb#define ISC_HTTPD_H 1 21193141Sdougb 22193141Sdougb/*! \file */ 23193141Sdougb 24193141Sdougb#include <isc/event.h> 25193141Sdougb#include <isc/eventclass.h> 26193141Sdougb#include <isc/types.h> 27193141Sdougb#include <isc/mutex.h> 28193141Sdougb#include <isc/task.h> 29262706Serwin#include <isc/time.h> 30193141Sdougb 31262706Serwin/*% 32262706Serwin * HTTP urls. These are the URLs we manage, and the function to call to 33262706Serwin * provide the data for it. We pass in the base url (so the same function 34262706Serwin * can handle multiple requests), and a structure to fill in to return a 35262706Serwin * result to the client. We also pass in a pointer to be filled in for 36262706Serwin * the data cleanup function. 37262706Serwin */ 38262706Serwinstruct isc_httpdurl { 39262706Serwin char *url; 40262706Serwin isc_httpdaction_t *action; 41262706Serwin void *action_arg; 42262706Serwin isc_boolean_t isstatic; 43262706Serwin isc_time_t loadtime; 44262706Serwin ISC_LINK(isc_httpdurl_t) link; 45262706Serwin}; 46262706Serwin 47193141Sdougb#define HTTPD_EVENTCLASS ISC_EVENTCLASS(4300) 48193141Sdougb#define HTTPD_SHUTDOWN (HTTPD_EVENTCLASS + 0x0001) 49193141Sdougb 50193141Sdougb#define ISC_HTTPDMGR_FLAGSHUTTINGDOWN 0x00000001 51193141Sdougb 52193141Sdougb/* 53193141Sdougb * Create a new http daemon which will send, once every time period, 54193141Sdougb * a http-like header followed by HTTP data. 55193141Sdougb */ 56193141Sdougbisc_result_t 57193141Sdougbisc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task, 58193141Sdougb isc_httpdclientok_t *client_ok, 59193141Sdougb isc_httpdondestroy_t *ondestory, void *cb_arg, 60193141Sdougb isc_timermgr_t *tmgr, isc_httpdmgr_t **httpdp); 61193141Sdougb 62193141Sdougbvoid 63193141Sdougbisc_httpdmgr_shutdown(isc_httpdmgr_t **httpdp); 64193141Sdougb 65193141Sdougbisc_result_t 66193141Sdougbisc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url, 67193141Sdougb isc_httpdaction_t *func, void *arg); 68193141Sdougb 69193141Sdougbisc_result_t 70262706Serwinisc_httpdmgr_addurl2(isc_httpdmgr_t *httpdmgr, const char *url, 71262706Serwin isc_boolean_t isstatic, 72262706Serwin isc_httpdaction_t *func, void *arg); 73262706Serwin 74262706Serwinisc_result_t 75193141Sdougbisc_httpd_response(isc_httpd_t *httpd); 76193141Sdougb 77193141Sdougbisc_result_t 78193141Sdougbisc_httpd_addheader(isc_httpd_t *httpd, const char *name, 79193141Sdougb const char *val); 80193141Sdougb 81193141Sdougbisc_result_t 82193141Sdougbisc_httpd_addheaderuint(isc_httpd_t *httpd, const char *name, int val); 83193141Sdougb 84193141Sdougbisc_result_t isc_httpd_endheaders(isc_httpd_t *httpd); 85193141Sdougb 86193141Sdougb#endif /* ISC_HTTPD_H */ 87