You are looking at historical revision 14356 of this page. It may differ significantly from its current revision.
dict
Description
Pure scheme implementation of a rfc2229 protocol client. This is a rewrite of the dict.egg available for chicken 3.x which was a wrapper around libdict.
Author
Download
Requirements
Requires the defstruct extension
Documentation
This extension provides a set of procedures, that can be used to communicate with dict-servers. At the moment of this writing it supports almost all commands of the dict-protocol. authentication and mime-headers are currently not supported, but will be once the needed extensions are available.
Connect/Disconnect
- <procedure>(connect server #!key (port (*default-port*)) (client "dict.eg for chicken scheme") (timeout #f)) => CONNECTION</procedure>
Connects to the dict-server with the specified port or the default-port as specified in rfc22229 (2628). Once the connection is established, the server's banner is parsed and information are extracted. Finally the procedure issues a client-command with the specified client-string as parameter. The value for timout is directly used to set the timeout for tcp-connect. The procedure returns a connection-object on success and signals an error otherwise.
- <procedure>(disconnect CONNECTION) => BOOL</procedure>
Closes the connection represented by CONNECTION and sets its status status do disconnected. Returns #t if the connection was closes successfully and false otherwise.
Status-responses
In case of an error the command-procedures return the status-response send by the server. In order to identify a status or present an error-message to the user, there are procedures that deal with status-response-objects
- <procedure>(status-response? RESP) => BOOL </procedure>
Check if a response is a status-response.
- <procedure>(response-status-error? STATUS-RESPONSE) => BOOL </procedure>
Checks if the given status-response represents an error.
- <procedure>(response-status-code STATUS-RESPONSE) => FIXNUM</procedure>
Retrieve the status-code (a positive fixnum) of the STATUS-RESPONSE.
- <procedure>(response-status-message STATUS-RESPONSE) => STRING</procedure>
Retrieve the textual information send by the server for this STATUS-RESPONSE
- <procedure>(response-status-code->string FIXNUM) => STRING</procedure>
Map status-codes to textual-representation as specified in rfc2229
Status-Response-Predicates
For each status-response-type there is a predicate that checks whether a given status-response represents that specific type. See the list of status-predicates at the end of this documentation.
Commands
Example
List of status-predicates
- status:n-databases-present?
- status:n-strategies-present?
- status:database-information-follows?
- status:help-text-follows?
- status:server-information-follows?
- status:challenge-follows?
- status:n-definitions-retrieved?
- status:word-database-name?
- status:n-matches-retrieved?
- status:statistic?
- status:banner?
- status:closing-connection?
- status:authentication-successful?
- status:ok?
- status:send-response?
- status:server-temporarily-unavailable?
- status:shutdown-at-op-request?
- status:syntax-error-command?
- status:syntax-error-parameter?
- status:command-not-implemented?
- status:parameter-not-implemented?
- status:access-denied?
- status:access-denied-show-info?
- status:access-denied-unknown-mech?
- status:invalid-database?
- status:invalid-strategy?
- status:no-match?
- status:no-database-present?
- status:no-strategies-present?