Mercurial > pidgin.yaz
annotate libpurple/network.h @ 31392:a328691c761a
* Don't include ourselves in the list of other endpoints that can be
disconnected
* Show a different message if there are no other endpoints. Unfortunately
this message has a colon after it, because our request API adds a colon
to all labels. There's a note in the code listing possible options for
fixing that. For now, I think this is an improvement
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 22 Nov 2010 07:32:57 +0000 |
parents | 1cdae196aac8 |
children | 44f53d3fc54f |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file network.h Network API |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * @ingroup core |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
6 /* purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
15823 | 8 * Purple is the legal property of its developers, whose names are too numerous |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15974
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 */ |
15823 | 26 #ifndef _PURPLE_NETWORK_H_ |
27 #define _PURPLE_NETWORK_H_ | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #ifdef __cplusplus |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 extern "C" { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 /**************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 /** @name Network API */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 /**************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 /*@{*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
15823 | 38 typedef struct _PurpleNetworkListenData PurpleNetworkListenData; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 |
15823 | 40 typedef void (*PurpleNetworkListenCallback) (int listenfd, gpointer data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 * Converts a dot-decimal IP address to an array of unsigned |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 * chars. For example, converts 192.168.0.1 to a 4 byte |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 * array containing 192, 168, 0 and 1. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 * @param ip An IP address in dot-decimal notiation. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 * @return An array of 4 bytes containing an IP addresses |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 * equivalent to the given parameter, or NULL if |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 * the given IP address is invalid. This value |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 * is statically allocated and should not be |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 * freed. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 */ |
15823 | 54 const unsigned char *purple_network_ip_atoi(const char *ip); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 * Sets the IP address of the local system in preferences. This |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 * is the IP address that should be used for incoming connections |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 * (file transfer, direct IM, etc.) and should therefore be |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 * publicly accessible. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 * @param ip The local IP address. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 */ |
15823 | 64 void purple_network_set_public_ip(const char *ip); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 * Returns the IP address of the local system set in preferences. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 * |
15823 | 69 * This returns the value set via purple_network_set_public_ip(). |
70 * You probably want to use purple_network_get_my_ip() instead. | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 * @return The local IP address set in preferences. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 */ |
15823 | 74 const char *purple_network_get_public_ip(void); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 * Returns the IP address of the local system. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 * |
15823 | 79 * You probably want to use purple_network_get_my_ip() instead. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 * @note The returned string is a pointer to a static buffer. If this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 * function is called twice, it may be important to make a copy |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 * of the returned string. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 * @param fd The fd to use to help figure out the IP, or else -1. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 * @return The local IP address. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 */ |
15823 | 88 const char *purple_network_get_local_system_ip(int fd); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 /** |
29495
02f6f49da454
Add a function to enumerate all local IPs
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
91 * Returns all IP addresses of the local system. |
02f6f49da454
Add a function to enumerate all local IPs
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
92 * |
30305
4742a50da311
Update this comment; the function supports IPv6
Paul Aurich <paul@darkrain42.org>
parents:
30153
diff
changeset
|
93 * @note The caller must free this list. If libpurple was built with |
4742a50da311
Update this comment; the function supports IPv6
Paul Aurich <paul@darkrain42.org>
parents:
30153
diff
changeset
|
94 * support for it, this function also enumerates IPv6 addresses. |
29496
f1aa01ff26dd
Remove IPv6 support from _get_local_system_ips, since I couldn't get it to
Marcus Lundblad <ml@update.uu.se>
parents:
29495
diff
changeset
|
95 * @since 2.7.0 |
29495
02f6f49da454
Add a function to enumerate all local IPs
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
96 * |
02f6f49da454
Add a function to enumerate all local IPs
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
97 * @return A list of local IP addresses. |
02f6f49da454
Add a function to enumerate all local IPs
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
98 */ |
29496
f1aa01ff26dd
Remove IPv6 support from _get_local_system_ips, since I couldn't get it to
Marcus Lundblad <ml@update.uu.se>
parents:
29495
diff
changeset
|
99 GList *purple_network_get_all_local_system_ips(void); |
29495
02f6f49da454
Add a function to enumerate all local IPs
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
100 |
02f6f49da454
Add a function to enumerate all local IPs
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
101 /** |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 * Returns the IP address that should be used anywhere a |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 * public IP addresses is needed (listening for an incoming |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 * file transfer, etc). |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 * If the user has manually specified an IP address via |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 * preferences, then this IP is returned. Otherwise the |
15823 | 108 * IP address returned by purple_network_get_local_system_ip() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 * is returned. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 * @note The returned string is a pointer to a static buffer. If this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 * function is called twice, it may be important to make a copy |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 * of the returned string. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 * @param fd The fd to use to help figure out the IP, or -1. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 * @return The local IP address to be used. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 */ |
15823 | 118 const char *purple_network_get_my_ip(int fd); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
120 /** |
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
121 * Should calls to purple_network_listen() and purple_network_listen_range() |
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
122 * map the port externally using NAT-PMP or UPnP? |
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
123 * The default value is TRUE |
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
124 * |
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
125 * @param map_external Should the open port be mapped externally? |
30116
1963a39c0ad1
I got confused when I first read this because I looked at the functions above
Mark Doliner <mark@kingant.net>
parents:
30115
diff
changeset
|
126 * @deprecated In 3.0.0 a boolean will be added to the functions mentioned |
1963a39c0ad1
I got confused when I first read this because I looked at the functions above
Mark Doliner <mark@kingant.net>
parents:
30115
diff
changeset
|
127 * above to perform the same function. |
21466
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
128 * @since 2.3.0 |
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
129 */ |
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
130 void purple_network_listen_map_external(gboolean map_external); |
7a05b6f84545
Don't map the port used for bonjour file transfers externally. This adds a new function that will go away in 3.0.0 when we can modify purple_network_do_listen to take an additional parameter.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20074
diff
changeset
|
131 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 * Attempts to open a listening port ONLY on the specified port number. |
15823 | 134 * You probably want to use purple_network_listen_range() instead of this. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 * This function is useful, for example, if you wanted to write a telnet |
15823 | 136 * server as a Purple plugin, and you HAD to listen on port 23. Why anyone |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 * would want to do that is beyond me. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 * This opens a listening port. The caller will want to set up a watcher |
15823 | 140 * of type PURPLE_INPUT_READ on the fd returned in cb. It will probably call |
30153
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
141 * accept in the watcher callback, and then possibly remove the watcher and |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
142 * close the listening socket, and add a new watcher on the new socket accept |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 * returned. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 * @param port The port number to bind to. Must be greater than 0. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 * @param socket_type The type of socket to open for listening. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 * @param cb The callback to be invoked when the port to listen on is available. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 * The file descriptor of the listening socket will be specified in |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 * this callback, or -1 if no socket could be established. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 * @param cb_data extra data to be returned when cb is called |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 * @return A pointer to a data structure that can be used to cancel |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 * the pending listener, or NULL if unable to obtain a local |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 * socket to listen on. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 */ |
15823 | 157 PurpleNetworkListenData *purple_network_listen(unsigned short port, |
158 int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 /** |
30153
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
161 * \copydoc purple_network_listen |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
162 * |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
163 * Libpurple does not currently do any port mapping (stateful firewall hole |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
164 * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
165 * addresses, a mapping is done). |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
166 * |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
167 * @param socket_family The protocol family of the socket. This should be |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
168 * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
169 * may or may not be able to accept IPv4 connections |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
170 * based on the system configuration (use |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
171 * purple_socket_speaks_ipv4 to check). If an IPv6 |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
172 * socket doesn't accept V4-mapped addresses, you will |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
173 * need a second listener to support both v4 and v6. |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
174 * @since 2.7.0 |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
175 * @deprecated This function will be renamed to purple_network_listen in 3.0.0. |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
176 */ |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
177 PurpleNetworkListenData *purple_network_listen_family(unsigned short port, |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
178 int socket_family, int socket_type, PurpleNetworkListenCallback cb, |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
179 gpointer cb_data); |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
180 |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
181 /** |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 * Opens a listening port selected from a range of ports. The range of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 * ports used is chosen in the following manner: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 * If a range is specified in preferences, these values are used. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 * If a non-0 values are passed to the function as parameters, these |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 * values are used. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 * Otherwise a port is chosen at random by the operating system. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 * This opens a listening port. The caller will want to set up a watcher |
15823 | 190 * of type PURPLE_INPUT_READ on the fd returned in cb. It will probably call |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 * accept in the watcher callback, and then possibly remove the watcher and close |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 * the listening socket, and add a new watcher on the new socket accept |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 * returned. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 * @param start The port number to bind to, or 0 to pick a random port. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 * Users are allowed to override this arg in prefs. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 * @param end The highest possible port in the range of ports to listen on, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 * or 0 to pick a random port. Users are allowed to override this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 * arg in prefs. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 * @param socket_type The type of socket to open for listening. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 * @param cb The callback to be invoked when the port to listen on is available. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 * The file descriptor of the listening socket will be specified in |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 * this callback, or -1 if no socket could be established. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 * @param cb_data extra data to be returned when cb is called |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 * @return A pointer to a data structure that can be used to cancel |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 * the pending listener, or NULL if unable to obtain a local |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 * socket to listen on. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 */ |
15823 | 211 PurpleNetworkListenData *purple_network_listen_range(unsigned short start, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 unsigned short end, int socket_type, |
15823 | 213 PurpleNetworkListenCallback cb, gpointer cb_data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 /** |
30153
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
216 * \copydoc purple_network_listen_range |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
217 * |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
218 * Libpurple does not currently do any port mapping (stateful firewall hole |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
219 * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
220 * addresses, a mapping is done). |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
221 * |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
222 * @param socket_family The protocol family of the socket. This should be |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
223 * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
224 * may or may not be able to accept IPv4 connections |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
225 * based on the system configuration (use |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
226 * purple_socket_speaks_ipv4 to check). If an IPv6 |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
227 * socket doesn't accept V4-mapped addresses, you will |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
228 * need a second listener to support both v4 and v6. |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
229 * @since 2.7.0 |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
230 * @deprecated This function will be renamed to purple_network_listen_range |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
231 * in 3.0.0. |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
232 */ |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
233 PurpleNetworkListenData *purple_network_listen_range_family( |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
234 unsigned short start, unsigned short end, int socket_family, |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
235 int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
236 |
35a1cf247168
Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <paul@darkrain42.org>
parents:
30116
diff
changeset
|
237 /** |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 * This can be used to cancel any in-progress listener connection |
15823 | 239 * by passing in the return value from either purple_network_listen() |
240 * or purple_network_listen_range(). | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 * |
30865
1cdae196aac8
Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30305
diff
changeset
|
242 * @param listen_data This listener attempt will be cancelled and |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 * the struct will be freed. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 */ |
15823 | 245 void purple_network_listen_cancel(PurpleNetworkListenData *listen_data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 * Gets a port number from a file descriptor. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 * @param fd The file descriptor. This should be a tcp socket. The current |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 * implementation probably dies on anything but IPv4. Perhaps this |
15823 | 252 * possible bug will inspire new and valuable contributors to Purple. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 * @return The port number, in host byte order. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 */ |
15823 | 255 unsigned short purple_network_get_port_from_fd(int fd); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 /** |
24290
af44492cdb95
Update the docs for purple_network_is_available(). It doesn't block.
Richard Laager <rlaager@wiktel.com>
parents:
21466
diff
changeset
|
258 * Detects if there is an available network connection. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 * |
24290
af44492cdb95
Update the docs for purple_network_is_available(). It doesn't block.
Richard Laager <rlaager@wiktel.com>
parents:
21466
diff
changeset
|
260 * @return TRUE if the network is available |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 */ |
15823 | 262 gboolean purple_network_is_available(void); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 /** |
25343
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
265 * Makes purple_network_is_available() always return @c TRUE. |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
266 * |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
267 * This is what backs the --force-online command line argument in Pidgin, |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
268 * for example. This is useful for offline testing, especially when |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
269 * combined with nullprpl. |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
270 * |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
271 * @since 2.6.0 |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
272 */ |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
273 void purple_network_force_online(void); |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
274 |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24291
diff
changeset
|
275 /** |
15974
1a12ce76c4f4
The network module now registers the signal 'network-configuration-changed' and emits it when a network change is detected via libnm or the win32 network monitor. The UI could also emit this signal if it knows something network.c doesn't. UPnP and NAT-PMP respond to the signal by clearing their IP address caches; changing networks without quitting/relaunching will now lead to the new IP address being (lazily) determined. This commit also enables nat-pmp and adds nat-pmp.[h|c] to the build process; please let me know if there are any problems building, as I only have OS X test machines.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
276 * Get the handle for the network system |
1a12ce76c4f4
The network module now registers the signal 'network-configuration-changed' and emits it when a network change is detected via libnm or the win32 network monitor. The UI could also emit this signal if it knows something network.c doesn't. UPnP and NAT-PMP respond to the signal by clearing their IP address caches; changing networks without quitting/relaunching will now lead to the new IP address being (lazily) determined. This commit also enables nat-pmp and adds nat-pmp.[h|c] to the build process; please let me know if there are any problems building, as I only have OS X test machines.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
277 * |
1a12ce76c4f4
The network module now registers the signal 'network-configuration-changed' and emits it when a network change is detected via libnm or the win32 network monitor. The UI could also emit this signal if it knows something network.c doesn't. UPnP and NAT-PMP respond to the signal by clearing their IP address caches; changing networks without quitting/relaunching will now lead to the new IP address being (lazily) determined. This commit also enables nat-pmp and adds nat-pmp.[h|c] to the build process; please let me know if there are any problems building, as I only have OS X test machines.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
278 * @return the handle to the network system |
1a12ce76c4f4
The network module now registers the signal 'network-configuration-changed' and emits it when a network change is detected via libnm or the win32 network monitor. The UI could also emit this signal if it knows something network.c doesn't. UPnP and NAT-PMP respond to the signal by clearing their IP address caches; changing networks without quitting/relaunching will now lead to the new IP address being (lazily) determined. This commit also enables nat-pmp and adds nat-pmp.[h|c] to the build process; please let me know if there are any problems building, as I only have OS X test machines.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
279 */ |
1a12ce76c4f4
The network module now registers the signal 'network-configuration-changed' and emits it when a network change is detected via libnm or the win32 network monitor. The UI could also emit this signal if it knows something network.c doesn't. UPnP and NAT-PMP respond to the signal by clearing their IP address caches; changing networks without quitting/relaunching will now lead to the new IP address being (lazily) determined. This commit also enables nat-pmp and adds nat-pmp.[h|c] to the build process; please let me know if there are any problems building, as I only have OS X test machines.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
280 void *purple_network_get_handle(void); |
1a12ce76c4f4
The network module now registers the signal 'network-configuration-changed' and emits it when a network change is detected via libnm or the win32 network monitor. The UI could also emit this signal if it knows something network.c doesn't. UPnP and NAT-PMP respond to the signal by clearing their IP address caches; changing networks without quitting/relaunching will now lead to the new IP address being (lazily) determined. This commit also enables nat-pmp and adds nat-pmp.[h|c] to the build process; please let me know if there are any problems building, as I only have OS X test machines.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
281 |
30115
9843473de5c4
Strip trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
29742
diff
changeset
|
282 /** |
26137
c56e8826fed0
Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents:
26132
diff
changeset
|
283 * Update the STUN server IP given the host name |
26132
ae3d25465d0f
Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents:
24291
diff
changeset
|
284 * Will result in a DNS query being executed asynchronous |
30115
9843473de5c4
Strip trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
29742
diff
changeset
|
285 * |
26132
ae3d25465d0f
Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents:
24291
diff
changeset
|
286 * @param stun_server The host name of the STUN server to set |
26511
f171707b7d54
ChangeLog.API new calls for STUN and TURN servers used by vv
Marcus Lundblad <ml@update.uu.se>
parents:
26213
diff
changeset
|
287 * @since 2.6.0 |
26132
ae3d25465d0f
Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents:
24291
diff
changeset
|
288 */ |
ae3d25465d0f
Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents:
24291
diff
changeset
|
289 void purple_network_set_stun_server(const gchar *stun_server); |
30115
9843473de5c4
Strip trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
29742
diff
changeset
|
290 |
26132
ae3d25465d0f
Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents:
24291
diff
changeset
|
291 /** |
ae3d25465d0f
Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents:
24291
diff
changeset
|
292 * Get the IP address of the STUN server as a string representation |
ae3d25465d0f
Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents:
24291
diff
changeset
|
293 * |
ae3d25465d0f
Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents:
24291
diff
changeset
|
294 * @return the IP address |
26511
f171707b7d54
ChangeLog.API new calls for STUN and TURN servers used by vv
Marcus Lundblad <ml@update.uu.se>
parents:
26213
diff
changeset
|
295 * @since 2.6.0 |
26132
ae3d25465d0f
Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents:
24291
diff
changeset
|
296 */ |
ae3d25465d0f
Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents:
24291
diff
changeset
|
297 const gchar *purple_network_get_stun_ip(void); |
30115
9843473de5c4
Strip trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
29742
diff
changeset
|
298 |
9843473de5c4
Strip trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
29742
diff
changeset
|
299 /** |
26137
c56e8826fed0
Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents:
26132
diff
changeset
|
300 * Update the TURN server IP given the host name |
c56e8826fed0
Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents:
26132
diff
changeset
|
301 * Will result in a DNS query being executed asynchronous |
30115
9843473de5c4
Strip trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
29742
diff
changeset
|
302 * |
28048
c55bba399426
I think this is the 3rd fix for the same error in the same function
Stu Tomlinson <stu@nosnilmot.com>
parents:
27711
diff
changeset
|
303 * @param turn_server The host name of the TURN server to set |
26511
f171707b7d54
ChangeLog.API new calls for STUN and TURN servers used by vv
Marcus Lundblad <ml@update.uu.se>
parents:
26213
diff
changeset
|
304 * @since 2.6.0 |
26137
c56e8826fed0
Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents:
26132
diff
changeset
|
305 */ |
27260
8ce05f8249da
Fix the name of an argument.
Marcus Lundblad <ml@update.uu.se>
parents:
27190
diff
changeset
|
306 void purple_network_set_turn_server(const gchar *turn_server); |
30115
9843473de5c4
Strip trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
29742
diff
changeset
|
307 |
26137
c56e8826fed0
Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents:
26132
diff
changeset
|
308 /** |
29295
836544f3b81f
Fix an incorrect API comment
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
309 * Get the IP address of the TURN server as a string representation |
26137
c56e8826fed0
Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents:
26132
diff
changeset
|
310 * |
c56e8826fed0
Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents:
26132
diff
changeset
|
311 * @return the IP address |
26511
f171707b7d54
ChangeLog.API new calls for STUN and TURN servers used by vv
Marcus Lundblad <ml@update.uu.se>
parents:
26213
diff
changeset
|
312 * @since 2.6.0 |
26137
c56e8826fed0
Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents:
26132
diff
changeset
|
313 */ |
c56e8826fed0
Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents:
26132
diff
changeset
|
314 const gchar *purple_network_get_turn_ip(void); |
30115
9843473de5c4
Strip trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
29742
diff
changeset
|
315 |
27190
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
26511
diff
changeset
|
316 /** |
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
26511
diff
changeset
|
317 * Remove a port mapping (UPnP or NAT-PMP) associated with listening socket |
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
26511
diff
changeset
|
318 * |
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
26511
diff
changeset
|
319 * @param fd Socket to remove the port mapping for |
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
26511
diff
changeset
|
320 * @since 2.6.0 |
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
26511
diff
changeset
|
321 */ |
30115
9843473de5c4
Strip trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
29742
diff
changeset
|
322 void purple_network_remove_port_mapping(gint fd); |
27190
38c4973b5222
Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <ml@update.uu.se>
parents:
26511
diff
changeset
|
323 |
15974
1a12ce76c4f4
The network module now registers the signal 'network-configuration-changed' and emits it when a network change is detected via libnm or the win32 network monitor. The UI could also emit this signal if it knows something network.c doesn't. UPnP and NAT-PMP respond to the signal by clearing their IP address caches; changing networks without quitting/relaunching will now lead to the new IP address being (lazily) determined. This commit also enables nat-pmp and adds nat-pmp.[h|c] to the build process; please let me know if there are any problems building, as I only have OS X test machines.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
324 /** |
27711
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
325 * Convert a UTF-8 domain name to ASCII in accordance with the IDNA |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
326 * specification. If libpurple is compiled without IDN support, this function |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
327 * copies the input into the output buffer. |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
328 * |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
329 * Because this function is used by DNS resolver child/threads, it uses no |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
330 * other libpurple API and is threadsafe. |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
331 * |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
332 * In general, a buffer of about 512 bytes is the appropriate size to use. |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
333 * |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
334 * @param in The hostname to be converted. |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
335 * @param out The output buffer where an allocated string will be returned. |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
336 * The caller is responsible for freeing this. |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
337 * @returns 0 on success, -1 if the out is NULL, or an error code |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
338 * that currently corresponds to the Idna_rc enum in libidn. |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
339 * @since 2.6.0 |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
340 */ |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
341 int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out); |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
342 |
7fbf964c6c6c
Move the IDN support into the DNS routines.
Paul Aurich <paul@darkrain42.org>
parents:
27261
diff
changeset
|
343 /** |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 * Initializes the network subsystem. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 */ |
15823 | 346 void purple_network_init(void); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 * Shuts down the network subsystem. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 */ |
15823 | 351 void purple_network_uninit(void); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 /*@}*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 #ifdef __cplusplus |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 |
15823 | 359 #endif /* _PURPLE_NETWORK_H_ */ |