D-Bus 1.15.12
dbus-transport-protected.h
1/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2/* dbus-transport-protected.h Used by subclasses of DBusTransport object (internal to D-Bus implementation)
3 *
4 * Copyright (C) 2002, 2004 Red Hat Inc.
5 *
6 * SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
7 *
8 * Licensed under the Academic Free License version 2.1
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 *
24 */
25#ifndef DBUS_TRANSPORT_PROTECTED_H
26#define DBUS_TRANSPORT_PROTECTED_H
27
28#include <dbus/dbus-internals.h>
29#include <dbus/dbus-errors.h>
30#include <dbus/dbus-transport.h>
31#include <dbus/dbus-message-internal.h>
32#include <dbus/dbus-auth.h>
33#include <dbus/dbus-resources.h>
34
36
38
44{
45 void (* finalize) (DBusTransport *transport);
48 dbus_bool_t (* handle_watch) (DBusTransport *transport,
49 DBusWatch *watch,
50 unsigned int flags);
55 void (* disconnect) (DBusTransport *transport);
58 dbus_bool_t (* connection_set) (DBusTransport *transport);
61 void (* do_iteration) (DBusTransport *transport,
62 unsigned int flags,
63 int timeout_milliseconds);
68 void (* live_messages_changed) (DBusTransport *transport);
71 dbus_bool_t (* get_socket_fd) (DBusTransport *transport,
72 DBusSocket *fd_p);
74};
75
123
124dbus_bool_t _dbus_transport_init_base (DBusTransport *transport,
125 const DBusTransportVTable *vtable,
126 const DBusString *server_guid,
127 const DBusString *address);
129
130
131typedef enum
132{
133 DBUS_TRANSPORT_OPEN_NOT_HANDLED,
134 DBUS_TRANSPORT_OPEN_OK,
135 DBUS_TRANSPORT_OPEN_BAD_ADDRESS,
136 DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT
137} DBusTransportOpenResult;
138
139DBusTransportOpenResult _dbus_transport_open_platform_specific (DBusAddressEntry *entry,
140 DBusTransport **transport_p,
141 DBusError *error);
142
143#define DBUS_TRANSPORT_CAN_SEND_UNIX_FD(x) \
144 _dbus_auth_get_unix_fd_negotiated((x)->auth)
145
147
148#endif /* DBUS_TRANSPORT_PROTECTED_H */
dbus_bool_t(* DBusAllowUnixUserFunction)(DBusConnection *connection, unsigned long uid, void *data)
Called during authentication to check whether the given UNIX user ID is allowed to connect,...
dbus_bool_t(* DBusAllowWindowsUserFunction)(DBusConnection *connection, const char *user_sid, void *data)
Called during authentication to check whether the given Windows user ID is allowed to connect,...
#define DBUS_BEGIN_DECLS
Macro used prior to declaring functions in the D-Bus header files.
Definition dbus-macros.h:36
#define DBUS_END_DECLS
Macro used after declaring functions in the D-Bus header files.
Definition dbus-macros.h:37
void(* DBusFreeFunction)(void *memory)
The type of a function which frees a block of memory.
Definition dbus-memory.h:65
DBusTransportOpenResult _dbus_transport_open_platform_specific(DBusAddressEntry *entry, DBusTransport **transport_p, DBusError *error)
Opens platform specific transport types.
dbus_bool_t _dbus_transport_init_base(DBusTransport *transport, const DBusTransportVTable *vtable, const DBusString *server_guid, const DBusString *address)
Initializes the base class members of DBusTransport.
void _dbus_transport_finalize_base(DBusTransport *transport)
Finalizes base class members of DBusTransport.
Internals of DBusAddressEntry.
Internal members of DBusAuth.
Definition dbus-auth.c:156
Implementation details of DBusConnection.
Internals of DBusCounter.
Object representing an exception.
Definition dbus-errors.h:51
Implementation details of DBusMessageLoader.
Socket interface.
The virtual table that must be implemented to create a new kind of transport.
dbus_bool_t(* get_socket_fd)(DBusTransport *transport, DBusSocket *fd_p)
Get socket file descriptor.
void(* disconnect)(DBusTransport *transport)
Disconnect this transport.
void(* live_messages_changed)(DBusTransport *transport)
Outstanding messages counter changed.
void(* do_iteration)(DBusTransport *transport, unsigned int flags, int timeout_milliseconds)
Called to do a single "iteration" (block on select/poll followed by reading or writing data).
dbus_bool_t(* handle_watch)(DBusTransport *transport, DBusWatch *watch, unsigned int flags)
The handle_watch method handles reading/writing data as indicated by the flags.
void(* finalize)(DBusTransport *transport)
The finalize method must free the transport.
dbus_bool_t(* connection_set)(DBusTransport *transport)
Called when transport->connection has been filled in.
Object representing a transport such as a socket.
unsigned int authenticated
Cache of auth state; use _dbus_transport_peek_is_authenticated() to query value.
DBusAllowWindowsUserFunction windows_user_function
Function for checking whether a user is authorized.
int refcount
Reference count.
long max_live_messages_size
Max total size of received messages.
long max_live_messages_unix_fds
Max total unix fds of received messages.
unsigned int allow_anonymous
TRUE if an anonymous client can connect
void * windows_user_data
Data for windows_user_function.
unsigned int is_server
TRUE if on the server side
unsigned int disconnected
TRUE if we are disconnected.
char * address
Address of the server we are connecting to (NULL for the server side of a transport)
unsigned int unused_bytes_recovered
TRUE if we've recovered unused bytes from auth
const DBusTransportVTable * vtable
Virtual methods for this instance.
DBusFreeFunction free_unix_user_data
Function to free unix_user_data.
unsigned int send_credentials_pending
TRUE if we need to send credentials
void * unix_user_data
Data for unix_user_function.
DBusConnection * connection
Connection owning this transport.
unsigned int receive_credentials_pending
TRUE if we need to receive credentials
DBusMessageLoader * loader
Message-loading buffer.
char * expected_guid
GUID we expect the server to have, NULL on server side or if we don't have an expectation.
DBusFreeFunction free_windows_user_data
Function to free windows_user_data.
DBusAllowUnixUserFunction unix_user_function
Function for checking whether a user is authorized.
DBusCredentials * credentials
Credentials of other end read from the socket.
DBusAuth * auth
Authentication conversation.
DBusCounter * live_messages
Counter for size/unix fds of all live messages.
Implementation of DBusWatch.
Definition dbus-watch.c:43