diff --git a/miniupnpc/Makefile b/miniupnpc/Makefile index ec6b5bd..4b1d545 100644 --- a/miniupnpc/Makefile +++ b/miniupnpc/Makefile @@ -62,13 +62,13 @@ SRCS = igd_desc_parse.c miniupnpc.c minixml.c minisoap.c miniwget.c \ minixmlvalid.c testupnpreplyparse.c minissdpc.c \ upnperrors.c testigddescparse.c testminiwget.c \ connecthostport.c portlistingparse.c receivedata.c \ - testportlistingparse.c miniupnpcmodule.c \ + upnpdev.c testportlistingparse.c miniupnpcmodule.c \ minihttptestserver.c \ listdevices.c LIBOBJS = miniwget.o minixml.o igd_desc_parse.o minisoap.o \ miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \ - connecthostport.o portlistingparse.o receivedata.o + connecthostport.o portlistingparse.o receivedata.o upnpdev.o ifneq ($(OS), AmigaOS) CFLAGS := -fPIC $(CFLAGS) diff --git a/miniupnpc/minissdpc.h b/miniupnpc/minissdpc.h index 6f5aa2c..cd4cb26 100644 --- a/miniupnpc/minissdpc.h +++ b/miniupnpc/minissdpc.h @@ -9,6 +9,7 @@ #define MINISSDPC_H_INCLUDED #include "miniupnpc_declspec.h" +#include "upnpdev.h" /* error codes : */ #define MINISSDPC_SUCCESS (0) diff --git a/miniupnpc/miniupnpc.c b/miniupnpc/miniupnpc.c index e500faa..9973d34 100644 --- a/miniupnpc/miniupnpc.c +++ b/miniupnpc/miniupnpc.c @@ -823,19 +823,6 @@ upnpDiscoverDevice(const char * device, int delay, const char * multicastif, ipv6, ttl, error, 0); } -/* freeUPNPDevlist() should be used to - * free the chained list returned by upnpDiscover() */ -MINIUPNP_LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist) -{ - struct UPNPDev * next; - while(devlist) - { - next = devlist->pNext; - free(devlist); - devlist = next; - } -} - static char * build_absolute_url(const char * baseurl, const char * descURL, const char * url, unsigned int scope_id) diff --git a/miniupnpc/miniupnpc.h b/miniupnpc/miniupnpc.h index 9637dcf..7cf7191 100644 --- a/miniupnpc/miniupnpc.h +++ b/miniupnpc/miniupnpc.h @@ -10,6 +10,7 @@ #include "miniupnpc_declspec.h" #include "igd_desc_parse.h" +#include "upnpdev.h" /* error codes : */ #define UPNPDISCOVER_SUCCESS (0) @@ -33,15 +34,6 @@ simpleUPnPcommand(int, const char *, const char *, const char *, struct UPNParg *, int *); -struct UPNPDev { - struct UPNPDev * pNext; - char * descURL; - char * st; - unsigned int scope_id; - char * usn; - char buffer[3]; -}; - /* upnpDiscover() * discover UPnP devices on the network. * The discovered devices are returned as a chained list. @@ -84,10 +76,6 @@ upnpDiscoverDevices(const char * const deviceTypes[], int * error, int searchalltypes); -/* freeUPNPDevlist() - * free list returned by upnpDiscover() */ -MINIUPNP_LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist); - /* parserootdesc() : * parse root XML description of a UPnP device and fill the IGDdatas * structure. */ diff --git a/miniupnpc/upnpdev.c b/miniupnpc/upnpdev.c new file mode 100644 index 0000000..3716a07 --- /dev/null +++ b/miniupnpc/upnpdev.c @@ -0,0 +1,16 @@ +#include +#include "upnpdev.h" + +/* freeUPNPDevlist() should be used to + * free the chained list returned by upnpDiscover() */ +void freeUPNPDevlist(struct UPNPDev * devlist) +{ + struct UPNPDev * next; + while(devlist) + { + next = devlist->pNext; + free(devlist); + devlist = next; + } +} + diff --git a/miniupnpc/upnpdev.h b/miniupnpc/upnpdev.h new file mode 100644 index 0000000..492dd39 --- /dev/null +++ b/miniupnpc/upnpdev.h @@ -0,0 +1,29 @@ +#ifndef UPNPDEV_H_INCLUDED +#define UPNPDEV_H_INCLUDED + +#include "miniupnpc_declspec.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct UPNPDev { + struct UPNPDev * pNext; + char * descURL; + char * st; + unsigned int scope_id; + char * usn; + char buffer[3]; +}; + +/* freeUPNPDevlist() + * free list returned by upnpDiscover() */ +MINIUPNP_LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist); + + +#ifdef __cplusplus +} +#endif + + +#endif