GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
STRUCTS_TYPE_DATA(3) FreeBSD Library Functions Manual STRUCTS_TYPE_DATA(3)

STRUCTS_DATA_TYPE, STRUCTS_FIXEDDATA_TYPE
structs types for binary data

PDEL Library (libpdel, -lpdel)

#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;

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.

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

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

Archie Cobbs ⟨archie@freebsd.org⟩
April 22, 2002 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.