Annotation of embedaddon/miniupnpd/upnphttp.h, revision 1.1
1.1 ! misho 1: /* $Id: upnphttp.h,v 1.20 2009/09/04 16:35:13 nanard Exp $ */
! 2: /* MiniUPnP project
! 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 */
! 7:
! 8: #ifndef __UPNPHTTP_H__
! 9: #define __UPNPHTTP_H__
! 10:
! 11: #include <netinet/in.h>
! 12: #include <sys/queue.h>
! 13:
! 14: #include "config.h"
! 15:
! 16: /* server: HTTP header returned in all HTTP responses : */
! 17: #define MINIUPNPD_SERVER_STRING OS_VERSION " UPnP/1.0 MiniUPnPd/1.5"
! 18:
! 19: /*
! 20: states :
! 21: 0 - waiting for data to read
! 22: 1 - waiting for HTTP Post Content.
! 23: ...
! 24: >= 100 - to be deleted
! 25: */
! 26: enum httpCommands {
! 27: EUnknown = 0,
! 28: EGet,
! 29: EPost,
! 30: ESubscribe,
! 31: EUnSubscribe
! 32: };
! 33:
! 34: struct upnphttp {
! 35: int socket;
! 36: struct in_addr clientaddr; /* client address */
! 37: int state;
! 38: char HttpVer[16];
! 39: /* request */
! 40: char * req_buf;
! 41: int req_buflen;
! 42: int req_contentlen;
! 43: int req_contentoff; /* header length */
! 44: enum httpCommands req_command;
! 45: const char * req_soapAction;
! 46: int req_soapActionLen;
! 47: #ifdef ENABLE_EVENTS
! 48: const char * req_Callback; /* For SUBSCRIBE */
! 49: int req_CallbackLen;
! 50: int req_Timeout;
! 51: const char * req_SID; /* For UNSUBSCRIBE */
! 52: int req_SIDLen;
! 53: #endif
! 54: int respflags;
! 55: /* response */
! 56: char * res_buf;
! 57: int res_buflen;
! 58: int res_buf_alloclen;
! 59: /*int res_contentlen;*/
! 60: /*int res_contentoff;*/ /* header length */
! 61: LIST_ENTRY(upnphttp) entries;
! 62: };
! 63:
! 64: #define FLAG_TIMEOUT 0x01
! 65: #define FLAG_SID 0x02
! 66:
! 67: #define FLAG_HTML 0x80
! 68:
! 69: /* New_upnphttp() */
! 70: struct upnphttp *
! 71: New_upnphttp(int);
! 72:
! 73: /* CloseSocket_upnphttp() */
! 74: void
! 75: CloseSocket_upnphttp(struct upnphttp *);
! 76:
! 77: /* Delete_upnphttp() */
! 78: void
! 79: Delete_upnphttp(struct upnphttp *);
! 80:
! 81: /* Process_upnphttp() */
! 82: void
! 83: Process_upnphttp(struct upnphttp *);
! 84:
! 85: /* BuildHeader_upnphttp()
! 86: * build the header for the HTTP Response
! 87: * also allocate the buffer for body data */
! 88: void
! 89: BuildHeader_upnphttp(struct upnphttp * h, int respcode,
! 90: const char * respmsg,
! 91: int bodylen);
! 92:
! 93: /* BuildResp_upnphttp()
! 94: * fill the res_buf buffer with the complete
! 95: * HTTP 200 OK response from the body passed as argument */
! 96: void
! 97: BuildResp_upnphttp(struct upnphttp *, const char *, int);
! 98:
! 99: /* BuildResp2_upnphttp()
! 100: * same but with given response code/message */
! 101: void
! 102: BuildResp2_upnphttp(struct upnphttp * h, int respcode,
! 103: const char * respmsg,
! 104: const char * body, int bodylen);
! 105:
! 106: /* SendResp_upnphttp() */
! 107: void
! 108: SendResp_upnphttp(struct upnphttp *);
! 109:
! 110: #endif
! 111:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>