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