annotate src/upnp.h @ 14180:45818acef0eb

[gaim-migrate @ 16830] Patch from Henning Norn to not show ICQ users as "pending" when they are away without a message committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 18 Aug 2006 05:59:47 +0000
parents 8e3b85fe4a55
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11195
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
1 /**
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
2 * @file upnp.h Universal Plug N Play API
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
3 * @ingroup core
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
4 *
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
5 * gaim
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
6 *
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
9 * source distribution.
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
10 *
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
14 * (at your option) any later version.
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
15 *
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
19 * GNU General Public License for more details.
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
20 *
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
24 */
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
25
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
26 #ifndef _GAIM_UPNP_H_
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
27 #define _GAIM_UPNP_H_
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
28
11391
d3755a7ddd82 [gaim-migrate @ 13620]
Adam Warrington <awarring>
parents: 11213
diff changeset
29
11195
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
30 #ifdef __cplusplus
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
31 extern "C" {
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
32 #endif
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
33
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
34 /**************************************************************************/
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
35 /** @name UPnP API */
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
36 /**************************************************************************/
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
37 /*@{*/
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
42 /**
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
43 * Sends a discovery request to search for a UPnP enabled IGD that
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
44 * contains the WANIPConnection service that will allow us to recieve the
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
60 * @return The control URL for the IGD we'll use to use the IGD services
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
64
11213
ff728e84d59a [gaim-migrate @ 13344]
Thomas Butter <tbutter>
parents: 11208
diff changeset
65
11195
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
66 /**
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
67 * Gets the IP address from a UPnP enabled IGD that sits on the local
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
71 *
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
72 * @return The IP address of the network, or NULL if something went wrong
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
75
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
76
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
77 /**
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
78 * Maps Ports in a UPnP enabled IGD that sits on the local network to
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
79 * this gaim client. Essentially, this function takes care of the port
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
80 * forwarding so things like file transfers can work behind NAT firewalls
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
90
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
91 /**
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
92 * Deletes a port mapping in a UPnP enabled IGD that sits on the local network
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
93 * to this gaim client. Essentially, this function takes care of deleting the
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
94 * port forwarding after they have completed a connection so another client on
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
95 * the local network can take advantage of the port forwarding
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
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
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
105 /*@}*/
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
106
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
107 #ifdef __cplusplus
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
108 }
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
109 #endif
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
110
3aeb85cc9cda [gaim-migrate @ 13319]
Adam Warrington <awarring>
parents:
diff changeset
111 #endif /* _GAIM_UPNP_H_ */