chiark / gitweb /
bus: generate a nice error when attempting to add a NULL string
[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 #include <endian.h>
26
27 /* Types of message */
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 #if __BYTE_ORDER == __BIG_ENDIAN
72         SD_BUS_NATIVE_ENDIAN   = SD_BUS_BIG_ENDIAN,
73         SD_BUS_REVERSE_ENDIAN  = SD_BUS_LITTLE_ENDIAN
74 #else
75         SD_BUS_NATIVE_ENDIAN   = SD_BUS_LITTLE_ENDIAN,
76         SD_BUS_REVERSE_ENDIAN  = SD_BUS_BIG_ENDIAN
77 #endif
78 };
79
80 /* Flags */
81
82 enum {
83         SD_BUS_MESSAGE_NO_REPLY_EXPECTED = 1,
84         SD_BUS_MESSAGE_NO_AUTO_START = 2
85 };
86
87 /* Header fields */
88
89 enum {
90         _SD_BUS_MESSAGE_HEADER_INVALID = 0,
91         SD_BUS_MESSAGE_HEADER_PATH,
92         SD_BUS_MESSAGE_HEADER_INTERFACE,
93         SD_BUS_MESSAGE_HEADER_MEMBER,
94         SD_BUS_MESSAGE_HEADER_ERROR_NAME,
95         SD_BUS_MESSAGE_HEADER_REPLY_SERIAL,
96         SD_BUS_MESSAGE_HEADER_DESTINATION,
97         SD_BUS_MESSAGE_HEADER_SENDER,
98         SD_BUS_MESSAGE_HEADER_SIGNATURE,
99         SD_BUS_MESSAGE_HEADER_UNIX_FDS,
100         _SD_BUS_MESSAGE_HEADER_MAX
101 };
102
103 #endif