3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef _PURPLE_UPNP_H_
23 #define _PURPLE_UPNP_H_
26 * @section_id: libpurple-upnp
27 * @short_description: <filename>upnp.h</filename>
28 * @title: Universal Plug N Play API
31 typedef struct _PurpleUPnPMappingAddRemove PurpleUPnPMappingAddRemove
;
35 /**************************************************************************/
37 /**************************************************************************/
39 /* typedef struct _PurpleUPnPRequestData PurpleUPnPRequestData; */
41 typedef void (*PurpleUPnPCallback
) (gboolean success
, gpointer data
);
49 void purple_upnp_init(void);
53 * purple_upnp_discover:
54 * @cb: an optional callback function to be notified when the UPnP
55 * discovery is complete
56 * @cb_data: Extra data to be passed to the callback
58 * Sends a discovery request to search for a UPnP enabled IGD that
59 * contains the WANIPConnection service that will allow us to recieve the
60 * public IP address of the IGD, and control it for forwarding ports.
61 * The result will be cached for further use.
63 void purple_upnp_discover(PurpleUPnPCallback cb
, gpointer cb_data
);
67 * purple_upnp_get_control_info:
69 * Retrieve the current UPnP control info, if there is any available.
70 * This will only be filled in if purple_upnp_discover() had been called,
71 * and finished discovering.
73 * Returns: The control URL for the IGD we'll use to use the IGD services
75 const PurpleUPnPControlInfo
* purple_upnp_get_control_info(void);
79 * purple_upnp_get_public_ip:
81 * Gets the IP address from a UPnP enabled IGD that sits on the local
82 * network, so when getting the network IP, instead of returning the
83 * local network IP, the public IP is retrieved. This is a cached value from
84 * the time of the UPnP discovery.
86 * Returns: The IP address of the network, or NULL if something went wrong
88 const gchar
* purple_upnp_get_public_ip(void);
91 * purple_upnp_cancel_port_mapping:
92 * @mapping_data: The data returned when you initiated the UPnP mapping request.
94 * Cancel a pending port mapping request initiated with either
95 * purple_upnp_set_port_mapping() or purple_upnp_remove_port_mapping().
97 void purple_upnp_cancel_port_mapping(PurpleUPnPMappingAddRemove
*mapping_data
);
100 * purple_upnp_set_port_mapping:
101 * @portmap: The port to map to this client
102 * @protocol: The protocol to map, either "TCP" or "UDP"
103 * @cb: an optional callback function to be notified when the mapping
104 * addition is complete
105 * @cb_data: Extra data to be passed to the callback
107 * Maps Ports in a UPnP enabled IGD that sits on the local network to
108 * this purple client. Essentially, this function takes care of the port
109 * forwarding so things like file transfers can work behind NAT firewalls
111 * Returns: Data which can be passed to purple_upnp_cancel_port_mapping() to
114 PurpleUPnPMappingAddRemove
*purple_upnp_set_port_mapping(unsigned short portmap
, const gchar
* protocol
,
115 PurpleUPnPCallback cb
, gpointer cb_data
);
118 * purple_upnp_remove_port_mapping:
119 * @portmap: The port to delete the mapping for
120 * @protocol: The protocol to map to. Either "TCP" or "UDP"
121 * @cb: an optional callback function to be notified when the mapping
122 * removal is complete
123 * @cb_data: Extra data to be passed to the callback
125 * Deletes a port mapping in a UPnP enabled IGD that sits on the local network
126 * to this purple client. Essentially, this function takes care of deleting the
127 * port forwarding after they have completed a connection so another client on
128 * the local network can take advantage of the port forwarding
130 * Returns: Data which can be passed to purple_upnp_cancel_port_mapping() to
133 PurpleUPnPMappingAddRemove
*purple_upnp_remove_port_mapping(unsigned short portmap
,
134 const gchar
* protocol
, PurpleUPnPCallback cb
, gpointer cb_data
);
138 #endif /* _PURPLE_UPNP_H_ */