Mercurial > pidgin
annotate src/upnp.h @ 13374:14d1892e0932
[gaim-migrate @ 15747]
Fix the showstopper bug about autoreconnect being too aggressive
"If you try to connect to an account and it fails, switching your
global status to Offline will not prevent the autoreconnect from
trying to re-connect"
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 02 Mar 2006 05:58:21 +0000 |
parents | 8e3b85fe4a55 |
children |
rev | line source |
---|---|
11195 | 1 /** |
2 * @file upnp.h Universal Plug N Play API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
7 * Gaim is the legal property of its developers, whose names are too numerous | |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 | |
26 #ifndef _GAIM_UPNP_H_ | |
27 #define _GAIM_UPNP_H_ | |
28 | |
11391 | 29 |
11195 | 30 #ifdef __cplusplus |
31 extern "C" { | |
32 #endif | |
33 | |
34 /**************************************************************************/ | |
35 /** @name UPnP API */ | |
36 /**************************************************************************/ | |
37 /*@{*/ | |
38 | |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
39 |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
40 typedef void (*GaimUPnPCallback) (gboolean success, gpointer data); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
41 |
11195 | 42 /** |
43 * Sends a discovery request to search for a UPnP enabled IGD that | |
44 * contains the WANIPConnection service that will allow us to recieve the | |
45 * public IP address of the IGD, and control it for forwarding ports. | |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
46 * The result will be cached for further use. |
11195 | 47 * |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
48 * @param cb an optional callback function to be notified when the UPnP |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
49 * discovery is complete |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
50 * @param cb_data Extra data to be passed to the callback |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
51 */ |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
52 void gaim_upnp_discover(GaimUPnPCallback cb, gpointer cb_data); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
53 |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
54 #if 0 |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
55 /** |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
56 * Retrieve the current UPnP control info, if there is any available. |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
57 * This will only be filled in if gaim_upnp_discover() had been called, |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
58 * and finished discovering. |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
59 * |
11195 | 60 * @return The control URL for the IGD we'll use to use the IGD services |
61 */ | |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
62 const GaimUPnPControlInfo* gaim_upnp_get_control_info(void); |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
63 #endif |
11195 | 64 |
11213 | 65 |
11195 | 66 /** |
67 * Gets the IP address from a UPnP enabled IGD that sits on the local | |
68 * network, so when getting the network IP, instead of returning the | |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
69 * local network IP, the public IP is retrieved. This is a cached value from |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
70 * the time of the UPnP discovery. |
11195 | 71 * |
72 * @return The IP address of the network, or NULL if something went wrong | |
73 */ | |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
74 const gchar* gaim_upnp_get_public_ip(void); |
11195 | 75 |
76 | |
77 /** | |
78 * Maps Ports in a UPnP enabled IGD that sits on the local network to | |
79 * this gaim client. Essentially, this function takes care of the port | |
80 * forwarding so things like file transfers can work behind NAT firewalls | |
81 * | |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
82 * @param portmap The port to map to this client |
11195 | 83 * @param protocol The protocol to map, either "TCP" or "UDP" |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
84 * @param cb an optional callback function to be notified when the mapping |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
85 * addition is complete |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
86 * @param cb_data Extra data to be passed to the callback |
11195 | 87 */ |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
88 void gaim_upnp_set_port_mapping(unsigned short portmap, const gchar* protocol, |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
89 GaimUPnPCallback cb, gpointer cb_data); |
11195 | 90 |
91 /** | |
92 * Deletes a port mapping in a UPnP enabled IGD that sits on the local network | |
93 * to this gaim client. Essentially, this function takes care of deleting the | |
94 * port forwarding after they have completed a connection so another client on | |
95 * the local network can take advantage of the port forwarding | |
96 * | |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
97 * @param portmap The port to delete the mapping for |
11195 | 98 * @param protocol The protocol to map to. Either "TCP" or "UDP" |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
99 * @param cb an optional callback function to be notified when the mapping |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
100 * removal is complete |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
101 * @param cb_data Extra data to be passed to the callback |
11195 | 102 */ |
12909
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
103 void gaim_upnp_remove_port_mapping(unsigned short portmap, |
8e3b85fe4a55
[gaim-migrate @ 15262]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11501
diff
changeset
|
104 const gchar* protocol, GaimUPnPCallback cb, gpointer cb_data); |
11195 | 105 /*@}*/ |
106 | |
107 #ifdef __cplusplus | |
108 } | |
109 #endif | |
110 | |
111 #endif /* _GAIM_UPNP_H_ */ |