pidgin 2.14.14dev
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
54const unsigned char *purple_network_ip_atoi(const char *ip);
55
64void purple_network_set_public_ip(const char *ip);
65
75
89
100
118const char *purple_network_get_my_ip(int fd);
119
130void 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
245void purple_network_listen_cancel(PurpleNetworkListenData *listen_data);
246
255unsigned short purple_network_get_port_from_fd(int fd);
256
263
274
281
289void purple_network_set_stun_server(const gchar *stun_server);
290
297const gchar *purple_network_get_stun_ip(void);
298
306void purple_network_set_turn_server(const gchar *turn_server);
307
314const gchar *purple_network_get_turn_ip(void);
315
323
341int 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.
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...
GList * purple_network_get_all_local_system_ips(void)
Returns all IP addresses of the local system.
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 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_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_public_ip(void)
Returns the IP address of the local system set in preferences.
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_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 unsigned char * purple_network_ip_atoi(const char *ip)
Converts a dot-decimal IP address to an array of unsigned chars.
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.
const gchar * purple_network_get_turn_ip(void)
Get the IP address of the TURN server as a string representation.
unsigned short purple_network_get_port_from_fd(int fd)
Gets a port number from a file descriptor.
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...
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.
const gchar * purple_network_get_stun_ip(void)
Get the IP address of the STUN server as a string representation.
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.