Common Lisp Package: INTERCOM

README:

FUNCTION

Public

MESSAGE (TYPE BODY)

sends a message to the client

Private

ASSERT-SESSION

asserts that we're currently running in an environment which is sane for intercom requests/executions

CALL-REMOTE-PROCEDURE (RID NAME &REST ARGS)

calls the remote prodecure with name <name> and <args> as the arguments with <rid> as reference. assumes the special variable *store* exists

FETCH-AND-CLEAR-MESSAGES

fetches and clears the messages in the mailbox

GET-REMOTE-PROCEDURE (NAME)

returns the remote procedure for <name> or nil if the procedure doesn't exist.

IN-ACTIVE-REMOTE-PROCEDURE-P

returns non-nil if we are currently in a remote procedure with an active rid.

INTERCOM-VAR (VARIABLE)

returns <variable> from the session in *store*

MAKE-REMOTE-PROCEDURE-LAMBDA-FUNCTION (ARGUMENTS BODY)

builds the s-expression representation for the lambda function which can be called for the definition of a remote procedure. this handles the creation of the &key arguments.

PERFORM-CLOSE-REQUEST (RID)

closes the request for the rid.

PERFORM-INTERCOM-REQUEST (JSOWN-REQUEST)

performs an intercom request as described by <jsown-request>.

REGISTER-REMOTE-PROCEDURE (NAME FUNCTION)

registers the remote procedure for <name> to be <function>.

REMOVE-RID (RID)

removes the <rid> from the list of active rids

RID-ACTIVE-P (RID)

returns non-nil iff <rid> is active for the current user.

START-RID (RID)

sets <rid> to be active

Undocumented

SETFINTERCOM-VAR (VALUE VARIABLE)

TALK (&KEY)

MACRO

Public

DEFINE-REMOTE-PROCEDURE (NAME (&REST ARGUMENTS) &BODY BODY)

defines a remote procedure with <name> as the name to be called and <arguments> as the assumed arguments. if <name> is a symbol with only non- lower-case-p characters, then it is converted to lowercase.

Private

IN-INTERCOM-SESSION (&BODY BODY)

executes a hunchentoot request in an environment in which *store* is bound to the current store.

WITH-SESSION-LOCK ((PROTECTION-SYMBOL) &BODY BODY)

executes <body> in a piece of code in which the session is locked

VARIABLE

Private

*REMOTE-PROCEDURES*

contains all intercom remote procedures, the keywords being the matched string and the values being the corresponding function.

*RID*

variable which contains the request id in functions which represent the execution of a remote procedure.

*STORE*

contains a key-value store for the variables which *should* be in the session