The lisp-chat Reference Manual

Table of Contents

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

The lisp-chat Reference Manual

This is the lisp-chat Reference Manual, version 0.2.0, generated automatically by Declt version 3.0 "Montgomery Scott" on Fri Jun 26 11:29:13 2020 GMT+0.


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

1 Introduction

Quicklisp dist

Lisp Chat

An experimental chat irc-like written in Lisp.

lisp-chat-screenshot

Installation

Install [roswell][ros] and add ~/.roswell/bin/ to the PATH variable.

After that just type:

ros install ryukinix/lisp-chat

Lisp-chat it's on Quicklisp as well, tested on the following implementations:

Usage

Load the server

$ lisp-chat-server localhost

Create a client

$ lisp-chat localhost

As alternative of localhost you can use server.lerax.me which points to a lisp-chat server running in the port 5558.

Alternative clients

If you want test this and don't have the Lisp requested, I have those alternatives for you:

On Python client, I wrote in a way only using ths stdlib avoiding pain to handle the dependency hell, so you can just call that:

$ python client.py

So finally... netcat. Yes! You can even just use netcat! An user called Chris in past days just logged in the server with the following message:

|16:30:37| [Chris]: Used netcad
|16:30:41| [Chris]: netcat*
|16:30:50| [Chris]: bye

So you can type netcat server.lerax.me 5558 and go on! I tested on my machine and works fine! The main reason is because the communication between server and client just use raw data. For better synchronization with text data from server while you typing, I suggest you to use a readline wrapper like rlwrap calling as rlwrap netcat server.lerax.me 5558.


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

2 Systems

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


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

2.1 lisp-chat

Author

Manoel Vilela

License

MIT

Description

An experimental chat irc-like

Version

0.2.0

Dependencies
Source

lisp-chat.asd (file)


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

2.2 lisp-chat/client

Author

Manoel Vilela

License

MIT

Description

An experimental chat irc-like: client

Version

0.2.0

Dependencies
Source

lisp-chat.asd (file)

Components

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

2.3 lisp-chat/server

Author

Manoel Vilela

Contact

manoel_vilela@engineer.com

License

MIT

Description

An experimental chat irc-like: server

Version

0.2.0

Dependencies
Source

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

Location

lisp-chat.asd

Systems

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

3.1.2 lisp-chat/client/config.lisp

Parent

lisp-chat/client (system)

Location

src/config.lisp

Packages

lisp-chat/config

Exported Definitions

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

3.1.3 lisp-chat/client/client.lisp

Dependency

config.lisp (file)

Parent

lisp-chat/client (system)

Location

src/client.lisp

Packages

lisp-chat/client

Exported Definitions

main (function)

Internal Definitions

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

3.1.4 lisp-chat/server/config.lisp

Parent

lisp-chat/server (system)

Location

src/config.lisp

Packages

lisp-chat/config

Exported Definitions

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

3.1.5 lisp-chat/server/server.lisp

Dependency

config.lisp (file)

Parent

lisp-chat/server (system)

Location

src/server.lisp

Packages

lisp-chat/server

Exported Definitions

main (function)

Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 lisp-chat/client

Source

client.lisp (file)

Use List
Exported Definitions

main (function)

Internal Definitions

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

4.2 lisp-chat/config

Source

config.lisp (file)

Use List

common-lisp

Used By List
Exported Definitions

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

4.3 lisp-chat/server

Source

server.lisp (file)

Use List
Exported Definitions

main (function)

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

Run application in debug mode with extra info in terminal

Package

lisp-chat/config

Source

config.lisp (file)

Special Variable: *host*

Host used in server and client

Package

lisp-chat/config

Source

config.lisp (file)

Special Variable: *port*

Default port

Package

lisp-chat/config

Source

config.lisp (file)


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

5.1.2 Functions

Function: main &key HOST PORT

Main function of client

Package

lisp-chat/client

Source

client.lisp (file)

Function: main &key HOST PORT

Well, this function run all the necessary shits.

Package

lisp-chat/server

Source

server.lisp (file)


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

5.2 Internal definitions


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

5.2.1 Special variables

Special Variable: *client-lock*
Package

lisp-chat/server

Source

server.lisp (file)

Special Variable: *clients*

List of clients

Package

lisp-chat/server

Source

server.lisp (file)

Special Variable: *commands-names*

Allowed command names to be called by client user

Package

lisp-chat/server

Source

server.lisp (file)

Special Variable: *day-names*

Day names

Package

lisp-chat/server

Source

server.lisp (file)

Special Variable: *io-lock*

I/O Mutex for avoid terminal race conditions

Package

lisp-chat/client

Source

client.lisp (file)

Special Variable: *message-semaphore*
Package

lisp-chat/server

Source

server.lisp (file)

Special Variable: *messages-log*

Messages log

Package

lisp-chat/server

Source

server.lisp (file)

Special Variable: *messages-stack*

Messages pending to be send by broadcasting

Package

lisp-chat/server

Source

server.lisp (file)

Special Variable: *server-nickname*

The server nickname

Package

lisp-chat/server

Source

server.lisp (file)

Special Variable: *uptime*

Uptime of server variable

Package

lisp-chat/server

Source

server.lisp (file)


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

5.2.2 Functions

Function: /help CLIENT &rest ARGS

Show a list of the available commands of lisp-chat

Package

lisp-chat/server

Source

server.lisp (file)

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 (file)

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 (file)

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 (file)

Function: /users CLIENT &rest ARGS

Return a list separated by commas of the currently logged users

Package

lisp-chat/server

Source

server.lisp (file)

Function: call-command CLIENT MESSAGE
Package

lisp-chat/server

Source

server.lisp (file)

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 (file)

Function: client-address INSTANCE
Function: (setf client-address) VALUE INSTANCE
Package

lisp-chat/server

Source

server.lisp (file)

Function: client-delete CLIENT

Delete a CLIENT from the list *clients*

Package

lisp-chat/server

Source

server.lisp (file)

Function: client-loop HOST PORT

Dispatch client threads for basic functioning system

Package

lisp-chat/client

Source

client.lisp (file)

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

lisp-chat/server

Source

server.lisp (file)

Function: client-p OBJECT
Package

lisp-chat/server

Source

server.lisp (file)

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 (file)

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 (file)

Function: client-sender SOCKET USERNAME

Routine to check new messages being typed by the user

Package

lisp-chat/client

Source

client.lisp (file)

Function: client-socket INSTANCE
Function: (setf client-socket) VALUE INSTANCE
Package

lisp-chat/server

Source

server.lisp (file)

Function: client-stream C

Select the stream IO from the client

Package

lisp-chat/server

Source

server.lisp (file)

Function: command-message CONTENT

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

Package

lisp-chat/server

Source

server.lisp (file)

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 (file)

Function: copy-client INSTANCE
Package

lisp-chat/server

Source

server.lisp (file)

Function: copy-message INSTANCE
Package

lisp-chat/server

Source

server.lisp (file)

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 (file)

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 (file)

Function: erase-last-line ()

Erase the last line by using ANSI Escape codes

Package

lisp-chat/client

Source

client.lisp (file)

Function: extract-params STRING
Package

lisp-chat/server

Source

server.lisp (file)

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 (file)

Function: get-time ()

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

Package

lisp-chat/server

Source

server.lisp (file)

Function: get-user-input USERNAME

Get the user input by using readline

Package

lisp-chat/client

Source

client.lisp (file)

Function: login SOCKET

Do the login of the application given a SOCKET instances

Package

lisp-chat/client

Source

client.lisp (file)

Function: make-client &key (NAME NAME) (SOCKET SOCKET) (ADDRESS ADDRESS)
Package

lisp-chat/server

Source

server.lisp (file)

Function: make-message &key (FROM FROM) (CONTENT CONTENT) (TIME TIME)
Package

lisp-chat/server

Source

server.lisp (file)

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 (file)

Function: message-content INSTANCE
Function: (setf message-content) VALUE INSTANCE
Package

lisp-chat/server

Source

server.lisp (file)

Function: message-from INSTANCE
Function: (setf message-from) VALUE INSTANCE
Package

lisp-chat/server

Source

server.lisp (file)

Function: message-p OBJECT
Package

lisp-chat/server

Source

server.lisp (file)

Function: message-time INSTANCE
Function: (setf message-time) VALUE INSTANCE
Package

lisp-chat/server

Source

server.lisp (file)

Function: push-message FROM CONTENT

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

Package

lisp-chat/server

Source

server.lisp (file)

Function: receive-message MESSAGE

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

Package

lisp-chat/client

Source

client.lisp (file)

Function: safe-client-thread CONNECTION

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

Package

lisp-chat/server

Source

server.lisp (file)

Function: send-message MESSAGE SOCKET

Send a MESSAGE string through a SOCKET instance

Package

lisp-chat/client

Source

client.lisp (file)

Function: send-message CLIENT MESSAGE

Send to CLIENT a MESSAGE :type string

Package

lisp-chat/server

Source

server.lisp (file)

Function: server-broadcast SOCKET

Call server-listener treating exceptional cases

Package

lisp-chat/client

Source

client.lisp (file)

Function: server-listener SOCKET

Routine to check new messages coming from the server

Package

lisp-chat/client

Source

client.lisp (file)

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 (file)

Function: socket-peer-address SOCKET

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

Package

lisp-chat/server

Source

server.lisp (file)

Function: split STRING DELIMITERP

Split a string by a delimiterp function character checking

Package

lisp-chat/server

Source

server.lisp (file)

Function: startswith STRING SUBSTRING

Check if STRING starts with SUBSTRING.

Package

lisp-chat/server

Source

server.lisp (file)


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

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 (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: name
Readers

client-name (function)

Writers

(setf client-name) (function)

Slot: socket
Readers

client-socket (function)

Writers

(setf client-socket) (function)

Slot: address
Readers

client-address (function)

Writers

(setf client-address) (function)

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 (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: from
Readers

message-from (function)

Writers

(setf message-from) (function)

Slot: content
Readers

message-content (function)

Writers

(setf message-content) (function)

Slot: time
Readers

message-time (function)

Writers

(setf message-time) (function)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L  
Index Entry  Section

F
File, Lisp, lisp-chat.asd: The lisp-chat․asd file
File, Lisp, lisp-chat/client/client.lisp: The lisp-chat/client/client․lisp file
File, Lisp, lisp-chat/client/config.lisp: The lisp-chat/client/config․lisp file
File, Lisp, lisp-chat/server/config.lisp: The lisp-chat/server/config․lisp file
File, Lisp, lisp-chat/server/server.lisp: The lisp-chat/server/server․lisp file

L
Lisp File, lisp-chat.asd: The lisp-chat․asd file
Lisp File, lisp-chat/client/client.lisp: The lisp-chat/client/client․lisp file
Lisp File, lisp-chat/client/config.lisp: The lisp-chat/client/config․lisp file
Lisp File, lisp-chat/server/config.lisp: The lisp-chat/server/config․lisp file
Lisp File, lisp-chat/server/server.lisp: The lisp-chat/server/server․lisp file
lisp-chat.asd: The lisp-chat․asd file
lisp-chat/client/client.lisp: The lisp-chat/client/client․lisp file
lisp-chat/client/config.lisp: The lisp-chat/client/config․lisp file
lisp-chat/server/config.lisp: The lisp-chat/server/config․lisp file
lisp-chat/server/server.lisp: The lisp-chat/server/server․lisp file

Jump to:   F   L  

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

A.2 Functions

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

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

/
/help: Internal functions
/log: Internal functions
/nick: Internal functions
/uptime: Internal functions
/users: Internal functions

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

D
debug-format: Internal functions

E
erase-last-line: Internal functions
extract-params: Internal functions

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

G
get-time: Internal functions
get-user-input: Internal functions

L
login: Internal functions

M
main: Exported functions
main: Exported functions
make-client: Internal functions
make-message: Internal functions
message-broadcast: Internal functions
message-content: Internal functions
message-from: Internal functions
message-p: Internal functions
message-time: Internal functions

P
push-message: Internal functions

R
receive-message: Internal functions

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

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

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

A.3 Variables

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

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

A
address: Internal structures

C
content: Internal structures

F
from: Internal structures

N
name: Internal structures

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

T
time: Internal structures

Jump to:   *  
A   C   F   N   S   T  

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

A.4 Data types

Jump to:   C   L   M   P   S  
Index Entry  Section

C
client: Internal structures

L
lisp-chat: The lisp-chat system
lisp-chat/client: The lisp-chat/client system
lisp-chat/client: The lisp-chat/client package
lisp-chat/config: The lisp-chat/config package
lisp-chat/server: The lisp-chat/server system
lisp-chat/server: The lisp-chat/server package

M
message: Internal structures

P
Package, lisp-chat/client: The lisp-chat/client package
Package, lisp-chat/config: The lisp-chat/config package
Package, lisp-chat/server: The lisp-chat/server package

S
Structure, client: Internal structures
Structure, message: Internal structures
System, lisp-chat: The lisp-chat system
System, lisp-chat/client: The lisp-chat/client system
System, lisp-chat/server: The lisp-chat/server system

Jump to:   C   L   M   P   S