From 3c9833b57c577d60ee407bd3450056ea0c6b9365 Mon Sep 17 00:00:00 2001 From: pgpickering Date: Thu, 21 Aug 2008 09:12:19 +0000 Subject: [PATCH] added nsedoc documentation for the binlib --- nselib/bin.luadoc | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 nselib/bin.luadoc diff --git a/nselib/bin.luadoc b/nselib/bin.luadoc new file mode 100644 index 000000000..56719604d --- /dev/null +++ b/nselib/bin.luadoc @@ -0,0 +1,49 @@ + +--- The Binary Data Library allows to pack and unpack to and from +-- binary data. Encoding and decoding works by using a format +-- string containing certain operator characters: +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +-- +--
OperatorDescription
Hhex string
Bbit string
xnull byte
zzero-terminated string
pstring preceded by 1-byte integer length
Pstring preceded by 2-byte integer length
astring preceded by 4-byte integer length
Astring
ffloat
ddouble
nLua number
cchar (1-byte integer)
Cbyte = unsigned char (1-byte unsigned integer)
sshort (2-byte integer)
Sunsigned short (2-byte unsigned integer)
iint (4-byte integer)
Iunsigned int (4-byte unsigned integer)
llong (8-byte integer)
Lunsigned long (8-byte unsigned integer)
<little endian modifier
>big endian modifier
=native endian modifier
+-- Note that the endian operators work as modifiers to all the +-- characters following them in the format string. + +module "bin" + + +--- Packs values according to format string. +-- Note: on Windows packing of 64 bit values > 2^63 currently +-- results in packing exactly 2^63. +--@param format Format string, used to pack following arguments +--@return String containing packed data +function bin.pack(format, ...) + + +--- Unpacks values according to format string. +--@param format Format string, used to unpack values out of data string +--@param data String containing packed data +--@param init Optional starting position within the string +--@return First returned value is the position in the data string where unpacking stopped, following returned values are the unpacked values. +function bin.unpack(format, data, init) +