STRUCTS_TYPE_DATA(3)

NAME
STRUCTS_DATA_TYPE, STRUCTS_FIXEDDATA_TYPE - structs types for binary data

LIBRARY
PDEL Library (libpdel, -lpdel)

SYNOPSIS
#include <sys/types.h>
#include <pdel/structs/structs.h>
#include <pdel/structs/type/data.h>
STRUCTS_DATA_TYPE(charset, mtype);
STRUCTS_FIXEDDATA_TYPE(length);
extern const struct structs_type structs_type_data;
extern const struct structs_type structs_type_hexdata;

DESCRIPTION
The STRUCTS_DATA_TYPE() and STRUCTS_FIXEDDATA_TYPE() macros define a structs(3) type (i.e., a struct structs_type) for describing variable and fixed length binary data, respectively.

For STRUCTS_DATA_TYPE(), the described data structure must be a struct structs_data:

        struct structs_data {
    	u_int   length;       /* number of bytes */
    	u_char  *data;        /* bytes */
        };

The length field contains the number of bytes in the sequence. The data itself is pointed to by data. mtype is the typed_mem(3) type used to dynamically allocate the buffer pointed to by data. The ASCII form of the data is a base-64 encoding using the character set specified by charset, or the default charset if charset is NULL. See base64(3) for the definition of a valid character set. As a special case, if charset is the empty string, then a straight hex encoding will be used. This results in a longer but more human readable encoding.

STRUCTS_FIXEDDATA_TYPE() defines a structs type for a binary sequence having fixed length length. The described data structure is an array of length u_char. The ASCII form is a straight hexadecimal encoding.

Two variable length types are predefined. structs_type_data uses the default RFC 2045 character set and structs_type_hexdata uses hexadecimal encoding for the ASCII expression. Both of these types use the typed_mem(3) type STRUCTS_DATA_MEMTYPE, defined in the header file.

SEE ALSO
base64(3), libpdel(3), structs(3), structs_type(3), typed_mem(3)

HISTORY
The PDEL library was developed at Packet Design, LLC. http://www.packetdesign.com/

AUTHORS
Archie Cobbs <archie@packetdesign.com>