pidgin: network.h Source File

pidgin 2.14.4

Loading...
Searching...
No Matches
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
30extern "C" {
31#endif
32
33/**************************************************************************/
35/**************************************************************************/
38typedef struct _PurpleNetworkListenData PurpleNetworkListenData;
39
40typedef 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
88 const char *purple_network_get_local_system_ip(int fd);
89
99GList *purple_network_get_all_local_system_ips(void);
100
118 const char *purple_network_get_my_ip(int fd);
119
130 void purple_network_listen_map_external(gboolean map_external);
131
157PurpleNetworkListenData *purple_network_listen(unsigned short port,
158 int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data);
159
177PurpleNetworkListenData *purple_network_listen_family(unsigned short port,
178 int socket_family, int socket_type, PurpleNetworkListenCallback cb,
179 gpointer cb_data);
180
211PurpleNetworkListenData *purple_network_listen_range(unsigned short start,
212 unsigned short end, int socket_type,
213 PurpleNetworkListenCallback cb, gpointer cb_data);
214
233PurpleNetworkListenData *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
262gboolean purple_network_is_available(void);
263
273 void purple_network_force_online(void);
274
280 void *purple_network_get_handle(void);
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
322 void purple_network_remove_port_mapping(gint fd);
323
341 int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out);
342
346 void purple_network_init(void);
347
351 void purple_network_uninit(void);
352
355#ifdef __cplusplus
356}
357#endif
358
359#endif /* _PURPLE_NETWORK_H_ */
purple_network_get_handle
void * purple_network_get_handle(void)
Get the handle for the network system.
purple_network_remove_port_mapping
void purple_network_remove_port_mapping(gint fd)
Remove a port mapping (UPnP or NAT-PMP) associated with listening socket.
purple_network_listen_map_external
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...
purple_network_get_all_local_system_ips
GList * purple_network_get_all_local_system_ips(void)
Returns all IP addresses of the local system.
purple_network_listen
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.
purple_network_get_local_system_ip
const char * purple_network_get_local_system_ip(int fd)
Returns the IP address of the local system.
purple_network_is_available
gboolean purple_network_is_available(void)
Detects if there is an available network connection.
purple_network_listen_range
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.
purple_network_get_public_ip
const char * purple_network_get_public_ip(void)
Returns the IP address of the local system set in preferences.
purple_network_listen_range_family
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.
purple_network_listen_cancel
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...
purple_network_ip_atoi
const unsigned char * purple_network_ip_atoi(const char *ip)
Converts a dot-decimal IP address to an array of unsigned chars.
purple_network_force_online
void purple_network_force_online(void)
Makes purple_network_is_available() always return TRUE.
purple_network_set_public_ip
void purple_network_set_public_ip(const char *ip)
Sets the IP address of the local system in preferences.
purple_network_get_turn_ip
const gchar * purple_network_get_turn_ip(void)
Get the IP address of the TURN server as a string representation.
purple_network_get_port_from_fd
unsigned short purple_network_get_port_from_fd(int fd)
Gets a port number from a file descriptor.
purple_network_get_my_ip
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...
purple_network_convert_idn_to_ascii
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.
purple_network_init
void purple_network_init(void)
Initializes the network subsystem.
purple_network_get_stun_ip
const gchar * purple_network_get_stun_ip(void)
Get the IP address of the STUN server as a string representation.
purple_network_listen_family
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.
purple_network_set_stun_server
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.
purple_network_uninit
void purple_network_uninit(void)
Shuts down the network subsystem.
purple_network_set_turn_server
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.