The trivial-nntp Reference Manual

Table of Contents

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

The trivial-nntp Reference Manual

This is the trivial-nntp Reference Manual, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 09:27:18 2018 GMT+0.


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

1 Introduction

:trivial-nntp (:tnntp)

Common lisp tools for connecting to and crawling around NNTP servers. It uses usocket and cl+ssl, and therefore handles simple or SSL-encrypted NNTP connections.

This is a minimalistic effort; however watch this:

     CL-USER> (in-package :tnntp)
     TNNTP> (command "HELP")
     "100 Legal commands^M"
     1
     TNNTP> (rlist)
     "  ARTICLE [message-ID|number]^M"
     "  AUTHINFO USER name|PASS password|GENERIC program [argument ...]^M"
     "  BODY [message-ID|number]^M" "  CAPABILITIES [keyword]^M"
     "  COMPRESS DEFLATE^M" "  DATE^M" "  GROUP newsgroup^M"
     "..."
     "Report problems to <usenet@fleegle.mixmin.net>.^M"
     TNNTP> (disconnect)
     "205 Bye!^M"
     2
     CL-USER>

This simple test connect to news.mixmin.net (see tnntp.lisp). To connect to your server, create a server just like this (with your own info, of course):

(defparameter *server* ;; or keep this in some other place...
  (make-server :name "news.mixmin.net"
	       :port 119
	       :user nil
	       :password nil
	       :ssl nil
	       )
(defparameter *conn* ;; or create an array of connections or whatever
  (make-conn :server *server* :group "alt.whatever")

At the core, the server structure (see 'tnntp.lisp') contains information about the URL, port, authentication. A connection keeps track of the socket/stream state. The system will transparently reconnect and restore current group on a connection should the server close the connection.

Commands are sent with something like (command connection "commandstring" :expecting 2 ) The expecting parameter, if specified, makes sure that the response in in 200-299 range (only first digit is checked). For commands with an additional parameter such as "GROUP groupname" the :also parameter avoids building command strings: (send-command "GROUP" :also groupname)

Responses are read with

Lines are returned unprocessed, with control-M character. Rationale: you will probably parse the lines anyway, so there is little reason to worry about that.

WORKFLOW

  1. Create a server structure with your server url, port and authentication info.
  2. Create a connection structure with the server.
  3. (command ...) "MODE READER" is a good start. If you send commands that return data, make sure to read everything up to and including the termination line containing a single dot. See (rlist) for details. If you don't you will get out of sync and send-command will not get a good response line.
  4. (disconnect) when done -- it sends "QUIT" and kills the sockets
  5. Write a news transport, a reader, a downloader, or anything that you are discouraged to do in this article

A SIMPLE EXAMPLE

(load-groups)
(search-groups "book")

Search the grouplist for anything containing the word 'book'; regex expressions allowed!

References: *


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 trivial-nntp

Author

Stacksmith <fpgasm@apple2.x10.mx>

License

MIT

Description

Simple tools for interfacing to NNTP servers

Dependencies
Source

trivial-nntp.asd (file)

Components

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

3 Files

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


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

3.1 Lisp


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

3.1.1 trivial-nntp.asd

Location

trivial-nntp.asd

Systems

trivial-nntp (system)


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

3.1.2 trivial-nntp/package.lisp

Parent

trivial-nntp (system)

Location

package.lisp

Packages

trivial-nntp


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

3.1.3 trivial-nntp/tnntp.lisp

Dependency

package.lisp (file)

Parent

trivial-nntp (system)

Location

tnntp.lisp

Exported Definitions
Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 trivial-nntp

Source

package.lisp (file)

Nickname

tnntp

Use List

common-lisp

Exported Definitions
Internal Definitions

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

5 Definitions

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


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

5.1 Exported definitions


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

5.1.1 Special variables

Special Variable: *conn*
Package

trivial-nntp

Source

tnntp.lisp (file)

Special Variable: *server*
Package

trivial-nntp

Source

tnntp.lisp (file)


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

5.1.2 Functions

Function: command STRING &key CONN EXPECTING ALSO ALSO2 DEPTH

send an NNTP command and read response. Return first digit of response and entire response string. - (commnad "XOVER" :also (range 1 10))
- (command "GROUP" :also "alt.blah.blah.blah"

Package

trivial-nntp

Source

tnntp.lisp (file)

Function: conn-bytes-read INSTANCE
Function: (setf conn-bytes-read) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: conn-group INSTANCE
Function: (setf conn-group) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: conn-server INSTANCE
Function: (setf conn-server) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: conn-stream INSTANCE
Function: (setf conn-stream) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: disconnect &key CONN

cleanly disconnect from the server

Package

trivial-nntp

Source

tnntp.lisp (file)

Function: make-conn &key (SERVER SERVER) (GROUP GROUP) (STREAM STREAM) (BYTES-READ BYTES-READ)
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: make-server &key (NAME NAME) (PORT PORT) (USER USER) (PASSWORD PASSWORD) (SSL SSL) (GROUPS GROUPS) (MAXCONNS MAXCONNS)
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: nntp-error ID MESSAGE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: range LOW HIGH &key STREAM

output an NNTP article range to stream.

Package

trivial-nntp

Source

tnntp.lisp (file)

Function: reconnect &key CONN

Reconnect to the server, if disconnected, restoring state (entering a group). This needs more work...

Package

trivial-nntp

Source

tnntp.lisp (file)

Function: rline &key CONN

return a unit (line) of text or nil for NNTP endline

Package

trivial-nntp

Source

tnntp.lisp (file)

Function: rlist &key CONN PROC

collect a list containing lines of data, processing if requested

Package

trivial-nntp

Source

tnntp.lisp (file)

Function: server-groups INSTANCE
Function: (setf server-groups) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: server-name INSTANCE
Function: (setf server-name) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: server-password INSTANCE
Function: (setf server-password) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: server-port INSTANCE
Function: (setf server-port) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: server-ssl INSTANCE
Function: (setf server-ssl) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: server-user INSTANCE
Function: (setf server-user) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)


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

5.1.3 Conditions

Condition: nntp-error ()
Package

trivial-nntp

Source

tnntp.lisp (file)

Direct superclasses

error (condition)

Direct methods
Direct slots
Slot: message

text message indicating nntp error

Initargs

:message

Initform

(quote nil)

Readers

nntp-error-message (generic function)

Writers

(setf nntp-error-message) (generic function)

Slot: id
Initargs

:id

Initform

(quote nil)

Readers

nntp-id (generic function)

Writers

(setf nntp-id) (generic function)


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

5.1.4 Structures

Structure: conn ()
Package

trivial-nntp

Source

tnntp.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: server
Readers

conn-server (function)

Writers

(setf conn-server) (function)

Slot: group
Readers

conn-group (function)

Writers

(setf conn-group) (function)

Slot: stream
Initform

0

Readers

conn-stream (function)

Writers

(setf conn-stream) (function)

Slot: bytes-read
Initform

0

Readers

conn-bytes-read (function)

Writers

(setf conn-bytes-read) (function)

Structure: server ()
Package

trivial-nntp

Source

tnntp.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods

print-object (method)

Direct slots
Slot: name
Readers

server-name (function)

Writers

(setf server-name) (function)

Slot: port
Initform

119

Readers

server-port (function)

Writers

(setf server-port) (function)

Slot: user
Readers

server-user (function)

Writers

(setf server-user) (function)

Slot: password
Readers

server-password (function)

Writers

(setf server-password) (function)

Slot: ssl
Readers

server-ssl (function)

Writers

(setf server-ssl) (function)

Slot: groups
Readers

server-groups (function)

Writers

(setf server-groups) (function)

Slot: maxconns
Initform

1

Readers

server-maxconns (function)

Writers

(setf server-maxconns) (function)


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

5.2 Internal definitions


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

5.2.1 Functions

Function: conn-p OBJECT
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: copy-conn INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: copy-server INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: line-or-nil LINE

return nil for NNTP endline

Package

trivial-nntp

Source

tnntp.lisp (file)

Function: response &key CONN EXPECTING

return first digit of the code and the entire line

Package

trivial-nntp

Source

tnntp.lisp (file)

Function: server-maxconns INSTANCE
Function: (setf server-maxconns) VALUE INSTANCE
Package

trivial-nntp

Source

tnntp.lisp (file)

Function: server-p OBJECT
Package

trivial-nntp

Source

tnntp.lisp (file)


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

5.2.2 Generic functions

Generic Function: nntp-error-message CONDITION
Generic Function: (setf nntp-error-message) NEW-VALUE CONDITION
Package

trivial-nntp

Methods
Method: nntp-error-message (CONDITION nntp-error)
Method: (setf nntp-error-message) NEW-VALUE (CONDITION nntp-error)
Source

tnntp.lisp (file)

Generic Function: nntp-id CONDITION
Generic Function: (setf nntp-id) NEW-VALUE CONDITION
Package

trivial-nntp

Methods
Method: nntp-id (CONDITION nntp-error)
Method: (setf nntp-id) NEW-VALUE (CONDITION nntp-error)
Source

tnntp.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   T  
Index Entry  Section

F
File, Lisp, trivial-nntp.asd: The trivial-nntp<dot>asd file
File, Lisp, trivial-nntp/package.lisp: The trivial-nntp/package<dot>lisp file
File, Lisp, trivial-nntp/tnntp.lisp: The trivial-nntp/tnntp<dot>lisp file

L
Lisp File, trivial-nntp.asd: The trivial-nntp<dot>asd file
Lisp File, trivial-nntp/package.lisp: The trivial-nntp/package<dot>lisp file
Lisp File, trivial-nntp/tnntp.lisp: The trivial-nntp/tnntp<dot>lisp file

T
trivial-nntp.asd: The trivial-nntp<dot>asd file
trivial-nntp/package.lisp: The trivial-nntp/package<dot>lisp file
trivial-nntp/tnntp.lisp: The trivial-nntp/tnntp<dot>lisp file

Jump to:   F   L   T  

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

A.2 Functions

Jump to:   (  
C   D   F   G   L   M   N   R   S  
Index Entry  Section

(
(setf conn-bytes-read): Exported functions
(setf conn-group): Exported functions
(setf conn-server): Exported functions
(setf conn-stream): Exported functions
(setf nntp-error-message): Internal generic functions
(setf nntp-error-message): Internal generic functions
(setf nntp-id): Internal generic functions
(setf nntp-id): Internal generic functions
(setf server-groups): Exported functions
(setf server-maxconns): Internal functions
(setf server-name): Exported functions
(setf server-password): Exported functions
(setf server-port): Exported functions
(setf server-ssl): Exported functions
(setf server-user): Exported functions

C
command: Exported functions
conn-bytes-read: Exported functions
conn-group: Exported functions
conn-p: Internal functions
conn-server: Exported functions
conn-stream: Exported functions
copy-conn: Internal functions
copy-server: Internal functions

D
disconnect: Exported functions

F
Function, (setf conn-bytes-read): Exported functions
Function, (setf conn-group): Exported functions
Function, (setf conn-server): Exported functions
Function, (setf conn-stream): Exported functions
Function, (setf server-groups): Exported functions
Function, (setf server-maxconns): Internal functions
Function, (setf server-name): Exported functions
Function, (setf server-password): Exported functions
Function, (setf server-port): Exported functions
Function, (setf server-ssl): Exported functions
Function, (setf server-user): Exported functions
Function, command: Exported functions
Function, conn-bytes-read: Exported functions
Function, conn-group: Exported functions
Function, conn-p: Internal functions
Function, conn-server: Exported functions
Function, conn-stream: Exported functions
Function, copy-conn: Internal functions
Function, copy-server: Internal functions
Function, disconnect: Exported functions
Function, line-or-nil: Internal functions
Function, make-conn: Exported functions
Function, make-server: Exported functions
Function, nntp-error: Exported functions
Function, range: Exported functions
Function, reconnect: Exported functions
Function, response: Internal functions
Function, rline: Exported functions
Function, rlist: Exported functions
Function, server-groups: Exported functions
Function, server-maxconns: Internal functions
Function, server-name: Exported functions
Function, server-p: Internal functions
Function, server-password: Exported functions
Function, server-port: Exported functions
Function, server-ssl: Exported functions
Function, server-user: Exported functions

G
Generic Function, (setf nntp-error-message): Internal generic functions
Generic Function, (setf nntp-id): Internal generic functions
Generic Function, nntp-error-message: Internal generic functions
Generic Function, nntp-id: Internal generic functions

L
line-or-nil: Internal functions

M
make-conn: Exported functions
make-server: Exported functions
Method, (setf nntp-error-message): Internal generic functions
Method, (setf nntp-id): Internal generic functions
Method, nntp-error-message: Internal generic functions
Method, nntp-id: Internal generic functions

N
nntp-error: Exported functions
nntp-error-message: Internal generic functions
nntp-error-message: Internal generic functions
nntp-id: Internal generic functions
nntp-id: Internal generic functions

R
range: Exported functions
reconnect: Exported functions
response: Internal functions
rline: Exported functions
rlist: Exported functions

S
server-groups: Exported functions
server-maxconns: Internal functions
server-name: Exported functions
server-p: Internal functions
server-password: Exported functions
server-port: Exported functions
server-ssl: Exported functions
server-user: Exported functions

Jump to:   (  
C   D   F   G   L   M   N   R   S  

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

A.3 Variables

Jump to:   *  
B   G   I   M   N   P   S   U  
Index Entry  Section

*
*conn*: Exported special variables
*server*: Exported special variables

B
bytes-read: Exported structures

G
group: Exported structures
groups: Exported structures

I
id: Exported conditions

M
maxconns: Exported structures
message: Exported conditions

N
name: Exported structures

P
password: Exported structures
port: Exported structures

S
server: Exported structures
Slot, bytes-read: Exported structures
Slot, group: Exported structures
Slot, groups: Exported structures
Slot, id: Exported conditions
Slot, maxconns: Exported structures
Slot, message: Exported conditions
Slot, name: Exported structures
Slot, password: Exported structures
Slot, port: Exported structures
Slot, server: Exported structures
Slot, ssl: Exported structures
Slot, stream: Exported structures
Slot, user: Exported structures
Special Variable, *conn*: Exported special variables
Special Variable, *server*: Exported special variables
ssl: Exported structures
stream: Exported structures

U
user: Exported structures

Jump to:   *  
B   G   I   M   N   P   S   U  

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

A.4 Data types

Jump to:   C   N   P   S   T  
Index Entry  Section

C
Condition, nntp-error: Exported conditions
conn: Exported structures

N
nntp-error: Exported conditions

P
Package, trivial-nntp: The trivial-nntp package

S
server: Exported structures
Structure, conn: Exported structures
Structure, server: Exported structures
System, trivial-nntp: The trivial-nntp system

T
trivial-nntp: The trivial-nntp system
trivial-nntp: The trivial-nntp package

Jump to:   C   N   P   S   T