miniupnpc.c: add upnpDiscoverAll() function
This commit is contained in:
parent
09d5473c54
commit
cb054ef580
|
@ -6,6 +6,7 @@
|
|||
* LICENCE file provided in this distribution. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "miniupnpc.h"
|
||||
|
||||
int main(int argc, char * * argv)
|
||||
|
@ -16,8 +17,19 @@ int main(int argc, char * * argv)
|
|||
int error = 0;
|
||||
struct UPNPDev * devlist = 0;
|
||||
struct UPNPDev * dev;
|
||||
int i;
|
||||
|
||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath,
|
||||
for(i = 1; i < argc; i++) {
|
||||
if(strcmp(argv[i], "-6") == 0)
|
||||
ipv6 = 1;
|
||||
else {
|
||||
printf("usage : %s [options]\n", argv[0]);
|
||||
printf(" -6 : use IPv6\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
devlist = upnpDiscoverAll(2000, multicastif, minissdpdpath,
|
||||
0/*sameport*/, ipv6, &error);
|
||||
if(devlist) {
|
||||
for(dev = devlist; dev != NULL; dev = dev->pNext) {
|
||||
|
|
|
@ -707,6 +707,22 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
"urn:schemas-upnp-org:service:WANIPConnection:1",
|
||||
"urn:schemas-upnp-org:service:WANPPPConnection:1",
|
||||
"upnp:rootdevice",
|
||||
/*"ssdp:all",*/
|
||||
0
|
||||
};
|
||||
return upnpDiscoverDevices(deviceList,
|
||||
delay, multicastif, minissdpdsock, sameport,
|
||||
ipv6, error);
|
||||
}
|
||||
|
||||
LIBSPEC struct UPNPDev *
|
||||
upnpDiscoverAll(int delay, const char * multicastif,
|
||||
const char * minissdpdsock, int sameport,
|
||||
int ipv6,
|
||||
int * error)
|
||||
{
|
||||
static const char * const deviceList[] = {
|
||||
/*"upnp:rootdevice",*/
|
||||
"ssdp:all",
|
||||
0
|
||||
};
|
||||
|
|
|
@ -59,6 +59,13 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
const char * minissdpdsock, int sameport,
|
||||
int ipv6,
|
||||
int * error);
|
||||
|
||||
LIBSPEC struct UPNPDev *
|
||||
upnpDiscoverAll(int delay, const char * multicastif,
|
||||
const char * minissdpdsock, int sameport,
|
||||
int ipv6,
|
||||
int * error);
|
||||
|
||||
/* freeUPNPDevlist()
|
||||
* free list returned by upnpDiscover() */
|
||||
LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist);
|
||||
|
|
Loading…
Reference in New Issue