D-Bus: dbus-signature.c Source File

D-Bus 1.8.16

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List

dbus-signature.c
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-signature.c Routines for reading recursive type signatures
3 *
4 * Copyright (C) 2005 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
26 #include "dbus-signature.h"
27 #include "dbus-marshal-recursive.h"
28 #include "dbus-marshal-basic.h"
29 #include "dbus-internals.h"
30 #include "dbus-test.h"
31
35 typedef struct
36 {
37 const char *pos;
38 unsigned int finished : 1;
39 unsigned int in_array : 1;
40 } DBusSignatureRealIter;
41
43 #define TYPE_IS_CONTAINER(typecode) \
44 ((typecode) == DBUS_TYPE_STRUCT || \
45 (typecode) == DBUS_TYPE_DICT_ENTRY || \
46 (typecode) == DBUS_TYPE_VARIANT || \
47 (typecode) == DBUS_TYPE_ARRAY)
48
49
66 void
67 dbus_signature_iter_init (DBusSignatureIter *iter,
68 const char *signature)
69 {
70 DBusSignatureRealIter *real_iter = (DBusSignatureRealIter *) iter;
71
72 real_iter->pos = signature;
73 real_iter->finished = FALSE;
74 real_iter->in_array = FALSE;
75 }
76
91 int
92 dbus_signature_iter_get_current_type (const DBusSignatureIter *iter)
93 {
94 DBusSignatureRealIter *real_iter = (DBusSignatureRealIter *) iter;
95
96 return _dbus_first_type_in_signature_c_str (real_iter->pos, 0);
97 }
98
111 char *
112 dbus_signature_iter_get_signature (const DBusSignatureIter *iter)
113 {
114 DBusSignatureRealIter *real_iter = (DBusSignatureRealIter *) iter;
115 DBusString str;
116 char *ret;
117 int pos;
118
119 if (!_dbus_string_init (&str))
120 return NULL;
121
122 pos = 0;
123 _dbus_type_signature_next (real_iter->pos, &pos);
124
125 if (!_dbus_string_append_len (&str, real_iter->pos, pos))
126 return NULL;
127 if (!_dbus_string_steal_data (&str, &ret))
128 ret = NULL;
129 _dbus_string_free (&str);
130
131 return ret;
132 }
133
145 int
146 dbus_signature_iter_get_element_type (const DBusSignatureIter *iter)
147 {
148 DBusSignatureRealIter *real_iter = (DBusSignatureRealIter *) iter;
149
150 _dbus_return_val_if_fail (dbus_signature_iter_get_current_type (iter) == DBUS_TYPE_ARRAY, DBUS_TYPE_INVALID);
151
152 return _dbus_first_type_in_signature_c_str (real_iter->pos, 1);
153 }
154
163 dbus_bool_t
164 dbus_signature_iter_next (DBusSignatureIter *iter)
165 {
166 DBusSignatureRealIter *real_iter = (DBusSignatureRealIter *) iter;
167
168 if (real_iter->finished)
169 return FALSE;
170 else
171 {
172 int pos;
173
174 if (real_iter->in_array)
175 {
176 real_iter->finished = TRUE;
177 return FALSE;
178 }
179
180 pos = 0;
181 _dbus_type_signature_next (real_iter->pos, &pos);
182 real_iter->pos += pos;
183
184 if (*real_iter->pos == DBUS_STRUCT_END_CHAR
185 || *real_iter->pos == DBUS_DICT_ENTRY_END_CHAR)
186 {
187 real_iter->finished = TRUE;
188 return FALSE;
189 }
190
191 return *real_iter->pos != DBUS_TYPE_INVALID;
192 }
193 }
194
206 void
207 dbus_signature_iter_recurse (const DBusSignatureIter *iter,
208 DBusSignatureIter *subiter)
209 {
210 DBusSignatureRealIter *real_iter = (DBusSignatureRealIter *) iter;
211 DBusSignatureRealIter *real_sub_iter = (DBusSignatureRealIter *) subiter;
212
213 _dbus_return_if_fail (dbus_type_is_container (dbus_signature_iter_get_current_type (iter)));
214
215 *real_sub_iter = *real_iter;
216 real_sub_iter->in_array = FALSE;
217 real_sub_iter->pos++;
218
219 if (dbus_signature_iter_get_current_type (iter) == DBUS_TYPE_ARRAY)
220 real_sub_iter->in_array = TRUE;
221 }
222
232 dbus_bool_t
233 dbus_signature_validate (const char *signature,
234 DBusError *error)
235
236 {
237 DBusString str;
238 DBusValidity reason;
239
240 _dbus_string_init_const (&str, signature);
241 reason = _dbus_validate_signature_with_reason (&str, 0, _dbus_string_get_length (&str));
242
243 if (reason == DBUS_VALID)
244 return TRUE;
245 else
246 {
247 dbus_set_error (error, DBUS_ERROR_INVALID_SIGNATURE, _dbus_validity_to_error_message (reason));
248 return FALSE;
249 }
250 }
251
263 dbus_bool_t
264 dbus_signature_validate_single (const char *signature,
265 DBusError *error)
266 {
267 DBusSignatureIter iter;
268
269 if (!dbus_signature_validate (signature, error))
270 return FALSE;
271
272 dbus_signature_iter_init (&iter, signature);
273 if (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_INVALID)
274 goto lose;
275 if (!dbus_signature_iter_next (&iter))
276 return TRUE;
277 lose:
278 dbus_set_error (error, DBUS_ERROR_INVALID_SIGNATURE, "Exactly one complete type required in signature");
279 return FALSE;
280 }
281
293 dbus_bool_t
294 dbus_type_is_container (int typecode)
295 {
296 /* only reasonable (non-line-noise) typecodes are allowed */
297 _dbus_return_val_if_fail (dbus_type_is_valid (typecode) || typecode == DBUS_TYPE_INVALID,
298 FALSE);
299 return TYPE_IS_CONTAINER (typecode);
300 }
301
317 dbus_bool_t
318 dbus_type_is_basic (int typecode)
319 {
320 /* only reasonable (non-line-noise) typecodes are allowed */
321 _dbus_return_val_if_fail (dbus_type_is_valid (typecode) || typecode == DBUS_TYPE_INVALID,
322 FALSE);
323
324 /* everything that isn't invalid or a container */
325 return !(typecode == DBUS_TYPE_INVALID || TYPE_IS_CONTAINER (typecode));
326 }
327
348 dbus_bool_t
349 dbus_type_is_fixed (int typecode)
350 {
351 /* only reasonable (non-line-noise) typecodes are allowed */
352 _dbus_return_val_if_fail (dbus_type_is_valid (typecode) || typecode == DBUS_TYPE_INVALID,
353 FALSE);
354
355 switch (typecode)
356 {
357 case DBUS_TYPE_BYTE:
358 case DBUS_TYPE_BOOLEAN:
359 case DBUS_TYPE_INT16:
360 case DBUS_TYPE_UINT16:
361 case DBUS_TYPE_INT32:
362 case DBUS_TYPE_UINT32:
363 case DBUS_TYPE_INT64:
364 case DBUS_TYPE_UINT64:
365 case DBUS_TYPE_DOUBLE:
366 case DBUS_TYPE_UNIX_FD:
367 return TRUE;
368 default:
369 return FALSE;
370 }
371 }
372
382 dbus_bool_t
383 dbus_type_is_valid (int typecode)
384 {
385 switch (typecode)
386 {
387 case DBUS_TYPE_BYTE:
388 case DBUS_TYPE_BOOLEAN:
389 case DBUS_TYPE_INT16:
390 case DBUS_TYPE_UINT16:
391 case DBUS_TYPE_INT32:
392 case DBUS_TYPE_UINT32:
393 case DBUS_TYPE_INT64:
394 case DBUS_TYPE_UINT64:
395 case DBUS_TYPE_DOUBLE:
396 case DBUS_TYPE_STRING:
397 case DBUS_TYPE_OBJECT_PATH:
398 case DBUS_TYPE_SIGNATURE:
399 case DBUS_TYPE_ARRAY:
400 case DBUS_TYPE_STRUCT:
401 case DBUS_TYPE_DICT_ENTRY:
402 case DBUS_TYPE_VARIANT:
403 case DBUS_TYPE_UNIX_FD:
404 return TRUE;
405
406 default:
407 return FALSE;
408 }
409 }
410 /* end of DBusSignature group */
412
413 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
414
421 dbus_bool_t
422 _dbus_signature_test (void)
423 {
424 DBusSignatureIter iter;
425 DBusSignatureIter subiter;
426 DBusSignatureIter subsubiter;
427 DBusSignatureIter subsubsubiter;
428 const char *sig;
429 dbus_bool_t boolres;
430
431 _dbus_assert (sizeof (DBusSignatureIter) >= sizeof (DBusSignatureRealIter));
432
433 sig = "";
434 _dbus_assert (dbus_signature_validate (sig, NULL));
435 _dbus_assert (!dbus_signature_validate_single (sig, NULL));
436 dbus_signature_iter_init (&iter, sig);
437 _dbus_assert (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_INVALID);
438
439 sig = DBUS_TYPE_STRING_AS_STRING;
440 _dbus_assert (dbus_signature_validate (sig, NULL));
441 _dbus_assert (dbus_signature_validate_single (sig, NULL));
442 dbus_signature_iter_init (&iter, sig);
443 _dbus_assert (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_STRING);
444
445 sig = DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_BYTE_AS_STRING;
446 _dbus_assert (dbus_signature_validate (sig, NULL));
447 dbus_signature_iter_init (&iter, sig);
448 _dbus_assert (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_STRING);
449 boolres = dbus_signature_iter_next (&iter);
450 _dbus_assert (boolres);
451 _dbus_assert (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_BYTE);
452
453 sig = DBUS_TYPE_UINT16_AS_STRING
454 DBUS_STRUCT_BEGIN_CHAR_AS_STRING
455 DBUS_TYPE_STRING_AS_STRING
456 DBUS_TYPE_UINT32_AS_STRING
457 DBUS_TYPE_VARIANT_AS_STRING
458 DBUS_TYPE_DOUBLE_AS_STRING
459 DBUS_STRUCT_END_CHAR_AS_STRING;
460 _dbus_assert (dbus_signature_validate (sig, NULL));
461 dbus_signature_iter_init (&iter, sig);
462 _dbus_assert (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_UINT16);
463 boolres = dbus_signature_iter_next (&iter);
464 _dbus_assert (boolres);
465 _dbus_assert (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_STRUCT);
466 dbus_signature_iter_recurse (&iter, &subiter);
467 _dbus_assert (dbus_signature_iter_get_current_type (&subiter) == DBUS_TYPE_STRING);
468 boolres = dbus_signature_iter_next (&subiter);
469 _dbus_assert (boolres);
470 _dbus_assert (dbus_signature_iter_get_current_type (&subiter) == DBUS_TYPE_UINT32);
471 boolres = dbus_signature_iter_next (&subiter);
472 _dbus_assert (boolres);
473 _dbus_assert (dbus_signature_iter_get_current_type (&subiter) == DBUS_TYPE_VARIANT);
474 boolres = dbus_signature_iter_next (&subiter);
475 _dbus_assert (boolres);
476 _dbus_assert (dbus_signature_iter_get_current_type (&subiter) == DBUS_TYPE_DOUBLE);
477
478 sig = DBUS_TYPE_UINT16_AS_STRING
479 DBUS_STRUCT_BEGIN_CHAR_AS_STRING
480 DBUS_TYPE_UINT32_AS_STRING
481 DBUS_TYPE_BYTE_AS_STRING
482 DBUS_TYPE_ARRAY_AS_STRING
483 DBUS_TYPE_ARRAY_AS_STRING
484 DBUS_TYPE_DOUBLE_AS_STRING
485 DBUS_STRUCT_BEGIN_CHAR_AS_STRING
486 DBUS_TYPE_BYTE_AS_STRING
487 DBUS_STRUCT_END_CHAR_AS_STRING
488 DBUS_STRUCT_END_CHAR_AS_STRING;
489 _dbus_assert (dbus_signature_validate (sig, NULL));
490 dbus_signature_iter_init (&iter, sig);
491 _dbus_assert (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_UINT16);
492 boolres = dbus_signature_iter_next (&iter);
493 _dbus_assert (boolres);
494 _dbus_assert (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_STRUCT);
495 dbus_signature_iter_recurse (&iter, &subiter);
496 _dbus_assert (dbus_signature_iter_get_current_type (&subiter) == DBUS_TYPE_UINT32);
497 boolres = dbus_signature_iter_next (&subiter);
498 _dbus_assert (boolres);
499 _dbus_assert (dbus_signature_iter_get_current_type (&subiter) == DBUS_TYPE_BYTE);
500 boolres = dbus_signature_iter_next (&subiter);
501 _dbus_assert (boolres);
502 _dbus_assert (dbus_signature_iter_get_current_type (&subiter) == DBUS_TYPE_ARRAY);
503 _dbus_assert (dbus_signature_iter_get_element_type (&subiter) == DBUS_TYPE_ARRAY);
504
505 dbus_signature_iter_recurse (&subiter, &subsubiter);
506 _dbus_assert (dbus_signature_iter_get_current_type (&subsubiter) == DBUS_TYPE_ARRAY);
507 _dbus_assert (dbus_signature_iter_get_element_type (&subsubiter) == DBUS_TYPE_DOUBLE);
508
509 dbus_signature_iter_recurse (&subsubiter, &subsubsubiter);
510 _dbus_assert (dbus_signature_iter_get_current_type (&subsubsubiter) == DBUS_TYPE_DOUBLE);
511 boolres = dbus_signature_iter_next (&subiter);
512 _dbus_assert (boolres);
513 _dbus_assert (dbus_signature_iter_get_current_type (&subiter) == DBUS_TYPE_STRUCT);
514 dbus_signature_iter_recurse (&subiter, &subsubiter);
515 _dbus_assert (dbus_signature_iter_get_current_type (&subsubiter) == DBUS_TYPE_BYTE);
516
517 sig = DBUS_TYPE_ARRAY_AS_STRING
518 DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
519 DBUS_TYPE_INT16_AS_STRING
520 DBUS_TYPE_STRING_AS_STRING
521 DBUS_DICT_ENTRY_END_CHAR_AS_STRING
522 DBUS_TYPE_VARIANT_AS_STRING;
523 _dbus_assert (dbus_signature_validate (sig, NULL));
524 _dbus_assert (!dbus_signature_validate_single (sig, NULL));
525 dbus_signature_iter_init (&iter, sig);
526 _dbus_assert (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_ARRAY);
527 _dbus_assert (dbus_signature_iter_get_element_type (&iter) == DBUS_TYPE_DICT_ENTRY);
528
529 dbus_signature_iter_recurse (&iter, &subiter);
530 dbus_signature_iter_recurse (&subiter, &subsubiter);
531 _dbus_assert (dbus_signature_iter_get_current_type (&subsubiter) == DBUS_TYPE_INT16);
532 boolres = dbus_signature_iter_next (&subsubiter);
533 _dbus_assert (boolres);
534 _dbus_assert (dbus_signature_iter_get_current_type (&subsubiter) == DBUS_TYPE_STRING);
535 boolres = dbus_signature_iter_next (&subsubiter);
536 _dbus_assert (!boolres);
537
538 boolres = dbus_signature_iter_next (&iter);
539 _dbus_assert (boolres);
540 _dbus_assert (dbus_signature_iter_get_current_type (&iter) == DBUS_TYPE_VARIANT);
541 boolres = dbus_signature_iter_next (&iter);
542 _dbus_assert (!boolres);
543
544 sig = DBUS_TYPE_DICT_ENTRY_AS_STRING;
545 _dbus_assert (!dbus_signature_validate (sig, NULL));
546
547 sig = DBUS_TYPE_ARRAY_AS_STRING;
548 _dbus_assert (!dbus_signature_validate (sig, NULL));
549
550 sig = DBUS_TYPE_UINT32_AS_STRING
551 DBUS_TYPE_ARRAY_AS_STRING;
552 _dbus_assert (!dbus_signature_validate (sig, NULL));
553
554 sig = DBUS_TYPE_ARRAY_AS_STRING
555 DBUS_TYPE_DICT_ENTRY_AS_STRING;
556 _dbus_assert (!dbus_signature_validate (sig, NULL));
557
558 sig = DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING;
559 _dbus_assert (!dbus_signature_validate (sig, NULL));
560
561 sig = DBUS_DICT_ENTRY_END_CHAR_AS_STRING;
562 _dbus_assert (!dbus_signature_validate (sig, NULL));
563
564 sig = DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
565 DBUS_TYPE_INT32_AS_STRING;
566 _dbus_assert (!dbus_signature_validate (sig, NULL));
567
568 sig = DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
569 DBUS_TYPE_INT32_AS_STRING
570 DBUS_TYPE_STRING_AS_STRING;
571 _dbus_assert (!dbus_signature_validate (sig, NULL));
572
573 sig = DBUS_STRUCT_END_CHAR_AS_STRING
574 DBUS_STRUCT_BEGIN_CHAR_AS_STRING;
575 _dbus_assert (!dbus_signature_validate (sig, NULL));
576
577 sig = DBUS_STRUCT_BEGIN_CHAR_AS_STRING
578 DBUS_TYPE_BOOLEAN_AS_STRING;
579 _dbus_assert (!dbus_signature_validate (sig, NULL));
580 return TRUE;
581 #if 0
582 oom:
583 _dbus_assert_not_reached ("out of memory");
584 return FALSE;
585 #endif
586 }
587
588 #endif
589
dbus_type_is_fixed
dbus_bool_t dbus_type_is_fixed(int typecode)
Tells you whether values of this type can change length if you set them to some other value...
Definition: dbus-signature.c:349
DBUS_TYPE_UINT16
#define DBUS_TYPE_UINT16
Type code marking a 16-bit unsigned integer.
Definition: dbus-protocol.h:78
NULL
#define NULL
A null pointer, defined appropriately for C or C++.
DBUS_STRUCT_BEGIN_CHAR_AS_STRING
#define DBUS_STRUCT_BEGIN_CHAR_AS_STRING
DBUS_STRUCT_BEGIN_CHAR as a string literal instead of a int literal
Definition: dbus-protocol.h:158
DBUS_TYPE_STRUCT
#define DBUS_TYPE_STRUCT
STRUCT and DICT_ENTRY are sort of special since their codes can't appear in a type string...
Definition: dbus-protocol.h:136
DBUS_TYPE_DICT_ENTRY
#define DBUS_TYPE_DICT_ENTRY
Type code used to represent a dict entry; however, this type code does not appear in type signatures...
Definition: dbus-protocol.h:143
DBUS_TYPE_STRING
#define DBUS_TYPE_STRING
Type code marking a UTF-8 encoded, nul-terminated Unicode string.
Definition: dbus-protocol.h:102
_dbus_assert
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
Definition: dbus-internals.h:135
_dbus_type_signature_next
void _dbus_type_signature_next(const char *type_str, int *type_pos)
Skips to the next "complete" type inside a type signature.
Definition: dbus-marshal-recursive.c:340
DBUS_TYPE_ARRAY_AS_STRING
#define DBUS_TYPE_ARRAY_AS_STRING
DBUS_TYPE_ARRAY as a string literal instead of a int literal
Definition: dbus-protocol.h:122
DBUS_TYPE_BYTE
#define DBUS_TYPE_BYTE
Type code marking an 8-bit unsigned integer.
Definition: dbus-protocol.h:66
DBusSignatureIter
DBusSignatureIter struct; contains no public fields.
Definition: dbus-signature.h:44
dbus_signature_iter_next
dbus_bool_t dbus_signature_iter_next(DBusSignatureIter *iter)
Skip to the next value on this "level".
Definition: dbus-signature.c:164
_dbus_string_init
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
Definition: dbus-string.c:175
DBUS_DICT_ENTRY_END_CHAR_AS_STRING
#define DBUS_DICT_ENTRY_END_CHAR_AS_STRING
DBUS_DICT_ENTRY_END_CHAR as a string literal instead of a int literal
Definition: dbus-protocol.h:170
DBusValidity
DBusValidity
This is primarily used in unit testing, so we can verify that each invalid message is invalid for the...
Definition: dbus-marshal-validate.h:49
DBUS_STRUCT_END_CHAR
#define DBUS_STRUCT_END_CHAR
Code marking the end of a struct type in a type signature.
Definition: dbus-protocol.h:160
DBUS_TYPE_DOUBLE
#define DBUS_TYPE_DOUBLE
Type code marking an 8-byte double in IEEE 754 format.
Definition: dbus-protocol.h:98
DBUS_TYPE_ARRAY
#define DBUS_TYPE_ARRAY
Type code marking a D-Bus array type.
Definition: dbus-protocol.h:120
DBUS_TYPE_INT64
#define DBUS_TYPE_INT64
Type code marking a 64-bit signed integer.
Definition: dbus-protocol.h:90
DBusSignatureRealIter
Implementation details of DBusSignatureIter, all fields are private.
Definition: dbus-signature.c:35
_dbus_first_type_in_signature_c_str
int _dbus_first_type_in_signature_c_str(const char *str, int pos)
Similar to _dbus_first_type_in_signature, but operates on a C string buffer.
Definition: dbus-marshal-basic.c:1431
DBusString
Definition: dbus-string.h:42
dbus_type_is_basic
dbus_bool_t dbus_type_is_basic(int typecode)
A "basic type" is a somewhat arbitrary concept, but the intent is to include those types that are ful...
Definition: dbus-signature.c:318
dbus_bool_t
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition: dbus-types.h:35
_dbus_string_init_const
void _dbus_string_init_const(DBusString *str, const char *value)
Initializes a constant string.
Definition: dbus-string.c:190
dbus_signature_iter_init
void dbus_signature_iter_init(DBusSignatureIter *iter, const char *signature)
Initializes a DBusSignatureIter for reading a type signature.
Definition: dbus-signature.c:67
DBUS_TYPE_INT32_AS_STRING
#define DBUS_TYPE_INT32_AS_STRING
DBUS_TYPE_INT32 as a string literal instead of a int literal
Definition: dbus-protocol.h:84
DBUS_TYPE_VARIANT_AS_STRING
#define DBUS_TYPE_VARIANT_AS_STRING
DBUS_TYPE_VARIANT as a string literal instead of a int literal
Definition: dbus-protocol.h:126
dbus_signature_iter_recurse
void dbus_signature_iter_recurse(const DBusSignatureIter *iter, DBusSignatureIter *subiter)
Initialize a new iterator pointing to the first type in the current container.
Definition: dbus-signature.c:207
DBUS_TYPE_UINT16_AS_STRING
#define DBUS_TYPE_UINT16_AS_STRING
DBUS_TYPE_UINT16 as a string literal instead of a int literal
Definition: dbus-protocol.h:80
DBUS_TYPE_INT32
#define DBUS_TYPE_INT32
Type code marking a 32-bit signed integer.
Definition: dbus-protocol.h:82
DBusSignatureRealIter::finished
unsigned int finished
true if we are at the end iter
Definition: dbus-signature.c:38
DBUS_TYPE_DOUBLE_AS_STRING
#define DBUS_TYPE_DOUBLE_AS_STRING
DBUS_TYPE_DOUBLE as a string literal instead of a int literal
Definition: dbus-protocol.h:100
DBusError
Object representing an exception.
Definition: dbus-errors.h:48
DBUS_TYPE_BYTE_AS_STRING
#define DBUS_TYPE_BYTE_AS_STRING
DBUS_TYPE_BYTE as a string literal instead of a int literal
Definition: dbus-protocol.h:68
DBUS_TYPE_SIGNATURE
#define DBUS_TYPE_SIGNATURE
Type code marking a D-Bus type signature.
Definition: dbus-protocol.h:110
DBUS_TYPE_UINT64
#define DBUS_TYPE_UINT64
Type code marking a 64-bit unsigned integer.
Definition: dbus-protocol.h:94
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
DBUS_TYPE_VARIANT
#define DBUS_TYPE_VARIANT
Type code marking a D-Bus variant type.
Definition: dbus-protocol.h:124
DBUS_TYPE_UINT32
#define DBUS_TYPE_UINT32
Type code marking a 32-bit unsigned integer.
Definition: dbus-protocol.h:86
DBUS_VALID
the data is valid
Definition: dbus-marshal-validate.h:56
_dbus_string_free
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init().
Definition: dbus-string.c:242
TRUE
#define TRUE
Expands to "1".
_dbus_assert_not_reached
#define _dbus_assert_not_reached(explanation)
Aborts with an error message if called.
Definition: dbus-internals.h:145
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
#define DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
DBUS_DICT_ENTRY_BEGIN_CHAR as a string literal instead of a int literal
Definition: dbus-protocol.h:166
DBUS_TYPE_OBJECT_PATH
#define DBUS_TYPE_OBJECT_PATH
Type code marking a D-Bus object path.
Definition: dbus-protocol.h:106
DBUS_TYPE_UNIX_FD
#define DBUS_TYPE_UNIX_FD
Type code marking a unix file descriptor.
Definition: dbus-protocol.h:114
DBUS_TYPE_INT16_AS_STRING
#define DBUS_TYPE_INT16_AS_STRING
DBUS_TYPE_INT16 as a string literal instead of a int literal
Definition: dbus-protocol.h:76
dbus_signature_iter_get_element_type
int dbus_signature_iter_get_element_type(const DBusSignatureIter *iter)
Convenience function for returning the element type of an array; This function allows you to avoid in...
Definition: dbus-signature.c:146
DBUS_TYPE_INVALID
#define DBUS_TYPE_INVALID
Type code that is never equal to a legitimate type code.
Definition: dbus-protocol.h:60
DBUS_ERROR_INVALID_SIGNATURE
#define DBUS_ERROR_INVALID_SIGNATURE
A type signature is not valid.
Definition: dbus-protocol.h:437
DBUS_TYPE_INT16
#define DBUS_TYPE_INT16
Type code marking a 16-bit signed integer.
Definition: dbus-protocol.h:74
DBUS_TYPE_BOOLEAN
#define DBUS_TYPE_BOOLEAN
Type code marking a boolean.
Definition: dbus-protocol.h:70
_dbus_string_append_len
dbus_bool_t _dbus_string_append_len(DBusString *str, const char *buffer, int len)
Appends block of bytes with the given length to a DBusString.
Definition: dbus-string.c:1119
DBUS_STRUCT_END_CHAR_AS_STRING
#define DBUS_STRUCT_END_CHAR_AS_STRING
DBUS_STRUCT_END_CHAR a string literal instead of a int literal
Definition: dbus-protocol.h:162
dbus_signature_validate
dbus_bool_t dbus_signature_validate(const char *signature, DBusError *error)
Check a type signature for validity.
Definition: dbus-signature.c:233
DBUS_TYPE_STRING_AS_STRING
#define DBUS_TYPE_STRING_AS_STRING
DBUS_TYPE_STRING as a string literal instead of a int literal
Definition: dbus-protocol.h:104
FALSE
#define FALSE
Expands to "0".
dbus_signature_validate_single
dbus_bool_t dbus_signature_validate_single(const char *signature, DBusError *error)
Check that a type signature is both valid and contains exactly one complete type. ...
Definition: dbus-signature.c:264
DBUS_DICT_ENTRY_END_CHAR
#define DBUS_DICT_ENTRY_END_CHAR
Code marking the end of a dict entry type in a type signature.
Definition: dbus-protocol.h:168
DBUS_TYPE_BOOLEAN_AS_STRING
#define DBUS_TYPE_BOOLEAN_AS_STRING
DBUS_TYPE_BOOLEAN as a string literal instead of a int literal
Definition: dbus-protocol.h:72
_dbus_string_steal_data
dbus_bool_t _dbus_string_steal_data(DBusString *str, char **data_return)
Like _dbus_string_get_data(), but removes the gotten data from the original string.
Definition: dbus-string.c:624
dbus_signature_iter_get_current_type
int dbus_signature_iter_get_current_type(const DBusSignatureIter *iter)
Returns the current type pointed to by the iterator.
Definition: dbus-signature.c:92
DBusSignatureRealIter::pos
const char * pos
current position in the signature string
Definition: dbus-signature.c:37
_dbus_validate_signature_with_reason
DBusValidity _dbus_validate_signature_with_reason(const DBusString *type_str, int type_pos, int len)
Verifies that the range of type_str from type_pos to type_end is a valid signature.
Definition: dbus-marshal-validate.c:51
DBusSignatureRealIter::in_array
unsigned int in_array
true if we are a subiterator pointing to an array's element type
Definition: dbus-signature.c:39
DBUS_TYPE_DICT_ENTRY_AS_STRING
#define DBUS_TYPE_DICT_ENTRY_AS_STRING
DBUS_TYPE_DICT_ENTRY as a string literal instead of a int literal
Definition: dbus-protocol.h:145
DBUS_TYPE_UINT32_AS_STRING
#define DBUS_TYPE_UINT32_AS_STRING
DBUS_TYPE_UINT32 as a string literal instead of a int literal
Definition: dbus-protocol.h:88
dbus_type_is_valid
dbus_bool_t dbus_type_is_valid(int typecode)
Return TRUE if the argument is a valid typecode.
Definition: dbus-signature.c:383
dbus_signature_iter_get_signature
char * dbus_signature_iter_get_signature(const DBusSignatureIter *iter)
Returns the signature of the single complete type starting at the given iterator. ...
Definition: dbus-signature.c:112
dbus_type_is_container
dbus_bool_t dbus_type_is_container(int typecode)
A "container type" can contain basic types, or nested container types.
Definition: dbus-signature.c:294