Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the lichat-serverlib Reference Manual, version 1.0.0, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 16:37:14 2021 GMT+0.
• Introduction | What lichat-serverlib is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
This is an implementation of the server-side protocol part of the Lichat protocol. It provides an extensible, transport-agnostic implementation that can be used to base a functional server on. All that the real server needs to take care of is the underlying connection establishment and reading.
You do not need this library if you are looking to implement a client. You don't need it if you're looking to implement a server either, but it will take care of a large part of the implementation tasks for you if you do use it.
In order to implement an actual server, you will want to do the following:
server
and connection
.connection
object.connection
and send them to process
.teardown-connection
that closes the connection to the client properly.send
specialised on your connection
subclass that handles the actual wire transmission of an update.For a simple illustrative example, see the lichat-tcp-server.
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The lichat-serverlib system |
Nicolas Hafner <shinmera@tymoon.eu>
Nicolas Hafner <shinmera@tymoon.eu>
(:git "https://github.com/shirakumo/lichat-serverlib.git")
zlib
Tools to help build a server using the lichat protocol.
1.0.0
lichat-serverlib.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
Next: The lichat-serverlib/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
lichat-serverlib.asd
lichat-serverlib (system)
Next: The lichat-serverlib/server-objects․lisp file, Previous: The lichat-serverlib․asd file, Up: Lisp files [Contents][Index]
lichat-serverlib (system)
package.lisp
Next: The lichat-serverlib/server-operations․lisp file, Previous: The lichat-serverlib/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
lichat-serverlib (system)
server-objects.lisp
Next: The lichat-serverlib/connection-maintenance․lisp file, Previous: The lichat-serverlib/server-objects․lisp file, Up: Lisp files [Contents][Index]
server-objects.lisp (file)
lichat-serverlib (system)
server-operations.lisp
Next: The lichat-serverlib/update-handlers․lisp file, Previous: The lichat-serverlib/server-operations․lisp file, Up: Lisp files [Contents][Index]
server-operations.lisp (file)
lichat-serverlib (system)
connection-maintenance.lisp
Next: The lichat-serverlib/emotes․lisp file, Previous: The lichat-serverlib/connection-maintenance․lisp file, Up: Lisp files [Contents][Index]
connection-maintenance.lisp (file)
lichat-serverlib (system)
update-handlers.lisp
Next: The lichat-serverlib/documentation․lisp file, Previous: The lichat-serverlib/update-handlers․lisp file, Up: Lisp files [Contents][Index]
update-handlers.lisp (file)
lichat-serverlib (system)
emotes.lisp
Previous: The lichat-serverlib/emotes․lisp file, Up: Lisp files [Contents][Index]
emotes.lisp (file)
lichat-serverlib (system)
documentation.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The lichat-serverlib package |
package.lisp (file)
org.shirakumo.lichat.serverlib
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables | ||
• Exported macros | ||
• Exported compiler macros | ||
• Exported functions | ||
• Exported generic functions | ||
• Exported conditions | ||
• Exported classes |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
emotes.lisp (file)
Next: Exported compiler macros, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
Easy wrapper to define a handler method for an update on a connection.
UPDATE is coerced to a symbol found in the LICHAT-PROTOCOL
package.
This creates a PROCESS method.
See PROCESS
update-handlers.lisp (file)
Next: Exported functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
connection-maintenance.lisp (file)
Next: Exported generic functions, Previous: Exported compiler macros, Up: Exported definitions [Contents][Index]
emotes.lisp (file)
emotes.lisp (file)
Checks whether the CHANNEL field is a valid channel.
If the channel does not exist, a FAILURE-CONDITION for a
LICHAT-PROTOCOL:NO-SUCH-CHANNEL failure is signalled. If it
does exist, but the user is not a part of it, a FAILURE
CONDITION for a LICHAT-PROTOCOL:NOT-IN-CHANNEL failure is
signalled. Otherwise, the corresponding channel object is
returned.
This is in accordance with §5.1.5 §5.4.2 §5.4.3 §5.4.4 §5.4.5
See LICHAT-PROTOCOL:NO-SUCH-CHANNEL
See LICHAT-PROTOCOL:NOT-IN-CHANNEL
See FIND-CHANNEL
server-operations.lisp (file)
Checks whether the CHANNEL field has a valid, unused name.
If the channel name is malformed, a FAILURE-CONDITION for
a LICHAT-PROTOCOL:BAD-NAME failure is signalled. If it is
valid, but a channel of that name already exists, a FAILURE-
CONDITION for a LICHAT-PROTOCOL:CHANNELNAME-TAKEN failure is
signalled.
This is in accordance with §5.1.3 §5.3.2
See LICHAT-PROTOCOL:BAD-NAME
See LICHAT-PROTOCOL:CHANNELNAME-TAKEN
See FIND-CHANNEL
See LICHAT-PROTOCOL:CHANNELNAME-P
server-operations.lisp (file)
Checks whether the FROM field matches the update.
If it is not, a FAILURE-CONDITION for a LICHAT-PROTOCOL:
USERNAME-MISMATCH failure is signalled. If it is, the
corresponding user object is returned.
This is in accordance with §5.1.4
See LICHAT-PROTOCOL:USERNAME-MISMATCH
See FIND-USER
server-operations.lisp (file)
Checks whether the given update is permitted.
If it is not, a FAILURE-CONDITION for a LICHAT-PROTOCOL:
INSUFFICIENT-PERMISSIONS failure is signalled.
This is in accordance with §5.1.7
See PERMITTED
See LICHAT-PROTOCOL:INSUFFICIENT-PERMISSIONS
server-operations.lisp (file)
Checks whether the TARGET field is a valid user.
If it is not, a FAILURE-CONDITION for a LICHAT-PROTOCOL:
NO-SUCH-USER failure is signalled. If it is, the
corresponding user object is returned.
This is in accordance with §5.1.6
See LICHAT-PROTOCOL:NO-SUCH-USER
See FIND-USER
server-operations.lisp (file)
Attempt to coerce the name-ish to a channel name.
Valid types are:
LICHAT-PROTOCOL:CHANNEL-UPDATE
LICHAT-PROTOCOL:CHANNEL
STRING
server-objects.lisp (file)
Attempt to coerce the name-ish to a user name.
Valid types are:
LICHAT-PROTOCOL:UPDATE
LICHAT-PROTOCOL:USER
STRING
server-objects.lisp (file)
emotes.lisp (file)
Signal a FAILURE-CONDITION that carries the designated failure and sends it off to the client.
See FAILURE-CONDITION
connection-maintenance.lisp (file)
Returns true if the action on the channel by the user is permitted.
Action should be the class-name of an update.
See RULE-PERMITTED
See LICHAT-PROTOCOL:PERMISSIONS
server-operations.lisp (file)
Prepare the list of permissions rule for the registrant.
server-operations.lisp (file)
emotes.lisp (file)
Checks whether the given rule allows the user of the given name access.
The rule evaluation is implemented according to §2.5
server-operations.lisp (file)
Convenience function to send an update to a connection.
Specifically, this will:
* Coerce the type-ish to a protocol type by looking the symbol
up in the lichat-protocol package.
* Add the :FROM initarg if it does not yet exist by using the
connection’s server’s name.
See SEND
connection-maintenance.lisp (file)
Next: Exported conditions, Previous: Exported functions, Up: Exported definitions [Contents][Index]
Returns T if the object is still considered to be alive.
server-objects.lisp (file)
automatically generated reader method
server-objects.lisp (file)
automatically generated writer method
server-objects.lisp (file)
automatically generated reader method
server-objects.lisp (file)
automatically generated writer method
server-objects.lisp (file)
Accessor to the hash-table of channels that exist on the server.
See SERVER
(setf channels) (generic function)
automatically generated reader method
server-objects.lisp (file)
channels (generic function)
automatically generated writer method
server-objects.lisp (file)
connection-maintenance.lisp (file)
Creates an appropriate channel object for the registrant on the server.
If NAME is NIL, a random ID with an @ prefix is chosen
that does not already exist on the server.
If NAME is STRING= to the name of the server, a primary
channel is created.
Otherwise a regular channel is created.
This is in accordance to §2.4
Note that this will /not/ check whether a channel of the
given name already exists and will instead just replace
it.
See PREP-PERMS
See LICHAT-PROTOCOL:CREATE
See MAKE-CHANNEL
See FIND-CHANNEL
See LICHAT-PROTOCOL:*DEFAULT-ANONYMOUS-CHANNEL-PERMISSIONS*
See LICHAT-PROTOCOL:*DEFAULT-PRIMARY-CHANNEL-PERMISSIONS*
See LICHAT-PROTOCOL:*DEFAULT-REGULAR-CHANNEL-PERMISSIONS*
server-operations.lisp (file)
automatically generated reader method
server-objects.lisp (file)
automatically generated writer method
server-objects.lisp (file)
The initargs of the failure update that should be constructed to relay this error to the client.
See FAILURE-CONDITION
connection-maintenance.lisp (file)
The type of the failure update that should be constructed to relay this error to the client.
See FAILURE-CONDITION
connection-maintenance.lisp (file)
Accesses a channel by the given name-ish on the server.
See COERCE-CHANNELNAME
See CHANNELS
See REMOVE-CHANNEL
(setf find-channel) (generic function)
server-objects.lisp (file)
find-channel (generic function)
server-objects.lisp (file)
Accesses a profile by the given name-ish on the server.
See COERCE-USERNAME
See PROFILES
See REMOVE-PROFILE
(setf find-profile) (generic function)
server-objects.lisp (file)
server-objects.lisp (file)
find-profile (generic function)
server-objects.lisp (file)
Accesses a user by the given name-ish on the server.
See COERCE-USERNAME
See USERS
See REMOVE-USER
(setf find-user) (generic function)
server-objects.lisp (file)
find-user (generic function)
server-objects.lisp (file)
Accessor to the number of seconds for which a flood frame lasts.
See FLOOD-PROTECTED-SERVER
(setf flood-frame) (generic function)
automatically generated reader method
server-objects.lisp (file)
flood-frame (generic function)
automatically generated writer method
server-objects.lisp (file)
Accessor to the number of updates that can be received within a frame before the connection is limited.
See FLOOD-PROTECTED-SERVER
(setf flood-limit) (generic function)
automatically generated reader method
server-objects.lisp (file)
flood-limit (generic function)
automatically generated writer method
server-objects.lisp (file)
Accessor to the number of updates that were processed within the last frame.
See FLOOD-PROTECTED-CONNECTION
(setf frame-count) (generic function)
automatically generated reader method
server-objects.lisp (file)
frame-count (generic function)
automatically generated writer method
server-objects.lisp (file)
Accessor to the number of seconds a connection can be idle before it is considered timed out.
See SERVER
(setf idle-timeout) (generic function)
automatically generated reader method
server-objects.lisp (file)
idle-timeout (generic function)
automatically generated writer method
server-objects.lisp (file)
Registers the connection on the server and prepares it for use.
This corresponds to §4.1.8 to §4.1.12 with the additional
act that a related profile’s timeout is reset, if such a
profile is found.
See RESET-TIMEOUT
server-operations.lisp (file)
Join a user to a channel.
Note that this will /not/ check whether the user is already in the channel or not and will just join them regardless.
A JOIN update is sent to all channel inhabitants, with the
given ID, or a fresh one if none is given.
The channel’s timeout is reset.
See LICHAT-PROTOCOL:JOIN
See LICHAT-PROTOCOL:NEXT-ID
See RESET-TIMEOUT
server-operations.lisp (file)
server-operations.lisp (file)
automatically generated reader method
server-objects.lisp (file)
automatically generated writer method
server-objects.lisp (file)
Accessor to the last frame number the connection handled.
See FLOOD-PROTECTED-CONNECTION
(setf last-frame) (generic function)
automatically generated reader method
server-objects.lisp (file)
last-frame (generic function)
automatically generated writer method
server-objects.lisp (file)
Accessor to the universal-time of when the last update was processed on the connection.
See CONNECTION
(setf last-update) (generic function)
automatically generated reader method
server-objects.lisp (file)
last-update (generic function)
automatically generated writer method
server-objects.lisp (file)
Leave a user from a channel.
Note that this will /not/ check whether the user actually is in the channel or not and will just leave them regardless.
A LEAVE update is sent to all channel inhabitants, with the
given ID, or a fresh one if none is given.
If no users remain, the channel’s timeout is started.
If NOTIFY-SELF is NIL, the LEAVE update is sent to every channel inhabitant other than the user leaving. Otherwise, the update is sent to everyone including the one leaving.
See LICHAT-PROTOCOL:LEAVE
See LICHAT-PROTOCOL:NEXT-ID
See START-TIMEOUT
server-operations.lisp (file)
server-operations.lisp (file)
Return a fresh list of all known channel objects for the server.
See CHANNEL
server-objects.lisp (file)
server-objects.lisp (file)
Return a fresh list of all known profile objects for the server.
See PROFILE
server-objects.lisp (file)
Construct an appropriate channel object for the server.
See CHANNEL
server-objects.lisp (file)
Construct an appropriate connection object for the server.
See CONNECTION
server-objects.lisp (file)
server-objects.lisp (file)
Construct an appropriate user object for the server.
See PROFILE
server-objects.lisp (file)
Construct an appropriate user object for the server.
See USER
server-objects.lisp (file)
Updates flood information for the connection and returns whether the connection is fine or not.
See FLOOD-PROTECTED-CONNECTION
See PROCESS
connection-maintenance.lisp (file)
connection-maintenance.lisp (file)
automatically generated reader method
server-objects.lisp (file)
server-objects.lisp (file)
server-objects.lisp (file)
Process an update source on a connection.
Sources that are accepted:
* STREAM – An update is read from the stream
and sent off to PROCESS again.
* LICHAT-PROTOCOL:UPDATE – The update is handled accordingly.
If an error of type FAILURE-CONDITION is signalled during the
evaluation of non-around methods, the encapsulated failure update
is sent to the connection. If an error of type LICHAT-PROTOCOL:
PROTOCOL-CONDITION is signalled during the evaluation of non-around
methods, an update of type LICHAT-PROTOCOL:FAILURE is sent to the
connection.
A CONTINUE restart is established around the method that can be
used to respond with a generic LICHAT-PROTOCOL:UPDATE-FAILURE
and return from the PROCESS method.
This method will also take care to handle flooding and timeout
recording for the connection.
The overarching server must establish a restart called CLOSE-
CONNECTION around the PROCESS method, or around all calls of it.
When this restart is invoked, the server must close the underlying
connection.
See LICHAT-PROTOCOL:FROM-WIRE
See LICHAT-PROTOCOL:PROTOCOL-CONDITION
See LICHAT-PROTOCOL:UPDATE-FAILURE
See FAILURE-CONDITION
emotes.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
update-handlers.lisp (file)
connection-maintenance.lisp (file)
connection-maintenance.lisp (file)
connection-maintenance.lisp (file)
Accessor to the hash-table of profiles that exist on the server.
See SERVER
(setf profiles) (generic function)
automatically generated reader method
server-objects.lisp (file)
profiles (generic function)
automatically generated writer method
server-objects.lisp (file)
automatically generated reader method
server-objects.lisp (file)
automatically generated writer method
server-objects.lisp (file)
Register a user profile.
Note that this will /not/ check whether the associated user
actually exists on the server or not and will just create
the profile regardless.
See FIND-PROFILE
See MAKE-PROFILE
See LICHAT-PROTOCOL:REGISTER
server-operations.lisp (file)
Removes the channel by the given name from the server.
See COERCE-CHANNELNAME
See CHANNELS
See FIND-CHANNEL
server-objects.lisp (file)
Removes the profile by the given name-ish from the server.
See COERCE-USERNAME
See PROFILES
See FIND-PROFILE
server-objects.lisp (file)
Removes the user by the given name-ish from the server.
See COERCE-USERNAME
See USERS
See FIND-USER
server-objects.lisp (file)
Resets the timeout to never occur.
See TIMEOUTABLE
server-objects.lisp (file)
Send an update to a place.
Places that are accepted:
* CONNECTION – Directly sends the update over the wire. Note
that the primary method for this must be
implemented by the overarching server.
* USER – Relays the update to all connections of the user.
* CHANNEL – Relays the update to all users in the channel.
This function has to be called in a regular interval by the
overarching server. It will take care of handling connection
timeouts and will close the connection in case of one.
See CONNECTION
See USER
See CHANNEL
connection-maintenance.lisp (file)
connection-maintenance.lisp (file)
connection-maintenance.lisp (file)
connection-maintenance.lisp (file)
Accessor to the connection’s server.
See CONNECTION
(setf server) (generic function)
automatically generated reader method
server-objects.lisp (file)
server (generic function)
automatically generated writer method
server-objects.lisp (file)
server-objects.lisp (file)
Starts the timeout by setting the object’s TIMEOUT slot to the correct time.
See TIMEOUTABLE
See LICHAT-PROTOCOL:LIFETIME
server-objects.lisp (file)
Removes and cleans up the connection on the server.
This corresponds to §4.3.3 to §4.3.4 with the additional
act that a related profile’s timeout is started, if such a
profile is found.
See START-TIMEOUT
server-operations.lisp (file)
The universal-time by which the object will be invalidated, if any.
See TIMEOUTABLE
(setf timeout) (generic function)
automatically generated reader method
server-objects.lisp (file)
timeout (generic function)
automatically generated writer method
server-objects.lisp (file)
Accessor to the hash-table of users that exist on the server.
See SERVER
(setf users) (generic function)
automatically generated reader method
server-objects.lisp (file)
users (generic function)
automatically generated writer method
server-objects.lisp (file)
Next: Exported classes, Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
Wrapper condition to carry a failure update.
See FAILURE-TYPE
See FAILURE-ARGS
See FAIL!
connection-maintenance.lisp (file)
error (condition)
severe-failure-condition (condition)
:type
failure-type (generic function)
:args
failure-args (generic function)
Previous: Exported conditions, Up: Exported definitions [Contents][Index]
server-objects.lisp (file)
channel (class)
(lichat-serverlib::make-ring 100)
backlog (generic function)
(setf backlog) (generic function)
(make-hash-table :test (quote eq))
join-times (generic function)
(setf join-times) (generic function)
A server-side channel object.
See LICHAT-PROTOCOL:CHANNEL See TIMEOUTABLE
server-objects.lisp (file)
backlogged-channel (class)
The representation of a client connection.
See SERVER
See LAST-UPDATE
See LICHAT-PROTOCOL:CONNECTION
server-objects.lisp (file)
connection (class)
flood-protected-connection (class)
:server
server (generic function)
(setf server) (generic function)
(get-universal-time)
last-update (generic function)
(setf last-update) (generic function)
:read-limit
read-limit (generic function)
(setf read-limit) (generic function)
Initarg | Value |
---|---|
:server | nil |
A connection with basic time-frame flood-protection.
See CONNECTION
See LAST-FRAME
See FRAME-COUNT
server-objects.lisp (file)
connection (class)
0
last-frame (generic function)
(setf last-frame) (generic function)
0
frame-count (generic function)
(setf frame-count) (generic function)
A server with basic time-frame flood-protection.
See SERVER
See FLOOD-FRAME
See FLOOD-LIMIT
server-objects.lisp (file)
server (class)
:flood-frame
flood-frame (generic function)
(setf flood-frame) (generic function)
:flood-limit
flood-limit (generic function)
(setf flood-limit) (generic function)
Initarg | Value |
---|---|
:flood-frame | 30 |
:flood-limit | 40 |
A server-side profile object
See LICHAT-PROTOCOL:PROFILE See TIMEOUTABLE
server-objects.lisp (file)
simple-profile (class)
An object representation of the server.
See USER
See USERS
See PROFILES
See CHANNELS
See IDLE-TIMEOUT
server-objects.lisp (file)
user (class)
flood-protected-server (class)
(make-hash-table :test (quote equal))
users (generic function)
(setf users) (generic function)
(make-hash-table :test (quote equal))
profiles (generic function)
(setf profiles) (generic function)
(make-hash-table :test (quote equal))
channels (generic function)
(setf channels) (generic function)
:idle-timeout
idle-timeout (generic function)
(setf idle-timeout) (generic function)
:allowed-content-types
allowed-content-types (generic function)
(setf allowed-content-types) (generic function)
:default-read-limit
default-read-limit (generic function)
(setf default-read-limit) (generic function)
Initarg | Value |
---|---|
:idle-timeout | 120 |
:allowed-content-types | nil |
:default-read-limit | nil |
Superclass for objects that can be invalidated through a timeout.
See TIMEOUT
See START-TIMEOUT
See RESET-TIMEOUT
See ALIVE-P
server-objects.lisp (file)
standard-object (class)
:timeout
timeout (generic function)
(setf timeout) (generic function)
A server-side user object
See LICHAT-PROTOCOL:USER
server-objects.lisp (file)
user (class)
server (class)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables | ||
• Internal functions | ||
• Internal conditions | ||
• Internal classes |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
emotes.lisp (file)
Next: Internal conditions, Previous: Internal special variables, Up: Internal definitions [Contents][Index]
emotes.lisp (file)
emotes.lisp (file)
connection-maintenance.lisp (file)
server-objects.lisp (file)
Next: Internal classes, Previous: Internal functions, Up: Internal definitions [Contents][Index]
connection-maintenance.lisp (file)
failure-condition (condition)
Previous: Internal conditions, Up: Internal definitions [Contents][Index]
server-objects.lisp (file)
profile (class)
password (generic function)
(setf password) (generic function)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L |
---|
Jump to: | F L |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
A B C D E F G I J L M P R S T U |
---|
Jump to: | (
A B C D E F G I J L M P R S T U |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
A B C D F I J L P R S T U |
---|
Jump to: | *
A B C D F I J L P R S T U |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | B C F L P S T U |
---|
Jump to: | B C F L P S T U |
---|