chiark / gitweb /
bus: add basic implementation of a native bus client library
[elogind.git] / src / libsystemd-bus / sd-bus-protocol.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #ifndef foosdbusprotocolhfoo
4 #define foosdbusprotocolhfoo
5
6 /***
7   This file is part of systemd.
8
9   Copyright 2013 Lennart Poettering
10
11   systemd is free software; you can redistribute it and/or modify it
12   under the terms of the GNU Lesser General Public License as published by
13   the Free Software Foundation; either version 2.1 of the License, or
14   (at your option) any later version.
15
16   systemd is distributed in the hope that it will be useful, but
17   WITHOUT ANY WARRANTY; without even the implied warranty of
18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19   Lesser General Public License for more details.
20
21   You should have received a copy of the GNU Lesser General Public License
22   along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 ***/
24
25 /* Types of message */
26
27 #define SD_BUS_DEFAULT_TIMEOUT ((usec_t) (25 * USEC_PER_SEC))
28
29 enum {
30         _SD_BUS_MESSAGE_TYPE_INVALID = 0,
31         SD_BUS_MESSAGE_TYPE_METHOD_CALL,
32         SD_BUS_MESSAGE_TYPE_METHOD_RETURN,
33         SD_BUS_MESSAGE_TYPE_METHOD_ERROR,
34         SD_BUS_MESSAGE_TYPE_SIGNAL,
35         _SD_BUS_MESSAGE_TYPE_MAX
36 };
37
38 /* Primitive types */
39
40 enum {
41         _SD_BUS_TYPE_INVALID         = 0,
42         SD_BUS_TYPE_BYTE             = 'y',
43         SD_BUS_TYPE_BOOLEAN          = 'b',
44         SD_BUS_TYPE_INT16            = 'n',
45         SD_BUS_TYPE_UINT16           = 'q',
46         SD_BUS_TYPE_INT32            = 'i',
47         SD_BUS_TYPE_UINT32           = 'u',
48         SD_BUS_TYPE_INT64            = 'x',
49         SD_BUS_TYPE_UINT64           = 't',
50         SD_BUS_TYPE_DOUBLE           = 'd',
51         SD_BUS_TYPE_STRING           = 's',
52         SD_BUS_TYPE_OBJECT_PATH      = 'o',
53         SD_BUS_TYPE_SIGNATURE        = 'g',
54         SD_BUS_TYPE_UNIX_FD          = 'h',
55         SD_BUS_TYPE_ARRAY            = 'a',
56         SD_BUS_TYPE_VARIANT          = 'v',
57         SD_BUS_TYPE_STRUCT           = 'r', /* not actually used in signatures */
58         SD_BUS_TYPE_STRUCT_BEGIN     = '(',
59         SD_BUS_TYPE_STRUCT_END       = ')',
60         SD_BUS_TYPE_DICT_ENTRY       = 'e', /* not actually used in signatures */
61         SD_BUS_TYPE_DICT_ENTRY_BEGIN = '{',
62         SD_BUS_TYPE_DICT_ENTRY_END   = '}',
63 };
64
65 /* Endianess */
66
67 enum {
68         _SD_BUS_INVALID_ENDIAN = 0,
69         SD_BUS_LITTLE_ENDIAN   = 'l',
70         SD_BUS_BIG_ENDIAN      = 'B'
71 };
72
73 /* Flags */
74
75 enum {
76         SD_BUS_MESSAGE_NO_REPLY_EXPECTED = 1,
77         SD_BUS_MESSAGE_NO_AUTO_START = 2
78 };
79
80 /* Header fields */
81
82 enum {
83         _SD_BUS_MESSAGE_HEADER_INVALID = 0,
84         SD_BUS_MESSAGE_HEADER_PATH,
85         SD_BUS_MESSAGE_HEADER_INTERFACE,
86         SD_BUS_MESSAGE_HEADER_MEMBER,
87         SD_BUS_MESSAGE_HEADER_ERROR_NAME,
88         SD_BUS_MESSAGE_HEADER_REPLY_SERIAL,
89         SD_BUS_MESSAGE_HEADER_DESTINATION,
90         SD_BUS_MESSAGE_HEADER_SENDER,
91         SD_BUS_MESSAGE_HEADER_SIGNATURE,
92         SD_BUS_MESSAGE_HEADER_UNIX_FDS,
93         _SD_BUS_MESSAGE_HEADER_MAX
94 };
95
96 #endif