Mercurial > pidgin.yaz
comparison libpurple/upnp.h @ 15441:56a2a0bb290a
Fix a crash when a network_listen_range process is canceled before its UPnP port mapping completes, which occurs regularly on certain routers when file transfers are initiated and then quickly finished. Much thanks to Elliott Harris and Eric Richie for their hard work with me hunting this down and fixing it.
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Sun, 28 Jan 2007 15:05:23 +0000 |
parents | 5fe8042783c1 |
children | 32c366eeeb99 |
comparison
equal
deleted
inserted
replaced
15439:a415922e2882 | 15441:56a2a0bb290a |
---|---|
24 */ | 24 */ |
25 | 25 |
26 #ifndef _GAIM_UPNP_H_ | 26 #ifndef _GAIM_UPNP_H_ |
27 #define _GAIM_UPNP_H_ | 27 #define _GAIM_UPNP_H_ |
28 | 28 |
29 typedef struct _UPnPMappingAddRemove UPnPMappingAddRemove; | |
29 | 30 |
30 #ifdef __cplusplus | 31 #ifdef __cplusplus |
31 extern "C" { | 32 extern "C" { |
32 #endif | 33 #endif |
33 | 34 |
72 * @return The IP address of the network, or NULL if something went wrong | 73 * @return The IP address of the network, or NULL if something went wrong |
73 */ | 74 */ |
74 const gchar* gaim_upnp_get_public_ip(void); | 75 const gchar* gaim_upnp_get_public_ip(void); |
75 | 76 |
76 /** | 77 /** |
78 * Cancel a pending port mapping request initiated with either | |
79 * gaim_upnp_set_port_mapping() or gaim_upnp_remove_port_mapping(). | |
80 * | |
81 * @param mapping_data The data returned when you initiated the UPnP mapping request. | |
82 */ | |
83 void gaim_upnp_cancel_port_mapping(UPnPMappingAddRemove *mapping_data); | |
84 | |
85 /** | |
77 * Maps Ports in a UPnP enabled IGD that sits on the local network to | 86 * Maps Ports in a UPnP enabled IGD that sits on the local network to |
78 * this gaim client. Essentially, this function takes care of the port | 87 * this gaim client. Essentially, this function takes care of the port |
79 * forwarding so things like file transfers can work behind NAT firewalls | 88 * forwarding so things like file transfers can work behind NAT firewalls |
80 * | 89 * |
81 * @param portmap The port to map to this client | 90 * @param portmap The port to map to this client |
82 * @param protocol The protocol to map, either "TCP" or "UDP" | 91 * @param protocol The protocol to map, either "TCP" or "UDP" |
83 * @param cb an optional callback function to be notified when the mapping | 92 * @param cb an optional callback function to be notified when the mapping |
84 * addition is complete | 93 * addition is complete |
85 * @param cb_data Extra data to be passed to the callback | 94 * @param cb_data Extra data to be passed to the callback |
95 * | |
96 * @return Data which can be passed to gaim_upnp_port_mapping_cancel() to cancel | |
86 */ | 97 */ |
87 void gaim_upnp_set_port_mapping(unsigned short portmap, const gchar* protocol, | 98 UPnPMappingAddRemove *gaim_upnp_set_port_mapping(unsigned short portmap, const gchar* protocol, |
88 GaimUPnPCallback cb, gpointer cb_data); | 99 GaimUPnPCallback cb, gpointer cb_data); |
89 | 100 |
90 /** | 101 /** |
91 * Deletes a port mapping in a UPnP enabled IGD that sits on the local network | 102 * Deletes a port mapping in a UPnP enabled IGD that sits on the local network |
92 * to this gaim client. Essentially, this function takes care of deleting the | 103 * to this gaim client. Essentially, this function takes care of deleting the |
96 * @param portmap The port to delete the mapping for | 107 * @param portmap The port to delete the mapping for |
97 * @param protocol The protocol to map to. Either "TCP" or "UDP" | 108 * @param protocol The protocol to map to. Either "TCP" or "UDP" |
98 * @param cb an optional callback function to be notified when the mapping | 109 * @param cb an optional callback function to be notified when the mapping |
99 * removal is complete | 110 * removal is complete |
100 * @param cb_data Extra data to be passed to the callback | 111 * @param cb_data Extra data to be passed to the callback |
112 * | |
113 * @return Data which can be passed to gaim_upnp_port_mapping_cancel() to cancel | |
101 */ | 114 */ |
102 void gaim_upnp_remove_port_mapping(unsigned short portmap, | 115 UPnPMappingAddRemove *gaim_upnp_remove_port_mapping(unsigned short portmap, |
103 const gchar* protocol, GaimUPnPCallback cb, gpointer cb_data); | 116 const gchar* protocol, GaimUPnPCallback cb, gpointer cb_data); |
104 | 117 |
105 /*@}*/ | 118 /*@}*/ |
106 | 119 |
107 #ifdef __cplusplus | 120 #ifdef __cplusplus |