src/upnp.h

changeset 14253
b63ebf84c42b
parent 14252
d10dda2777a9
child 14254
77edc7a6191a
equal deleted inserted replaced
14252:d10dda2777a9 14253:b63ebf84c42b
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
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /**************************************************************************/
35 /** @name UPnP API */
36 /**************************************************************************/
37 /*@{*/
38
39
40 typedef void (*GaimUPnPCallback) (gboolean success, gpointer data);
41
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.
46 * The result will be cached for further use.
47 *
48 * @param cb an optional callback function to be notified when the UPnP
49 * discovery is complete
50 * @param cb_data Extra data to be passed to the callback
51 */
52 void gaim_upnp_discover(GaimUPnPCallback cb, gpointer cb_data);
53
54 #if 0
55 /**
56 * Retrieve the current UPnP control info, if there is any available.
57 * This will only be filled in if gaim_upnp_discover() had been called,
58 * and finished discovering.
59 *
60 * @return The control URL for the IGD we'll use to use the IGD services
61 */
62 const GaimUPnPControlInfo* gaim_upnp_get_control_info(void);
63 #endif
64
65
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
69 * local network IP, the public IP is retrieved. This is a cached value from
70 * the time of the UPnP discovery.
71 *
72 * @return The IP address of the network, or NULL if something went wrong
73 */
74 const gchar* gaim_upnp_get_public_ip(void);
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 *
82 * @param portmap The port to map to this client
83 * @param protocol The protocol to map, either "TCP" or "UDP"
84 * @param cb an optional callback function to be notified when the mapping
85 * addition is complete
86 * @param cb_data Extra data to be passed to the callback
87 */
88 void gaim_upnp_set_port_mapping(unsigned short portmap, const gchar* protocol,
89 GaimUPnPCallback cb, gpointer cb_data);
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 *
97 * @param portmap The port to delete the mapping for
98 * @param protocol The protocol to map to. Either "TCP" or "UDP"
99 * @param cb an optional callback function to be notified when the mapping
100 * removal is complete
101 * @param cb_data Extra data to be passed to the callback
102 */
103 void gaim_upnp_remove_port_mapping(unsigned short portmap,
104 const gchar* protocol, GaimUPnPCallback cb, gpointer cb_data);
105 /*@}*/
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif /* _GAIM_UPNP_H_ */

mercurial