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

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

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