D-Bus: dbus-server-socket.c Source File

D-Bus 1.13.18

dbus-server-socket.c
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-server-socket.c Server implementation for sockets
3 *
4 * Copyright (C) 2002, 2003, 2004, 2006 Red Hat Inc.
5 *
6 * Licensed under the Academic Free License version 2.1
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 */
23
24 #include <config.h>
25 #include "dbus-internals.h"
26 #include "dbus-server-socket.h"
27 #include "dbus-transport-socket.h"
28 #include "dbus-connection-internal.h"
29 #include "dbus-memory.h"
30 #include "dbus-nonce.h"
31 #include "dbus-string.h"
32
44 typedef struct DBusServerSocket DBusServerSocket;
45
50 struct DBusServerSocket
51 {
52 DBusServer base;
53 int n_fds;
54 DBusSocket *fds;
55 DBusWatch **watch;
56 char *socket_name;
57 DBusNonceFile *noncefile;
58 };
59
60 static void
61 socket_finalize (DBusServer *server)
62 {
63 DBusServerSocket *socket_server = (DBusServerSocket*) server;
64 int i;
65
66 _dbus_server_finalize_base (server);
67
68 for (i = 0 ; i < socket_server->n_fds ; i++)
69 if (socket_server->watch[i])
70 {
71 _dbus_watch_unref (socket_server->watch[i]);
72 socket_server->watch[i] = NULL;
73 }
74
75 dbus_free (socket_server->fds);
76 dbus_free (socket_server->watch);
77 dbus_free (socket_server->socket_name);
78 _dbus_noncefile_delete (&socket_server->noncefile, NULL);
79 dbus_free (server);
80 }
81
82 /* Return value is just for memory, not other failures. */
83 static dbus_bool_t
84 handle_new_client_fd_and_unlock (DBusServer *server,
85 DBusSocket client_fd)
86 {
87 DBusConnection *connection;
88 DBusTransport *transport;
89 DBusNewConnectionFunction new_connection_function;
90 void *new_connection_data;
91
92 _dbus_verbose ("Creating new client connection with fd %" DBUS_SOCKET_FORMAT "\n",
93 _dbus_socket_printable (client_fd));
94
95 HAVE_LOCK_CHECK (server);
96
97 if (!_dbus_set_socket_nonblocking (client_fd, NULL))
98 {
99 SERVER_UNLOCK (server);
100 return TRUE;
101 }
102
103 transport = _dbus_transport_new_for_socket (client_fd, &server->guid_hex, NULL);
104 if (transport == NULL)
105 {
106 _dbus_close_socket (client_fd, NULL);
107 SERVER_UNLOCK (server);
108 return FALSE;
109 }
110
111 if (!_dbus_transport_set_auth_mechanisms (transport,
112 (const char **) server->auth_mechanisms))
113 {
114 _dbus_transport_unref (transport);
115 SERVER_UNLOCK (server);
116 return FALSE;
117 }
118
119 /* note that client_fd is now owned by the transport, and will be
120 * closed on transport disconnection/finalization
121 */
122
123 connection = _dbus_connection_new_for_transport (transport);
124 _dbus_transport_unref (transport);
125 transport = NULL; /* now under the connection lock */
126
127 if (connection == NULL)
128 {
129 SERVER_UNLOCK (server);
130 return FALSE;
131 }
132
133 /* See if someone wants to handle this new connection, self-referencing
134 * for paranoia.
135 */
136 new_connection_function = server->new_connection_function;
137 new_connection_data = server->new_connection_data;
138
139 _dbus_server_ref_unlocked (server);
140 SERVER_UNLOCK (server);
141
142 if (new_connection_function)
143 {
144 (* new_connection_function) (server, connection,
145 new_connection_data);
146 }
147 dbus_server_unref (server);
148
149 /* If no one grabbed a reference, the connection will die. */
150 _dbus_connection_close_if_only_one_ref (connection);
151 dbus_connection_unref (connection);
152
153 return TRUE;
154 }
155
156 static dbus_bool_t
157 socket_handle_watch (DBusWatch *watch,
158 unsigned int flags,
159 void *data)
160 {
161 DBusServer *server = data;
162 DBusServerSocket *socket_server = data;
163
164 #ifndef DBUS_DISABLE_ASSERT
165 int i;
166 dbus_bool_t found = FALSE;
167 #endif
168
169 SERVER_LOCK (server);
170
171 #ifndef DBUS_DISABLE_ASSERT
172 for (i = 0 ; i < socket_server->n_fds ; i++)
173 {
174 if (socket_server->watch[i] == watch)
175 found = TRUE;
176 }
177 _dbus_assert (found);
178 #endif
179
180 _dbus_verbose ("Handling client connection, flags 0x%x\n", flags);
181
182 if (flags & DBUS_WATCH_READABLE)
183 {
184 DBusSocket client_fd;
185 DBusSocket listen_fd;
186 int saved_errno;
187
188 listen_fd = _dbus_watch_get_socket (watch);
189
190 if (socket_server->noncefile)
191 client_fd = _dbus_accept_with_noncefile (listen_fd, socket_server->noncefile);
192 else
193 client_fd = _dbus_accept (listen_fd);
194
195 saved_errno = _dbus_save_socket_errno ();
196
197 if (!_dbus_socket_is_valid (client_fd))
198 {
199 /* EINTR handled for us */
200
201 if (_dbus_get_is_errno_eagain_or_ewouldblock (saved_errno))
202 _dbus_verbose ("No client available to accept after all\n");
203 else
204 _dbus_verbose ("Failed to accept a client connection: %s\n",
205 _dbus_strerror (saved_errno));
206
207 SERVER_UNLOCK (server);
208 }
209 else
210 {
211 if (!handle_new_client_fd_and_unlock (server, client_fd))
212 _dbus_verbose ("Rejected client connection due to lack of memory\n");
213 }
214 }
215
216 if (flags & DBUS_WATCH_ERROR)
217 _dbus_verbose ("Error on server listening socket\n");
218
219 if (flags & DBUS_WATCH_HANGUP)
220 _dbus_verbose ("Hangup on server listening socket\n");
221
222 return TRUE;
223 }
224
225 static void
226 socket_disconnect (DBusServer *server)
227 {
228 DBusServerSocket *socket_server = (DBusServerSocket*) server;
229 int i;
230
231 HAVE_LOCK_CHECK (server);
232
233 for (i = 0 ; i < socket_server->n_fds ; i++)
234 {
235 if (socket_server->watch[i])
236 {
237 _dbus_server_remove_watch (server,
238 socket_server->watch[i]);
239 _dbus_watch_invalidate (socket_server->watch[i]);
240 _dbus_watch_unref (socket_server->watch[i]);
241 socket_server->watch[i] = NULL;
242 }
243
244 if (_dbus_socket_is_valid (socket_server->fds[i]))
245 {
246 _dbus_close_socket (socket_server->fds[i], NULL);
247 _dbus_socket_invalidate (&socket_server->fds[i]);
248 }
249 }
250
251 if (socket_server->socket_name != NULL)
252 {
253 DBusString tmp;
254 _dbus_string_init_const (&tmp, socket_server->socket_name);
255 _dbus_delete_file (&tmp, NULL);
256 }
257
258 if (server->published_address)
259 _dbus_daemon_unpublish_session_bus_address();
260
261 HAVE_LOCK_CHECK (server);
262 }
263
264 static const DBusServerVTable socket_vtable = {
265 socket_finalize,
266 socket_disconnect
267 };
268
285 DBusServer*
286 _dbus_server_new_for_socket (DBusSocket *fds,
287 int n_fds,
288 const DBusString *address,
289 DBusNonceFile *noncefile,
290 DBusError *error)
291 {
292 DBusServerSocket *socket_server;
293 DBusServer *server;
294 int i;
295
296 socket_server = dbus_new0 (DBusServerSocket, 1);
297 if (socket_server == NULL)
298 goto failed;
299
300 socket_server->noncefile = noncefile;
301
302 socket_server->fds = dbus_new (DBusSocket, n_fds);
303 if (!socket_server->fds)
304 goto failed;
305
306 socket_server->watch = dbus_new0 (DBusWatch *, n_fds);
307 if (!socket_server->watch)
308 goto failed;
309
310 for (i = 0 ; i < n_fds ; i++)
311 {
312 DBusWatch *watch;
313
314 watch = _dbus_watch_new (_dbus_socket_get_pollable (fds[i]),
315 DBUS_WATCH_READABLE,
316 TRUE,
317 socket_handle_watch, socket_server,
318 NULL);
319 if (watch == NULL)
320 goto failed;
321
322 socket_server->n_fds++;
323 socket_server->fds[i] = fds[i];
324 socket_server->watch[i] = watch;
325 }
326
327 if (!_dbus_server_init_base (&socket_server->base,
328 &socket_vtable, address,
329 error))
330 goto failed;
331
332 server = (DBusServer*)socket_server;
333
334 SERVER_LOCK (server);
335
336 for (i = 0 ; i < n_fds ; i++)
337 {
338 if (!_dbus_server_add_watch (&socket_server->base,
339 socket_server->watch[i]))
340 {
341 int j;
342
343 /* The caller is still responsible for closing the fds until
344 * we return successfully, so don't let socket_disconnect()
345 * close them */
346 for (j = 0; j < n_fds; j++)
347 _dbus_socket_invalidate (&socket_server->fds[j]);
348
349 /* socket_disconnect() will try to remove all the watches;
350 * make sure it doesn't see the ones that weren't even added
351 * yet */
352 for (j = i; j < n_fds; j++)
353 {
354 _dbus_watch_invalidate (socket_server->watch[j]);
355 _dbus_watch_unref (socket_server->watch[j]);
356 socket_server->watch[j] = NULL;
357 }
358
359 _dbus_server_disconnect_unlocked (server);
360 SERVER_UNLOCK (server);
361 _dbus_server_finalize_base (&socket_server->base);
362 goto failed;
363 }
364 }
365
366 SERVER_UNLOCK (server);
367
368 _dbus_server_trace_ref (&socket_server->base, 0, 1, "new_for_socket");
369 return (DBusServer*) socket_server;
370
371 failed:
372 if (socket_server != NULL)
373 {
374 if (socket_server->watch != NULL)
375 {
376 for (i = 0; i < n_fds; i++)
377 {
378 if (socket_server->watch[i] != NULL)
379 {
380 _dbus_watch_invalidate (socket_server->watch[i]);
381 _dbus_watch_unref (socket_server->watch[i]);
382 socket_server->watch[i] = NULL;
383 }
384 }
385 }
386
387 dbus_free (socket_server->watch);
388 dbus_free (socket_server->fds);
389 dbus_free (socket_server);
390 }
391
392 if (error != NULL && !dbus_error_is_set (error))
393 _DBUS_SET_OOM (error);
394
395 return NULL;
396 }
397
417 DBusServer*
418 _dbus_server_new_for_tcp_socket (const char *host,
419 const char *bind,
420 const char *port,
421 const char *family,
422 DBusError *error,
423 dbus_bool_t use_nonce)
424 {
425 DBusServer *server = NULL;
426 DBusSocket *listen_fds = NULL;
427 int nlisten_fds = 0, i;
428 DBusString address = _DBUS_STRING_INIT_INVALID;
429 DBusString host_str; /* Initialized as const later, not freed */
430 DBusString port_str = _DBUS_STRING_INIT_INVALID;
431 DBusNonceFile *noncefile = NULL;
432 const char *family_used = NULL;
433
434 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
435
436 if (!_dbus_string_init (&address))
437 {
438 dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
439 goto failed;
440 }
441
442 if (!_dbus_string_init (&port_str))
443 {
444 dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
445 goto failed;
446 }
447
448 if (host == NULL)
449 host = "localhost";
450
451 if (port == NULL)
452 port = "0";
453
454 if (bind == NULL)
455 bind = host;
456 else if (strcmp (bind, "*") == 0)
457 bind = NULL;
458
459 nlisten_fds =_dbus_listen_tcp_socket (bind, port, family,
460 &port_str,
461 &family_used,
462 &listen_fds, error);
463 if (nlisten_fds <= 0)
464 {
465 _DBUS_ASSERT_ERROR_IS_SET(error);
466 goto failed;
467 }
468
469 _dbus_string_init_const (&host_str, host);
470 if (!_dbus_string_append (&address, use_nonce ? "nonce-tcp:host=" : "tcp:host=") ||
471 !_dbus_address_append_escaped (&address, &host_str) ||
472 !_dbus_string_append (&address, ",port=") ||
473 !_dbus_string_append (&address, _dbus_string_get_const_data(&port_str)))
474 {
475 dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
476 goto failed;
477 }
478 if (family_used &&
479 (!_dbus_string_append (&address, ",family=") ||
480 !_dbus_string_append (&address, family_used)))
481 {
482 dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
483 goto failed;
484 }
485
486 if (use_nonce)
487 {
488 if (!_dbus_noncefile_create (&noncefile, error))
489 goto failed;
490
491 if (!_dbus_string_append (&address, ",noncefile=") ||
492 !_dbus_address_append_escaped (&address, _dbus_noncefile_get_path (noncefile)))
493 {
494 dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
495 goto failed;
496 }
497 }
498
499 server = _dbus_server_new_for_socket (listen_fds, nlisten_fds, &address, noncefile, error);
500 if (server == NULL)
501 goto failed;
502
503 /* server has taken ownership of noncefile and the fds in listen_fds */
504 _dbus_string_free (&port_str);
505 _dbus_string_free (&address);
506 dbus_free(listen_fds);
507
508 return server;
509
510 failed:
511 _dbus_noncefile_delete (&noncefile, NULL);
512
513 if (listen_fds != NULL)
514 {
515 for (i = 0; i < nlisten_fds; i++)
516 _dbus_close_socket (listen_fds[i], NULL);
517 dbus_free (listen_fds);
518 }
519
520 _dbus_string_free (&port_str);
521 _dbus_string_free (&address);
522 return NULL;
523 }
524
537 DBusServerListenResult
538 _dbus_server_listen_socket (DBusAddressEntry *entry,
539 DBusServer **server_p,
540 DBusError *error)
541 {
542 const char *method;
543
544 *server_p = NULL;
545
546 method = dbus_address_entry_get_method (entry);
547
548 if (strcmp (method, "tcp") == 0 || strcmp (method, "nonce-tcp") == 0)
549 {
550 const char *host;
551 const char *port;
552 const char *bind;
553 const char *family;
554
555 host = dbus_address_entry_get_value (entry, "host");
556 bind = dbus_address_entry_get_value (entry, "bind");
557 port = dbus_address_entry_get_value (entry, "port");
558 family = dbus_address_entry_get_value (entry, "family");
559
560 *server_p = _dbus_server_new_for_tcp_socket (host, bind, port,
561 family, error, strcmp (method, "nonce-tcp") == 0 ? TRUE : FALSE);
562
563 if (*server_p)
564 {
565 _DBUS_ASSERT_ERROR_IS_CLEAR(error);
566 return DBUS_SERVER_LISTEN_OK;
567 }
568 else
569 {
570 _DBUS_ASSERT_ERROR_IS_SET(error);
571 return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
572 }
573 }
574 else
575 {
576 _DBUS_ASSERT_ERROR_IS_CLEAR(error);
577 return DBUS_SERVER_LISTEN_NOT_HANDLED;
578 }
579 }
580
590 void
591 _dbus_server_socket_own_filename (DBusServer *server,
592 char *filename)
593 {
594 DBusServerSocket *socket_server = (DBusServerSocket*) server;
595
596 socket_server->socket_name = filename;
597 }
598
599
_dbus_server_init_base
dbus_bool_t _dbus_server_init_base(DBusServer *server, const DBusServerVTable *vtable, const DBusString *address, DBusError *error)
Initializes the members of the DBusServer base class.
Definition: dbus-server.c:112
_dbus_server_new_for_socket
DBusServer * _dbus_server_new_for_socket(DBusSocket *fds, int n_fds, const DBusString *address, DBusNonceFile *noncefile, DBusError *error)
Creates a new server listening on the given file descriptor.
Definition: dbus-server-socket.c:286
_dbus_accept
DBusSocket _dbus_accept(DBusSocket listen_fd)
Accepts a connection on a listening socket.
Definition: dbus-sysdeps-unix.c:2541
dbus_server_unref
void dbus_server_unref(DBusServer *server)
Decrements the reference count of a DBusServer.
Definition: dbus-server.c:733
_dbus_string_free
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init(), and fills it with the same contents as #_DBUS_STRING_I...
Definition: dbus-string.c:271
_dbus_server_socket_own_filename
void _dbus_server_socket_own_filename(DBusServer *server, char *filename)
This is a bad hack since it's really unix domain socket specific.
Definition: dbus-server-socket.c:591
DBusServerSocket::watch
DBusWatch ** watch
File descriptor watch.
Definition: dbus-server-socket.c:55
_dbus_server_remove_watch
void _dbus_server_remove_watch(DBusServer *server, DBusWatch *watch)
Removes a watch previously added with _dbus_server_remove_watch().
Definition: dbus-server.c:312
_dbus_set_socket_nonblocking
dbus_bool_t _dbus_set_socket_nonblocking(DBusSocket fd, DBusError *error)
Sets a file descriptor to be nonblocking.
Definition: dbus-sysdeps-unix.c:3636
DBusServer
Definition: dbus-server-protected.h:57
dbus_address_entry_get_method
const char * dbus_address_entry_get_method(DBusAddressEntry *entry)
Returns the method string of an address entry.
Definition: dbus-address.c:230
DBusWatch
Implementation of DBusWatch.
Definition: dbus-watch.c:41
_dbus_server_listen_socket
DBusServerListenResult _dbus_server_listen_socket(DBusAddressEntry *entry, DBusServer **server_p, DBusError *error)
Tries to interpret the address entry for various socket-related addresses (well, currently only tcp a...
Definition: dbus-server-socket.c:538
DBusServer::auth_mechanisms
char ** auth_mechanisms
Array of allowed authentication mechanisms.
Definition: dbus-server-protected.h:85
DBusConnection
Implementation details of DBusConnection.
Definition: dbus-connection.c:257
_dbus_string_init
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
Definition: dbus-string.c:182
_dbus_server_add_watch
dbus_bool_t _dbus_server_add_watch(DBusServer *server, DBusWatch *watch)
Adds a watch for this server, chaining out to application-provided watch handlers.
Definition: dbus-server.c:296
DBusServer::new_connection_function
DBusNewConnectionFunction new_connection_function
Callback to invoke when a new connection is created.
Definition: dbus-server-protected.h:76
TRUE
#define TRUE
DBUS_WATCH_READABLE
@ DBUS_WATCH_READABLE
As in POLLIN.
Definition: dbus-connection.h:61
DBUS_WATCH_ERROR
@ DBUS_WATCH_ERROR
As in POLLERR (can't watch for this, but can be present in current state passed to dbus_watch_handle(...
Definition: dbus-connection.h:63
dbus_address_entry_get_value
const char * dbus_address_entry_get_value(DBusAddressEntry *entry, const char *key)
Returns a value from a key of an entry.
Definition: dbus-address.c:247
_dbus_delete_file
dbus_bool_t _dbus_delete_file(const DBusString *filename, DBusError *error)
Deletes the given file.
Definition: dbus-file-unix.c:397
_dbus_listen_tcp_socket
int _dbus_listen_tcp_socket(const char *host, const char *port, const char *family, DBusString *retport, const char **retfamily, DBusSocket **fds_p, DBusError *error)
Creates a socket and binds it to the given path, then listens on the socket.
Definition: dbus-sysdeps-unix.c:1582
_dbus_watch_unref
void _dbus_watch_unref(DBusWatch *watch)
Decrements the reference count of a DBusWatch object and finalizes the object if the count reaches ze...
Definition: dbus-watch.c:138
dbus_free
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
Definition: dbus-memory.c:704
_dbus_connection_new_for_transport
DBusConnection * _dbus_connection_new_for_transport(DBusTransport *transport)
Creates a new connection for the given transport.
Definition: dbus-connection.c:1249
DBusString
Definition: dbus-string.h:43
DBusServerSocket::fds
DBusSocket * fds
File descriptor or DBUS_SOCKET_INVALID if disconnected.
Definition: dbus-server-socket.c:54
DBusServer::published_address
dbus_bool_t published_address
flag which indicates that server has published its bus address.
Definition: dbus-server-protected.h:70
DBusSocket
Socket interface.
Definition: dbus-sysdeps.h:181
DBusAddressEntry
Internals of DBusAddressEntry.
Definition: dbus-address.c:47
FALSE
#define FALSE
DBusTransport
Object representing a transport such as a socket.
Definition: dbus-transport-protected.h:81
DBUS_ERROR_NO_MEMORY
#define DBUS_ERROR_NO_MEMORY
There was not enough memory to complete an operation.
Definition: dbus-protocol.h:361
_dbus_transport_set_auth_mechanisms
dbus_bool_t _dbus_transport_set_auth_mechanisms(DBusTransport *transport, const char **mechanisms)
Sets the SASL authentication mechanisms supported by this transport.
Definition: dbus-transport.c:1559
DBusNewConnectionFunction
void(* DBusNewConnectionFunction)(DBusServer *server, DBusConnection *new_connection, void *data)
Called when a new connection to the server is available.
Definition: dbus-server.h:48
DBusServerSocket::base
DBusServer base
Parent class members.
Definition: dbus-server-socket.c:52
dbus_error_is_set
dbus_bool_t dbus_error_is_set(const DBusError *error)
Checks whether an error occurred (the error is set).
Definition: dbus-errors.c:329
_dbus_transport_unref
void _dbus_transport_unref(DBusTransport *transport)
Decrements the reference count for the transport.
Definition: dbus-transport.c:480
DBusNonceFile
Definition: dbus-nonce.c:34
dbus_new
#define dbus_new(type, count)
Definition: dbus-memory.h:57
_dbus_close_socket
dbus_bool_t _dbus_close_socket(DBusSocket fd, DBusError *error)
Closes a socket.
Definition: dbus-sysdeps-unix.c:286
_dbus_address_append_escaped
dbus_bool_t _dbus_address_append_escaped(DBusString *escaped, const DBusString *unescaped)
Appends an escaped version of one string to another string, using the D-Bus address escaping mechanis...
Definition: dbus-address.c:107
_dbus_assert
#define _dbus_assert(condition)
Definition: dbus-internals.h:153
DBusServerVTable
Virtual table to be implemented by all server "subclasses".
Definition: dbus-server-protected.h:44
DBusError
Object representing an exception.
Definition: dbus-errors.h:49
_dbus_watch_invalidate
void _dbus_watch_invalidate(DBusWatch *watch)
Clears the file descriptor from a now-invalid watch object so that no one tries to use it.
Definition: dbus-watch.c:169
DBusServer::guid_hex
DBusString guid_hex
Hex-encoded version of GUID.
Definition: dbus-server-protected.h:64
dbus_set_error
void dbus_set_error(DBusError *error, const char *name, const char *format,...)
Assigns an error name and message to a DBusError.
Definition: dbus-errors.c:354
DBusServerSocket::n_fds
int n_fds
Number of active file handles.
Definition: dbus-server-socket.c:53
dbus_connection_unref
void dbus_connection_unref(DBusConnection *connection)
Decrements the reference count of a DBusConnection, and finalizes it if the count reaches zero.
Definition: dbus-connection.c:2816
_dbus_server_finalize_base
void _dbus_server_finalize_base(DBusServer *server)
Finalizes the members of the DBusServer base class.
Definition: dbus-server.c:201
DBusServerSocket
Implementation details of DBusServerSocket.
Definition: dbus-server-socket.c:51
DBusServer::new_connection_data
void * new_connection_data
Data for new connection callback.
Definition: dbus-server-protected.h:78
DBusServerSocket::noncefile
DBusNonceFile * noncefile
Nonce file used to authenticate clients.
Definition: dbus-server-socket.c:57
_dbus_string_init_const
void _dbus_string_init_const(DBusString *str, const char *value)
Initializes a constant string.
Definition: dbus-string.c:197
dbus_new0
#define dbus_new0(type, count)
Definition: dbus-memory.h:58
_dbus_server_ref_unlocked
DBUS_PRIVATE_EXPORT void _dbus_server_ref_unlocked(DBusServer *server)
Like dbus_server_ref() but does not acquire the lock (must already be held)
Definition: dbus-server.c:456
_dbus_watch_new
DBusWatch * _dbus_watch_new(DBusPollable fd, unsigned int flags, dbus_bool_t enabled, DBusWatchHandler handler, void *data, DBusFreeFunction free_data_function)
Creates a new DBusWatch.
Definition: dbus-watch.c:88
DBusServerSocket::socket_name
char * socket_name
Name of domain socket, to unlink if appropriate.
Definition: dbus-server-socket.c:56
_dbus_get_is_errno_eagain_or_ewouldblock
dbus_bool_t _dbus_get_is_errno_eagain_or_ewouldblock(int e)
See if errno is EAGAIN or EWOULDBLOCK (this has to be done differently for Winsock so is abstracted)
Definition: dbus-sysdeps-unix.c:4657
_dbus_transport_new_for_socket
DBusTransport * _dbus_transport_new_for_socket(DBusSocket fd, const DBusString *server_guid, const DBusString *address)
Creates a new transport for the given socket file descriptor.
Definition: dbus-transport-socket.c:1291
DBUS_WATCH_HANGUP
@ DBUS_WATCH_HANGUP
As in POLLHUP (can't watch for it, but can be present in current state passed to dbus_watch_handle())...
Definition: dbus-connection.h:68
_dbus_string_append
dbus_bool_t _dbus_string_append(DBusString *str, const char *buffer)
Appends a nul-terminated C-style string to a DBusString.
Definition: dbus-string.c:959
_dbus_server_new_for_tcp_socket
DBusServer * _dbus_server_new_for_tcp_socket(const char *host, const char *bind, const char *port, const char *family, DBusError *error, dbus_bool_t use_nonce)
Creates a new server listening on TCP.
Definition: dbus-server-socket.c:418
_dbus_connection_close_if_only_one_ref
void _dbus_connection_close_if_only_one_ref(DBusConnection *connection)
Used internally to handle the semantics of dbus_server_set_new_connection_function().
Definition: dbus-connection.c:2146
dbus_bool_t
dbus_uint32_t dbus_bool_t
Definition: dbus-types.h:35
NULL
#define NULL