The cl-rfc4251 Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-rfc4251 Reference Manual

This is the cl-rfc4251 Reference Manual, version 0.1.0, generated automatically by Declt version 3.0 "Montgomery Scott" on Wed Nov 04 12:40:51 2020 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

cl-rfc4251

cl-rfc4251 is a Common Lisp system, which provides support for parsing RFC 4251 encoded binary data, as described in the Data Type Representations Used in the SSH Protocols section of the document.

Requirements

Installation

Clone the cl-rfc4251 repo in your Quicklisp local-projects directory.

git clone https://github.com/dnaeon/cl-rfc4251.git

Load the system.

CL-USER> (ql:quickload :cl-rfc4251)

Supported Data Types

The following table summarizes the supported data types, that can be decoded or encoded by the respective RFC4251:DECODE and RFC4251:ENCODE generic functions. The RFC 4251 and cl-rfc4251 type columns specify the mapping between the RFC-defined data type name and the keywords used to decode or encode a given value in Common Lisp.

| RFC 4251 | cl-rfc4251 type | Description | |-------------|-----------------|--------------------------------------------------| | byte | :byte | An arbitrary 8-bit value (octet) | | byte[n] | :raw-bytes | A sequence of raw bytes up to a given length | | boolean | :boolean | A boolean value | | uint32 | :uint32 | Unsigned 32-bit integer in big-endian byte order | | uint64 | :uint64 | Unsigned 64-bit integer in big-endian byte order | | string | :string | Arbitrary length string | | mpint | :mpint | Multiple precision integer | | name-list | :name-list | A string of comma-separated names |

In addition to the above data types the cl-rfc4251 system supports encoding and decoding of these types as well. Note, that these are not mentioned in RFC 4251.

| cl-rfc4251 type | Description | |-----------------|-------------------------------------------------------| | :uint16-be | Unsigned 16-bit integer in big-endian byte order | | :uint16-le | Unsigned 16-bit integer in little-endian byte order | | :uint32-le | Unsigned 32-bit integer in little-endian byte order | | :uint64-le | Unsigned 64-bit integer in little-endian byte order | | :c-string | NULL-terminated C string | | :buffer | A buffer similar to :string, but contains raw bytes |

Usage

The following section provides various examples showing how to encode and decode values using the cl-rfc4251 system.

For additional examples, make sure to check the test suite.

Decoding

The cl-rfc4251 system exports the generic functions DECODE and ENCODE via the CL-RFC4251 (also available via its nickname RFC4251) package.

The RFC4251:DECODE function takes a type and a binary stream from which to decode. Some types also take additional keyword parameters (e.g. :raw-bytes), which allow to specify the number of bytes to be decoded.

In all of the examples that follow below s represents a binary stream. You can also use the RFC4251:MAKE-BINARY-INPUT-STREAM function to create a binary stream, which uses a vector for the underlying data.

RFC4251:DECODE returns multiple values -- the actual decoded value, and the number of bytes that were read from the binary stream in order to produce the value.

Decode raw bytes with a given length from the binary stream s.

CL-USER> (rfc4251:decode :raw-bytes s :length 4)
#(0 0 0 8)
4

The second value in above example indicates the actual bytes that were read from the binary stream.

This example decodes a 16-bit unsigned integer represented in big-endian byte order from a given binary stream s.

CL-USER> (let ((s (rfc4251:make-binary-input-stream #(0 #x80))))
           (rfc4251:decode :uint16 s))
128
2

The following example decodes a multiple precision integer represented in two's complement format from the binary stream s.

CL-USER> (let ((s (rfc4251:make-binary-input-stream #(#x00 #x00 #x00 #x05 #xFF #x21 #x52 #x41 #x11))))
           (rfc4251:decode :mpint s))
-3735928559
9

The second value in the example above, which specifies the number of bytes being read is 9, because we had to read one uint32 value (the header) and additional 5 bytes (the value partition).

A bytes buffer is similar to a :string, except that the bytes are not explicitely converted to a string value, but instead the result contains the raw bytes.

CL-USER> (let ((s (rfc4251:make-binary-input-stream #(#x00 #x00 #x00 #x04 #x0A #x0B #x0C #x0D))))
           (rfc4251:decode :buffer s))
#(10 11 12 13)
8

Encoding

The RFC4251:ENCODE generic function is used to encode data. The function returns the total number of bytes written to the binary stream.

You can also use the RFC4251:MAKE-BINARY-OUTPUT-STREAM function to create a binary stream, if needed.

The following example encodes an unsigned 16-bit integer value.

CL-USER> (defparameter *s* (rfc4251:make-binary-output-stream))
*S*
CL-USER> (rfc4251:encode :uint16 42 *s*)
2
CL-USER> (rfc4251:binary-output-stream-data *s*)
#(0 42)

Note in the second expression the number of bytes that were written.

Above example, can be written this way as well, if you only care about the actual encoded bytes.

CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
           (rfc4251:encode :uint16 42 s)          ;; <- Encode the value into the stream
           (rfc4251:binary-output-stream-data s)) ;; <- Return the contents of the stream
#(0 42)

The following example encodes a string value.

CL-USER> (defparameter *s* (rfc4251:make-binary-output-stream))
*S*
CL-USER> (rfc4251:encode :string "Hello, World!" *s*)
17
CL-USER> (rfc4251:binary-output-stream-data *s*)
#(0 0 0 13 72 101 108 108 111 44 32 87 111 114 108 100 33)

The result from the second expression here is 17, which includes the 4 (uint32) bytes required for the header (representing the bytes that follow), plus the additional 13 bytes representing the actual string data.

The following examples show how to encode mpint values according to RFC 4251.

CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
           (rfc4251:encode :mpint #x00 s)         ;; <- Encode the zero value
           (rfc4251:binary-output-stream-data s)) ;; <- Get the encoded data
#(0 0 0 0)

Here are a few more examples taken directly from the examples described in RFC 4251.

CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
           (rfc4251:encode :mpint #x-DEADBEEF s)
           (rfc4251:binary-output-stream-data s))
#(0 0 0 5 255 33 82 65 17)
CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
           (rfc4251:encode :mpint #x80 s)
           (rfc4251:binary-output-stream-data s))
#(0 0 0 2 0 128)
CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
           (rfc4251:encode :mpint #x9A378F9B2E332A7 s)
           (rfc4251:binary-output-stream-data s))
#(0 0 0 8 9 163 120 249 178 227 50 167)
CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
           (rfc4251:encode :mpint #x-1234 s)
           (rfc4251:binary-output-stream-data s))
#(0 0 0 2 237 204)

Encoding a bytes buffer. A bytes buffer is preceeded by its length, similar to the way :string values are being encoded.

CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
           (rfc4251:encode :buffer #(#x0A #x0B #x0C #x0D) s)
           (rfc4251:binary-output-stream-data s))
#(0 0 0 4 10 11 12 13)

Tests

Tests are provided as part of the cl-rfc4251.test system.

In order to run the tests you can evaluate the following expressions.

CL-USER> (ql:quickload :cl-rfc4251.test)
CL-USER> (asdf:test-system :cl-rfc4251.test)

Or you can run the tests in a Docker container instead.

First, build the Docker image.

docker build -t cl-rfc4251 .

Run the tests.

docker run --rm cl-rfc4251

Contributing

cl-rfc4251 is hosted on Github. Please contribute by reporting issues, suggesting features or by sending patches using pull requests.

Authors

License

This project is Open Source and licensed under the BSD License.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 cl-rfc4251

Long Name

cl-rfc4251

Maintainer

Marin Atanasov Nikolov <dnaeon@gmail.com>

Author

Marin Atanasov Nikolov <dnaeon@gmail.com>

Home Page

https://github.com/dnaeon/cl-rfc4251

Source Control

https://github.com/dnaeon/cl-rfc4251

Bug Tracker

https://github.com/dnaeon/cl-rfc4251

License

BSD 2-Clause

Description

Common Lisp library for encoding and decoding data in RFC 4251 compliant format

Long Description

## cl-rfc4251

‘cl-rfc4251‘ is a Common Lisp system, which provides support for
parsing [RFC 4251][RFC 4251] encoded binary
data, as described in the [Data Type Representations Used in the SSH Protocols](https://tools.ietf.org/html/rfc4251#section-5) section of
the document.

## Requirements

* [Quicklisp][Quicklisp]

## Installation

Clone the [cl-rfc4251][cl-rfc4251] repo in
your [Quicklisp local-projects
directory][Quicklisp FAQ].

“‘ shell
git clone https://github.com/dnaeon/cl-rfc4251.git
“‘

Load the system.

“‘ shell
CL-USER> (ql:quickload :cl-rfc4251)
“‘

## Supported Data Types

The following table summarizes the supported data types, that can be
decoded or encoded by the respective ‘RFC4251:DECODE‘ and
‘RFC4251:ENCODE‘ generic functions. The ‘RFC 4251‘ and ‘cl-rfc4251
type‘ columns specify the mapping between the RFC-defined data type
name and the keywords used to decode or encode a given value in Common
Lisp.

| RFC 4251 | cl-rfc4251 type | Description | |————-|—————–|————————————————–|
| ‘byte‘ | ‘:byte‘ | An arbitrary 8-bit value (octet) |
| ‘byte[n]‘ | ‘:raw-bytes‘ | A sequence of raw bytes up to a given length |
| ‘boolean‘ | ‘:boolean‘ | A boolean value |
| ‘uint32‘ | ‘:uint32‘ | Unsigned 32-bit integer in big-endian byte order |
| ‘uint64‘ | ‘:uint64‘ | Unsigned 64-bit integer in big-endian byte order |
| ‘string‘ | ‘:string‘ | Arbitrary length string |
| ‘mpint‘ | ‘:mpint‘ | Multiple precision integer |
| ‘name-list‘ | ‘:name-list‘ | A string of comma-separated names |

In addition to the above data types the ‘cl-rfc4251‘ system supports
encoding and decoding of these types as well. Note, that these are not
mentioned in RFC 4251.

| cl-rfc4251 type | Description | |—————–|——————————————————-|
| ‘:uint16-be‘ | Unsigned 16-bit integer in big-endian byte order |
| ‘:uint16-le‘ | Unsigned 16-bit integer in little-endian byte order |
| ‘:uint32-le‘ | Unsigned 32-bit integer in little-endian byte order |
| ‘:uint64-le‘ | Unsigned 64-bit integer in little-endian byte order |
| ‘:c-string‘ | NULL-terminated C string |
| ‘:buffer‘ | A buffer similar to ‘:string‘, but contains raw bytes |

## Usage

The following section provides various examples showing how to encode
and decode values using the ‘cl-rfc4251‘ system.

For additional examples, make sure to check the [test
suite](./t/test-suite.lisp).

### Decoding

The ‘cl-rfc4251‘ system exports the generic functions ‘DECODE‘ and
‘ENCODE‘ via the ‘CL-RFC4251‘ (also available via its nickname
‘RFC4251‘) package.

The ‘RFC4251:DECODE‘ function takes a *type* and a *binary stream*
from which to decode. Some types also take additional keyword
parameters (e.g. ‘:raw-bytes‘), which allow to specify the number of
bytes to be decoded.

In all of the examples that follow below ‘s‘ represents a binary
stream. You can also use the ‘RFC4251:MAKE-BINARY-INPUT-STREAM‘
function to create a binary stream, which uses a vector for the
underlying data.

‘RFC4251:DECODE‘ returns multiple values – the actual decoded value,
and the number of bytes that were read from the binary stream in order
to produce the value.

Decode raw bytes with a given length from the binary stream ‘s‘.

“‘ common-lisp
CL-USER> (rfc4251:decode :raw-bytes s :length 4)
#(0 0 0 8)
4
“‘

The second value in above example indicates the actual bytes that were
read from the binary stream.

This example decodes a 16-bit unsigned integer represented in
big-endian byte order from a given binary stream ‘s‘.

“‘ common-lisp
CL-USER> (let ((s (rfc4251:make-binary-input-stream #(0 #x80))))
(rfc4251:decode :uint16 s))
128
2
“‘

The following example decodes a multiple precision integer represented
in two’s complement format from the binary stream ‘s‘.

“‘ common-lisp
CL-USER> (let ((s (rfc4251:make-binary-input-stream #(#x00 #x00 #x00 #x05 #xFF #x21 #x52 #x41 #x11)))) (rfc4251:decode :mpint s))
-3735928559
9
“‘

The second value in the example above, which specifies the number of
bytes being read is ‘9‘, because we had to read one ‘uint32‘ value
(the header) and additional ‘5‘ bytes (the value partition).

A bytes buffer is similar to a ‘:string‘, except that the bytes are
not explicitely converted to a string value, but instead the result
contains the raw bytes.

“‘ common-lisp
CL-USER> (let ((s (rfc4251:make-binary-input-stream #(#x00 #x00 #x00 #x04 #x0A #x0B #x0C #x0D)))) (rfc4251:decode :buffer s))
#(10 11 12 13)
8
“‘

### Encoding

The ‘RFC4251:ENCODE‘ generic function is used to encode data. The
function returns the total number of bytes written to the binary
stream.

You can also use the ‘RFC4251:MAKE-BINARY-OUTPUT-STREAM‘ function to
create a binary stream, if needed.

The following example encodes an unsigned 16-bit integer value.

“‘ common-lisp
CL-USER> (defparameter *s* (rfc4251:make-binary-output-stream))
*S*
CL-USER> (rfc4251:encode :uint16 42 *s*)
2
CL-USER> (rfc4251:binary-output-stream-data *s*)
#(0 42)
“‘

Note in the second expression the number of bytes that were written.

Above example, can be written this way as well, if you only care about
the actual encoded bytes.

“‘ common-lisp
CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
(rfc4251:encode :uint16 42 s) ;; <- Encode the value into the stream (rfc4251:binary-output-stream-data s)) ;; <- Return the contents of the stream
#(0 42)
“‘

The following example encodes a string value.

“‘ common-lisp
CL-USER> (defparameter *s* (rfc4251:make-binary-output-stream))
*S*
CL-USER> (rfc4251:encode :string "Hello, World!" *s*)
17
CL-USER> (rfc4251:binary-output-stream-data *s*)
#(0 0 0 13 72 101 108 108 111 44 32 87 111 114 108 100 33)
“‘

The result from the second expression here is ‘17‘, which includes the
‘4‘ (uint32) bytes required for the header (representing the bytes that follow),
plus the additional ‘13‘ bytes representing the actual string data.

The following examples show how to encode ‘mpint‘ values according to
[RFC 4251][RFC 4251].

“‘ common-lisp
CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
(rfc4251:encode :mpint #x00 s) ;; <- Encode the zero value (rfc4251:binary-output-stream-data s)) ;; <- Get the encoded data
#(0 0 0 0)
“‘

Here are a few more examples taken directly from the examples described in
[RFC 4251][RFC 4251].

“‘ common-lisp
CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
(rfc4251:encode :mpint #x-DEADBEEF s)
(rfc4251:binary-output-stream-data s))
#(0 0 0 5 255 33 82 65 17)
CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
(rfc4251:encode :mpint #x80 s)
(rfc4251:binary-output-stream-data s))
#(0 0 0 2 0 128)
CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
(rfc4251:encode :mpint #x9A378F9B2E332A7 s)
(rfc4251:binary-output-stream-data s))
#(0 0 0 8 9 163 120 249 178 227 50 167)
CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
(rfc4251:encode :mpint #x-1234 s)
(rfc4251:binary-output-stream-data s))
#(0 0 0 2 237 204)
“‘

Encoding a bytes buffer. A bytes buffer is preceeded by its length,
similar to the way ‘:string‘ values are being encoded.

“‘ common-lisp
CL-USER> (let ((s (rfc4251:make-binary-output-stream)))
(rfc4251:encode :buffer #(#x0A #x0B #x0C #x0D) s)
(rfc4251:binary-output-stream-data s))
#(0 0 0 4 10 11 12 13)
“‘

## Tests

Tests are provided as part of the ‘cl-rfc4251.test‘ system.

In order to run the tests you can evaluate the following expressions.

“‘ common-lisp
CL-USER> (ql:quickload :cl-rfc4251.test)
CL-USER> (asdf:test-system :cl-rfc4251.test)
“‘

Or you can run the tests in a Docker container instead.

First, build the Docker image.

“‘ shell
docker build -t cl-rfc4251 .
“‘

Run the tests.

“‘ shell
docker run –rm cl-rfc4251
“‘

## Contributing

‘cl-rfc4251‘ is hosted on
[Github](https://github.com/dnaeon/cl-rfc4251). Please contribute by
reporting issues, suggesting features or by sending patches using pull
requests.

## Authors

* Marin Atanasov Nikolov (dnaeon@gmail.com)

## License

This project is Open Source and licensed under the [BSD License](http://opensource.org/licenses/BSD-2-Clause).

[RFC 4251]: https://tools.ietf.org/html/rfc4251
[Quicklisp]: https://www.quicklisp.org/beta/
[Quicklisp FAQ]: https://www.quicklisp.org/beta/faq.html
[cl-rfc4251]: https://github.com/dnaeon/cl-rfc4251

Version

0.1.0

Dependencies
Source

cl-rfc4251.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

Modules are listed depth-first from the system components tree.


Next: , Previous: , Up: Modules   [Contents][Index]

3.1 cl-rfc4251/util

Parent

cl-rfc4251 (system)

Location

src/

Component

util.lisp (file)


Next: , Previous: , Up: Modules   [Contents][Index]

3.2 cl-rfc4251/core

Dependency

util (module)

Parent

cl-rfc4251 (system)

Location

src/

Components

Previous: , Up: Modules   [Contents][Index]

3.3 cl-rfc4251/client-package

Dependency

core (module)

Parent

cl-rfc4251 (system)

Location

src/

Component

package.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

4 Files

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


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 cl-rfc4251.asd

Location

cl-rfc4251.asd

Systems

cl-rfc4251 (system)

Packages

cl-rfc4251-system


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.2 cl-rfc4251/util/util.lisp

Parent

util (module)

Location

src/util.lisp

Packages

cl-rfc4251.util

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.3 cl-rfc4251/core/decoder.lisp

Parent

core (module)

Location

src/decoder.lisp

Packages

cl-rfc4251.decoder

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.4 cl-rfc4251/core/encoder.lisp

Parent

core (module)

Location

src/encoder.lisp

Packages

cl-rfc4251.encoder

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.5 cl-rfc4251/core/stream.lisp

Parent

core (module)

Location

src/stream.lisp

Packages

cl-rfc4251.stream

Exported Definitions

Previous: , Up: Lisp files   [Contents][Index]

4.1.6 cl-rfc4251/client-package/package.lisp

Parent

client-package (module)

Location

src/package.lisp

Packages

cl-rfc4251


Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

5.1 cl-rfc4251-system

Source

cl-rfc4251.asd

Use List

Next: , Previous: , Up: Packages   [Contents][Index]

5.2 cl-rfc4251.util

Source

util.lisp (file)

Nickname

rfc4251.util

Use List

common-lisp

Exported Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.3 cl-rfc4251.decoder

Source

decoder.lisp (file)

Nickname

rfc4251.decoder

Use List

common-lisp

Exported Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.4 cl-rfc4251.encoder

Source

encoder.lisp (file)

Nickname

rfc4251.encoder

Use List

common-lisp

Exported Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.5 cl-rfc4251.stream

Source

stream.lisp (file)

Nickname

rfc4251.stream

Use List

common-lisp

Exported Definitions

Previous: , Up: Packages   [Contents][Index]

5.6 cl-rfc4251

Source

package.lisp (file)

Nickname

rfc4251

Use List

common-lisp


Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

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


Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Functions

Function: decode-int-be BYTES

Decode a vector of bytes into an integer, using big-endian byte order

Package

cl-rfc4251.util

Source

util.lisp (file)

Function: decode-int-le BYTES

Decode a vector of bytes into integer, using litte-endian byte order

Package

cl-rfc4251.util

Source

util.lisp (file)

Function: encode-int-be VALUE &key ADD-SIGN MIN-BYTES

Encode the given value as bytes in big-endian byte order

Package

cl-rfc4251.util

Source

util.lisp (file)

Function: encode-int-le VALUE &key ADD-SIGN MIN-BYTES

Convert an integer value to a vector of bytes in little-endian byte order

Package

cl-rfc4251.util

Source

util.lisp (file)

Function: make-binary-input-stream DATA &key START END

Creates a new instance of BINARY-INPUT-STREAM class

Package

cl-rfc4251.stream

Source

stream.lisp (file)

Function: make-binary-output-stream ()

Creates a new instance of BINARY-OUTPUT-STREAM

Package

cl-rfc4251.stream

Source

stream.lisp (file)

Function: twos-complement N N-BITS

Returns the two’s complement of the given number

Package

cl-rfc4251.util

Source

util.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Generic functions

Generic Function: binary-input-stream-data OBJECT
Package

cl-rfc4251.stream

Methods
Method: binary-input-stream-data (BINARY-INPUT-STREAM binary-input-stream)

A vector providing the underlying data

Source

stream.lisp (file)

Generic Function: binary-input-stream-end OBJECT
Package

cl-rfc4251.stream

Methods
Method: binary-input-stream-end (BINARY-INPUT-STREAM binary-input-stream)

End marker up to which bytes are to be read

Source

stream.lisp (file)

Generic Function: binary-input-stream-index OBJECT
Package

cl-rfc4251.stream

Methods
Method: binary-input-stream-index (BINARY-INPUT-STREAM binary-input-stream)

Current index position in the data

Source

stream.lisp (file)

Generic Function: binary-output-stream-data OBJECT
Generic Function: (setf binary-output-stream-data) NEW-VALUE OBJECT
Package

cl-rfc4251.stream

Methods
Method: binary-output-stream-data (BINARY-OUTPUT-STREAM binary-output-stream)
Method: (setf binary-output-stream-data) NEW-VALUE (BINARY-OUTPUT-STREAM binary-output-stream)

The underlying vector to which data is written

Source

stream.lisp (file)

Generic Function: decode TYPE STREAM &key LENGTH

Decode a value with the given type from the binary
stream. Returns multiple values – the decoded value and the number of bytes that were actually read to produce the value.

Package

cl-rfc4251.decoder

Source

decoder.lisp (file)

Methods
Method: decode (TYPE (eql buffer)) STREAM &key

Decode a bytes buffer from the given stream

Method: decode (TYPE (eql c-string)) STREAM &key

Decode a NULL-terminated C string from the given stream

Method: decode (TYPE (eql name-list)) STREAM &key

Decode a comma-separated list of names from the given binary stream

Method: decode (TYPE (eql mpint)) STREAM &key

Decode a multiple precision integer in two’s complement format

Method: decode (TYPE (eql string)) STREAM &key

Decode a string value from the given binary stream

Method: decode (TYPE (eql uint64)) STREAM &key

Synonym for :uint64-be

Method: decode (TYPE (eql uint64-le)) STREAM &key

Decode 64-bit unsigned integer using little-endian byte order

Method: decode (TYPE (eql uint64-be)) STREAM &key

Decode 64-bit unsigned integer using big-endian byte order

Method: decode (TYPE (eql uint32)) STREAM &key

Synonym for :uint32-be

Method: decode (TYPE (eql uint32-le)) STREAM &key

Decode 32-bit unsigned integer using little-endian byte order

Method: decode (TYPE (eql uint32-be)) STREAM &key

Decode 32-bit unsigned integer using big-endian byte order

Method: decode (TYPE (eql uint16)) STREAM &key

Synonym for :uint16-be

Method: decode (TYPE (eql uint16-le)) STREAM &key

Decode 16-bit unsigned integer using little-endian byte order

Method: decode (TYPE (eql uint16-be)) STREAM &key

Decode 16-bit unsigned integer using big-endian byte order

Method: decode (TYPE (eql boolean)) STREAM &key

Decode a boolean value from the given binary stream

Method: decode (TYPE (eql byte)) STREAM &key

Decode a single byte (octet) from the given binary stream

Method: decode (TYPE (eql raw-bytes)) STREAM &key LENGTH

Read up to the given length of raw bytes from the stream

Generic Function: encode TYPE VALUE STREAM &key LENGTH

Encodes the value of the given type into the binary stream. Returns the number of bytes that were written to the stream.

Package

cl-rfc4251.encoder

Source

encoder.lisp (file)

Methods
Method: encode (TYPE (eql buffer)) VALUE STREAM &key

Encode a bytes buffer into the given stream

Method: encode (TYPE (eql c-string)) VALUE STREAM &key

Encode a NULL-terminated C string into the binary stream

Method: encode (TYPE (eql name-list)) VALUE STREAM &key

Encode a list of strings into the binary stream

Method: encode (TYPE (eql mpint)) VALUE STREAM &key

Encode the given multiple precision integer value into the binary stream

Method: encode (TYPE (eql string)) VALUE STREAM &key

Encode a string value into the given binary stream

Method: encode (TYPE (eql uint64)) VALUE STREAM &key

Synonym for :uint64-be

Method: encode (TYPE (eql uint64-le)) VALUE STREAM &key

Encode an unsigned 64-bit integer in little-endian byte order

Method: encode (TYPE (eql uint64-be)) VALUE STREAM &key

Encode an unsigned 64-bit integer in big-endian byte order

Method: encode (TYPE (eql uint32)) VALUE STREAM &key

Synonym for :uint32-be

Method: encode (TYPE (eql uint32-le)) VALUE STREAM &key

Encode an unsigned 32-bit integer in little-endian byte order

Method: encode (TYPE (eql uint32-be)) VALUE STREAM &key

Encode an unsigned 32-bit integer in big-endian byte order

Method: encode (TYPE (eql uint16)) VALUE STREAM &key

Synonym for :uint16-be

Method: encode (TYPE (eql uint16-le)) VALUE STREAM &key

Encode an unsigned 16-bit integer in little-endian byte order

Method: encode (TYPE (eql uint16-be)) VALUE STREAM &key

Encode an unsigned 16-bit integer in big-endian byte order

Method: encode (TYPE (eql boolean)) VALUE STREAM &key
Method: encode (TYPE (eql raw-bytes)) BYTES-VECTOR STREAM &key LENGTH
Method: encode (TYPE (eql byte)) VALUE STREAM &key

Encodes a raw byte into the given binary stream

Generic Function: get-binary-stream-bytes STREAM

Returns the underlying bytes for a binary stream

Package

cl-rfc4251.stream

Source

stream.lisp (file)

Methods
Method: get-binary-stream-bytes (S binary-output-stream)
Method: get-binary-stream-bytes (S binary-input-stream)

Previous: , Up: Exported definitions   [Contents][Index]

6.1.3 Classes

Class: binary-input-stream ()

Binary input stream class using a vector as the underlying data

Package

cl-rfc4251.stream

Source

stream.lisp (file)

Direct superclasses

fundamental-binary-input-stream (class)

Direct methods
Direct slots
Slot: data

A vector providing the underlying data

Initargs

:data

Initform

(error "must provide vector data")

Readers

binary-input-stream-data (generic function)

Slot: index

Current index position in the data

Initargs

:index

Initform

0

Readers

binary-input-stream-index (generic function)

Slot: end

End marker up to which bytes are to be read

Initargs

:end

Readers

binary-input-stream-end (generic function)

Class: binary-output-stream ()

Binary output stream class using a vector for the underlying data

Package

cl-rfc4251.stream

Source

stream.lisp (file)

Direct superclasses

fundamental-binary-output-stream (class)

Direct methods
Direct slots
Slot: data

The underlying vector to which data is written

Initargs

:data

Initform

(make-array 0 :element-type (quote (unsigned-byte 8)) :adjustable t :fill-pointer 0)

Readers

binary-output-stream-data (generic function)

Writers

(setf binary-output-stream-data) (generic function)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L   M  
Index Entry  Section

C
cl-rfc4251.asd: The cl-rfc4251․asd file
cl-rfc4251/client-package: The cl-rfc4251/client-package module
cl-rfc4251/client-package/package.lisp: The cl-rfc4251/client-package/package․lisp file
cl-rfc4251/core: The cl-rfc4251/core module
cl-rfc4251/core/decoder.lisp: The cl-rfc4251/core/decoder․lisp file
cl-rfc4251/core/encoder.lisp: The cl-rfc4251/core/encoder․lisp file
cl-rfc4251/core/stream.lisp: The cl-rfc4251/core/stream․lisp file
cl-rfc4251/util: The cl-rfc4251/util module
cl-rfc4251/util/util.lisp: The cl-rfc4251/util/util․lisp file

F
File, Lisp, cl-rfc4251.asd: The cl-rfc4251․asd file
File, Lisp, cl-rfc4251/client-package/package.lisp: The cl-rfc4251/client-package/package․lisp file
File, Lisp, cl-rfc4251/core/decoder.lisp: The cl-rfc4251/core/decoder․lisp file
File, Lisp, cl-rfc4251/core/encoder.lisp: The cl-rfc4251/core/encoder․lisp file
File, Lisp, cl-rfc4251/core/stream.lisp: The cl-rfc4251/core/stream․lisp file
File, Lisp, cl-rfc4251/util/util.lisp: The cl-rfc4251/util/util․lisp file

L
Lisp File, cl-rfc4251.asd: The cl-rfc4251․asd file
Lisp File, cl-rfc4251/client-package/package.lisp: The cl-rfc4251/client-package/package․lisp file
Lisp File, cl-rfc4251/core/decoder.lisp: The cl-rfc4251/core/decoder․lisp file
Lisp File, cl-rfc4251/core/encoder.lisp: The cl-rfc4251/core/encoder․lisp file
Lisp File, cl-rfc4251/core/stream.lisp: The cl-rfc4251/core/stream․lisp file
Lisp File, cl-rfc4251/util/util.lisp: The cl-rfc4251/util/util․lisp file

M
Module, cl-rfc4251/client-package: The cl-rfc4251/client-package module
Module, cl-rfc4251/core: The cl-rfc4251/core module
Module, cl-rfc4251/util: The cl-rfc4251/util module

Jump to:   C   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
B   D   E   F   G   M   T  
Index Entry  Section

(
(setf binary-output-stream-data): Exported generic functions
(setf binary-output-stream-data): Exported generic functions

B
binary-input-stream-data: Exported generic functions
binary-input-stream-data: Exported generic functions
binary-input-stream-end: Exported generic functions
binary-input-stream-end: Exported generic functions
binary-input-stream-index: Exported generic functions
binary-input-stream-index: Exported generic functions
binary-output-stream-data: Exported generic functions
binary-output-stream-data: Exported generic functions

D
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode: Exported generic functions
decode-int-be: Exported functions
decode-int-le: Exported functions

E
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode: Exported generic functions
encode-int-be: Exported functions
encode-int-le: Exported functions

F
Function, decode-int-be: Exported functions
Function, decode-int-le: Exported functions
Function, encode-int-be: Exported functions
Function, encode-int-le: Exported functions
Function, make-binary-input-stream: Exported functions
Function, make-binary-output-stream: Exported functions
Function, twos-complement: Exported functions

G
Generic Function, (setf binary-output-stream-data): Exported generic functions
Generic Function, binary-input-stream-data: Exported generic functions
Generic Function, binary-input-stream-end: Exported generic functions
Generic Function, binary-input-stream-index: Exported generic functions
Generic Function, binary-output-stream-data: Exported generic functions
Generic Function, decode: Exported generic functions
Generic Function, encode: Exported generic functions
Generic Function, get-binary-stream-bytes: Exported generic functions
get-binary-stream-bytes: Exported generic functions
get-binary-stream-bytes: Exported generic functions
get-binary-stream-bytes: Exported generic functions

M
make-binary-input-stream: Exported functions
make-binary-output-stream: Exported functions
Method, (setf binary-output-stream-data): Exported generic functions
Method, binary-input-stream-data: Exported generic functions
Method, binary-input-stream-end: Exported generic functions
Method, binary-input-stream-index: Exported generic functions
Method, binary-output-stream-data: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, decode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, encode: Exported generic functions
Method, get-binary-stream-bytes: Exported generic functions
Method, get-binary-stream-bytes: Exported generic functions

T
twos-complement: Exported functions

Jump to:   (  
B   D   E   F   G   M   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   D   E   I   S  
Index Entry  Section

D
data: Exported classes
data: Exported classes

E
end: Exported classes

I
index: Exported classes

S
Slot, data: Exported classes
Slot, data: Exported classes
Slot, end: Exported classes
Slot, index: Exported classes

Jump to:   D   E   I   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   B   C   P   S  
Index Entry  Section

B
binary-input-stream: Exported classes
binary-output-stream: Exported classes

C
cl-rfc4251: The cl-rfc4251 system
cl-rfc4251: The cl-rfc4251 package
cl-rfc4251-system: The cl-rfc4251-system package
cl-rfc4251.decoder: The cl-rfc4251․decoder package
cl-rfc4251.encoder: The cl-rfc4251․encoder package
cl-rfc4251.stream: The cl-rfc4251․stream package
cl-rfc4251.util: The cl-rfc4251․util package
Class, binary-input-stream: Exported classes
Class, binary-output-stream: Exported classes

P
Package, cl-rfc4251: The cl-rfc4251 package
Package, cl-rfc4251-system: The cl-rfc4251-system package
Package, cl-rfc4251.decoder: The cl-rfc4251․decoder package
Package, cl-rfc4251.encoder: The cl-rfc4251․encoder package
Package, cl-rfc4251.stream: The cl-rfc4251․stream package
Package, cl-rfc4251.util: The cl-rfc4251․util package

S
System, cl-rfc4251: The cl-rfc4251 system

Jump to:   B   C   P   S