Annotation of embedaddon/miniupnpc/miniupnpc.h, revision 1.1.1.2

1.1.1.2 ! misho       1: /* $Id: miniupnpc.h,v 1.31 2012/09/27 15:42:10 nanard Exp $ */
1.1       misho       2: /* Project: miniupnp
                      3:  * http://miniupnp.free.fr/
                      4:  * Author: Thomas Bernard
1.1.1.2 ! misho       5:  * Copyright (c) 2005-2012 Thomas Bernard
1.1       misho       6:  * This software is subjects to the conditions detailed
                      7:  * in the LICENCE file provided within this distribution */
1.1.1.2 ! misho       8: #ifndef MINIUPNPC_H_INCLUDED
        !             9: #define MINIUPNPC_H_INCLUDED
1.1       misho      10: 
                     11: #include "declspec.h"
                     12: #include "igd_desc_parse.h"
                     13: 
                     14: /* error codes : */
                     15: #define UPNPDISCOVER_SUCCESS (0)
                     16: #define UPNPDISCOVER_UNKNOWN_ERROR (-1)
                     17: #define UPNPDISCOVER_SOCKET_ERROR (-101)
                     18: #define UPNPDISCOVER_MEMORY_ERROR (-102)
                     19: 
1.1.1.2 ! misho      20: /* versions : */
        !            21: #define MINIUPNPC_VERSION      "1.8"
        !            22: #define MINIUPNPC_API_VERSION  9
        !            23: 
1.1       misho      24: #ifdef __cplusplus
                     25: extern "C" {
                     26: #endif
                     27: 
                     28: /* Structures definitions : */
                     29: struct UPNParg { const char * elt; const char * val; };
                     30: 
                     31: char *
                     32: simpleUPnPcommand(int, const char *, const char *,
                     33:                   const char *, struct UPNParg *,
                     34:                   int *);
                     35: 
                     36: struct UPNPDev {
                     37:        struct UPNPDev * pNext;
                     38:        char * descURL;
                     39:        char * st;
1.1.1.2 ! misho      40:        unsigned int scope_id;
1.1       misho      41:        char buffer[2];
                     42: };
                     43: 
                     44: /* upnpDiscover()
                     45:  * discover UPnP devices on the network.
                     46:  * The discovered devices are returned as a chained list.
                     47:  * It is up to the caller to free the list with freeUPNPDevlist().
                     48:  * delay (in millisecond) is the maximum time for waiting any device
                     49:  * response.
                     50:  * If available, device list will be obtained from MiniSSDPd.
                     51:  * Default path for minissdpd socket will be used if minissdpdsock argument
                     52:  * is NULL.
                     53:  * If multicastif is not NULL, it will be used instead of the default
                     54:  * multicast interface for sending SSDP discover packets.
                     55:  * If sameport is not null, SSDP packets will be sent from the source port
                     56:  * 1900 (same as destination port) otherwise system assign a source port. */
                     57: LIBSPEC struct UPNPDev *
                     58: upnpDiscover(int delay, const char * multicastif,
                     59:              const char * minissdpdsock, int sameport,
                     60:              int ipv6,
                     61:              int * error);
                     62: /* freeUPNPDevlist()
                     63:  * free list returned by upnpDiscover() */
                     64: LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist);
                     65: 
                     66: /* parserootdesc() :
                     67:  * parse root XML description of a UPnP device and fill the IGDdatas
                     68:  * structure. */
                     69: LIBSPEC void parserootdesc(const char *, int, struct IGDdatas *);
                     70: 
                     71: /* structure used to get fast access to urls
                     72:  * controlURL: controlURL of the WANIPConnection
                     73:  * ipcondescURL: url of the description of the WANIPConnection
                     74:  * controlURL_CIF: controlURL of the WANCommonInterfaceConfig
                     75:  * controlURL_6FC: controlURL of the WANIPv6FirewallControl
                     76:  */
                     77: struct UPNPUrls {
                     78:        char * controlURL;
                     79:        char * ipcondescURL;
                     80:        char * controlURL_CIF;
                     81:        char * controlURL_6FC;
1.1.1.2 ! misho      82:        char * rootdescURL;
1.1       misho      83: };
                     84: 
                     85: /* UPNP_GetValidIGD() :
                     86:  * return values :
                     87:  *     0 = NO IGD found
                     88:  *     1 = A valid connected IGD has been found
                     89:  *     2 = A valid IGD has been found but it reported as
                     90:  *         not connected
                     91:  *     3 = an UPnP device has been found but was not recognized as an IGD
                     92:  *
                     93:  * In any non zero return case, the urls and data structures
                     94:  * passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
                     95:  * free allocated memory.
                     96:  */
                     97: LIBSPEC int
                     98: UPNP_GetValidIGD(struct UPNPDev * devlist,
                     99:                  struct UPNPUrls * urls,
                    100:                                 struct IGDdatas * data,
                    101:                                 char * lanaddr, int lanaddrlen);
                    102: 
                    103: /* UPNP_GetIGDFromUrl()
                    104:  * Used when skipping the discovery process.
                    105:  * return value :
                    106:  *   0 - Not ok
                    107:  *   1 - OK */
                    108: LIBSPEC int
                    109: UPNP_GetIGDFromUrl(const char * rootdescurl,
                    110:                    struct UPNPUrls * urls,
                    111:                    struct IGDdatas * data,
                    112:                    char * lanaddr, int lanaddrlen);
                    113: 
1.1.1.2 ! misho     114: LIBSPEC void
        !           115: GetUPNPUrls(struct UPNPUrls *, struct IGDdatas *,
        !           116:             const char *, unsigned int);
1.1       misho     117: 
1.1.1.2 ! misho     118: LIBSPEC void
        !           119: FreeUPNPUrls(struct UPNPUrls *);
1.1       misho     120: 
                    121: /* return 0 or 1 */
                    122: LIBSPEC int UPNPIGD_IsConnected(struct UPNPUrls *, struct IGDdatas *);
                    123: 
                    124: 
                    125: #ifdef __cplusplus
                    126: }
                    127: #endif
                    128: 
                    129: #endif
                    130: 

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