2 #define PROTON_CODEC_H 1
PN_EXTERN bool pn_data_next(pn_data_t *data)
Advances the current node to its next sibling and returns true.
PN_EXTERN int pn_data_put_int(pn_data_t *data, int32_t i)
Puts a PN_INT value.
PN_EXTERN pn_bytes_t pn_data_get_string(pn_data_t *data)
If the current node is a string, returns its value, returns "" otherwise.
PN_EXTERN pn_decimal32_t pn_data_get_decimal32(pn_data_t *data)
If the current node is a decimal32, returns its value, returns 0 otherwise.
The binary AMQP type.
Definition: codec.h:144
PN_EXTERN const char * pn_type_name(pn_type_t type)
Return a string name for an AMQP type.
uint16_t as_ushort
Valid when type is PN_USHORT.
Definition: codec.h:218
pn_decimal64_t as_decimal64
Valid when type is PN_DECIMAL64.
Definition: codec.h:273
PN_EXTERN pn_atom_t pn_data_get_atom(pn_data_t *data)
If the current node is a scalar value, return it as a pn_atom_t.
PN_EXTERN int pn_data_put_ubyte(pn_data_t *data, uint8_t ub)
Puts a PN_UBYTE value.
PN_EXTERN pn_timestamp_t pn_data_get_timestamp(pn_data_t *data)
If the current node is a timestamp, returns its value, returns 0 otherwise.
PN_EXTERN int pn_data_errno(pn_data_t *data)
Access the current error code for a given pn_data_t.
uint32_t as_uint
Valid when type is PN_UINT.
Definition: codec.h:228
double as_double
Valid when type is PN_DOUBLE.
Definition: codec.h:263
PN_EXTERN int pn_data_put_string(pn_data_t *data, pn_bytes_t string)
Puts a PN_STRING value.
struct pn_error_t pn_error_t
Definition: error.h:32
PN_EXTERN int pn_data_put_binary(pn_data_t *data, pn_bytes_t bytes)
Puts a PN_BINARY value.
PN_EXTERN float pn_data_get_float(pn_data_t *data)
If the current node is a float, returns its value, raises 0 otherwise.
PN_EXTERN int pn_data_put_decimal128(pn_data_t *data, pn_decimal128_t d)
Puts a PN_DECIMAL128 value.
The timestamp AMQP type.
Definition: codec.h:109
pn_decimal32_t as_decimal32
Valid when type is PN_DECIMAL32.
Definition: codec.h:268
PN_EXTERN int64_t pn_data_get_long(pn_data_t *data)
If the current node is an signed long, returns its value, returns 0 otherwise.
PN_EXTERN int pn_data_put_uint(pn_data_t *data, uint32_t ui)
Puts a PN_UINT value.
PN_EXTERN pn_uuid_t pn_data_get_uuid(pn_data_t *data)
If the current node is a UUID, returns its value, returns None otherwise.
PN_EXTERN bool pn_data_prev(pn_data_t *data)
Moves the current node to its previous sibling and returns true.
PN_EXTERN int8_t pn_data_get_byte(pn_data_t *data)
If the current node is a signed byte, returns its value, returns 0 otherwise.
A descriminated union that holds any scalar AMQP value.
Definition: codec.h:193
The symbol AMQP type.
Definition: codec.h:156
The short AMQP type.
Definition: codec.h:78
uintptr_t pn_handle_t
Definition: object.h:36
int32_t as_int
Valid when type is PN_INT.
Definition: codec.h:233
PN_EXTERN bool pn_data_lookup(pn_data_t *data, const char *name)
PN_EXTERN int pn_data_put_timestamp(pn_data_t *data, pn_timestamp_t t)
Puts a PN_TIMESTAMP value.
PN_EXTERN int pn_data_put_float(pn_data_t *data, float f)
Puts a PN_FLOAT value.
PN_EXTERN void pn_data_dump(pn_data_t *data)
Dumps a debug representation of the internal state of the pn_data_t object that includes its navigati...
The ulong AMQP type.
Definition: codec.h:98
pn_type_t type
Indicates the type of value the atom is currently pointing to.
Definition: codec.h:198
int64_t pn_timestamp_t
Definition: types.h:50
The string AMQP type.
Definition: codec.h:150
struct pn_data_t pn_data_t
An AMQP Data object.
Definition: codec.h:352
PN_EXTERN size_t pn_data_size(pn_data_t *data)
Returns the total number of nodes contained in a pn_data_t object.
pn_decimal128_t as_decimal128
Valid when type is PN_DECIMAL128.
Definition: codec.h:278
PN_EXTERN bool pn_data_get_bool(pn_data_t *data)
If the current node is a PN_BOOL, returns its value.
PN_EXTERN int pn_data_copy(pn_data_t *data, pn_data_t *src)
Copy the contents of another pn_data_t object.
PN_EXTERN int pn_data_appendn(pn_data_t *data, pn_data_t *src, int limit)
Append up to n values from the contents of another pn_data_t object.
PN_EXTERN int pn_data_format(pn_data_t *data, char *bytes, size_t *size)
Formats the contents of a pn_data_t object in a human readable way and writes them to the indicated l...
The double AMQP type.
Definition: codec.h:119
PN_EXTERN size_t pn_data_get_map(pn_data_t *data)
If the current node is a map, return the number of child elements, otherwise return zero...
An AMQP list.
Definition: codec.h:171
The signed int AMQP type.
Definition: codec.h:88
pn_bytes_t as_bytes
Valid when type is PN_BINARY or PN_STRING or PN_SYMBOL.
Definition: codec.h:292
PN_EXTERN int pn_data_put_map(pn_data_t *data)
Puts an empty map value into a pn_data_t.
PN_EXTERN int pn_data_vfill(pn_data_t *data, const char *fmt, va_list ap)
uint32_t pn_decimal32_t
Definition: types.h:52
The boolean AMQP type.
Definition: codec.h:58
PN_EXTERN int pn_data_put_short(pn_data_t *data, int16_t s)
Puts a PN_SHORT value.
pn_uuid_t as_uuid
Valid when type is PN_UUID.
Definition: codec.h:283
An AMQP map.
Definition: codec.h:177
PN_EXTERN double pn_data_get_double(pn_data_t *data)
If the current node is a double, returns its value, returns 0 otherwise.
PN_EXTERN bool pn_data_restore(pn_data_t *data, pn_handle_t point)
Restores a prior navigational state that was saved using pn_data_point().
PN_EXTERN int pn_data_put_byte(pn_data_t *data, int8_t b)
Puts a PN_BYTE value.
#define PN_EXTERN
Definition: import_export.h:53
PN_EXTERN pn_bytes_t pn_data_get_bytes(pn_data_t *data)
If the current node is a symbol, string, or binary, return the bytes representing its value...
PN_EXTERN bool pn_data_is_described(pn_data_t *data)
Checks if the current node is a described value.
The unsigned short AMQP type.
Definition: codec.h:73
PN_EXTERN int pn_data_put_uuid(pn_data_t *data, pn_uuid_t u)
Puts a PN_UUID value.
PN_EXTERN bool pn_data_exit(pn_data_t *data)
Sets the current node to the parent node and the parent node to its own parent.
PN_EXTERN int pn_data_put_symbol(pn_data_t *data, pn_bytes_t symbol)
Puts a PN_SYMBOL value.
PN_EXTERN ssize_t pn_data_encode(pn_data_t *data, char *bytes, size_t size)
Writes the contents of a data object to the given buffer as an AMQP data stream.
PN_EXTERN int pn_data_put_decimal32(pn_data_t *data, pn_decimal32_t d)
Puts a PN_DECIMAL32 value.
The float AMQP type.
Definition: codec.h:114
PN_EXTERN pn_data_t * pn_data(size_t capacity)
Construct a pn_data_t object with the supplied initial capacity.
PN_EXTERN bool pn_data_is_null(pn_data_t *data)
Checks if the current node is a PN_NULL.
PN_EXTERN int pn_data_print(pn_data_t *data)
Prints the contents of a pn_data_t object using pn_data_format() to stdout.
PN_EXTERN pn_decimal64_t pn_data_get_decimal64(pn_data_t *data)
If the current node is a decimal64, returns its value, returns 0 otherwise.
PN_EXTERN pn_bytes_t pn_data_get_symbol(pn_data_t *data)
If the current node is a symbol, returns its value, returns "" otherwise.
The decimal32 AMQP type.
Definition: codec.h:124
The decimal64 AMQP type.
Definition: codec.h:129
PN_EXTERN pn_handle_t pn_data_point(pn_data_t *data)
Returns a handle for the current navigational state of a pn_data_t so that it can be later restored u...
PN_EXTERN int pn_data_append(pn_data_t *data, pn_data_t *src)
Append the contents of another pn_data_t object.
int64_t as_long
Valid when type is PN_LONG.
Definition: codec.h:248
PN_EXTERN void pn_data_clear(pn_data_t *data)
Clears a pn_data_t object.
PN_EXTERN void pn_data_free(pn_data_t *data)
Free a pn_data_t object.
PN_EXTERN pn_type_t pn_data_get_array_type(pn_data_t *data)
Return the array type if the current node points to an array, undefined otherwise.
PN_EXTERN pn_error_t * pn_data_error(pn_data_t *data)
Access the current error for a givn pn_data_t.
PN_EXTERN bool pn_data_is_array_described(pn_data_t *data)
Returns true if the current node points to a described array.
An AMQP array.
Definition: codec.h:166
The unsigned int AMQP type.
Definition: codec.h:83
PN_EXTERN uint8_t pn_data_get_ubyte(pn_data_t *data)
If the current node is a PN_UBYTE, return its value, otherwise return 0.
PN_EXTERN pn_char_t pn_data_get_char(pn_data_t *data)
If the current node is a char, returns its value, returns 0 otherwise.
The long AMQP type.
Definition: codec.h:103
The byte AMQP type.
Definition: codec.h:68
The UUID AMQP type.
Definition: codec.h:139
PN_EXTERN uint16_t pn_data_get_ushort(pn_data_t *data)
If the current node is an unsigned short, returns its value, returns 0 otherwise. ...
PN_EXTERN int pn_data_put_bool(pn_data_t *data, bool b)
Puts a PN_BOOL value.
int8_t as_byte
Valid when type is PN_BYTE.
Definition: codec.h:213
PN_EXTERN uint64_t pn_data_get_ulong(pn_data_t *data)
If the current node is an unsigned long, returns its value, returns 0 otherwise.
PN_EXTERN void pn_data_narrow(pn_data_t *data)
Modify a pn_data_t object to behave as if the current node is the root node of the tree...
PN_EXTERN int pn_data_put_ushort(pn_data_t *data, uint16_t us)
Puts a PN_USHORT value.
PN_EXTERN void pn_data_widen(pn_data_t *data)
Reverse the effect of pn_data_narrow().
PN_EXTERN pn_decimal128_t pn_data_get_decimal128(pn_data_t *data)
If the current node is a decimal128, returns its value, returns 0 otherwise.
uint32_t pn_char_t
Definition: types.h:51
PN_EXTERN int32_t pn_data_get_int(pn_data_t *data)
If the current node is a signed int, returns its value, returns 0 otherwise.
PN_EXTERN int pn_data_put_null(pn_data_t *data)
Puts a PN_NULL value.
PN_EXTERN int pn_data_put_char(pn_data_t *data, pn_char_t c)
Puts a PN_CHAR value.
PN_EXTERN int pn_data_put_double(pn_data_t *data, double d)
Puts a PN_DOUBLE value.
uint64_t as_ulong
Valid when type is PN_ULONG.
Definition: codec.h:243
PN_EXTERN int pn_data_put_long(pn_data_t *data, int64_t l)
Puts a PN_LONG value.
PN_EXTERN int16_t pn_data_get_short(pn_data_t *data)
If the current node is a signed short, returns its value, returns 0 otherwise.
PN_EXTERN int pn_data_put_list(pn_data_t *data)
Puts an empty list value into a pn_data_t.
PN_EXTERN int pn_data_put_described(pn_data_t *data)
Puts a described value into a pn_data_t object.
pn_timestamp_t as_timestamp
Valid when type is PN_TIMESTAMP.
Definition: codec.h:253
uint64_t pn_decimal64_t
Definition: types.h:53
The unsigned byte AMQP type.
Definition: codec.h:63
pn_type_t
Identifies an AMQP type.
Definition: codec.h:48
uint8_t as_ubyte
Valid when type is PN_UBYTE.
Definition: codec.h:208
PN_EXTERN int pn_data_put_ulong(pn_data_t *data, uint64_t ul)
Puts a PN_ULONG value.
PN_EXTERN size_t pn_data_get_list(pn_data_t *data)
If the current node is a list, return the number of elements, otherwise return zero.
int16_t as_short
Valid when type is PN_SHORT.
Definition: codec.h:223
PN_EXTERN ssize_t pn_data_decode(pn_data_t *data, const char *bytes, size_t size)
Decodes a single value from the contents of the AMQP data stream into the current data object...
PN_EXTERN int pn_data_fill(pn_data_t *data, const char *fmt,...)
The decimal128 AMQP type.
Definition: codec.h:134
PN_EXTERN int pn_data_put_decimal64(pn_data_t *data, pn_decimal64_t d)
Puts a PN_DECIMAL64 value.
float as_float
Valid when type is PN_FLOAT.
Definition: codec.h:258
PN_EXTERN void pn_data_rewind(pn_data_t *data)
Clears current node pointer and sets the parent to the root node.
PN_EXTERN bool pn_data_enter(pn_data_t *data)
Sets the parent node to the current node and clears the current node.
PN_EXTERN int pn_data_put_atom(pn_data_t *data, pn_atom_t atom)
Puts any scalar value value.
The char AMQP type.
Definition: codec.h:93
PN_EXTERN int pn_data_scan(pn_data_t *data, const char *fmt,...)
PN_EXTERN int pn_data_vscan(pn_data_t *data, const char *fmt, va_list ap)
PN_EXTERN pn_bytes_t pn_data_get_binary(pn_data_t *data)
If the current node is binary, returns its value, returns "" otherwise.
PN_EXTERN uint32_t pn_data_get_uint(pn_data_t *data)
If the current node is an unsigned int, returns its value, returns 0 otherwise.
PN_EXTERN size_t pn_data_get_array(pn_data_t *data)
PN_EXTERN int pn_data_put_array(pn_data_t *data, bool described, pn_type_t type)
Puts an empty array value into a pn_data_t.
The NULL AMQP type.
Definition: codec.h:53
A described AMQP type.
Definition: codec.h:161
pn_char_t as_char
Valid when type is PN_CHAR.
Definition: codec.h:238
bool as_bool
Valid when type is PN_BOOL.
Definition: codec.h:203
PN_EXTERN pn_type_t pn_data_type(pn_data_t *data)
Access the type of the current node.