Annotation of embedaddon/libpdel/structs/type/structs_type_data.3, revision 1.1.1.1

1.1       misho       1: .\" Copyright (c) 2001-2002 Packet Design, LLC.
                      2: .\" All rights reserved.
                      3: .\" 
                      4: .\" Subject to the following obligations and disclaimer of warranty,
                      5: .\" use and redistribution of this software, in source or object code
                      6: .\" forms, with or without modifications are expressly permitted by
                      7: .\" Packet Design; provided, however, that:
                      8: .\" 
                      9: .\"    (i)  Any and all reproductions of the source or object code
                     10: .\"         must include the copyright notice above and the following
                     11: .\"         disclaimer of warranties; and
                     12: .\"    (ii) No rights are granted, in any manner or form, to use
                     13: .\"         Packet Design trademarks, including the mark "PACKET DESIGN"
                     14: .\"         on advertising, endorsements, or otherwise except as such
                     15: .\"         appears in the above copyright notice or in the software.
                     16: .\" 
                     17: .\" THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
                     18: .\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
                     19: .\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
                     20: .\" THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
                     21: .\" WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
                     22: .\" OR NON-INFRINGEMENT.  PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
                     23: .\" OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
                     24: .\" OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
                     25: .\" RELIABILITY OR OTHERWISE.  IN NO EVENT SHALL PACKET DESIGN BE
                     26: .\" LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
                     27: .\" OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
                     28: .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
                     29: .\" DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
                     30: .\" USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
                     31: .\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     32: .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
                     33: .\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
                     34: .\" THE POSSIBILITY OF SUCH DAMAGE.
                     35: .\"
                     36: .\" Author: Archie Cobbs <archie@freebsd.org>
                     37: .\"
                     38: .\" $Id: structs_type_data.3,v 1.8 2004/06/02 17:24:38 archie Exp $
                     39: .\"
                     40: .Dd April 22, 2002
                     41: .Dt STRUCTS_TYPE_DATA 3
                     42: .Os
                     43: .Sh NAME
                     44: .Nm STRUCTS_DATA_TYPE ,
                     45: .Nm STRUCTS_FIXEDDATA_TYPE
                     46: .Nd structs types for binary data
                     47: .Sh LIBRARY
                     48: PDEL Library (libpdel, \-lpdel)
                     49: .Sh SYNOPSIS
                     50: .In sys/types.h
                     51: .In pdel/structs/structs.h
                     52: .In pdel/structs/type/data.h
                     53: .Fn STRUCTS_DATA_TYPE charset mtype
                     54: .Fn STRUCTS_FIXEDDATA_TYPE length
                     55: .Vt extern const struct structs_type structs_type_data ;
                     56: .Vt extern const struct structs_type structs_type_hexdata ;
                     57: .Sh DESCRIPTION
                     58: The
                     59: .Fn STRUCTS_DATA_TYPE
                     60: and
                     61: .Fn STRUCTS_FIXEDDATA_TYPE
                     62: macros define a
                     63: .Xr structs 3
                     64: type (i.e., a
                     65: .Dv "struct structs_type" )
                     66: for describing variable and fixed length binary data, respectively.
                     67: .Pp
                     68: For
                     69: .Fn STRUCTS_DATA_TYPE ,
                     70: the described data structure must be a
                     71: .Dv "struct structs_data" :
                     72: .Pp
                     73: .Bd -literal -offset 3n
                     74:     struct structs_data {
                     75:        u_int   length;       /* number of bytes */
                     76:        u_char  *data;        /* bytes */
                     77:     };
                     78: .Ed
                     79: .Pp
                     80: The
                     81: .Fa length
                     82: field contains the number of bytes in the sequence.
                     83: The data itself is pointed to by
                     84: .Fa data .
                     85: .Fa mtype
                     86: is the
                     87: .Xr typed_mem 3
                     88: type used to dynamically allocate the buffer pointed to by
                     89: .Fa data .
                     90: The ASCII form of the data is a base-64 encoding using the character
                     91: set specified by
                     92: .Fa charset ,
                     93: or the default charset if
                     94: .Fa charset
                     95: is
                     96: .Dv NULL .
                     97: See
                     98: .Xr base64 3
                     99: for the definition of a valid character set.
                    100: As a special case, if
                    101: .Fa charset
                    102: is the empty string, then a straight hex encoding will be used.
                    103: This results in a longer but more human readable encoding.
                    104: .Pp
                    105: .Fn STRUCTS_FIXEDDATA_TYPE
                    106: defines a structs type for a binary sequence having fixed length
                    107: .Fa length .
                    108: The described data structure is an array of
                    109: .Fa length
                    110: .Li "u_char" .
                    111: The ASCII form is a straight hexadecimal encoding.
                    112: .Pp
                    113: Two variable length types are predefined.
                    114: .Nm structs_type_data
                    115: uses the default RFC 2045 character set and
                    116: .Nm structs_type_hexdata
                    117: uses hexadecimal encoding for the ASCII expression.
                    118: Both of these types use the
                    119: .Xr typed_mem 3
                    120: type
                    121: .Dv STRUCTS_DATA_MEMTYPE ,
                    122: defined in the header file.
                    123: .Sh SEE ALSO
                    124: .Xr base64 3 ,
                    125: .Xr libpdel 3 ,
                    126: .Xr structs 3 ,
                    127: .Xr structs_type 3 ,
                    128: .Xr typed_mem 3
                    129: .Sh HISTORY
                    130: The PDEL library was developed at Packet Design, LLC.
                    131: .Dv "http://www.packetdesign.com/"
                    132: .Sh AUTHORS
                    133: .An Archie Cobbs Aq archie@freebsd.org

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>