View previous topic :: View next topic |
Author |
Message |
tiennou
Joined: 19 Nov 2007 Posts: 1
|
Posted: Mon Nov 19, 2007 2:05 pm Post subject: Returning UPnP error codes |
|
|
Hi !
I'm a (part-time) developer of Transmission too, and I'm currently inspecting our NAT code. I have a feature request regarding miniUPnPc, because right now we can't get a meaningful error code back from it's mapping functions :
- UPNP_GetValidIGD is the only one to return "usable" value (I can log 0 => "No IGD device", 1 => "Found IGD Device: connected", 2 => "Found IGD Device: disconnected", 3 => "Found IGD Device: not recognized"), but I'm not sure it won't return something over 3.
- UPNP_AddPortMapping return 0 on error, 1 otherwise (which BTW is not "normal" C behavior), and you can't access what was really replied by the IGD ( 0 => "Good", errorCode => "Bad" ).
- UPNP_DeletePortMapping returns void, so you can't know if a port mapping was found or not.
Now I can manage to tweak the code so I get those error codes, and maybe even code a char * UPNP_ErrorStr(int errCode), but I want to know your opinion on this (because obviously I'm breaking already existing code).
And while I'm writing do you have plans on setting up a Subversion repository of some sort ?
Thanks for this slated "mini" but nevertheless useful library ! |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Mon Nov 19, 2007 11:38 pm Post subject: |
|
|
you are right the error handling is not clean. I need to work on it.
What are the miniupnpc api function you are using so I work on these first ?
About svn, I'm currently using my CVS repository for the miniupnp project but there is no anonymous access I upload updated sources to the website as frequently as possible and you can send me patches. _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
Charles
Joined: 06 Nov 2007 Posts: 20
|
Posted: Tue Nov 20, 2007 8:43 pm Post subject: |
|
|
miniupnp wrote: | you are right the error handling is not clean. I need to work on it.
What are the miniupnpc api function you are using so I work on these first? |
We're using these functions:
* upnpDiscover
* UPNP_GetValidIGD
* freeUPNPDevlist
* UPNP_AddPortMapping
* UPNP_DeletePortMapping
* FreeUPNPUrls
though if you're taking requests, I'd rather have nat-pmp first... |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Wed Dec 19, 2007 6:38 pm Post subject: |
|
|
I began to improve error codes in UPnP methods.
UPnP error codes are now returned by major UPnP methods. Please read upnpcommands.h for more details about which codes are returned by which functions.
miniupnpc-20071219.tar.gz
it still needs some improvements ! _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
katt
Joined: 13 Nov 2014 Posts: 1 Location: USA
|
Posted: Thu Nov 13, 2014 4:54 am Post subject: |
|
|
I went through miniupnp.h, it seems APIs are given for device detection on demand (when you requested). But will it handle the event notification of new device added in to the network ?
___________________________
katt |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Thu Nov 13, 2014 8:50 am Post subject: |
|
|
katt wrote: | I went through miniupnp.h, it seems APIs are given for device detection on demand (when you requested). But will it handle the event notification of new device added in to the network ?
|
No _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
|