Annotation of embedaddon/miniupnpd/upnphttp.h, revision 1.1.1.2

1.1.1.2 ! misho       1: /* $Id: upnphttp.h,v 1.24 2011/06/27 11:06:00 nanard Exp $ */ 
1.1       misho       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 : */
1.1.1.2 ! misho      17: #define MINIUPNPD_SERVER_STRING        OS_VERSION " UPnP/1.0 MiniUPnPd/" MINIUPNPD_VERSION
1.1       misho      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 */
1.1.1.2 ! misho      37: #ifdef ENABLE_IPV6
        !            38:        int ipv6;
        !            39:        struct in6_addr clientaddr_v6;
        !            40: #endif
1.1       misho      41:        int state;
                     42:        char HttpVer[16];
                     43:        /* request */
                     44:        char * req_buf;
                     45:        int req_buflen;
                     46:        int req_contentlen;
                     47:        int req_contentoff;     /* header length */
                     48:        enum httpCommands req_command;
                     49:        const char * req_soapAction;
                     50:        int req_soapActionLen;
                     51: #ifdef ENABLE_EVENTS
                     52:        const char * req_Callback;      /* For SUBSCRIBE */
                     53:        int req_CallbackLen;
                     54:        int req_Timeout;
                     55:        const char * req_SID;           /* For UNSUBSCRIBE */
                     56:        int req_SIDLen;
                     57: #endif
1.1.1.2 ! misho      58:        int respflags;                          /* see FLAG_* constants below */
1.1       misho      59:        /* response */
                     60:        char * res_buf;
                     61:        int res_buflen;
                     62:        int res_buf_alloclen;
                     63:        /*int res_contentlen;*/
                     64:        /*int res_contentoff;*/         /* header length */
                     65:        LIST_ENTRY(upnphttp) entries;
                     66: };
                     67: 
1.1.1.2 ! misho      68: /* Include the "Timeout:" header in response */
1.1       misho      69: #define FLAG_TIMEOUT   0x01
1.1.1.2 ! misho      70: /* Include the "SID:" header in response */
1.1       misho      71: #define FLAG_SID               0x02
                     72: 
1.1.1.2 ! misho      73: /* If set, the Content-Type is set to text/xml, otherwise it is text/xml */
1.1       misho      74: #define FLAG_HTML              0x80
                     75: 
                     76: /* New_upnphttp() */
                     77: struct upnphttp *
                     78: New_upnphttp(int);
                     79: 
                     80: /* CloseSocket_upnphttp() */
                     81: void
                     82: CloseSocket_upnphttp(struct upnphttp *);
                     83: 
                     84: /* Delete_upnphttp() */
                     85: void
                     86: Delete_upnphttp(struct upnphttp *);
                     87: 
                     88: /* Process_upnphttp() */
                     89: void
                     90: Process_upnphttp(struct upnphttp *);
                     91: 
                     92: /* BuildHeader_upnphttp()
                     93:  * build the header for the HTTP Response
                     94:  * also allocate the buffer for body data */
                     95: void
                     96: BuildHeader_upnphttp(struct upnphttp * h, int respcode,
                     97:                      const char * respmsg,
                     98:                      int bodylen);
                     99: 
                    100: /* BuildResp_upnphttp() 
                    101:  * fill the res_buf buffer with the complete
                    102:  * HTTP 200 OK response from the body passed as argument */
                    103: void
                    104: BuildResp_upnphttp(struct upnphttp *, const char *, int);
                    105: 
                    106: /* BuildResp2_upnphttp()
                    107:  * same but with given response code/message */
                    108: void
                    109: BuildResp2_upnphttp(struct upnphttp * h, int respcode,
                    110:                     const char * respmsg,
                    111:                     const char * body, int bodylen);
                    112: 
                    113: /* SendResp_upnphttp() */
                    114: void
                    115: SendResp_upnphttp(struct upnphttp *);
                    116: 
                    117: #endif
                    118: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>