version 1.1.1.2, 2012/05/29 12:55:57
|
version 1.1.1.3, 2013/07/22 00:32:35
|
Line 1
|
Line 1
|
/* $Id$ */ | /* $Id$ */ |
/* MiniUPnP project |
/* MiniUPnP project |
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ |
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ |
* (c) 2006-2011 Thomas Bernard | * (c) 2006-2012 Thomas Bernard |
* This software is subject to the conditions detailed |
* This software is subject to the conditions detailed |
* in the LICENCE file provided within the distribution */ |
* in the LICENCE file provided within the distribution */ |
|
|
#ifndef __UPNPHTTP_H__ | #ifndef UPNPHTTP_H_INCLUDED |
#define __UPNPHTTP_H__ | #define UPNPHTTP_H_INCLUDED |
|
|
#include <netinet/in.h> |
#include <netinet/in.h> |
#include <sys/queue.h> |
#include <sys/queue.h> |
|
|
#include "config.h" |
#include "config.h" |
|
|
|
#if 0 |
|
/* according to "UPnP Device Architecture 1.0" */ |
|
#define UPNP_VERSION_STRING "UPnP/1.0" |
|
#else |
|
/* according to "UPnP Device Architecture 1.1" */ |
|
#define UPNP_VERSION_STRING "UPnP/1.1" |
|
#endif |
|
|
/* server: HTTP header returned in all HTTP responses : */ |
/* server: HTTP header returned in all HTTP responses : */ |
#define MINIUPNPD_SERVER_STRING OS_VERSION " UPnP/1.0 MiniUPnPd/" MINIUPNPD_VERSION | #define MINIUPNPD_SERVER_STRING OS_VERSION " " UPNP_VERSION_STRING " MiniUPnPd/" MINIUPNPD_VERSION |
|
|
/* |
/* |
states : |
states : |
Line 23
|
Line 31
|
... |
... |
>= 100 - to be deleted |
>= 100 - to be deleted |
*/ |
*/ |
|
enum httpStates { |
|
EWaitingForHttpRequest = 0, |
|
EWaitingForHttpContent, |
|
ESendingContinue, |
|
ESendingAndClosing, |
|
EToDelete = 100 |
|
}; |
|
|
enum httpCommands { |
enum httpCommands { |
EUnknown = 0, |
EUnknown = 0, |
EGet, |
EGet, |
Line 38 struct upnphttp {
|
Line 54 struct upnphttp {
|
int ipv6; |
int ipv6; |
struct in6_addr clientaddr_v6; |
struct in6_addr clientaddr_v6; |
#endif |
#endif |
int state; | enum httpStates state; |
char HttpVer[16]; |
char HttpVer[16]; |
/* request */ |
/* request */ |
char * req_buf; |
char * req_buf; |
|
char accept_language[8]; |
int req_buflen; |
int req_buflen; |
int req_contentlen; |
int req_contentlen; |
int req_contentoff; /* header length */ |
int req_contentoff; /* header length */ |
enum httpCommands req_command; |
enum httpCommands req_command; |
const char * req_soapAction; | int req_soapActionOff; |
int req_soapActionLen; |
int req_soapActionLen; |
#ifdef ENABLE_EVENTS |
#ifdef ENABLE_EVENTS |
const char * req_Callback; /* For SUBSCRIBE */ | int req_CallbackOff; /* For SUBSCRIBE */ |
int req_CallbackLen; |
int req_CallbackLen; |
int req_Timeout; |
int req_Timeout; |
const char * req_SID; /* For UNSUBSCRIBE */ | int req_SIDOff; /* For UNSUBSCRIBE */ |
int req_SIDLen; |
int req_SIDLen; |
|
const char * res_SID; |
|
#ifdef UPNP_STRICT |
|
int req_NTOff; |
|
int req_NTLen; |
#endif |
#endif |
|
#endif |
int respflags; /* see FLAG_* constants below */ |
int respflags; /* see FLAG_* constants below */ |
/* response */ |
/* response */ |
char * res_buf; |
char * res_buf; |
int res_buflen; |
int res_buflen; |
|
int res_sent; |
int res_buf_alloclen; |
int res_buf_alloclen; |
/*int res_contentlen;*/ |
|
/*int res_contentoff;*/ /* header length */ |
|
LIST_ENTRY(upnphttp) entries; |
LIST_ENTRY(upnphttp) entries; |
}; |
}; |
|
|
Line 70 struct upnphttp {
|
Line 91 struct upnphttp {
|
/* Include the "SID:" header in response */ |
/* Include the "SID:" header in response */ |
#define FLAG_SID 0x02 |
#define FLAG_SID 0x02 |
|
|
|
/* If set, the POST request included a "Expect: 100-continue" header */ |
|
#define FLAG_CONTINUE 0x40 |
|
|
/* If set, the Content-Type is set to text/xml, otherwise it is text/xml */ |
/* If set, the Content-Type is set to text/xml, otherwise it is text/xml */ |
#define FLAG_HTML 0x80 |
#define FLAG_HTML 0x80 |
|
|
|
/* If set, the corresponding Allow: header is set */ |
|
#define FLAG_ALLOW_POST 0x100 |
|
#define FLAG_ALLOW_SUB_UNSUB 0x200 |
|
|
|
|
/* New_upnphttp() */ |
/* New_upnphttp() */ |
struct upnphttp * |
struct upnphttp * |
New_upnphttp(int); |
New_upnphttp(int); |
Line 97 BuildHeader_upnphttp(struct upnphttp * h, int respcode
|
Line 126 BuildHeader_upnphttp(struct upnphttp * h, int respcode
|
const char * respmsg, |
const char * respmsg, |
int bodylen); |
int bodylen); |
|
|
/* BuildResp_upnphttp() | /* BuildResp_upnphttp() |
* fill the res_buf buffer with the complete |
* fill the res_buf buffer with the complete |
* HTTP 200 OK response from the body passed as argument */ |
* HTTP 200 OK response from the body passed as argument */ |
void |
void |
Line 110 BuildResp2_upnphttp(struct upnphttp * h, int respcode,
|
Line 139 BuildResp2_upnphttp(struct upnphttp * h, int respcode,
|
const char * respmsg, |
const char * respmsg, |
const char * body, int bodylen); |
const char * body, int bodylen); |
|
|
/* SendResp_upnphttp() */ | int |
void | |
SendResp_upnphttp(struct upnphttp *); |
SendResp_upnphttp(struct upnphttp *); |
|
|
|
/* SendRespAndClose_upnphttp() */ |
|
void |
|
SendRespAndClose_upnphttp(struct upnphttp *); |
|
|
#endif |
#endif |
|
|