@c -*-texinfo-*-
@c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2002, 2003,
-@c 2004, 2005, 2006 Free Software Foundation, Inc.
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001,
+@c 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
@c See the file elisp.texi for copying conditions.
@setfilename ../info/processes
@node Processes, Display, Abbrevs, Top
@item strz @var{len}
Zero-terminated string, in a fixed-size field with length @var{len}.
-@item vec @var{len}
-Vector of @var{len} bytes.
+@item vec @var{len} [@var{type}]
+Vector of @var{len} elements of type @var{type}, or bytes if not
+@var{type} is specified.
+The @var{type} is any of the simple types above, or another vector
+specified as a list @code{(vec @var{len} [@var{type}])}.
@item ip
Four-byte vector representing an Internet address. For example:
above-listed type specifications.
@end table
-For a fixed-size field, the length @var{len} is given as an
-integer specifying the number of bytes in the field. When the
-length of a field is not fixed, it typically depends on the value of a
-preceding field. In this case, the length can be given either by
-that field's name as specified for @code{bindat-get-field} below, or by
-an expression @code{(eval @var{form})} where @var{form} should
-evaluate to an integer, specifying the field length.
+For a fixed-size field, the length @var{len} is given as an integer
+specifying the number of bytes in the field.
+
+When the length of a field is not fixed, it typically depends on the
+value of a preceding field. In this case, the length @var{len} can be
+given either as a list @code{(@var{name} ...)} identifying a
+@dfn{field name} in the format specified for @code{bindat-get-field}
+below, or by an expression @code{(eval @var{form})} where @var{form}
+should evaluate to an integer, specifying the field length.
A field specification generally has the form @code{([@var{name}]
@var{handler})}. The square braces indicate that @var{name} is
The data as a byte array.
@item bindat-idx
-Current index into bindat-raw of the unpacking or packing operation.
+Current index (within @code{bindat-raw}) for unpacking or packing.
@item struct
The alist containing the structured data that have been unpacked so
struct data @{
unsigned char type;
unsigned char opcode;
- unsigned long length; /* In little endian order */
+ unsigned short length; /* In network byte order */
unsigned char id[8]; /* null-terminated string */
unsigned char data[/* (length + 3) & ~3 */];
@};
struct packet @{
struct header header;
+ unsigned long counters[2]; /* In little endian order */
unsigned char items;
unsigned char filler[3];
struct data item[/* items */];
(setq data-spec
'((type u8)
(opcode u8)
- (length u16r) ;; little endian order
+ (length u16) ;; network byte order
(id strz 8)
(data vec (length))
(align 4)))
(setq packet-spec
'((header struct header-spec)
+ (counters vec 2 u32r) ;; little endian order
(items u8)
(fill 3)
(item repeat (items)
@lisp
(setq binary-data
- [ 192 168 1 100 192 168 1 101 01 28 21 32 2 0 0 0
- 2 3 5 0 ?A ?B ?C ?D ?E ?F 0 0 1 2 3 4 5 0 0 0
- 1 4 7 0 ?B ?C ?D ?E ?F ?G 0 0 6 7 8 9 10 11 12 0 ])
+ [ 192 168 1 100 192 168 1 101 01 28 21 32
+ 160 134 1 0 5 1 0 0 2 0 0 0
+ 2 3 0 5 ?A ?B ?C ?D ?E ?F 0 0 1 2 3 4 5 0 0 0
+ 1 4 0 7 ?B ?C ?D ?E ?F ?G 0 0 6 7 8 9 10 11 12 0 ])
@end lisp
The corresponding decoded structure:
(src-ip . [192 168 1 101])
(dest-port . 284)
(src-port . 5408))
+ (counters . [100000 261])
(items . 2)
(item ((data . [1 2 3 4 5])
(id . "ABCDEF")