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
|
|
29 #ifdef __cplusplus
|
|
30 extern "C" {
|
|
31 #endif
|
|
32
|
|
33 /**************************************************************************/
|
|
34 /** @name UPnP API */
|
|
35 /**************************************************************************/
|
|
36 /*@{*/
|
|
37
|
|
38 /**
|
|
39 * Sends a discovery request to search for a UPnP enabled IGD that
|
|
40 * contains the WANIPConnection service that will allow us to recieve the
|
|
41 * public IP address of the IGD, and control it for forwarding ports.
|
|
42 *
|
|
43 * @param void
|
|
44 *
|
|
45 * @return The control URL for the IGD we'll use to use the IGD services
|
|
46 */
|
|
47 char *gaim_upnp_discover(void);
|
|
48
|
|
49
|
|
50 /**
|
|
51 * Gets the IP address from a UPnP enabled IGD that sits on the local
|
|
52 * network, so when getting the network IP, instead of returning the
|
|
53 * local network IP, the public IP is retrieved.
|
|
54 *
|
|
55 * @param controlURL The control URL retrieved from gaim_upnp_discover.
|
|
56 *
|
|
57 * @return The IP address of the network, or NULL if something went wrong
|
|
58 */
|
|
59 char* gaim_upnp_get_public_ip(const char* controlURL);
|
|
60
|
|
61
|
|
62 /**
|
|
63 * Maps Ports in a UPnP enabled IGD that sits on the local network to
|
|
64 * this gaim client. Essentially, this function takes care of the port
|
|
65 * forwarding so things like file transfers can work behind NAT firewalls
|
|
66 *
|
|
67 * @param controlURL The control URL retrieved from gaim_upnp_discover.
|
|
68 * @param portMap The port to map to this client
|
|
69 * @param protocol The protocol to map, either "TCP" or "UDP"
|
|
70 * @param internalIP The internal IP to map to
|
|
71 *
|
|
72 * @return TRUE if success, FALSE if something went wrong.
|
|
73 */
|
|
74 gboolean gaim_upnp_set_port_mapping(const char* controlURL,
|
|
75 unsigned short portMap,
|
11196
|
76 const char* protocol);
|
11195
|
77
|
|
78 /**
|
|
79 * Deletes a port mapping in a UPnP enabled IGD that sits on the local network
|
|
80 * to this gaim client. Essentially, this function takes care of deleting the
|
|
81 * port forwarding after they have completed a connection so another client on
|
|
82 * the local network can take advantage of the port forwarding
|
|
83 *
|
|
84 * @param controlURL The control URL retrieved from gaim_upnp_discover.
|
|
85 * @param portMap The port to delete the mapping for
|
|
86 * @param protocol The protocol to map to. Either "TCP" or "UDP"
|
|
87 *
|
|
88 * @return TRUE if success, FALSE if something went wrong.
|
|
89 */
|
|
90 gboolean
|
|
91 gaim_upnp_remove_port_mapping(const char* controlURL, unsigned short portMap,
|
|
92 const char* protocol);
|
|
93 /*@}*/
|
|
94
|
|
95
|
|
96 #ifdef __cplusplus
|
|
97 }
|
|
98 #endif
|
|
99
|
|
100 #endif /* _GAIM_UPNP_H_ */
|