comparison libpurple/upnp.h @ 15373:5fe8042783c1

Rename gtk/ and libgaim/ to pidgin/ and libpurple/
author Sean Egan <seanegan@gmail.com>
date Sat, 20 Jan 2007 02:32:10 +0000
parents
children 56a2a0bb290a
comparison
equal deleted inserted replaced
15372:f79e0f4df793 15373:5fe8042783c1
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 /* typedef struct _GaimUPnPRequestData GaimUPnPRequestData; */
40
41 typedef void (*GaimUPnPCallback) (gboolean success, gpointer data);
42
43 /**
44 * Sends a discovery request to search for a UPnP enabled IGD that
45 * contains the WANIPConnection service that will allow us to recieve the
46 * public IP address of the IGD, and control it for forwarding ports.
47 * The result will be cached for further use.
48 *
49 * @param cb an optional callback function to be notified when the UPnP
50 * discovery is complete
51 * @param cb_data Extra data to be passed to the callback
52 */
53 void gaim_upnp_discover(GaimUPnPCallback cb, gpointer cb_data);
54
55 #if 0
56 /**
57 * Retrieve the current UPnP control info, if there is any available.
58 * This will only be filled in if gaim_upnp_discover() had been called,
59 * and finished discovering.
60 *
61 * @return The control URL for the IGD we'll use to use the IGD services
62 */
63 const GaimUPnPControlInfo* gaim_upnp_get_control_info(void);
64 #endif
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 * Maps Ports in a UPnP enabled IGD that sits on the local network to
78 * this gaim client. Essentially, this function takes care of the port
79 * forwarding so things like file transfers can work behind NAT firewalls
80 *
81 * @param portmap The port to map to this client
82 * @param protocol The protocol to map, either "TCP" or "UDP"
83 * @param cb an optional callback function to be notified when the mapping
84 * addition is complete
85 * @param cb_data Extra data to be passed to the callback
86 */
87 void gaim_upnp_set_port_mapping(unsigned short portmap, const gchar* protocol,
88 GaimUPnPCallback cb, gpointer cb_data);
89
90 /**
91 * Deletes a port mapping in a UPnP enabled IGD that sits on the local network
92 * to this gaim client. Essentially, this function takes care of deleting the
93 * port forwarding after they have completed a connection so another client on
94 * the local network can take advantage of the port forwarding
95 *
96 * @param portmap The port to delete the mapping for
97 * @param protocol The protocol to map to. Either "TCP" or "UDP"
98 * @param cb an optional callback function to be notified when the mapping
99 * removal is complete
100 * @param cb_data Extra data to be passed to the callback
101 */
102 void gaim_upnp_remove_port_mapping(unsigned short portmap,
103 const gchar* protocol, GaimUPnPCallback cb, gpointer cb_data);
104
105 /*@}*/
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif /* _GAIM_UPNP_H_ */