The smallnet Reference Manual

This is the smallnet Reference Manual, version 1.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Jul 13 22:00:18 2025 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 smallnet

Author

nytpu <>

Home Page

https://git.sr.ht/~nytpu/smallnet

Source Control

(GIT https://git.sr.ht/~nytpu/smallnet)

License

MPL-2.0

Version

1.1.0

Dependencies
  • nytpu.lisp-utils (system).
  • uiop (system).
  • alexandria (system).
  • babel (system).
  • quri (system).
  • cl-mimeparse (system).
  • usocket (system).
  • cl+ssl (system)., for feature (:not :windows)
  • schannel (system)., for feature :windows
Source

smallnet.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 smallnet/smallnet.asd

Source

smallnet.asd.

Parent Component

smallnet (system).

ASDF Systems

smallnet.


3.1.2 smallnet/package.lisp

Source

smallnet.asd.

Parent Component

smallnet (system).

Packages

3.1.3 smallnet/smallnet.lisp

Dependency

package.lisp (file).

Source

smallnet.asd.

Parent Component

smallnet (system).

Internals

3.1.4 smallnet/gemini.lisp

Dependencies
Source

smallnet.asd.

Parent Component

smallnet (system).

Public Interface
Internals

3.1.5 smallnet/gopher.lisp

Dependencies
Source

smallnet.asd.

Parent Component

smallnet (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 smallnet.gemini

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

4.2 smallnet

Source

package.lisp.

Use List

common-lisp.

Internals

4.3 smallnet.gopher

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 Special variables

Special Variable: *codes-statuses*

Association list mapping Gemini numeric response codes to keywords ("statuses") named after the response code name in the specification.

Package

smallnet.gemini.

Source

gemini.lisp.


5.1.2 Ordinary functions

Function: code->status (code)

Convert a numeric Gemini response code to a response status keyword, or NIL if the response code is not a valid one.

Package

smallnet.gemini.

Source

gemini.lisp.

Function: gemini-request (uri &key host port follow-redirects no-decode force-decode timeout nodelay client-cert client-cert-key client-cert-password ignore-read/close-ssl-error)

Perform a Gemini request against URI. Returns the response body (or NIL if the response doesn’t have a body), the response status keyword, the parsed response meta, and the unmodified response meta as multiple values. The response body is decoded to string if the response type is textual, otherwise it is an octet vector. Meta is a MIMEPARSE:MEDIA-RANGE if status is :SUCCESS, otherwise it’s a string (the unmodified response meta is always a string).

- HOST specifies the host to connect to, overriding the URI’s HOST.
- PORT specifies the port to connect to, overriding the URI’s PORT. If no PORT is given and URI doesn’t contain a PORT, then 1965 is used.
- FOLLOW-REDIRECTS specifies the number of redirects to follow, or set to NIL to not automatically follow them and just return the redirect status code.
- NO-DECODE, if T, will always return the body as a raw octet vector rather than trying to decode text/* MIME types. Overrides FORCE-DECODE.
- FORCE-DECODE, if T, will force trying to decode the body as text even if it is not indicated as such.
- TIMEOUT specifies a timeout to use on the socket connection.
- NODELAY disables Nagle’s algorithm on the socket used for connection.
- CLIENT-CERT specifies the path to the client certificate to use on most systems, or the identifier in the Windows certificate repository on Windows.
- CLIENT-CERT-KEY specifies the path to the client certificate’s key. Ignored on Windows.
- CLIENT-CERT-PASSWORD specifies the password to decrypt the client certificate. Ignored on Windows.
- IGNORE-READ/CLOSE-SSL-ERROR ignores if the Gemini server doesn’t send a TLS close_notify before closing the socket.

Package

smallnet.gemini.

Source

gemini.lisp.

Function: gopher-request (uri &key host port response-type selector no-decode timeout nodelay)

Perform a Gopher request against URI. Returns the response body (or NIL if the response doesn’t have a body) and the response item type as multiple values. The response body is decoded to string if the response type is textual, otherwise it is an octet vector. The response body is attempted to decode with UTF-8, otherwise it falls back to Latin-1.

- HOST specifies the host to connect to, overriding the URI’s HOST.
- PORT specifies the port to connect to, overriding the URI’s PORT. If no PORT is given and URI doesn’t contain a PORT, then 70 is used.
- RESPONSE-TYPE overrides the response type extracted from the URI, or overrides the default type if URI doesn’t have a response type.
- SELECTOR overrides the selector parsed from the URI
- NO-DECODE, if T, will always return the body as a raw octet vector rather than trying to decode text/* MIME types. Overrides FORCE-DECODE
- FORCE-DECODE, if T, will always try and decode the body as text.
- TIMEOUT specifies a timeout to use on the socket connection.
- NODELAY disables Nagle’s algorithm on the socket used for connection.

Note that providing *all* of HOST, PORT, RESPONSE-TYPE, and SELECTOR means that URI can be empty since no fields will be taken from it.

Package

smallnet.gopher.

Source

gopher.lisp.

Function: status->code (status)

Convert a Gemini response status keyword to a numeric code, or NIL if the response status is not a valid one.

Package

smallnet.gemini.

Source

gemini.lisp.


5.1.3 Generic functions

Generic Reader: hostname (object)
Package

smallnet.gopher.

Methods
Reader Method: hostname ((gophermap-line gophermap-line))

automatically generated reader method

Source

gopher.lisp.

Target Slot

hostname.

Generic Writer: (setf hostname) (object)
Package

smallnet.gopher.

Methods
Writer Method: (setf hostname) ((gophermap-line gophermap-line))

automatically generated writer method

Source

gopher.lisp.

Target Slot

hostname.

Generic Reader: item-type (object)
Package

smallnet.gopher.

Methods
Reader Method: item-type ((gophermap-line gophermap-line))

automatically generated reader method

Source

gopher.lisp.

Target Slot

item-type.

Generic Writer: (setf item-type) (object)
Package

smallnet.gopher.

Methods
Writer Method: (setf item-type) ((gophermap-line gophermap-line))

automatically generated writer method

Source

gopher.lisp.

Target Slot

item-type.

Generic Reader: level (object)
Package

smallnet.gemini.

Methods
Reader Method: level ((gemtext-header gemtext-header))

automatically generated reader method

Source

gemini.lisp.

Target Slot

level.

Generic Writer: (setf level) (object)
Package

smallnet.gemini.

Methods
Writer Method: (setf level) ((gemtext-header gemtext-header))

automatically generated writer method

Source

gemini.lisp.

Target Slot

level.

Generic Reader: name (object)
Package

smallnet.gopher.

Methods
Reader Method: name ((gophermap-line gophermap-line))

automatically generated reader method

Source

gopher.lisp.

Target Slot

name.

Generic Writer: (setf name) (object)
Package

smallnet.gopher.

Methods
Writer Method: (setf name) ((gophermap-line gophermap-line))

automatically generated writer method

Source

gopher.lisp.

Target Slot

name.

Generic Function: parse-gemtext (document)

Parse a Gemtext DOCUMENT into a sequence of GEMTEXT-LINEs. The input document is either a single string containing multiple lines, or a sequence of strings already split into lines.

Package

smallnet.gemini.

Source

gemini.lisp.

Methods
Method: parse-gemtext ((document sequence))
Method: parse-gemtext ((document string))
Generic Function: parse-gophermap (document)

Parse a Gophermap DOCUMENT into a sequence of GOPHERMAP-LINEs. The input document is either a single string containing multiple lines, or a sequence of strings already split into lines.

Package

smallnet.gopher.

Source

gopher.lisp.

Methods
Method: parse-gophermap ((document sequence))
Method: parse-gophermap ((document string))
Generic Reader: port (object)
Package

smallnet.gopher.

Methods
Reader Method: port ((gophermap-line gophermap-line))

automatically generated reader method

Source

gopher.lisp.

Target Slot

port.

Generic Writer: (setf port) (object)
Package

smallnet.gopher.

Methods
Writer Method: (setf port) ((gophermap-line gophermap-line))

automatically generated writer method

Source

gopher.lisp.

Target Slot

port.

Generic Reader: selector (object)
Package

smallnet.gopher.

Methods
Reader Method: selector ((gophermap-line gophermap-line))

automatically generated reader method

Source

gopher.lisp.

Target Slot

selector.

Generic Writer: (setf selector) (object)
Package

smallnet.gopher.

Methods
Writer Method: (setf selector) ((gophermap-line gophermap-line))

automatically generated writer method

Source

gopher.lisp.

Target Slot

selector.

Generic Reader: text (object)
Package

smallnet.gemini.

Methods
Reader Method: text ((gemtext-line gemtext-line))

automatically generated reader method

Source

gemini.lisp.

Target Slot

text.

Generic Writer: (setf text) (object)
Package

smallnet.gemini.

Methods
Writer Method: (setf text) ((gemtext-line gemtext-line))

automatically generated writer method

Source

gemini.lisp.

Target Slot

text.

Generic Reader: url (object)
Package

smallnet.gemini.

Methods
Reader Method: url ((gemtext-link gemtext-link))

automatically generated reader method

Source

gemini.lisp.

Target Slot

url.

Generic Writer: (setf url) (object)
Package

smallnet.gemini.

Methods
Writer Method: (setf url) ((gemtext-link gemtext-link))

automatically generated writer method

Source

gemini.lisp.

Target Slot

url.


5.1.4 Standalone methods

Method: print-object ((object gemtext-line) stream)
Source

gemini.lisp.

Method: print-object ((object gemtext-header) stream)
Source

gemini.lisp.

Method: print-object ((object gemtext-link) stream)
Source

gemini.lisp.

Method: print-object ((object gophermap-line) stream)
Source

gopher.lisp.


5.1.5 Conditions

Condition: malformed-response

Raised when a malformed response is received.

Package

smallnet.gemini.

Source

gemini.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: reason
Initargs

:reason

Readers

reason.

Writers

This slot is read-only.

Slot: response
Initargs

:response

Readers

response.

Writers

This slot is read-only.


5.1.6 Classes

Class: gemtext-header
Package

smallnet.gemini.

Source

gemini.lisp.

Direct superclasses

gemtext-line.

Direct methods
Direct slots
Slot: level
Type

(integer 1 3)

Initargs

:level

Readers

level.

Writers

(setf level).

Class: gemtext-line
Package

smallnet.gemini.

Source

gemini.lisp.

Direct subclasses
Direct methods
Direct slots
Slot: text
Type

string

Initargs

:text

Readers

text.

Writers

(setf text).

Package

smallnet.gemini.

Source

gemini.lisp.

Direct superclasses

gemtext-line.

Direct methods
Direct slots
Slot: url
Type

(or string quri.uri:uri)

Initargs

:url

Readers

url.

Writers

(setf url).

Class: gemtext-list-item
Package

smallnet.gemini.

Source

gemini.lisp.

Direct superclasses

gemtext-line.

Class: gemtext-preformatted-toggle
Package

smallnet.gemini.

Source

gemini.lisp.

Direct superclasses

gemtext-line.

Class: gemtext-quote
Package

smallnet.gemini.

Source

gemini.lisp.

Direct superclasses

gemtext-line.

Class: gemtext-text-line
Package

smallnet.gemini.

Source

gemini.lisp.

Direct superclasses

gemtext-line.

Class: gophermap-line
Package

smallnet.gopher.

Source

gopher.lisp.

Direct methods
Direct slots
Slot: item-type
Type

character

Initargs

:item-type

Readers

item-type.

Writers

(setf item-type).

Slot: name
Type

string

Initargs

:name

Readers

name.

Writers

(setf name).

Slot: selector
Type

string

Initargs

:selector

Readers

selector.

Writers

(setf selector).

Slot: hostname
Type

string

Initargs

:hostname

Readers

hostname.

Writers

(setf hostname).

Slot: port
Type

(unsigned-byte 16)

Initargs

:port

Readers

port.

Writers

(setf port).


5.2 Internals


5.2.1 Constants

Constant: +crlf+
Package

smallnet.

Source

smallnet.lisp.

Constant: +end-of-response-cr+
Package

smallnet.gopher.

Source

gopher.lisp.

Constant: +end-of-response-crlf+
Package

smallnet.gopher.

Source

gopher.lisp.

Constant: +end-of-response-lf+
Package

smallnet.gopher.

Source

gopher.lisp.

Constant: +tab+
Package

smallnet.gopher.

Source

gopher.lisp.

Constant: +whitespace-bag+
Package

smallnet.gemini.

Source

gemini.lisp.


5.2.2 Macros

Macro: with-ssl-client-stream ((stream host port &key timeout nodelay client-cert client-cert-key client-cert-password) &body body)
Package

smallnet.gemini.

Source

gemini.lisp.


5.2.3 Ordinary functions

Function: decode-body-if-possible (body meta &optional force-decode override-encoding)
Package

smallnet.gemini.

Source

gemini.lisp.

Function: make-context ()
Package

smallnet.gemini.

Source

gemini.lisp.

Function: parse-gemtext-line (line)
Package

smallnet.gemini.

Source

gemini.lisp.

Function: parse-gopher-path (path override-type override-selector)
Package

smallnet.gopher.

Source

gopher.lisp.

Function: parse-gophermap-line (line)
Package

smallnet.gopher.

Source

gopher.lisp.

Function: parse-header (header)
Package

smallnet.gemini.

Source

gemini.lisp.

Function: read-all (stream)
Package

smallnet.

Source

smallnet.lisp.

Function: read-header (stream babel-encoding &optional eof-error-p)
Package

smallnet.gemini.

Source

gemini.lisp.

Function: remove-markup (line prefix)
Package

smallnet.gemini.

Source

gemini.lisp.

Function: textual-gophertype? (type)
Package

smallnet.gopher.

Source

gopher.lisp.

Function: valid-gophertype? (type)
Package

smallnet.gopher.

Source

gopher.lisp.


5.2.4 Generic functions

Generic Reader: reason (condition)
Package

smallnet.gemini.

Methods
Reader Method: reason ((condition malformed-response))
Source

gemini.lisp.

Target Slot

reason.

Generic Reader: response (condition)
Package

smallnet.gemini.

Methods
Reader Method: response ((condition malformed-response))
Source

gemini.lisp.

Target Slot

response.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
C   D   F   G   H   I   L   M   N   P   R   S   T   U   V   W  
Index Entry  Section

(
(setf hostname): Public generic functions
(setf hostname): Public generic functions
(setf item-type): Public generic functions
(setf item-type): Public generic functions
(setf level): Public generic functions
(setf level): Public generic functions
(setf name): Public generic functions
(setf name): Public generic functions
(setf port): Public generic functions
(setf port): Public generic functions
(setf selector): Public generic functions
(setf selector): Public generic functions
(setf text): Public generic functions
(setf text): Public generic functions
(setf url): Public generic functions
(setf url): Public generic functions

C
code->status: Public ordinary functions

D
decode-body-if-possible: Private ordinary functions

F
Function, code->status: Public ordinary functions
Function, decode-body-if-possible: Private ordinary functions
Function, gemini-request: Public ordinary functions
Function, gopher-request: Public ordinary functions
Function, make-context: Private ordinary functions
Function, parse-gemtext-line: Private ordinary functions
Function, parse-gopher-path: Private ordinary functions
Function, parse-gophermap-line: Private ordinary functions
Function, parse-header: Private ordinary functions
Function, read-all: Private ordinary functions
Function, read-header: Private ordinary functions
Function, remove-markup: Private ordinary functions
Function, status->code: Public ordinary functions
Function, textual-gophertype?: Private ordinary functions
Function, valid-gophertype?: Private ordinary functions

G
gemini-request: Public ordinary functions
Generic Function, (setf hostname): Public generic functions
Generic Function, (setf item-type): Public generic functions
Generic Function, (setf level): Public generic functions
Generic Function, (setf name): Public generic functions
Generic Function, (setf port): Public generic functions
Generic Function, (setf selector): Public generic functions
Generic Function, (setf text): Public generic functions
Generic Function, (setf url): Public generic functions
Generic Function, hostname: Public generic functions
Generic Function, item-type: Public generic functions
Generic Function, level: Public generic functions
Generic Function, name: Public generic functions
Generic Function, parse-gemtext: Public generic functions
Generic Function, parse-gophermap: Public generic functions
Generic Function, port: Public generic functions
Generic Function, reason: Private generic functions
Generic Function, response: Private generic functions
Generic Function, selector: Public generic functions
Generic Function, text: Public generic functions
Generic Function, url: Public generic functions
gopher-request: Public ordinary functions

H
hostname: Public generic functions
hostname: Public generic functions

I
item-type: Public generic functions
item-type: Public generic functions

L
level: Public generic functions
level: Public generic functions

M
Macro, with-ssl-client-stream: Private macros
make-context: Private ordinary functions
Method, (setf hostname): Public generic functions
Method, (setf item-type): Public generic functions
Method, (setf level): Public generic functions
Method, (setf name): Public generic functions
Method, (setf port): Public generic functions
Method, (setf selector): Public generic functions
Method, (setf text): Public generic functions
Method, (setf url): Public generic functions
Method, hostname: Public generic functions
Method, item-type: Public generic functions
Method, level: Public generic functions
Method, name: Public generic functions
Method, parse-gemtext: Public generic functions
Method, parse-gemtext: Public generic functions
Method, parse-gophermap: Public generic functions
Method, parse-gophermap: Public generic functions
Method, port: Public generic functions
Method, print-object: Public standalone methods
Method, print-object: Public standalone methods
Method, print-object: Public standalone methods
Method, print-object: Public standalone methods
Method, reason: Private generic functions
Method, response: Private generic functions
Method, selector: Public generic functions
Method, text: Public generic functions
Method, url: Public generic functions

N
name: Public generic functions
name: Public generic functions

P
parse-gemtext: Public generic functions
parse-gemtext: Public generic functions
parse-gemtext: Public generic functions
parse-gemtext-line: Private ordinary functions
parse-gopher-path: Private ordinary functions
parse-gophermap: Public generic functions
parse-gophermap: Public generic functions
parse-gophermap: Public generic functions
parse-gophermap-line: Private ordinary functions
parse-header: Private ordinary functions
port: Public generic functions
port: Public generic functions
print-object: Public standalone methods
print-object: Public standalone methods
print-object: Public standalone methods
print-object: Public standalone methods

R
read-all: Private ordinary functions
read-header: Private ordinary functions
reason: Private generic functions
reason: Private generic functions
remove-markup: Private ordinary functions
response: Private generic functions
response: Private generic functions

S
selector: Public generic functions
selector: Public generic functions
status->code: Public ordinary functions

T
text: Public generic functions
text: Public generic functions
textual-gophertype?: Private ordinary functions

U
url: Public generic functions
url: Public generic functions

V
valid-gophertype?: Private ordinary functions

W
with-ssl-client-stream: Private macros


A.4 Data types

Jump to:   C   F   G   M   P   S  
Index Entry  Section

C
Class, gemtext-header: Public classes
Class, gemtext-line: Public classes
Class, gemtext-link: Public classes
Class, gemtext-list-item: Public classes
Class, gemtext-preformatted-toggle: Public classes
Class, gemtext-quote: Public classes
Class, gemtext-text-line: Public classes
Class, gophermap-line: Public classes
Condition, malformed-response: Public conditions

F
File, gemini.lisp: The smallnet/gemini․lisp file
File, gopher.lisp: The smallnet/gopher․lisp file
File, package.lisp: The smallnet/package․lisp file
File, smallnet.asd: The smallnet/smallnet․asd file
File, smallnet.lisp: The smallnet/smallnet․lisp file

G
gemini.lisp: The smallnet/gemini․lisp file
gemtext-header: Public classes
gemtext-line: Public classes
gemtext-link: Public classes
gemtext-list-item: Public classes
gemtext-preformatted-toggle: Public classes
gemtext-quote: Public classes
gemtext-text-line: Public classes
gopher.lisp: The smallnet/gopher․lisp file
gophermap-line: Public classes

M
malformed-response: Public conditions

P
Package, smallnet: The smallnet package
Package, smallnet.gemini: The smallnet․gemini package
Package, smallnet.gopher: The smallnet․gopher package
package.lisp: The smallnet/package․lisp file

S
smallnet: The smallnet system
smallnet: The smallnet package
smallnet.asd: The smallnet/smallnet․asd file
smallnet.gemini: The smallnet․gemini package
smallnet.gopher: The smallnet․gopher package
smallnet.lisp: The smallnet/smallnet․lisp file
System, smallnet: The smallnet system