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.1, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:05:54 2018 GMT+0.


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

1 Introduction

lisp-chat

Quicklisp dist

Lisp Chat

An experimental chat irc-like written in Lisp.

lisp-chat-screenshot

Installation

You'll need in your system:

Make sure that ~/.sbclrc has a entry calling to the Quicklisp setup.

(load "~/.quicklisp/setup.lisp")

Since that ~/.quicklisp is the Quicklisp instalation distribution, clone this repository with:

git clone https://www.github.com/ryukinix/lisp-chat.git ~/.quicklisp/local-projects/lisp-chat

Tip for Quicklisp

As I said, we'll need a proper instalation of Quicklisp to getting this running. To accomplish that, if you are not familiar with the CL ecossystem, I'll guide you in a simple way: clone the Quicklisp Client and execute the setup.lisp with sbcl --script setup.lisp.

In general Quicklisp distribution provide the folder ~/quicklisp instead of ~/.quicklisp, but I personally don't like it much. Make sure to synchronize with the quicklisp correct folder. Maybe will need change the .sblcrc file to accomplish that, since for default as I said quicklisp set ~/quicklisp folder.

Usage

Load the server

$ ./lisp-chat-server

Get a client

$ ./lisp-chat

You can easilly setup your own configuration of *port* and *domain* for running a new instance of the server and client. For now we have a instance of lisp-chat as example running. If you really want to runs locally, you can just change the *domain* variable to "localhost" as:

(require 'lisp-chat)
(setq lisp-chat-config:*domain* "localhost")

For Non-lispers

If you want test this and don't have the Lisp environment with SBCL and Quicklisp, I have two alternative choices 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 chat.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 ryukinix.tk 5558.


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

Author

Manoel Vilela

Contact

manoel_vilela@engineer.com

License

MIT

Description

An experimental chat irc-like

Version

0.1

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

lisp-chat (system)


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

3.1.2 lisp-chat/src/config.lisp

Parent

lisp-chat (system)

Location

src/config.lisp

Packages

lisp-chat-config

Exported Definitions

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

3.1.3 lisp-chat/src/client.lisp

Dependency

src/config.lisp (file)

Parent

lisp-chat (system)

Location

src/client.lisp

Packages

lisp-chat-client

Exported Definitions

main (function)

Internal Definitions

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

3.1.4 lisp-chat/src/server.lisp

Dependency

src/config.lisp (file)

Parent

lisp-chat (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-config

Source

src/config.lisp (file)

Use List

common-lisp

Used By List
Exported Definitions

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

4.2 lisp-chat-client

Source

src/client.lisp (file)

Use List
Exported Definitions

main (function)

Internal Definitions

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

4.3 lisp-chat-server

Source

src/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*
Package

lisp-chat-config

Source

src/config.lisp (file)

Special Variable: *host*
Package

lisp-chat-config

Source

src/config.lisp (file)

Special Variable: *port*
Package

lisp-chat-config

Source

src/config.lisp (file)


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

5.1.2 Functions

Function: main ()
Package

lisp-chat-client

Source

src/client.lisp (file)

Function: main ()

Well, this function run all the necessary shits.

Package

lisp-chat-server

Source

src/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-mutex*
Package

lisp-chat-server

Source

src/server.lisp (file)

Special Variable: *clients*
Package

lisp-chat-server

Source

src/server.lisp (file)

Special Variable: *commands-names*
Package

lisp-chat-server

Source

src/server.lisp (file)

Special Variable: *day-names*
Package

lisp-chat-server

Source

src/server.lisp (file)

Special Variable: *io-mutex*
Package

lisp-chat-client

Source

src/client.lisp (file)

Special Variable: *message-semaphore*
Package

lisp-chat-server

Source

src/server.lisp (file)

Special Variable: *messages-log*
Package

lisp-chat-server

Source

src/server.lisp (file)

Special Variable: *messages-stack*
Package

lisp-chat-server

Source

src/server.lisp (file)

Special Variable: *server-nickname*
Package

lisp-chat-server

Source

src/server.lisp (file)

Special Variable: *uptime*
Package

lisp-chat-server

Source

src/server.lisp (file)


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

5.2.2 Functions

Function: /help ()

Show a list of the available commands of lisp-chat

Package

lisp-chat-server

Source

src/server.lisp (file)

Function: /log &optional DEPTH

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

Package

lisp-chat-server

Source

src/server.lisp (file)

Function: /uptime ()

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

Package

lisp-chat-server

Source

src/server.lisp (file)

Function: /users ()

Return a list separated by commas of the currently logged users

Package

lisp-chat-server

Source

src/server.lisp (file)

Function: call-command-by-name STRING

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

src/server.lisp (file)

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

lisp-chat-server

Source

src/server.lisp (file)

Function: client-delete CLIENT

Delete a CLIENT from the list *clients*

Package

lisp-chat-server

Source

src/server.lisp (file)

Function: client-loop ()
Package

lisp-chat-client

Source

src/client.lisp (file)

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

lisp-chat-server

Source

src/server.lisp (file)

Function: client-p OBJECT
Package

lisp-chat-server

Source

src/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

src/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

src/server.lisp (file)

Function: client-sender SOCKET USERNAME
Package

lisp-chat-client

Source

src/client.lisp (file)

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

lisp-chat-server

Source

src/server.lisp (file)

Function: client-stream C

Select the stream IO from the client

Package

lisp-chat-server

Source

src/server.lisp (file)

Function: command-message CONTENT

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

Package

lisp-chat-server

Source

src/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

src/server.lisp (file)

Function: copy-client INSTANCE
Package

lisp-chat-server

Source

src/server.lisp (file)

Function: copy-message INSTANCE
Package

lisp-chat-server

Source

src/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

src/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

src/server.lisp (file)

Function: erase-last-line ()
Package

lisp-chat-client

Source

src/client.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

src/server.lisp (file)

Function: get-time ()

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

Package

lisp-chat-server

Source

src/server.lisp (file)

Function: get-user-input USERNAME
Package

lisp-chat-client

Source

src/client.lisp (file)

Function: login SOCKET
Package

lisp-chat-client

Source

src/client.lisp (file)

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

lisp-chat-server

Source

src/server.lisp (file)

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

lisp-chat-server

Source

src/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

src/server.lisp (file)

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

lisp-chat-server

Source

src/server.lisp (file)

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

lisp-chat-server

Source

src/server.lisp (file)

Function: message-p OBJECT
Package

lisp-chat-server

Source

src/server.lisp (file)

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

lisp-chat-server

Source

src/server.lisp (file)

Function: push-message FROM CONTENT

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

Package

lisp-chat-server

Source

src/server.lisp (file)

Function: receive-message MESSAGE
Package

lisp-chat-client

Source

src/client.lisp (file)

Function: safe-client-thread CONNECTION

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

Package

lisp-chat-server

Source

src/server.lisp (file)

Function: send-message MESSAGE SOCKET
Package

lisp-chat-client

Source

src/client.lisp (file)

Function: send-message CLIENT MESSAGE

Send to CLIENT a MESSAGE :type string

Package

lisp-chat-server

Source

src/server.lisp (file)

Function: server-broadcast SOCKET
Package

lisp-chat-client

Source

src/client.lisp (file)

Function: server-listener SOCKET
Package

lisp-chat-client

Source

src/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

src/server.lisp (file)

Function: socket-peer-address SOCKET

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

Package

lisp-chat-server

Source

src/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

src/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

src/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<dot>asd file
File, Lisp, lisp-chat/src/client.lisp: The lisp-chat/src/client<dot>lisp file
File, Lisp, lisp-chat/src/config.lisp: The lisp-chat/src/config<dot>lisp file
File, Lisp, lisp-chat/src/server.lisp: The lisp-chat/src/server<dot>lisp file

L
Lisp File, lisp-chat.asd: The lisp-chat<dot>asd file
Lisp File, lisp-chat/src/client.lisp: The lisp-chat/src/client<dot>lisp file
Lisp File, lisp-chat/src/config.lisp: The lisp-chat/src/config<dot>lisp file
Lisp File, lisp-chat/src/server.lisp: The lisp-chat/src/server<dot>lisp file
lisp-chat.asd: The lisp-chat<dot>asd file
lisp-chat/src/client.lisp: The lisp-chat/src/client<dot>lisp file
lisp-chat/src/config.lisp: The lisp-chat/src/config<dot>lisp file
lisp-chat/src/server.lisp: The lisp-chat/src/server<dot>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
/uptime: Internal functions
/users: Internal functions

C
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

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, /uptime: Internal functions
Function, /users: 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, 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

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

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-mutex*: 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-mutex*: 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-mutex*: 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-mutex*: 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 package
lisp-chat-config: The lisp-chat-config package
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

Jump to:   C   L   M   P   S