network.h

Go to the documentation of this file.
00001 
00006 /* purple
00007  *
00008  * Purple is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  */
00026 #ifndef _PURPLE_NETWORK_H_
00027 #define _PURPLE_NETWORK_H_
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 /**************************************************************************/
00035 /**************************************************************************/
00038 typedef struct _PurpleNetworkListenData PurpleNetworkListenData;
00039 
00040 typedef void (*PurpleNetworkListenCallback) (int listenfd, gpointer data);
00041 
00054 const unsigned char *purple_network_ip_atoi(const char *ip);
00055 
00064 void purple_network_set_public_ip(const char *ip);
00065 
00074 const char *purple_network_get_public_ip(void);
00075 
00088 const char *purple_network_get_local_system_ip(int fd);
00089 
00107 const char *purple_network_get_my_ip(int fd);
00108 
00119 void purple_network_listen_map_external(gboolean map_external);
00120 
00146 PurpleNetworkListenData *purple_network_listen(unsigned short port,
00147         int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data);
00148 
00179 PurpleNetworkListenData *purple_network_listen_range(unsigned short start,
00180         unsigned short end, int socket_type,
00181         PurpleNetworkListenCallback cb, gpointer cb_data);
00182 
00191 void purple_network_listen_cancel(PurpleNetworkListenData *listen_data);
00192 
00201 unsigned short purple_network_get_port_from_fd(int fd);
00202 
00208 gboolean purple_network_is_available(void);
00209 
00215 void *purple_network_get_handle(void);
00216 
00220 void purple_network_init(void);
00221 
00225 void purple_network_uninit(void);
00226 
00229 #ifdef __cplusplus
00230 }
00231 #endif
00232 
00233 #endif /* _PURPLE_NETWORK_H_ */