D-Bus 1.15.8
Data Structures | Typedefs | Functions
DBusServer implementations for SOCKET

Implementation details of DBusServer on SOCKET. More...

Data Structures

struct  DBusServerSocket
 Implementation details of DBusServerSocket. More...
 

Typedefs

typedef struct DBusServerSocket DBusServerSocket
 Opaque object representing a Socket server implementation. More...
 

Functions

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. More...
 
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. More...
 
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 and nonce-tcp). More...
 
void _dbus_server_socket_own_filename (DBusServer *server, char *filename)
 This is a bad hack since it's really unix domain socket specific. More...
 
DBusServer_dbus_server_new_for_domain_socket (const char *path, dbus_bool_t abstract, DBusError *error)
 Creates a new server listening on the given Unix domain socket. More...
 
DBusServerListenResult _dbus_server_listen_unix_socket (DBusAddressEntry *entry, DBusServer **server_p, DBusError *error)
 Tries to interpret the address entry for UNIX socket addresses. More...
 

Detailed Description

Implementation details of DBusServer on SOCKET.

Typedef Documentation

◆ DBusServerSocket

Opaque object representing a Socket server implementation.

Definition at line 46 of file dbus-server-socket.c.

Function Documentation

◆ _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 and nonce-tcp).

Sets error if the result is not OK.

Parameters
entryan address entry
server_pa new DBusServer, or NULL on failure.
errorlocation to store rationale for failure on bad address
Returns
the outcome

Definition at line 540 of file dbus-server-socket.c.

References _dbus_server_new_for_tcp_socket(), dbus_address_entry_get_method(), dbus_address_entry_get_value(), FALSE, NULL, and TRUE.

◆ _dbus_server_listen_unix_socket()

DBusServerListenResult _dbus_server_listen_unix_socket ( DBusAddressEntry entry,
DBusServer **  server_p,
DBusError error 
)

Tries to interpret the address entry for UNIX socket addresses.

Sets error if the result is not OK.

Parameters
entryan address entry
server_plocation to store a new DBusServer, or NULL on failure.
errorlocation to store rationale for failure on bad address
Returns
the outcome

Definition at line 761 of file dbus-server-socket.c.

References _dbus_concat_dir_and_file(), _dbus_getenv(), _dbus_server_new_for_domain_socket(), _dbus_set_bad_address(), _dbus_string_append(), _dbus_string_free(), _dbus_string_get_const_data(), _dbus_string_init(), _dbus_string_init_const(), dbus_address_entry_get_method(), dbus_address_entry_get_value(), DBUS_ERROR_NOT_SUPPORTED, dbus_set_error(), FALSE, and NULL.

◆ _dbus_server_new_for_domain_socket()

DBusServer * _dbus_server_new_for_domain_socket ( const char *  path,
dbus_bool_t  abstract,
DBusError error 
)

Creates a new server listening on the given Unix domain socket.

Parameters
paththe path for the domain socket.
abstractTRUE to use abstract socket namespace
errorlocation to store reason for failure.
Returns
the new server, or NULL on failure.

Definition at line 610 of file dbus-server-socket.c.

References _dbus_address_append_escaped(), _dbus_listen_unix_socket(), _dbus_strdup(), _dbus_string_append(), _dbus_string_init(), _dbus_string_init_const(), DBUS_ERROR_NO_MEMORY, dbus_set_error(), and NULL.

Referenced by _dbus_server_listen_unix_socket().

◆ _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.

The file descriptor should be nonblocking (use _dbus_set_fd_nonblocking() to make it so). The file descriptor should be listening for connections, that is, listen() should have been successfully invoked on it. The server will use accept() to accept new client connections.

Parameters
fdslist of file descriptors.
n_fdsnumber of file descriptors
addressthe server's address
noncefileto be used for authentication (NULL if not needed)
errorlocation to store reason for failure
Returns
the new server, or NULL on OOM or other error.

Definition at line 288 of file dbus-server-socket.c.

References _dbus_watch_new(), dbus_new, dbus_new0, fds, noncefile, NULL, and watch.

Referenced by _dbus_server_listen_platform_specific(), _dbus_server_new_for_launchd(), and _dbus_server_new_for_tcp_socket().

◆ _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.

If host is NULL, it will default to localhost. If bind is NULL, it will default to the value for the host parameter, and if that is NULL, then localhost If bind is a hostname, it will be resolved and will listen on all returned addresses. If family is NULL, hostname resolution will try all address families, otherwise it can be ipv4 or ipv6 to restrict the addresses considered.

Parameters
hostthe hostname to report for the listen address
bindthe hostname to listen on
portthe port to listen on or 0 to let the OS choose
family
errorlocation to store reason for failure.
use_noncewhether to use a nonce for low-level authentication (nonce-tcp transport) or not (tcp transport)
Returns
the new server, or NULL on failure.

Definition at line 420 of file dbus-server-socket.c.

References _dbus_address_append_escaped(), _dbus_close_socket(), _dbus_listen_tcp_socket(), _dbus_server_new_for_socket(), _dbus_string_append(), _dbus_string_free(), _dbus_string_get_const_data(), _dbus_string_init(), _dbus_string_init_const(), DBUS_ERROR_NO_MEMORY, dbus_free(), dbus_set_error(), and NULL.

Referenced by _dbus_server_listen_platform_specific(), and _dbus_server_listen_socket().

◆ _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.

Also, the function weirdly adopts ownership of the passed-in string.

Parameters
servera socket server
filenamesocket filename to report/delete

Definition at line 593 of file dbus-server-socket.c.

References socket_name.