libpurple/network.h

Wed, 07 Oct 2020 01:10:20 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Wed, 07 Oct 2020 01:10:20 -0500
changeset 40543
42fd60e3fbe8
parent 40489
a377443c1338
child 40613
55230eededd8
permissions
-rw-r--r--

Fix a couple GI/doc warnings

* De-publicize glibcompat.h
It's not meant for external users.

* Fix docs of `_purple_network_set_common_socket_flags`.
It seems to still be Doxygen-styled.

Testing Done:
Compile.

Reviewed at https://reviews.imfreedom.org/r/146/

20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
1 /* purple
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
2 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
3 * Purple is the legal property of its developers, whose names are too numerous
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
5 * source distribution.
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
6 *
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
11 *
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
16 *
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 16035
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
20 */
35487
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35486
diff changeset
21
40474
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40440
diff changeset
22 #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40440
diff changeset
23 # error "only <purple.h> may be included directly"
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40440
diff changeset
24 #endif
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40440
diff changeset
25
39659
e4dfb99b0cef Fix libpurple header guards using reserved names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39291
diff changeset
26 #ifndef PURPLE_NETWORK_H
e4dfb99b0cef Fix libpurple header guards using reserved names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39291
diff changeset
27 #define PURPLE_NETWORK_H
35440
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
28 /**
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
29 * SECTION:network
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
30 * @section_id: libpurple-network
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
31 * @short_description: <filename>network.h</filename>
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
32 * @title: Network API
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
33 */
467bb21b82a1 Add section blocks for debug.h to prpl.h
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
34
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32604
diff changeset
35 #include <glib.h>
40107
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
36 #include <gio/gio.h>
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32604
diff changeset
37
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40189
diff changeset
38 #ifndef _WIN32
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40189
diff changeset
39 # include <netinet/in.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40189
diff changeset
40 # include <sys/socket.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40189
diff changeset
41 #endif
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40189
diff changeset
42
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32604
diff changeset
43 G_BEGIN_DECLS
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
44
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
45 /**************************************************************************/
35472
474e26199560 Removed @name
Ankit Vani <a@nevitus.org>
parents: 35440
diff changeset
46 /* Network API */
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
47 /**************************************************************************/
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
48
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
49 typedef struct _PurpleNetworkListenData PurpleNetworkListenData;
14329
05c3cc0c1f79 [gaim-migrate @ 16949]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
50
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
51 typedef void (*PurpleNetworkListenCallback) (int listenfd, gpointer data);
12909
dfcf4df1dcd7 [gaim-migrate @ 15262]
Daniel Atallah <datallah@pidgin.im>
parents: 12730
diff changeset
52
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
53 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
54 * purple_network_set_public_ip:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
55 * @ip: The local IP address.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
56 *
8834
0a798e3d2b84 [gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents: 8250
diff changeset
57 * Sets the IP address of the local system in preferences. This
0a798e3d2b84 [gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents: 8250
diff changeset
58 * is the IP address that should be used for incoming connections
0a798e3d2b84 [gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents: 8250
diff changeset
59 * (file transfer, direct IM, etc.) and should therefore be
0a798e3d2b84 [gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents: 8250
diff changeset
60 * publicly accessible.
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
61 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
62 void purple_network_set_public_ip(const char *ip);
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
63
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
64 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
65 * purple_network_get_public_ip:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
66 *
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
67 * Returns the IP address of the local system set in preferences.
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
68 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
69 * This returns the value set via purple_network_set_public_ip().
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
70 * You probably want to use purple_network_get_my_ip() instead.
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
71 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
72 * Returns: The local IP address set in preferences.
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
73 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
74 const char *purple_network_get_public_ip(void);
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
75
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
76 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
77 * purple_network_get_local_system_ip:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
78 * @fd: The fd to use to help figure out the IP, or else -1.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
79 *
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
80 * Returns the IP address of the local system.
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
81 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
82 * You probably want to use purple_network_get_my_ip() instead.
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
83 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
84 * Note: The returned string is a pointer to a static buffer. If this
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
85 * function is called twice, it may be important to make a copy
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
86 * of the returned string.
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
87 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
88 * Returns: The local IP address.
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
89 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
90 const char *purple_network_get_local_system_ip(int fd);
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
91
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
92 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
93 * purple_network_get_all_local_system_ips:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
94 *
29510
9c636f4b965c Add a function to enumerate all local IPs
Marcus Lundblad <malu@pidgin.im>
parents: 27980
diff changeset
95 * Returns all IP addresses of the local system.
9c636f4b965c Add a function to enumerate all local IPs
Marcus Lundblad <malu@pidgin.im>
parents: 27980
diff changeset
96 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
97 * Note: The caller must free this list. If libpurple was built with
30189
95b0f2520718 Update this comment; the function supports IPv6
Paul Aurich <darkrain42@pidgin.im>
parents: 30027
diff changeset
98 * support for it, this function also enumerates IPv6 addresses.
29510
9c636f4b965c Add a function to enumerate all local IPs
Marcus Lundblad <malu@pidgin.im>
parents: 27980
diff changeset
99 *
39738
14d425a528ad Add missing transfer annotations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39659
diff changeset
100 * Returns: (element-type utf8) (transfer full): A list of local IP addresses.
29510
9c636f4b965c Add a function to enumerate all local IPs
Marcus Lundblad <malu@pidgin.im>
parents: 27980
diff changeset
101 */
29511
7c4b1ba4f2aa Remove IPv6 support from _get_local_system_ips, since I couldn't get it to
Marcus Lundblad <malu@pidgin.im>
parents: 29510
diff changeset
102 GList *purple_network_get_all_local_system_ips(void);
29510
9c636f4b965c Add a function to enumerate all local IPs
Marcus Lundblad <malu@pidgin.im>
parents: 27980
diff changeset
103
9c636f4b965c Add a function to enumerate all local IPs
Marcus Lundblad <malu@pidgin.im>
parents: 27980
diff changeset
104 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
105 * purple_network_get_my_ip:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
106 * @fd: The fd to use to help figure out the IP, or -1.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
107 *
8834
0a798e3d2b84 [gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents: 8250
diff changeset
108 * Returns the IP address that should be used anywhere a
0a798e3d2b84 [gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents: 8250
diff changeset
109 * public IP addresses is needed (listening for an incoming
0a798e3d2b84 [gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents: 8250
diff changeset
110 * file transfer, etc).
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
111 *
8834
0a798e3d2b84 [gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents: 8250
diff changeset
112 * If the user has manually specified an IP address via
0a798e3d2b84 [gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents: 8250
diff changeset
113 * preferences, then this IP is returned. Otherwise the
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
114 * IP address returned by purple_network_get_local_system_ip()
8834
0a798e3d2b84 [gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents: 8250
diff changeset
115 * is returned.
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
116 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
117 * Note: The returned string is a pointer to a static buffer. If this
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
118 * function is called twice, it may be important to make a copy
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
119 * of the returned string.
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
120 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
121 * Returns: The local IP address to be used.
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
122 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
123 const char *purple_network_get_my_ip(int fd);
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
124
21549
7436059db33b 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 <datallah@pidgin.im>
parents: 20147
diff changeset
125 /**
40107
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
126 * purple_network_get_my_ip_from_gio:
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
127 * @sockconn: The socket connection to use to help figure out the IP, or %NULL.
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
128 *
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
129 * Returns the IP address that should be used anywhere a
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
130 * public IP addresses is needed (listening for an incoming
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
131 * file transfer, etc).
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
132 *
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
133 * If the user has manually specified an IP address via
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
134 * preferences, then this IP is returned. Otherwise the
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
135 * IP address returned by purple_network_get_local_system_ip_from_gio()
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
136 * is returned.
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
137 *
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
138 * Returns: The local IP address to be used.
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
139 */
40110
bc2b94f2595a Make purple_network_get_my_ip_from_gio return non-const.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40107
diff changeset
140 gchar *purple_network_get_my_ip_from_gio(GSocketConnection *sockconn);
40107
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
141
6320c272e8b2 xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39738
diff changeset
142 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
143 * purple_network_listen:
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
144 * @port: The port number to bind to. Must be greater than 0.
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
145 * @socket_family: The protocol family of the socket. This should be
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
146 * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
147 * may or may not be able to accept IPv4 connections
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
148 * based on the system configuration (use
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
149 * purple_socket_speaks_ipv4 to check). If an IPv6
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
150 * socket doesn't accept V4-mapped addresses, you will
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
151 * need a second listener to support both v4 and v6.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
152 * @socket_type: The type of socket to open for listening.
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
153 * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
154 * @map_external: Should the open port be mapped externally using
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
155 * NAT-PNP or UPnP? (default should be %TRUE)
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
156 * @cb: (scope call): The callback to be invoked when the port to listen on is
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
157 * available. The file descriptor of the listening socket will be
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
158 * specified in this callback, or -1 if no socket could be established.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
159 * @cb_data: extra data to be returned when cb is called
8246
c83c0421149a [gaim-migrate @ 8969]
Mark Doliner <markdoliner@pidgin.im>
parents: 8240
diff changeset
160 *
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
161 * Attempts to open a listening port ONLY on the specified port number.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
162 * You probably want to use purple_network_listen_range() instead of this.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
163 * This function is useful, for example, if you wanted to write a telnet
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
164 * server as a Purple plugin, and you HAD to listen on port 23. Why anyone
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
165 * would want to do that is beyond me.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
166 *
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
167 * This opens a listening port. The caller will want to set up a watcher
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
168 * of type PURPLE_INPUT_READ on the fd returned in cb. It will probably call
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
169 * accept in the watcher callback, and then possibly remove the watcher and
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
170 * close the listening socket, and add a new watcher on the new socket accept
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
171 * returned.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
172 *
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
173 * Libpurple does not currently do any port mapping (stateful firewall hole
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
174 * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
175 * addresses, a mapping is done).
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
176 *
40188
80e78796edb2 Revert (skip) annotations
qarkai <qarkai@gmail.com>
parents: 40186
diff changeset
177 * Returns: (transfer full): A pointer to a data structure that can be used to cancel
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
178 * the pending listener, or %NULL if unable to obtain a local
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
179 * socket to listen on.
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
180 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
181 PurpleNetworkListenData *purple_network_listen(unsigned short port,
32594
f2feea134fdb Remove deprecated purple_network_listen_map_external().
Andrew Victor <andrew.victor@mxit.com>
parents: 32593
diff changeset
182 int socket_family, int socket_type, gboolean map_external,
f2feea134fdb Remove deprecated purple_network_listen_map_external().
Andrew Victor <andrew.victor@mxit.com>
parents: 32593
diff changeset
183 PurpleNetworkListenCallback cb, gpointer cb_data);
30027
2ab6e591cf72 Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <darkrain42@pidgin.im>
parents: 29988
diff changeset
184
2ab6e591cf72 Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <darkrain42@pidgin.im>
parents: 29988
diff changeset
185 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
186 * purple_network_listen_range:
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
187 * @start: The port number to bind to, or 0 to pick a random port.
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
188 * Users are allowed to override this arg in prefs.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
189 * @end: The highest possible port in the range of ports to listen on,
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
190 * or 0 to pick a random port. Users are allowed to override this
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
191 * arg in prefs.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
192 * @socket_family: The protocol family of the socket. This should be
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
193 * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
194 * may or may not be able to accept IPv4 connections
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
195 * based on the system configuration (use
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
196 * purple_socket_speaks_ipv4 to check). If an IPv6
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
197 * socket doesn't accept V4-mapped addresses, you will
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
198 * need a second listener to support both v4 and v6.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
199 * @socket_type: The type of socket to open for listening.
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
200 * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
201 * @map_external: Should the open port be mapped externally using
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
202 * NAT-PNP or UPnP? (default should be %TRUE)
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
203 * @cb: (scope call): The callback to be invoked when the port to listen on is
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
204 * available. The file descriptor of the listening socket will be
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
205 * specified in this callback, or -1 if no socket could be established.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
206 * @cb_data: extra data to be returned when cb is called
8250
e855dcce1fa0 [gaim-migrate @ 8973]
Mark Doliner <markdoliner@pidgin.im>
parents: 8248
diff changeset
207 *
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
208 * Opens a listening port selected from a range of ports. The range of
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
209 * ports used is chosen in the following manner:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
210 * If a range is specified in preferences, these values are used.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
211 * If a non-0 values are passed to the function as parameters, these
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
212 * values are used.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
213 * Otherwise a port is chosen at random by the operating system.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
214 *
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
215 * This opens a listening port. The caller will want to set up a watcher
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
216 * of type PURPLE_INPUT_READ on the fd returned in cb. It will probably call
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
217 * accept in the watcher callback, and then possibly remove the watcher and close
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
218 * the listening socket, and add a new watcher on the new socket accept
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
219 * returned.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
220 *
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
221 * Libpurple does not currently do any port mapping (stateful firewall hole
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
222 * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
223 * addresses, a mapping is done).
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
224 *
40188
80e78796edb2 Revert (skip) annotations
qarkai <qarkai@gmail.com>
parents: 40186
diff changeset
225 * Returns: (transfer full): A pointer to a data structure that can be used to cancel
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
226 * the pending listener, or %NULL if unable to obtain a local
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
227 * socket to listen on.
8246
c83c0421149a [gaim-migrate @ 8969]
Mark Doliner <markdoliner@pidgin.im>
parents: 8240
diff changeset
228 */
32593
8fe5585c5397 Rename purple_network_listen_range_family() to purple_network_listen_range().
Andrew Victor <andrew.victor@mxit.com>
parents: 32592
diff changeset
229 PurpleNetworkListenData *purple_network_listen_range(
30027
2ab6e591cf72 Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <darkrain42@pidgin.im>
parents: 29988
diff changeset
230 unsigned short start, unsigned short end, int socket_family,
32594
f2feea134fdb Remove deprecated purple_network_listen_map_external().
Andrew Victor <andrew.victor@mxit.com>
parents: 32593
diff changeset
231 int socket_type, gboolean map_external,
f2feea134fdb Remove deprecated purple_network_listen_map_external().
Andrew Victor <andrew.victor@mxit.com>
parents: 32593
diff changeset
232 PurpleNetworkListenCallback cb, gpointer cb_data);
30027
2ab6e591cf72 Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <darkrain42@pidgin.im>
parents: 29988
diff changeset
233
2ab6e591cf72 Add network listen functions that accept a family argument (AF_INET(6?)).
Paul Aurich <darkrain42@pidgin.im>
parents: 29988
diff changeset
234 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
235 * purple_network_listen_cancel:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
236 * @listen_data: This listener attempt will be cancelled and
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
237 * the struct will be freed.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
238 *
14329
05c3cc0c1f79 [gaim-migrate @ 16949]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
239 * This can be used to cancel any in-progress listener connection
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
240 * by passing in the return value from either purple_network_listen()
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
241 * or purple_network_listen_range().
14329
05c3cc0c1f79 [gaim-migrate @ 16949]
Mark Doliner <markdoliner@pidgin.im>
parents: 14254
diff changeset
242 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
243 void purple_network_listen_cancel(PurpleNetworkListenData *listen_data);
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
244
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
245 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
246 * purple_network_get_port_from_fd:
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
247 * @fd: The file descriptor. This should be a tcp socket. The current
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
248 * implementation probably dies on anything but IPv4. Perhaps this
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
249 * possible bug will inspire new and valuable contributors to Purple.
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
250 *
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
251 * Gets a port number from a file descriptor.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
252 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
253 * Returns: The port number, in host byte order.
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
254 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
255 unsigned short purple_network_get_port_from_fd(int fd);
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
256
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
257 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
258 * purple_network_is_available:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
259 *
24567
edd8e0bb750c Update the docs for purple_network_is_available(). It doesn't block.
Richard Laager <rlaager@pidgin.im>
parents: 21549
diff changeset
260 * Detects if there is an available network connection.
14758
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14329
diff changeset
261 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
262 * Returns: TRUE if the network is available
14758
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14329
diff changeset
263 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
264 gboolean purple_network_is_available(void);
14758
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14329
diff changeset
265
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14329
diff changeset
266 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
267 * purple_network_force_online:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
268 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
269 * Makes purple_network_is_available() always return %TRUE.
24999
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24568
diff changeset
270 *
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24568
diff changeset
271 * This is what backs the --force-online command line argument in Pidgin,
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24568
diff changeset
272 * for example. This is useful for offline testing, especially when
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
273 * combined with nullprotocol.
24999
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24568
diff changeset
274 */
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24568
diff changeset
275 void purple_network_force_online(void);
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24568
diff changeset
276
84d597b7e7c6 Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents: 24568
diff changeset
277 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
278 * purple_network_get_handle:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
279 *
16035
eb4eda79a147 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 <evands@pidgin.im>
parents: 15884
diff changeset
280 * Get the handle for the network system
eb4eda79a147 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 <evands@pidgin.im>
parents: 15884
diff changeset
281 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
282 * Returns: the handle to the network system
16035
eb4eda79a147 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 <evands@pidgin.im>
parents: 15884
diff changeset
283 */
eb4eda79a147 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 <evands@pidgin.im>
parents: 15884
diff changeset
284 void *purple_network_get_handle(void);
eb4eda79a147 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 <evands@pidgin.im>
parents: 15884
diff changeset
285
29987
59b582625aaf Strip trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 29686
diff changeset
286 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
287 * purple_network_set_stun_server:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
288 * @stun_server: The host name of the STUN server to set
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
289 *
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26256
diff changeset
290 * Update the STUN server IP given the host name
26256
d2673c935184 Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <malu@pidgin.im>
parents: 24568
diff changeset
291 * Will result in a DNS query being executed asynchronous
d2673c935184 Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <malu@pidgin.im>
parents: 24568
diff changeset
292 */
d2673c935184 Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <malu@pidgin.im>
parents: 24568
diff changeset
293 void purple_network_set_stun_server(const gchar *stun_server);
29987
59b582625aaf Strip trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 29686
diff changeset
294
26256
d2673c935184 Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <malu@pidgin.im>
parents: 24568
diff changeset
295 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
296 * purple_network_get_stun_ip:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
297 *
26256
d2673c935184 Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <malu@pidgin.im>
parents: 24568
diff changeset
298 * Get the IP address of the STUN server as a string representation
d2673c935184 Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <malu@pidgin.im>
parents: 24568
diff changeset
299 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
300 * Returns: the IP address
26256
d2673c935184 Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <malu@pidgin.im>
parents: 24568
diff changeset
301 */
d2673c935184 Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <malu@pidgin.im>
parents: 24568
diff changeset
302 const gchar *purple_network_get_stun_ip(void);
29987
59b582625aaf Strip trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 29686
diff changeset
303
59b582625aaf Strip trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 29686
diff changeset
304 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
305 * purple_network_set_turn_server:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
306 * @turn_server: The host name of the TURN server to set
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
307 *
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26256
diff changeset
308 * Update the TURN server IP given the host name
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26256
diff changeset
309 * Will result in a DNS query being executed asynchronous
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26256
diff changeset
310 */
27403
7e44bc3accd5 Fix the name of an argument.
Marcus Lundblad <malu@pidgin.im>
parents: 27332
diff changeset
311 void purple_network_set_turn_server(const gchar *turn_server);
29987
59b582625aaf Strip trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 29686
diff changeset
312
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26256
diff changeset
313 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
314 * purple_network_get_turn_ip:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
315 *
29230
76bab3cd1668 Fix an incorrect API comment
Marcus Lundblad <malu@pidgin.im>
parents: 27980
diff changeset
316 * Get the IP address of the TURN server as a string representation
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26256
diff changeset
317 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 33894
diff changeset
318 * Returns: the IP address
26261
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26256
diff changeset
319 */
ffabb135a4b6 Added support to generate relayed candidates (TURN).
Marcus Lundblad <malu@pidgin.im>
parents: 26256
diff changeset
320 const gchar *purple_network_get_turn_ip(void);
29987
59b582625aaf Strip trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 29686
diff changeset
321
27332
8240ab259385 Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <malu@pidgin.im>
parents: 26644
diff changeset
322 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
323 * purple_network_remove_port_mapping:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
324 * @fd: Socket to remove the port mapping for
27332
8240ab259385 Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <malu@pidgin.im>
parents: 26644
diff changeset
325 *
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
326 * Remove a port mapping (UPnP or NAT-PMP) associated with listening socket
27332
8240ab259385 Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <malu@pidgin.im>
parents: 26644
diff changeset
327 */
29987
59b582625aaf Strip trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 29686
diff changeset
328 void purple_network_remove_port_mapping(gint fd);
27332
8240ab259385 Add a function to remove a port mapping (UPnP or NAT-PMP) given a file
Marcus Lundblad <malu@pidgin.im>
parents: 26644
diff changeset
329
16035
eb4eda79a147 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 <evands@pidgin.im>
parents: 15884
diff changeset
330 /**
40543
42fd60e3fbe8 Fix a couple GI/doc warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40489
diff changeset
331 * _purple_network_set_common_socket_flags:
42fd60e3fbe8 Fix a couple GI/doc warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40489
diff changeset
332 * @fd: The file descriptor for the socket.
42fd60e3fbe8 Fix a couple GI/doc warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40489
diff changeset
333 *
40474
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40440
diff changeset
334 * Sets most commonly used socket flags: O_NONBLOCK and FD_CLOEXEC.
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40440
diff changeset
335 *
40543
42fd60e3fbe8 Fix a couple GI/doc warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40489
diff changeset
336 * Returns: %TRUE if succeeded, %FALSE otherwise.
40474
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40440
diff changeset
337 */
40543
42fd60e3fbe8 Fix a couple GI/doc warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40489
diff changeset
338 gboolean _purple_network_set_common_socket_flags(int fd);
40474
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40440
diff changeset
339
1341be8e3402 Make it so only libpurple can directly include libpurple header files.
Gary Kramlich <grim@reaperworld.com>
parents: 40440
diff changeset
340 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
341 * purple_network_init:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
342 *
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
343 * Initializes the network subsystem.
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
344 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
345 void purple_network_init(void);
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
346
14758
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14329
diff changeset
347 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
348 * purple_network_uninit:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35395
diff changeset
349 *
14758
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14329
diff changeset
350 * Shuts down the network subsystem.
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14329
diff changeset
351 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
352 void purple_network_uninit(void);
14758
13b9adc9efd2 [gaim-migrate @ 17448]
Sean Egan <seanegan@pidgin.im>
parents: 14329
diff changeset
353
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32604
diff changeset
354 G_END_DECLS
8231
347c8992c445 [gaim-migrate @ 8954]
Tim Ringenbach <marv@pidgin.im>
parents:
diff changeset
355
39659
e4dfb99b0cef Fix libpurple header guards using reserved names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39291
diff changeset
356 #endif /* PURPLE_NETWORK_H */

mercurial