miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Returning UPnP error codes

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Feature Request
View previous topic :: View next topic  
Author Message
tiennou



Joined: 19 Nov 2007
Posts: 1

PostPosted: Mon Nov 19, 2007 2:05 pm    Post subject: Returning UPnP error codes Reply with quote

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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1445

PostPosted: Mon Nov 19, 2007 11:38 pm    Post subject: Reply with quote

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 Smile I upload updated sources to the website as frequently as possible and you can send me patches.
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Charles



Joined: 06 Nov 2007
Posts: 20

PostPosted: Tue Nov 20, 2007 8:43 pm    Post subject: Reply with quote

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... Wink
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1445

PostPosted: Wed Dec 19, 2007 6:38 pm    Post subject: Reply with quote

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 ! Smile
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
katt



Joined: 13 Nov 2014
Posts: 1
Location: USA

PostPosted: Thu Nov 13, 2014 4:54 am    Post subject: Reply with quote

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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1445

PostPosted: Thu Nov 13, 2014 8:50 am    Post subject: Reply with quote

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.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Feature Request All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.