The lisp-chat Reference Manual

This is the lisp-chat Reference Manual, version 0.2.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 16:54:58 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 lisp-chat

An experimental chat irc-like

Author

Manoel Vilela

License

MIT

Version

0.2.0

Dependencies
Source

lisp-chat.asd.


2.2 lisp-chat/client

An experimental chat irc-like: client

Author

Manoel Vilela

License

MIT

Version

0.2.0

Dependencies
  • usocket (system).
  • cl-readline (system).
  • bordeaux-threads (system).
Source

lisp-chat.asd.

Child Components

2.3 lisp-chat/server

An experimental chat irc-like: server

Author

Manoel Vilela

Contact

License

MIT

Version

0.2.0

Dependencies
  • usocket (system).
  • bordeaux-threads (system).
Source

lisp-chat.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 lisp-chat/lisp-chat.asd

Source

lisp-chat.asd.

Parent Component

lisp-chat (system).

ASDF Systems

3.1.2 lisp-chat/client/config.lisp

Source

lisp-chat.asd.

Parent Component

lisp-chat/client (system).

Packages

lisp-chat/config.

Public Interface

3.1.3 lisp-chat/client/client.lisp

Dependency

config.lisp (file).

Source

lisp-chat.asd.

Parent Component

lisp-chat/client (system).

Packages

lisp-chat/client.

Public Interface

main (function).

Internals

3.1.4 lisp-chat/server/config.lisp

Source

lisp-chat.asd.

Parent Component

lisp-chat/server (system).

Packages

lisp-chat/config.

Public Interface

3.1.5 lisp-chat/server/server.lisp

Dependency

config.lisp (file).

Source

lisp-chat.asd.

Parent Component

lisp-chat/server (system).

Packages

lisp-chat/server.

Public Interface

main (function).

Internals

4 Packages

Packages are listed by definition order.


4.1 lisp-chat/config

Source

config.lisp.

Use List

common-lisp.

Used By List
Public Interface

4.2 lisp-chat/client

Source

client.lisp.

Use List
Public Interface

main (function).

Internals

4.3 lisp-chat/server

Source

server.lisp.

Use List
Public Interface

main (function).

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: *debug*

Run application in debug mode with extra info in terminal

Package

lisp-chat/config.

Source

config.lisp.

Special Variable: *host*

Host used in server and client

Package

lisp-chat/config.

Source

config.lisp.

Special Variable: *port*

Default port

Package

lisp-chat/config.

Source

config.lisp.


5.1.2 Ordinary functions

Function: main (&key host port)

Main function of client

Package

lisp-chat/client.

Source

client.lisp.

Function: main (&key host port)

Well, this function run all the necessary shits.

Package

lisp-chat/server.

Source

server.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *client-lock*
Package

lisp-chat/server.

Source

server.lisp.

Special Variable: *clients*

List of clients

Package

lisp-chat/server.

Source

server.lisp.

Special Variable: *commands-names*

Allowed command names to be called by client user

Package

lisp-chat/server.

Source

server.lisp.

Special Variable: *day-names*

Day names

Package

lisp-chat/server.

Source

server.lisp.

Special Variable: *io-lock*

I/O Mutex for avoid terminal race conditions

Package

lisp-chat/client.

Source

client.lisp.

Special Variable: *message-semaphore*
Package

lisp-chat/server.

Source

server.lisp.

Special Variable: *messages-log*

Messages log

Package

lisp-chat/server.

Source

server.lisp.

Special Variable: *messages-stack*

Messages pending to be send by broadcasting

Package

lisp-chat/server.

Source

server.lisp.

Special Variable: *server-nickname*

The server nickname

Package

lisp-chat/server.

Source

server.lisp.

Special Variable: *uptime*

Uptime of server variable

Package

lisp-chat/server.

Source

server.lisp.


5.2.2 Ordinary functions

Function: /help (client &rest args)

Show a list of the available commands of lisp-chat

Package

lisp-chat/server.

Source

server.lisp.

Function: /log (client &optional depth &rest args)

Show the last messages typed on the server.
DEPTH is optional number of messages frames from log

Package

lisp-chat/server.

Source

server.lisp.

Function: /nick (client &optional new-nick &rest args)

Change the client-name given a NEW-NICK which should be a string

Package

lisp-chat/server.

Source

server.lisp.

Function: /uptime (client &rest args)

Return a string nice encoded to preset the uptime since the server started.

Package

lisp-chat/server.

Source

server.lisp.

Function: /users (client &rest args)

Return a list separated by commas of the currently logged users

Package

lisp-chat/server.

Source

server.lisp.

Function: call-command (client message)
Package

lisp-chat/server.

Source

server.lisp.

Function: call-command-by-name (string params)

Wow, this is a horrible hack to get a string as symbol for functions/command like /help /users /log and so on.

Package

lisp-chat/server.

Source

server.lisp.

Reader: client-address (instance)
Writer: (setf client-address) (instance)
Package

lisp-chat/server.

Source

server.lisp.

Target Slot

address.

Function: client-delete (client)

Delete a CLIENT from the list *clients*

Package

lisp-chat/server.

Source

server.lisp.

Function: client-loop (host port)

Dispatch client threads for basic functioning system

Package

lisp-chat/client.

Source

client.lisp.

Reader: client-name (instance)
Writer: (setf client-name) (instance)
Package

lisp-chat/server.

Source

server.lisp.

Target Slot

name.

Function: client-p (object)
Package

lisp-chat/server.

Source

server.lisp.

Function: client-reader (client)

This procedure is a wrapper for CLIENT-READER-ROUTINE treating all the possible errors based on HANDLER-CASE macro.

Package

lisp-chat/server.

Source

server.lisp.

Function: client-reader-routine (client)

This function create a IO-bound procedure to act
by reading the events of a specific CLIENT.
On this software each client talks on your own thread.

Package

lisp-chat/server.

Source

server.lisp.

Function: client-sender (socket username)

Routine to check new messages being typed by the user

Package

lisp-chat/client.

Source

client.lisp.

Reader: client-socket (instance)
Writer: (setf client-socket) (instance)
Package

lisp-chat/server.

Source

server.lisp.

Target Slot

socket.

Function: client-stream (c)

Select the stream IO from the client

Package

lisp-chat/server.

Source

server.lisp.

Function: command-message (content)

This function prepare the CONTENT as a message by the @server

Package

lisp-chat/server.

Source

server.lisp.

Function: connection-handler (socket-server)

This is a special thread just for accepting connections from SOCKET-SERVER and creating new clients from it.

Package

lisp-chat/server.

Source

server.lisp.

Function: copy-client (instance)
Package

lisp-chat/server.

Source

server.lisp.

Function: copy-message (instance)
Package

lisp-chat/server.

Source

server.lisp.

Function: create-client (connection)

This procedure create a new client based on CONNECTION made by USOCKET:SOCKET-ACCEPT. This shit create a lot of side effects as messages if the debug is on because this makes all the log stuff to make analysis

Package

lisp-chat/server.

Source

server.lisp.

Function: debug-format (&rest args)

If *debug* from lisp-chat-config is true, print debug info on running based on ARGS

Package

lisp-chat/server.

Source

server.lisp.

Function: erase-last-line ()

Erase the last line by using ANSI Escape codes

Package

lisp-chat/client.

Source

client.lisp.

Function: extract-params (string)
Package

lisp-chat/server.

Source

server.lisp.

Function: formated-message (message)

The default message format of this server. MESSAGE is a string Changing this reflects all the layout from client/server. Probably this would be the MFRP: Manoel Fucking Raw Protocol. Because this we can still use netcat as client for lisp-chat.

Package

lisp-chat/server.

Source

server.lisp.

Function: get-time ()

Return a encoded string as HH:MM:SS based on the current timestamp.

Package

lisp-chat/server.

Source

server.lisp.

Function: get-user-input (username)

Get the user input by using readline

Package

lisp-chat/client.

Source

client.lisp.

Function: login (socket)

Do the login of the application given a SOCKET instances

Package

lisp-chat/client.

Source

client.lisp.

Function: make-client (&key name socket address)
Package

lisp-chat/server.

Source

server.lisp.

Function: make-message (&key from content time)
Package

lisp-chat/server.

Source

server.lisp.

Function: message-broadcast ()

This procedure is a general independent thread to run brodcasting all the clients when a message is ping on this server

Package

lisp-chat/server.

Source

server.lisp.

Reader: message-content (instance)
Writer: (setf message-content) (instance)
Package

lisp-chat/server.

Source

server.lisp.

Target Slot

content.

Reader: message-from (instance)
Writer: (setf message-from) (instance)
Package

lisp-chat/server.

Source

server.lisp.

Target Slot

from.

Function: message-p (object)
Package

lisp-chat/server.

Source

server.lisp.

Reader: message-time (instance)
Writer: (setf message-time) (instance)
Package

lisp-chat/server.

Source

server.lisp.

Target Slot

time.

Function: push-message (from content)

Push a messaged FROM as CONTENT into the *messages-stack*

Package

lisp-chat/server.

Source

server.lisp.

Function: receive-message (message)

Receive a message and print in the terminal carefully with IO race conditions

Package

lisp-chat/client.

Source

client.lisp.

Function: safe-client-thread (connection)

This function is a wrapper for CREATE-CLIENT treating the exceptions.

Package

lisp-chat/server.

Source

server.lisp.

Function: send-message (message socket)

Send a MESSAGE string through a SOCKET instance

Package

lisp-chat/client.

Source

client.lisp.

Function: send-message (client message)

Send to CLIENT a MESSAGE :type string

Package

lisp-chat/server.

Source

server.lisp.

Function: server-broadcast (socket)

Call server-listener treating exceptional cases

Package

lisp-chat/client.

Source

client.lisp.

Function: server-listener (socket)

Routine to check new messages coming from the server

Package

lisp-chat/client.

Source

client.lisp.

Function: server-loop (socket-server)

This is the general server-loop procedure. Create the threads necessary for the basic working state of this chat. The main idea is creating a MESSAGE-BROADCAST procedure and CONNECTION-HANDLER procedure running as separated threads.

The first procedure send always a new message too all clients defined on *clients* when *messages-semaphore* is signalized. The second procedure is a general connection-handler for new clients trying connecting to the server.

Package

lisp-chat/server.

Source

server.lisp.

Function: socket-peer-address (socket)

Given a USOCKET:SOCKET instance return a ipv4 encoded IP string

Package

lisp-chat/server.

Source

server.lisp.

Function: split (string delimiterp)

Split a string by a delimiterp function character checking

Package

lisp-chat/server.

Source

server.lisp.

Function: startswith (string substring)

Check if STRING starts with SUBSTRING.

Package

lisp-chat/server.

Source

server.lisp.


5.2.3 Structures

Structure: client

This structure handle the creation/control of the clients of the server. NAME is a string. Socket is a USOCKET:SOCKET and address is a ipv4 encoded string.

Package

lisp-chat/server.

Source

server.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: name
Readers

client-name.

Writers

(setf client-name).

Slot: socket
Package

usocket.

Readers

client-socket.

Writers

(setf client-socket).

Slot: address
Readers

client-address.

Writers

(setf client-address).

Structure: message

This structure abstract the type message with is saved into *messages-log* and until consumed, temporally pushed to *messages-stack*. FROM, CONTENT and TIME has type string

Package

lisp-chat/server.

Source

server.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: from
Readers

message-from.

Writers

(setf message-from).

Slot: content
Readers

message-content.

Writers

(setf message-content).

Slot: time
Package

common-lisp.

Readers

message-time.

Writers

(setf message-time).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (   /  
C   D   E   F   G   L   M   P   R   S  
Index Entry  Section

(
(setf client-address): Private ordinary functions
(setf client-name): Private ordinary functions
(setf client-socket): Private ordinary functions
(setf message-content): Private ordinary functions
(setf message-from): Private ordinary functions
(setf message-time): Private ordinary functions

/
/help: Private ordinary functions
/log: Private ordinary functions
/nick: Private ordinary functions
/uptime: Private ordinary functions
/users: Private ordinary functions

C
call-command: Private ordinary functions
call-command-by-name: Private ordinary functions
client-address: Private ordinary functions
client-delete: Private ordinary functions
client-loop: Private ordinary functions
client-name: Private ordinary functions
client-p: Private ordinary functions
client-reader: Private ordinary functions
client-reader-routine: Private ordinary functions
client-sender: Private ordinary functions
client-socket: Private ordinary functions
client-stream: Private ordinary functions
command-message: Private ordinary functions
connection-handler: Private ordinary functions
copy-client: Private ordinary functions
copy-message: Private ordinary functions
create-client: Private ordinary functions

D
debug-format: Private ordinary functions

E
erase-last-line: Private ordinary functions
extract-params: Private ordinary functions

F
formated-message: Private ordinary functions
Function, (setf client-address): Private ordinary functions
Function, (setf client-name): Private ordinary functions
Function, (setf client-socket): Private ordinary functions
Function, (setf message-content): Private ordinary functions
Function, (setf message-from): Private ordinary functions
Function, (setf message-time): Private ordinary functions
Function, /help: Private ordinary functions
Function, /log: Private ordinary functions
Function, /nick: Private ordinary functions
Function, /uptime: Private ordinary functions
Function, /users: Private ordinary functions
Function, call-command: Private ordinary functions
Function, call-command-by-name: Private ordinary functions
Function, client-address: Private ordinary functions
Function, client-delete: Private ordinary functions
Function, client-loop: Private ordinary functions
Function, client-name: Private ordinary functions
Function, client-p: Private ordinary functions
Function, client-reader: Private ordinary functions
Function, client-reader-routine: Private ordinary functions
Function, client-sender: Private ordinary functions
Function, client-socket: Private ordinary functions
Function, client-stream: Private ordinary functions
Function, command-message: Private ordinary functions
Function, connection-handler: Private ordinary functions
Function, copy-client: Private ordinary functions
Function, copy-message: Private ordinary functions
Function, create-client: Private ordinary functions
Function, debug-format: Private ordinary functions
Function, erase-last-line: Private ordinary functions
Function, extract-params: Private ordinary functions
Function, formated-message: Private ordinary functions
Function, get-time: Private ordinary functions
Function, get-user-input: Private ordinary functions
Function, login: Private ordinary functions
Function, main: Public ordinary functions
Function, main: Public ordinary functions
Function, make-client: Private ordinary functions
Function, make-message: Private ordinary functions
Function, message-broadcast: Private ordinary functions
Function, message-content: Private ordinary functions
Function, message-from: Private ordinary functions
Function, message-p: Private ordinary functions
Function, message-time: Private ordinary functions
Function, push-message: Private ordinary functions
Function, receive-message: Private ordinary functions
Function, safe-client-thread: Private ordinary functions
Function, send-message: Private ordinary functions
Function, send-message: Private ordinary functions
Function, server-broadcast: Private ordinary functions
Function, server-listener: Private ordinary functions
Function, server-loop: Private ordinary functions
Function, socket-peer-address: Private ordinary functions
Function, split: Private ordinary functions
Function, startswith: Private ordinary functions

G
get-time: Private ordinary functions
get-user-input: Private ordinary functions

L
login: Private ordinary functions

M
main: Public ordinary functions
main: Public ordinary functions
make-client: Private ordinary functions
make-message: Private ordinary functions
message-broadcast: Private ordinary functions
message-content: Private ordinary functions
message-from: Private ordinary functions
message-p: Private ordinary functions
message-time: Private ordinary functions

P
push-message: Private ordinary functions

R
receive-message: Private ordinary functions

S
safe-client-thread: Private ordinary functions
send-message: Private ordinary functions
send-message: Private ordinary functions
server-broadcast: Private ordinary functions
server-listener: Private ordinary functions
server-loop: Private ordinary functions
socket-peer-address: Private ordinary functions
split: Private ordinary functions
startswith: Private ordinary functions


A.3 Variables

Jump to:   *  
A   C   F   N   S   T  
Index Entry  Section

*
*client-lock*: Private special variables
*clients*: Private special variables
*commands-names*: Private special variables
*day-names*: Private special variables
*debug*: Public special variables
*host*: Public special variables
*io-lock*: Private special variables
*message-semaphore*: Private special variables
*messages-log*: Private special variables
*messages-stack*: Private special variables
*port*: Public special variables
*server-nickname*: Private special variables
*uptime*: Private special variables

A
address: Private structures

C
content: Private structures

F
from: Private structures

N
name: Private structures

S
Slot, address: Private structures
Slot, content: Private structures
Slot, from: Private structures
Slot, name: Private structures
Slot, socket: Private structures
Slot, time: Private structures
socket: Private structures
Special Variable, *client-lock*: Private special variables
Special Variable, *clients*: Private special variables
Special Variable, *commands-names*: Private special variables
Special Variable, *day-names*: Private special variables
Special Variable, *debug*: Public special variables
Special Variable, *host*: Public special variables
Special Variable, *io-lock*: Private special variables
Special Variable, *message-semaphore*: Private special variables
Special Variable, *messages-log*: Private special variables
Special Variable, *messages-stack*: Private special variables
Special Variable, *port*: Public special variables
Special Variable, *server-nickname*: Private special variables
Special Variable, *uptime*: Private special variables

T
time: Private structures