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
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: (scope async): An optional callback function to be notified when the
55 * UPnP discovery is complete.
56 * @cb_data: (closure): 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
);
66 * purple_upnp_get_public_ip:
68 * Gets the IP address from a UPnP enabled IGD that sits on the local
69 * network, so when getting the network IP, instead of returning the
70 * local network IP, the public IP is retrieved. This is a cached value from
71 * the time of the UPnP discovery.
73 * Returns: The IP address of the network, or NULL if something went wrong
75 const gchar
* purple_upnp_get_public_ip(void);
78 * purple_upnp_cancel_port_mapping:
79 * @mapping_data: The data returned when you initiated the UPnP mapping request.
81 * Cancel a pending port mapping request initiated with either
82 * purple_upnp_set_port_mapping() or purple_upnp_remove_port_mapping().
84 void purple_upnp_cancel_port_mapping(PurpleUPnPMappingAddRemove
*mapping_data
);
87 * purple_upnp_set_port_mapping:
88 * @portmap: The port to map to this client
89 * @protocol: The protocol to map, either "TCP" or "UDP"
90 * @cb: (scope async): An optional callback function to be notified when the
91 * mapping addition is complete.
92 * @cb_data: (closure): Extra data to be passed to the callback.
94 * Maps Ports in a UPnP enabled IGD that sits on the local network to
95 * this purple client. Essentially, this function takes care of the port
96 * forwarding so things like file transfers can work behind NAT firewalls
98 * Returns: Data which can be passed to purple_upnp_cancel_port_mapping() to
101 PurpleUPnPMappingAddRemove
*purple_upnp_set_port_mapping(unsigned short portmap
, const gchar
* protocol
,
102 PurpleUPnPCallback cb
, gpointer cb_data
);
105 * purple_upnp_remove_port_mapping:
106 * @portmap: The port to delete the mapping for
107 * @protocol: The protocol to map to. Either "TCP" or "UDP"
108 * @cb: (scope async): An optional callback function to be notified when the
109 * mapping removal is complete.
110 * @cb_data: (closure): Extra data to be passed to the callback.
112 * Deletes a port mapping in a UPnP enabled IGD that sits on the local network
113 * to this purple client. Essentially, this function takes care of deleting the
114 * port forwarding after they have completed a connection so another client on
115 * the local network can take advantage of the port forwarding
117 * Returns: Data which can be passed to purple_upnp_cancel_port_mapping() to
120 PurpleUPnPMappingAddRemove
*purple_upnp_remove_port_mapping(unsigned short portmap
,
121 const gchar
* protocol
, PurpleUPnPCallback cb
, gpointer cb_data
);
125 #endif /* PURPLE_UPNP_H */