pidgin  2.14.10
network.h
Go to the documentation of this file.
1 
6 /* purple
7  *
8  * Purple is the legal property of its developers, whose names are too numerous
9  * to list here. Please refer to the COPYRIGHT file distributed with this
10  * source distribution.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25  */
26 #ifndef _PURPLE_NETWORK_H_
27 #define _PURPLE_NETWORK_H_
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /**************************************************************************/
35 /**************************************************************************/
38 typedef struct _PurpleNetworkListenData PurpleNetworkListenData;
39 
40 typedef void (*PurpleNetworkListenCallback) (int listenfd, gpointer data);
41 
54 const unsigned char *purple_network_ip_atoi(const char *ip);
55 
64 void purple_network_set_public_ip(const char *ip);
65 
74 const char *purple_network_get_public_ip(void);
75 
89 
100 
118 const char *purple_network_get_my_ip(int fd);
119 
130 void purple_network_listen_map_external(gboolean map_external);
131 
157 PurpleNetworkListenData *purple_network_listen(unsigned short port,
158  int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data);
159 
177 PurpleNetworkListenData *purple_network_listen_family(unsigned short port,
178  int socket_family, int socket_type, PurpleNetworkListenCallback cb,
179  gpointer cb_data);
180 
211 PurpleNetworkListenData *purple_network_listen_range(unsigned short start,
212  unsigned short end, int socket_type,
213  PurpleNetworkListenCallback cb, gpointer cb_data);
214 
233 PurpleNetworkListenData *purple_network_listen_range_family(
234  unsigned short start, unsigned short end, int socket_family,
235  int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data);
236 
245 void purple_network_listen_cancel(PurpleNetworkListenData *listen_data);
246 
255 unsigned short purple_network_get_port_from_fd(int fd);
256 
263 
274 
281 
289 void purple_network_set_stun_server(const gchar *stun_server);
290 
297 const gchar *purple_network_get_stun_ip(void);
298 
306 void purple_network_set_turn_server(const gchar *turn_server);
307 
314 const gchar *purple_network_get_turn_ip(void);
315 
323 
341 int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out);
342 
347 
352 
355 #ifdef __cplusplus
356 }
357 #endif
358 
359 #endif /* _PURPLE_NETWORK_H_ */
void * purple_network_get_handle(void)
Get the handle for the network system.
const char * purple_network_get_public_ip(void)
Returns the IP address of the local system set in preferences.
void purple_network_remove_port_mapping(gint fd)
Remove a port mapping (UPnP or NAT-PMP) associated with listening socket.
void purple_network_listen_map_external(gboolean map_external)
Should calls to purple_network_listen() and purple_network_listen_range() map the port externally usi...
const char * purple_network_get_local_system_ip(int fd)
Returns the IP address of the local system.
gboolean purple_network_is_available(void)
Detects if there is an available network connection.
PurpleNetworkListenData * purple_network_listen(unsigned short port, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data)
Attempts to open a listening port ONLY on the specified port number.
const gchar * purple_network_get_stun_ip(void)
Get the IP address of the STUN server as a string representation.
const unsigned char * purple_network_ip_atoi(const char *ip)
Converts a dot-decimal IP address to an array of unsigned chars.
PurpleNetworkListenData * purple_network_listen_range(unsigned short start, unsigned short end, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data)
Opens a listening port selected from a range of ports.
const char * purple_network_get_my_ip(int fd)
Returns the IP address that should be used anywhere a public IP addresses is needed (listening for an...
void purple_network_listen_cancel(PurpleNetworkListenData *listen_data)
This can be used to cancel any in-progress listener connection by passing in the return value from ei...
const gchar * purple_network_get_turn_ip(void)
Get the IP address of the TURN server as a string representation.
PurpleNetworkListenData * purple_network_listen_range_family(unsigned short start, unsigned short end, int socket_family, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data)
Opens a listening port selected from a range of ports.
void purple_network_force_online(void)
Makes purple_network_is_available() always return TRUE.
void purple_network_set_public_ip(const char *ip)
Sets the IP address of the local system in preferences.
unsigned short purple_network_get_port_from_fd(int fd)
Gets a port number from a file descriptor.
int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out)
Convert a UTF-8 domain name to ASCII in accordance with the IDNA specification.
void purple_network_init(void)
Initializes the network subsystem.
PurpleNetworkListenData * purple_network_listen_family(unsigned short port, int socket_family, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data)
Attempts to open a listening port ONLY on the specified port number.
void purple_network_set_stun_server(const gchar *stun_server)
Update the STUN server IP given the host name Will result in a DNS query being executed asynchronous.
void purple_network_uninit(void)
Shuts down the network subsystem.
void purple_network_set_turn_server(const gchar *turn_server)
Update the TURN server IP given the host name Will result in a DNS query being executed asynchronous.
GList * purple_network_get_all_local_system_ips(void)
Returns all IP addresses of the local system.