The packet Reference Manual

This is the packet Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sat Dec 03 22:47:48 2022 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 packet

Simple binary serialization library.

Author

Frank James <>

License

BSD

Dependency

ieee-floats (system).

Source

packet.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 packet/packet.asd

Source

packet.asd.

Parent Component

packet (system).

ASDF Systems

packet.


3.1.2 packet/package.lisp

Source

packet.asd.

Parent Component

packet (system).

Packages

packet.


3.1.3 packet/utils.lisp

Dependency

package.lisp (file).

Source

packet.asd.

Parent Component

packet (system).

Public Interface

3.1.4 packet/packet.lisp

Dependency

utils.lisp (file).

Source

packet.asd.

Parent Component

packet (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 packet

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Macros

Macro: defenum (name enums)

Define a list of enums

Package

packet.

Source

utils.lisp.

Macro: defflags (name flags &optional documentation)

Macro to define a set of flags

Package

packet.

Source

utils.lisp.

Macro: defpacket (name slots &rest options)

Macro to define the CLOS class and packet type.

SLOTS should be a list of format (SLOT-NAME SLOT-TYPE &rest SLOT-OPTIONS).

SLOT-NAME should be a symbol used for refering to the CLOS class slot.

SLOT-TYPE should be a symbol refering to a previously defined packet type (forward references are forbidden because we need to know the total packet size at definition time).
Use (SLOT-TYPE LENGTH) for arrays.

SLOT-OPTIONS are passed to the corresponding defclass slot specifier.

OPTIONS can contain (:packing PACKING) and (:size SIZE). These are used to
set the packing width and total packet size. If not specified PACKING defaults to *DEFAULT-PACKING*, SIZE defaults to the total size of packet type. If specified, SIZE may not be less than this, but can be more, to allow for unused space at the end of the structure.

All other options are passed to defclass.

Package

packet.

Source

packet.lisp.

Macro: defpacket* (name slots &rest options)

Like DEFPACKET but defines a DEFSTRUCT instead of a DEFCLASS.

Each slot should be of the form (slot-name slot-type &optional initial-value).

Initial value defaults to 0.

Package

packet.

Source

packet.lisp.


5.1.2 Ordinary functions

Function: enum (enum enums)
Package

packet.

Source

utils.lisp.

Function: enum-id (number enums)
Package

packet.

Source

utils.lisp.

Function: enum-p (number enum enums)
Package

packet.

Source

utils.lisp.

Function: flag-p (number flag-name flags)
Package

packet.

Source

utils.lisp.

Function: hd (data)

Hexdump output

Package

packet.

Source

utils.lisp.

Function: list-types ()

List all defined PACKET types.

Package

packet.

Source

packet.lisp.

Function: pack (object type)

Make a packet buffer from the initial object.

Package

packet.

Source

packet.lisp.

Function: pack-flags (flag-names flags)

Combine flags

Package

packet.

Source

utils.lisp.

Function: pad (array len)

Pad array with zeros if its too short

Package

packet.

Source

utils.lisp.

Function: pad* (array &optional width)

Pad to a length multiple of WIDTH

Package

packet.

Source

utils.lisp.

Function: subseq* (sequence start &optional len)

Subsequence with length

Package

packet.

Source

utils.lisp.

Function: type-size (type)

Get the total size in bytes for this type.

Package

packet.

Source

packet.lisp.

Function: unpack (buffer type)

Unpack a buffer into an object. Returns any extra (unused) bytes as the 2nd value

Package

packet.

Source

packet.lisp.

Function: unpack-flags (number flags)

Split the number into its flags.

Package

packet.

Source

utils.lisp.

Function: usb8 (&rest sequences)

Make an (unsigned byte 8) vector from the sequences

Package

packet.

Source

utils.lisp.

Function: usb8* (&rest numbers)

Make an (unsigned-byte 8) vector from the numbers

Package

packet.

Source

utils.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *default-packing*

Default packing boundary.

Package

packet.

Source

packet.lisp.

Special Variable: *type-definitions*

Global table storing type definitions.

Package

packet.

Source

packet.lisp.


5.2.2 Macros

Macro: define-alias (alias name)
Package

packet.

Source

packet.lisp.

Macro: define-type (name ((pobject pbuffer pstart) &body pbody) ((ubuffer ustart) &body ubody) size)
Package

packet.

Source

packet.lisp.


5.2.3 Ordinary functions

Function: %define-alias (alias name)

Define an alias for a type. Allows refering to the same type by a different name.

Package

packet.

Source

packet.lisp.

Function: %define-type (name pack-handler unpack-handler size)

Intern a new type definition.

PACK-HANDLER is a function with lambda-list (object buffer start)
and should encode the object into the buffer starting at offset START.

UNPACK-HANDLE is a function with lambda-list (buffer start)
and should extract information about the desired object starting at offset START. It should return the object.

SIZE is the total number of bytes this object consumes.

Package

packet.

Source

packet.lisp.

Function: bytes (integer size)

Expand an INTEGER into its consituent number of SIZE bytes.

Package

packet.

Source

packet.lisp.

Function: compute-real-slots (slots packing &optional size)

Compute the offsets of each slot. We use this information in the closures generated by DEFPACKET to pack/unpack the object.

Package

packet.

Source

packet.lisp.

Function: get-type (name)

Find the type definition.

Package

packet.

Source

packet.lisp.

Function: merge-bytes (bytes &optional signed)

Convert a list of bytes into a signed/unsigned integer

Package

packet.

Source

packet.lisp.

Function: pack-array (array type buffer start)

Pack an array of object into the buffer.

Package

packet.

Source

packet.lisp.

Function: pack-bytes (bytes buffer start)

Pack a list of bytes into a buffer

Package

packet.

Source

packet.lisp.

Function: pack-object (object slots buffer start)

Pack an OBJECT specified by SLOTS into the BUFFER starting at offset START.

Package

packet.

Source

packet.lisp.

Function: pack-string (string length buffer start)

Pack a string into the buffer.

Package

packet.

Source

packet.lisp.

Function: pack-type (object type buffer start)

Pack an object into the buffer.

Package

packet.

Source

packet.lisp.

Function: pack-wstring (string length buffer start)

Pack a string into the buffer.

Package

packet.

Source

packet.lisp.

Function: round-offset (offset packing)

Round the offset to the nearest packing boundary

Package

packet.

Source

packet.lisp.

Function: type-packer (type)

Get the packing handler for this type.

Package

packet.

Source

packet.lisp.

Function: type-unpacker (type)

Get the unpacking handler for this type.

Package

packet.

Source

packet.lisp.

Function: unpack-array (length type buffer start)

Extract an array of objects from the buffer.

Package

packet.

Source

packet.lisp.

Function: unpack-bytes (buffer start size &optional signed)

Get an integer from the buffer.

Package

packet.

Source

packet.lisp.

Function: unpack-object (object slots buffer start)

Unpack the SLOTS of OBJECT from BUFFER starting at offset START.

Package

packet.

Source

packet.lisp.

Function: unpack-string (length buffer start)

Unpack a string from the buffer.

Package

packet.

Source

packet.lisp.

Function: unpack-type (type buffer start)

Unpack an objcet from the buffer.

Package

packet.

Source

packet.lisp.

Function: unpack-wstring (length buffer start)

Unpack a string from the buffer.

Package

packet.

Source

packet.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %  
B   C   D   E   F   G   H   L   M   P   R   S   T   U  
Index Entry  Section

%
%define-alias: Private ordinary functions
%define-type: Private ordinary functions

B
bytes: Private ordinary functions

C
compute-real-slots: Private ordinary functions

D
defenum: Public macros
defflags: Public macros
define-alias: Private macros
define-type: Private macros
defpacket: Public macros
defpacket*: Public macros

E
enum: Public ordinary functions
enum-id: Public ordinary functions
enum-p: Public ordinary functions

F
flag-p: Public ordinary functions
Function, %define-alias: Private ordinary functions
Function, %define-type: Private ordinary functions
Function, bytes: Private ordinary functions
Function, compute-real-slots: Private ordinary functions
Function, enum: Public ordinary functions
Function, enum-id: Public ordinary functions
Function, enum-p: Public ordinary functions
Function, flag-p: Public ordinary functions
Function, get-type: Private ordinary functions
Function, hd: Public ordinary functions
Function, list-types: Public ordinary functions
Function, merge-bytes: Private ordinary functions
Function, pack: Public ordinary functions
Function, pack-array: Private ordinary functions
Function, pack-bytes: Private ordinary functions
Function, pack-flags: Public ordinary functions
Function, pack-object: Private ordinary functions
Function, pack-string: Private ordinary functions
Function, pack-type: Private ordinary functions
Function, pack-wstring: Private ordinary functions
Function, pad: Public ordinary functions
Function, pad*: Public ordinary functions
Function, round-offset: Private ordinary functions
Function, subseq*: Public ordinary functions
Function, type-packer: Private ordinary functions
Function, type-size: Public ordinary functions
Function, type-unpacker: Private ordinary functions
Function, unpack: Public ordinary functions
Function, unpack-array: Private ordinary functions
Function, unpack-bytes: Private ordinary functions
Function, unpack-flags: Public ordinary functions
Function, unpack-object: Private ordinary functions
Function, unpack-string: Private ordinary functions
Function, unpack-type: Private ordinary functions
Function, unpack-wstring: Private ordinary functions
Function, usb8: Public ordinary functions
Function, usb8*: Public ordinary functions

G
get-type: Private ordinary functions

H
hd: Public ordinary functions

L
list-types: Public ordinary functions

M
Macro, defenum: Public macros
Macro, defflags: Public macros
Macro, define-alias: Private macros
Macro, define-type: Private macros
Macro, defpacket: Public macros
Macro, defpacket*: Public macros
merge-bytes: Private ordinary functions

P
pack: Public ordinary functions
pack-array: Private ordinary functions
pack-bytes: Private ordinary functions
pack-flags: Public ordinary functions
pack-object: Private ordinary functions
pack-string: Private ordinary functions
pack-type: Private ordinary functions
pack-wstring: Private ordinary functions
pad: Public ordinary functions
pad*: Public ordinary functions

R
round-offset: Private ordinary functions

S
subseq*: Public ordinary functions

T
type-packer: Private ordinary functions
type-size: Public ordinary functions
type-unpacker: Private ordinary functions

U
unpack: Public ordinary functions
unpack-array: Private ordinary functions
unpack-bytes: Private ordinary functions
unpack-flags: Public ordinary functions
unpack-object: Private ordinary functions
unpack-string: Private ordinary functions
unpack-type: Private ordinary functions
unpack-wstring: Private ordinary functions
usb8: Public ordinary functions
usb8*: Public ordinary functions