Adding listdevice program
This commit is contained in:
parent
01ec54aec3
commit
d06140277b
|
@ -20,3 +20,4 @@ _jnaerator.*
|
|||
out.errors.txt
|
||||
jnaerator-*.jar
|
||||
miniupnpc.h.bak
|
||||
listdevices
|
||||
|
|
|
@ -54,7 +54,8 @@ SRCS = igd_desc_parse.c miniupnpc.c minixml.c minisoap.c miniwget.c \
|
|||
upnpc.c upnpcommands.c upnpreplyparse.c testminixml.c \
|
||||
minixmlvalid.c testupnpreplyparse.c minissdpc.c \
|
||||
upnperrors.c testigddescparse.c testminiwget.c \
|
||||
connecthostport.c portlistingparse.c receivedata.c
|
||||
connecthostport.c portlistingparse.c receivedata.c \
|
||||
listdevices.c
|
||||
|
||||
LIBOBJS = miniwget.o minixml.o igd_desc_parse.o minisoap.o \
|
||||
miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \
|
||||
|
@ -89,7 +90,7 @@ ifeq ($(JARSUFFIX), win32)
|
|||
endif
|
||||
endif
|
||||
|
||||
EXECUTABLES = upnpc-static
|
||||
EXECUTABLES = upnpc-static listdevices
|
||||
EXECUTABLES_ADDTESTS = testminixml minixmlvalid testupnpreplyparse \
|
||||
testigddescparse testminiwget
|
||||
|
||||
|
@ -226,6 +227,9 @@ upnpc-static: upnpc.o $(LIBRARY) $(LDLIBS)
|
|||
upnpc-shared: upnpc.o $(SHAREDLIBRARY) $(LDLIBS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^
|
||||
|
||||
listdevices: listdevices.o $(LIBRARY) $(LDLIBS)
|
||||
$(CC) $(LDFLAGS) -o $@ $^
|
||||
|
||||
testminixml: $(TESTMINIXMLOBJS)
|
||||
|
||||
testminiwget: $(TESTMINIWGETOBJS)
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/* $Id$ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2013 Thomas Bernard
|
||||
* This software is subject to the conditions detailed in the
|
||||
* LICENCE file provided in this distribution. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "miniupnpc.h"
|
||||
|
||||
int main(int argc, char * * argv)
|
||||
{
|
||||
const char * multicastif = 0;
|
||||
const char * minissdpdpath = 0;
|
||||
int ipv6 = 0;
|
||||
int error = 0;
|
||||
struct UPNPDev * devlist = 0;
|
||||
struct UPNPDev * dev;
|
||||
|
||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath,
|
||||
0/*sameport*/, ipv6, &error);
|
||||
if(devlist) {
|
||||
for(dev = devlist; dev != NULL; dev = dev->pNext) {
|
||||
printf("%s\t%s\n", dev->st, dev->descURL);
|
||||
}
|
||||
freeUPNPDevlist(devlist);
|
||||
} else {
|
||||
printf("no device found.\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue