Main Page   Modules   Data Structures   File List   Data Fields   Related Pages  

code for loading test message data
[D-BUS internal implementation details]

code for loading up test data for unit tests. More...

Data Structures

struct  SavedLength
 Saved length. More...


Defines

#define SAVE_FOR_UNALIGN(str, boundary)
 Saves the segment to delete in order to unalign the next item. More...

#define PERFORM_UNALIGN(str)
 Deletes the alignment padding. More...


Functions

dbus_bool_t _dbus_message_data_load (DBusString *dest, const DBusString *filename)
 Reads the given filename, which should be in "message description language" (look at some examples), and builds up the message data from it. More...


Detailed Description

code for loading up test data for unit tests.

The code in here is used for unit testing, it loads up message data from a description in a file.


Define Documentation

#define PERFORM_UNALIGN str   
 

Value:

if (unalign)                                                  \
    {                                                           \
      _dbus_string_delete ((str), align_pad_start,              \
                           align_pad_end - align_pad_start);    \
      unalign = FALSE;                                          \
    }
Deletes the alignment padding.

Definition at line 184 of file dbus-message-builder.c.

#define SAVE_FOR_UNALIGN str,
boundary   
 

Value:

int align_pad_start = _dbus_string_get_length (str);                  \
  int align_pad_end = _DBUS_ALIGN_VALUE (align_pad_start, (boundary))
Saves the segment to delete in order to unalign the next item.

Definition at line 179 of file dbus-message-builder.c.


Function Documentation

dbus_bool_t _dbus_message_data_load DBusString   dest,
const DBusString   filename
 

Reads the given filename, which should be in "message description language" (look at some examples), and builds up the message data from it.

The message data may be invalid, or valid.

The parser isn't very strict, it's just a hack for test programs.

The file format is:

   VALID_HEADER <type> normal header; byte order, type, padding, header len, body len, serial
   REQUIRED_FIELDS add required fields with placeholder values
   BIG_ENDIAN switch to big endian
   LITTLE_ENDIAN switch to little endian
   OPPOSITE_ENDIAN switch to opposite endian
   ALIGN <N> aligns to the given value
   UNALIGN skips alignment for the next marshal
   BYTE <N> inserts the given integer in [0,255] or char in 'a' format
   START_LENGTH <name> marks the start of a length to measure
   END_LENGTH <name> records the length since START_LENGTH under the given name
                     (or if no START_LENGTH, absolute length)
   LENGTH <name> inserts the saved length of the same name
   CHOP <N> chops last N bytes off the data
   HEADER_FIELD <fieldname> inserts a header field name byte
   TYPE <typename> inserts a typecode byte 

Following commands insert aligned data unless preceded by "UNALIGN":

   INT32 <N> marshals an INT32
   UINT32 <N> marshals a UINT32
   INT64 <N> marshals an INT64
   UINT64 <N> marshals a UINT64
   DOUBLE <N> marshals a double
   STRING 'Foo' marshals a string
   OBJECT_PATH '/foo/bar' marshals an object path
   BYTE_ARRAY { 'a', 3, 4, 5, 6} marshals a BYTE array
   BOOLEAN_ARRAY { false, true, false} marshals a BOOLEAN array
   INT32_ARRAY { 3, 4, 5, 6} marshals an INT32 array
   UINT32_ARRAY { 3, 4, 5, 6} marshals an UINT32 array
   DOUBLE_ARRAY { 1.0, 2.0, 3.0, 4.0} marshals a DOUBLE array  
   STRING_ARRAY { "foo", "bar", "gazonk"} marshals a STRING array  

Todo:
add support for array types INT32_ARRAY { 3, 4, 5, 6 } and so forth.
Parameters:
dest  the string to append the message data to
filename  the filename to load
Returns:
TRUE on success

Definition at line 577 of file dbus-message-builder.c.

References SavedLength::endian, SavedLength::length, DBusError::message, SavedLength::name, SavedLength::offset, and SavedLength::start.


Generated on Wed Jun 9 05:01:28 2004 for D-BUS by doxygen1.2.15