author | Mikael Berthe <mikael@lilotux.net> |
Mon, 25 Jan 2016 18:35:10 +0100 | |
changeset 685 | dfa02c1c7fda |
parent 664 | f57b1b61e1fe |
child 690 | 7ccf2113ec5f |
permissions | -rw-r--r-- |
516
4dd3aa6b83e5
Change the tab width to 4 steps in the emacs headers
Mikael Hallendal <micke@imendio.com>
parents:
515
diff
changeset
|
1 |
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
2 |
/* |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
3 |
* Copyright (C) 2006 Imendio AB |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
4 |
* |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
6 |
* modify it under the terms of the GNU Lesser General Public License as |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; either version 2 of the |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
8 |
* License, or (at your option) any later version. |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
9 |
* |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
13 |
* Lesser General Public License for more details. |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
14 |
* |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU Lesser General Public |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
16 |
* License along with this program; if not, write to the |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
17 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
18 |
* Boston, MA 02111-1307, USA. |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
19 |
*/ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
20 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
21 |
#include <config.h> |
487
c74b31fef496
Include netinet/in_systm.h in lm-sock.c, fixes LM-130.
Mikael Hallendal <micke@imendio.com>
parents:
431
diff
changeset
|
22 |
|
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
23 |
#include <glib.h> |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
24 |
#include <glib/gi18n.h> |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
25 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
26 |
#ifndef G_OS_WIN32 |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
27 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
28 |
#include <errno.h> |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
29 |
#include <string.h> |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
30 |
#include <unistd.h> |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
31 |
#include <sys/socket.h> |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
32 |
#include <fcntl.h> |
487
c74b31fef496
Include netinet/in_systm.h in lm-sock.c, fixes LM-130.
Mikael Hallendal <micke@imendio.com>
parents:
431
diff
changeset
|
33 |
|
c74b31fef496
Include netinet/in_systm.h in lm-sock.c, fixes LM-130.
Mikael Hallendal <micke@imendio.com>
parents:
431
diff
changeset
|
34 |
/* Needed for BSD, LM-130 */ |
c74b31fef496
Include netinet/in_systm.h in lm-sock.c, fixes LM-130.
Mikael Hallendal <micke@imendio.com>
parents:
431
diff
changeset
|
35 |
#ifdef HAVE_NETINET_IN_SYSTM_H |
c74b31fef496
Include netinet/in_systm.h in lm-sock.c, fixes LM-130.
Mikael Hallendal <micke@imendio.com>
parents:
431
diff
changeset
|
36 |
#include <netinet/in_systm.h> |
c74b31fef496
Include netinet/in_systm.h in lm-sock.c, fixes LM-130.
Mikael Hallendal <micke@imendio.com>
parents:
431
diff
changeset
|
37 |
#endif |
c74b31fef496
Include netinet/in_systm.h in lm-sock.c, fixes LM-130.
Mikael Hallendal <micke@imendio.com>
parents:
431
diff
changeset
|
38 |
|
293
b4336dfa5b91
Enabled optional building of async DNS lookups and TCP keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
292
diff
changeset
|
39 |
#include <netinet/in.h> |
b4336dfa5b91
Enabled optional building of async DNS lookups and TCP keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
292
diff
changeset
|
40 |
#include <netinet/ip.h> |
b4336dfa5b91
Enabled optional building of async DNS lookups and TCP keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
292
diff
changeset
|
41 |
#include <netinet/tcp.h> |
487
c74b31fef496
Include netinet/in_systm.h in lm-sock.c, fixes LM-130.
Mikael Hallendal <micke@imendio.com>
parents:
431
diff
changeset
|
42 |
|
308
7e2050a6df75
Added lm_connection_get_client_host (forward-port from LM1.2).
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
304
diff
changeset
|
43 |
#include <arpa/inet.h> |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
44 |
#define LM_SHUTDOWN SHUT_RDWR |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
45 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
46 |
#else /* G_OS_WIN32 */ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
47 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
48 |
#include <winsock2.h> |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
49 |
#define LM_SHUTDOWN SD_BOTH |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
50 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
51 |
#endif /* G_OS_WIN32 */ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
52 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
53 |
#include "lm-internals.h" |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
54 |
#include "lm-connection.h" |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
55 |
#include "lm-sock.h" |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
56 |
#include "lm-debug.h" |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
57 |
|
308
7e2050a6df75
Added lm_connection_get_client_host (forward-port from LM1.2).
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
304
diff
changeset
|
58 |
#define IPV6_MAX_ADDRESS_LEN 46 /* 45 + '\0' */ |
7e2050a6df75
Added lm_connection_get_client_host (forward-port from LM1.2).
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
304
diff
changeset
|
59 |
|
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
60 |
static gboolean initialised = FALSE; |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
61 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
62 |
gboolean |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
63 |
_lm_sock_library_init (void) |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
64 |
{ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
65 |
#ifdef G_OS_WIN32 |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
66 |
WORD version; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
67 |
WSADATA data; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
68 |
int error; |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
69 |
#endif /* G_OS_WIN32 */ |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
70 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
71 |
if (initialised) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
72 |
return TRUE; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
73 |
} |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
74 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
75 |
lm_verbose ("Socket library initialising...\n"); |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
76 |
|
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
77 |
#ifdef G_OS_WIN32 |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
78 |
lm_verbose ("Checking for winsock 2.0 or above...\n"); |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
79 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
80 |
version = MAKEWORD (2, 0); |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
81 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
82 |
error = WSAStartup (version, &data); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
83 |
if (error != 0) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
84 |
g_printerr ("WSAStartup() failed, error:%d\n", error); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
85 |
return FALSE; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
86 |
} |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
87 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
88 |
/* Confirm that the WinSock DLL supports 2.0. |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
89 |
* Note that if the DLL supports versions greater |
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
90 |
* than 2.0 in addition to 2.0, it will still return |
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
91 |
* 2.0 in wVersion since that is the version we |
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
92 |
* requested. |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
93 |
*/ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
94 |
if (LOBYTE (data.wVersion) != 2 || |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
95 |
HIBYTE (data.wVersion) != 0) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
96 |
/* Tell the user that we could not find a usable |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
97 |
* WinSock DLL. |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
98 |
*/ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
99 |
g_printerr ("Socket library version is not sufficient!\n"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
100 |
WSACleanup (); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
101 |
return FALSE; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
102 |
} |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
103 |
#endif /* G_OS_WIN32 */ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
104 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
105 |
initialised = TRUE; |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
106 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
107 |
return TRUE; |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
108 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
109 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
110 |
void |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
111 |
_lm_sock_library_shutdown (void) |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
112 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
113 |
if (!initialised) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
114 |
return; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
115 |
} |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
116 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
117 |
lm_verbose ("Socket library shutting down...\n"); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
118 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
119 |
#ifdef G_OS_WIN32 |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
120 |
WSACleanup (); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
121 |
#endif /* G_OS_WIN32 */ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
122 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
123 |
initialised = FALSE; |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
124 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
125 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
126 |
void |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
127 |
_lm_sock_set_blocking (LmOldSocketT sock, |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
128 |
gboolean block) |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
129 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
130 |
int res; |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
131 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
132 |
#ifndef G_OS_WIN32 |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
133 |
res = fcntl (sock, F_SETFL, block ? 0 : O_NONBLOCK); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
134 |
#else /* G_OS_WIN32 */ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
135 |
u_long mode = (block ? 0 : 1); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
136 |
res = ioctlsocket (sock, FIONBIO, &mode); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
137 |
#endif /* G_OS_WIN32 */ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
138 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
139 |
if (res != 0) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
140 |
g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
141 |
"Could not set connection to be %s\n", |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
142 |
block ? "blocking" : "non-blocking"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
143 |
} |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
144 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
145 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
146 |
void |
431
04577a6b7ff7
Renamed LmSocket to LmOldSocket to make room for a new socket abstraction layer.
Mikael Hallendal <micke@imendio.com>
parents:
342
diff
changeset
|
147 |
_lm_sock_shutdown (LmOldSocketT sock) |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
148 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
149 |
shutdown (sock, LM_SHUTDOWN); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
150 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
151 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
152 |
void |
431
04577a6b7ff7
Renamed LmSocket to LmOldSocket to make room for a new socket abstraction layer.
Mikael Hallendal <micke@imendio.com>
parents:
342
diff
changeset
|
153 |
_lm_sock_close (LmOldSocketT sock) |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
154 |
{ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
155 |
#ifndef G_OS_WIN32 |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
156 |
close (sock); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
157 |
#else /* G_OS_WIN32 */ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
158 |
closesocket (sock); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
159 |
#endif /* G_OS_WIN32 */ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
160 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
161 |
|
431
04577a6b7ff7
Renamed LmSocket to LmOldSocket to make room for a new socket abstraction layer.
Mikael Hallendal <micke@imendio.com>
parents:
342
diff
changeset
|
162 |
LmOldSocketT |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
163 |
_lm_sock_makesocket (int af, |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
164 |
int type, |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
165 |
int protocol) |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
166 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
167 |
return (LmOldSocketT)socket (af, type, protocol); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
168 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
169 |
|
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
170 |
int |
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
171 |
_lm_sock_connect (LmOldSocketT sock, |
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
172 |
const struct sockaddr *name, |
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
173 |
int namelen) |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
174 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
175 |
return connect (sock, name, namelen); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
176 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
177 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
178 |
gboolean |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
179 |
_lm_sock_is_blocking_error (int err) |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
180 |
{ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
181 |
#ifndef G_OS_WIN32 |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
182 |
return (err == _LM_SOCK_EINPROGRESS); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
183 |
#else /* G_OS_WIN32 */ |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
184 |
return (err == _LM_SOCK_EINPROGRESS || |
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
185 |
err == _LM_SOCK_EWOULDBLOCK || |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
186 |
err == _LM_SOCK_EINVAL); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
187 |
#endif /* G_OS_WIN32 */ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
188 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
189 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
190 |
gboolean |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
191 |
_lm_sock_is_blocking_success (int err) |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
192 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
193 |
return (err == _LM_SOCK_EALREADY || err == _LM_SOCK_EISCONN); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
194 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
195 |
|
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
196 |
int |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
197 |
_lm_sock_get_last_error (void) |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
198 |
{ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
199 |
#ifndef G_OS_WIN32 |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
200 |
return errno; |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
201 |
#else /* G_OS_WIN32 */ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
202 |
return WSAGetLastError (); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
203 |
#endif /* G_OS_WIN32 */ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
204 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
205 |
|
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
206 |
void |
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
207 |
_lm_sock_get_error (LmOldSocketT sock, |
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
208 |
void *error, |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
209 |
socklen_t *len) |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
210 |
{ |
601
7972c1499f6d
Theoretically, getsockopt could fail and leave 'error' unset. While I
Will Thompson <will.thompson@collabora.co.uk>
parents:
581
diff
changeset
|
211 |
if (getsockopt (sock, SOL_SOCKET, SO_ERROR, (void*) error, len) != 0) |
664
f57b1b61e1fe
Remove trailing whitespace and mixed indenting
Till Maas <opensource@till.name>
parents:
653
diff
changeset
|
212 |
*((int *) error) = errno; |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
213 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
214 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
215 |
const gchar * |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
216 |
_lm_sock_get_error_str (int err) |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
217 |
{ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
218 |
#ifndef G_OS_WIN32 |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
219 |
return strerror (err); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
220 |
#else /* G_OS_WIN32 */ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
221 |
switch (err) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
222 |
case WSAEINTR: return _("Connect interrupted and canceled"); |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
223 |
case WSAEACCES: return _("Permission denied"); |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
224 |
case WSAEFAULT: return _("Bad address"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
225 |
case WSAEINVAL: return _("Invalid argument"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
226 |
case WSAEMFILE: return _("Too many open sockets"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
227 |
case WSAEWOULDBLOCK: return _("Resource temporarily unavailable"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
228 |
case WSAEINPROGRESS: return _("Operation now in progress"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
229 |
case WSAEALREADY: return _("Operation already in progress"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
230 |
case WSAENOTSOCK: return _("Socket operation on nonsocket"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
231 |
case WSAEDESTADDRREQ: return _("Destination address required"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
232 |
case WSAEMSGSIZE: return _("Message too long"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
233 |
case WSAEPROTOTYPE: return _("Protocol wrong type for socket"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
234 |
case WSAENOPROTOOPT: return _("Bad protocol option"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
235 |
case WSAEPROTONOSUPPORT: return _("Protocol not supported"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
236 |
case WSAESOCKTNOSUPPORT: return _("Socket type not supported"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
237 |
case WSAEOPNOTSUPP: return _("Operation not supported"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
238 |
case WSAEPFNOSUPPORT: return _("Protocol family not supported"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
239 |
case WSAEAFNOSUPPORT: return _("Address family not supported by protocol family"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
240 |
case WSAEADDRINUSE: return _("Address already in use"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
241 |
case WSAEADDRNOTAVAIL: return _("Can not assign requested address"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
242 |
case WSAENETDOWN: return _("Network is down"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
243 |
case WSAENETUNREACH: return _("Network is unreachable"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
244 |
case WSAENETRESET: return _("Network dropped connection on reset"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
245 |
case WSAECONNABORTED: return _("Software caused connection abort"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
246 |
case WSAECONNRESET: return _("Connection reset by peer"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
247 |
case WSAENOBUFS: return _("No buffer space available"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
248 |
case WSAEISCONN: return _("Socket is already connected"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
249 |
case WSAENOTCONN: return _("Socket is not connected"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
250 |
case WSAESHUTDOWN: return _("Can not send after socket shutdown"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
251 |
case WSAETIMEDOUT: return _("Connection timed out"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
252 |
case WSAECONNREFUSED: return _("Connection refused"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
253 |
case WSAEHOSTDOWN: return _("Host is down"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
254 |
case WSAEHOSTUNREACH: return _("No route to host"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
255 |
case WSAEPROCLIM: return _("Too many processes"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
256 |
case WSASYSNOTREADY: return _("Network subsystem is unavailable"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
257 |
case WSAVERNOTSUPPORTED: return _("Winsock library version is out of range "); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
258 |
case WSANOTINITIALISED: return _("Successful WSAStartup not yet performed"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
259 |
case WSAEDISCON: return _("Graceful shutdown in progress"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
260 |
case WSATYPE_NOT_FOUND: return _("Class type not found"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
261 |
case WSAHOST_NOT_FOUND: return _("Host not found"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
262 |
case WSATRY_AGAIN: return _("Nonauthoritative host not found"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
263 |
case WSANO_RECOVERY: return _("This is a nonrecoverable error"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
264 |
case WSANO_DATA: return _("Valid name, no data record of requested type"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
265 |
case WSA_INVALID_HANDLE: return _("Specified event object handle is invalid"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
266 |
case WSA_INVALID_PARAMETER: return _("One or more parameters are invalid"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
267 |
case WSA_IO_INCOMPLETE: return _("Overlapped I/O event object no in signaled state"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
268 |
case WSA_IO_PENDING: return _("Overlapped operations will complete later"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
269 |
case WSA_NOT_ENOUGH_MEMORY: return _("Insufficient memory available"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
270 |
case WSA_OPERATION_ABORTED: return _("Overlapped operation aborted"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
271 |
/* os dependent */ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
272 |
case WSASYSCALLFAILURE: return _("System call failure"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
273 |
} |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
274 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
275 |
return _("Unknown"); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
276 |
#endif /* G_OS_WIN32 */ |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
277 |
} |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
278 |
|
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
279 |
const gchar * |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
280 |
_lm_sock_addrinfo_get_error_str (int err) |
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
281 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
282 |
switch (err) { |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
283 |
case EAI_AGAIN: |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
284 |
return _("The nameserver failed to return an " |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
285 |
"address, try again later"); |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
286 |
case EAI_BADFLAGS: |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
287 |
return _("Internal error trying to obtain remote address"); |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
288 |
case EAI_FAIL: |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
289 |
return _("The nameserver encountered errors " |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
290 |
"looking up this address"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
291 |
/* EAI_NODATA is apparently missing on FreeBSD. On recent GNU libc, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
292 |
* it requires _GNU_SOURCE to be defined; in the unlikely case that |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
293 |
* that GNU libc returns this value we'll return the default message */ |
342
ea543fec7afd
Protect EAI_NODATA with #ifdef. Fixes LM-120.
Owen Taylor <otaylor@redhat.com>
parents:
308
diff
changeset
|
294 |
#ifdef EAI_NODATA |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
295 |
case EAI_NODATA: |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
296 |
return _("The remote host exists but no address " |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
297 |
"is available"); |
342
ea543fec7afd
Protect EAI_NODATA with #ifdef. Fixes LM-120.
Owen Taylor <otaylor@redhat.com>
parents:
308
diff
changeset
|
298 |
#endif |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
299 |
case EAI_NONAME: |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
300 |
return _("The remote address is unknown"); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
301 |
case EAI_FAMILY: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
302 |
case EAI_SERVICE: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
303 |
case EAI_SOCKTYPE: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
304 |
return _("The remote address is not obtainable " |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
305 |
"for that socket type."); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
306 |
default: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
307 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
308 |
} |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
309 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
310 |
return _("The remote address could not be obtained "); |
140
103227122f45
2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff
changeset
|
311 |
} |
292
bb7269466be2
Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
196
diff
changeset
|
312 |
|
bb7269466be2
Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
196
diff
changeset
|
313 |
gboolean |
431
04577a6b7ff7
Renamed LmSocket to LmOldSocket to make room for a new socket abstraction layer.
Mikael Hallendal <micke@imendio.com>
parents:
342
diff
changeset
|
314 |
_lm_sock_set_keepalive (LmOldSocketT sock, int delay) |
292
bb7269466be2
Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
196
diff
changeset
|
315 |
{ |
546
590cf5cd6ea1
Removed optional definition of _lm_sock_set_keepalive.
Mikael Hallendal <micke@imendio.com>
parents:
518
diff
changeset
|
316 |
#ifdef USE_TCP_KEEPALIVES |
652
c20a83e11260
Fix TCP keepalives on OS X 10.9
Jack Nagel <jacknagel@gmail.com>
parents:
601
diff
changeset
|
317 |
|
653 | 318 |
#if defined(__APPLE__) && !defined(TCP_KEEPIDLE) |
652
c20a83e11260
Fix TCP keepalives on OS X 10.9
Jack Nagel <jacknagel@gmail.com>
parents:
601
diff
changeset
|
319 |
#define TCP_KEEPIDLE TCP_KEEPALIVE |
c20a83e11260
Fix TCP keepalives on OS X 10.9
Jack Nagel <jacknagel@gmail.com>
parents:
601
diff
changeset
|
320 |
#endif |
c20a83e11260
Fix TCP keepalives on OS X 10.9
Jack Nagel <jacknagel@gmail.com>
parents:
601
diff
changeset
|
321 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
322 |
int opt; |
292
bb7269466be2
Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
196
diff
changeset
|
323 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
324 |
opt = 1; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
325 |
if (setsockopt (sock, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof (opt)) < 0) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
326 |
return FALSE; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
327 |
} |
292
bb7269466be2
Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
196
diff
changeset
|
328 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
329 |
opt = 3; /* 3 keepalives before considering connection dead */ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
330 |
if (setsockopt (sock, IPPROTO_TCP, TCP_KEEPCNT, &opt, sizeof (opt)) < 0) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
331 |
return FALSE; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
332 |
} |
292
bb7269466be2
Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
196
diff
changeset
|
333 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
334 |
opt = delay; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
335 |
if (setsockopt (sock, IPPROTO_TCP, TCP_KEEPIDLE, &opt, sizeof (opt)) < 0) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
336 |
return FALSE; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
337 |
} |
292
bb7269466be2
Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
196
diff
changeset
|
338 |
|
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
339 |
opt = delay; |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
340 |
if (setsockopt (sock, IPPROTO_TCP, TCP_KEEPINTVL, &opt, sizeof (opt)) < 0) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
341 |
return FALSE; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
342 |
} |
546
590cf5cd6ea1
Removed optional definition of _lm_sock_set_keepalive.
Mikael Hallendal <micke@imendio.com>
parents:
518
diff
changeset
|
343 |
#endif /* USE_TCP_KEEPALIVES */ |
292
bb7269466be2
Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
196
diff
changeset
|
344 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
345 |
return TRUE; |
292
bb7269466be2
Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
196
diff
changeset
|
346 |
} |
bb7269466be2
Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
196
diff
changeset
|
347 |
|
308
7e2050a6df75
Added lm_connection_get_client_host (forward-port from LM1.2).
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
304
diff
changeset
|
348 |
gchar * |
431
04577a6b7ff7
Renamed LmSocket to LmOldSocket to make room for a new socket abstraction layer.
Mikael Hallendal <micke@imendio.com>
parents:
342
diff
changeset
|
349 |
_lm_sock_get_local_host (LmOldSocketT sock) |
308
7e2050a6df75
Added lm_connection_get_client_host (forward-port from LM1.2).
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
304
diff
changeset
|
350 |
{ |
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
351 |
struct sockaddr addr_info; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
352 |
void *sock_addr; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
353 |
socklen_t namelen; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
354 |
char addrbuf[IPV6_MAX_ADDRESS_LEN]; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
355 |
const char *host; |
308
7e2050a6df75
Added lm_connection_get_client_host (forward-port from LM1.2).
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
304
diff
changeset
|
356 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
357 |
namelen = sizeof (struct sockaddr); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
358 |
if (getsockname (sock, &addr_info, &namelen)) { |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
359 |
return NULL; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
360 |
} |
308
7e2050a6df75
Added lm_connection_get_client_host (forward-port from LM1.2).
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
304
diff
changeset
|
361 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
362 |
switch (addr_info.sa_family) { |
581
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
363 |
case AF_INET: |
757d716a8f8a
Applied ksmith's DNS patch.
Samuel Tesla <stesla@engineyard.com>
parents:
546
diff
changeset
|
364 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
365 |
sock_addr = & (((struct sockaddr_in *) &addr_info)->sin_addr); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
366 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
367 |
case AF_INET6: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
368 |
sock_addr = & (((struct sockaddr_in6 *) &addr_info)->sin6_addr); |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
369 |
break; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
370 |
default: |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
371 |
return NULL; |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
372 |
} |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
373 |
/* inet_ntoa has been obsoleted in favour of inet_ntop */ |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
374 |
host = inet_ntop (addr_info.sa_family, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
375 |
sock_addr, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
376 |
addrbuf, |
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
377 |
IPV6_MAX_ADDRESS_LEN); |
308
7e2050a6df75
Added lm_connection_get_client_host (forward-port from LM1.2).
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
304
diff
changeset
|
378 |
|
518
cdd6a0c5b439
Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents:
516
diff
changeset
|
379 |
return g_strdup (host); |
308
7e2050a6df75
Added lm_connection_get_client_host (forward-port from LM1.2).
Senko Rasic <senko.rasic@collabora.co.uk>
parents:
304
diff
changeset
|
380 |
} |