1 /* $Id: upnphttp.h,v 1.24 2011/06/27 11:06:00 nanard Exp $ */
3 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
4 * (c) 2006-2011 Thomas Bernard
5 * This software is subject to the conditions detailed
6 * in the LICENCE file provided within the distribution */
11 #include <netinet/in.h>
12 #include <sys/queue.h>
16 /* server: HTTP header returned in all HTTP responses : */
17 #define MINIUPNPD_SERVER_STRING OS_VERSION " UPnP/1.0 MiniUPnPd/" MINIUPNPD_VERSION
21 0 - waiting for data to read
22 1 - waiting for HTTP Post Content.
24 >= 100 - to be deleted
36 struct in_addr clientaddr
; /* client address */
39 struct in6_addr clientaddr_v6
;
47 int req_contentoff
; /* header length */
48 enum httpCommands req_command
;
49 const char * req_soapAction
;
50 int req_soapActionLen
;
52 const char * req_Callback
; /* For SUBSCRIBE */
55 const char * req_SID
; /* For UNSUBSCRIBE */
58 int respflags
; /* see FLAG_* constants below */
63 /*int res_contentlen;*/
64 /*int res_contentoff;*/ /* header length */
65 LIST_ENTRY(upnphttp
) entries
;
68 /* Include the "Timeout:" header in response */
69 #define FLAG_TIMEOUT 0x01
70 /* Include the "SID:" header in response */
73 /* If set, the Content-Type is set to text/xml, otherwise it is text/xml */
74 #define FLAG_HTML 0x80
80 /* CloseSocket_upnphttp() */
82 CloseSocket_upnphttp(struct upnphttp
*);
84 /* Delete_upnphttp() */
86 Delete_upnphttp(struct upnphttp
*);
88 /* Process_upnphttp() */
90 Process_upnphttp(struct upnphttp
*);
92 /* BuildHeader_upnphttp()
93 * build the header for the HTTP Response
94 * also allocate the buffer for body data */
96 BuildHeader_upnphttp(struct upnphttp
* h
, int respcode
,
100 /* BuildResp_upnphttp()
101 * fill the res_buf buffer with the complete
102 * HTTP 200 OK response from the body passed as argument */
104 BuildResp_upnphttp(struct upnphttp
*, const char *, int);
106 /* BuildResp2_upnphttp()
107 * same but with given response code/message */
109 BuildResp2_upnphttp(struct upnphttp
* h
, int respcode
,
110 const char * respmsg
,
111 const char * body
, int bodylen
);
113 /* SendResp_upnphttp() */
115 SendResp_upnphttp(struct upnphttp
*);