/*++ /* NAME /* dict_tcp 3 /* SUMMARY /* dictionary manager interface to tcp-based lookup tables /* SYNOPSIS /* #include <dict_tcp.h> /* /* DICT *dict_tcp_open(map, open_flags, dict_flags) /* const char *map; /* int open_flags; /* int dict_flags; /* DESCRIPTION /* dict_tcp_open() makes a TCP server accessible via the generic /* dictionary operations described in dict_open(3). /* The only implemented operation is dictionary lookup. This map /* type can be useful for simulating a dynamic lookup table. /* /* Map names have the form host:port. /* /* The TCP map class implements a very simple protocol: the client /* sends a request, and the server sends one reply. Requests and /* replies are sent as one line of ASCII text, terminated by the /* ASCII newline character. Request and reply parameters (see below) /* are separated by whitespace. /* ENCODING /* .ad /* .fi /* In request and reply parameters, the character % and any non-printing /* and whitespace characters must be replaced by %XX, XX being the /* corresponding ASCII hexadecimal character value. The hexadecimal codes /* can be specified in any case (upper, lower, mixed). /* REQUEST FORMAT /* .ad /* .fi /* Requests are strings that serve as lookup key in the simulated /* table. /* .IP "get SPACE key NEWLINE" /* Look up data under the specified key. /* .IP "put SPACE key SPACE value NEWLINE" /* This request is currently not implemented. /* REPLY FORMAT /* .ad /* .fi /* Replies must be no longer than 4096 characters including the /* newline terminator, and must have the following form: /* .IP "500 SPACE text NEWLINE" /* In case of a lookup request, the requested data does not exist. /* In case of an update request, the request was rejected. /* The text gives the nature of the problem. /* .IP "400 SPACE text NEWLINE" /* This indicates an error condition. The text gives the nature of /* the problem. The client should retry the request later. /* .IP "200 SPACE text NEWLINE" /* The request was successful. In the case of a lookup request, /* the text contains an encoded version of the requested data. /* SECURITY /* This map must not be used for security sensitive information, /* because neither the connection nor the server are authenticated. /* SEE ALSO /* dict(3) generic dictionary manager /* hex_quote(3) http-style quoting /* DIAGNOSTICS /* Fatal errors: out of memory, unknown host or service name, /* attempt to update or iterate over map. /* BUGS /* Only the lookup method is currently implemented. /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA
/*--*/
if (dict_tcp->fp)
(void) vstream_fclose(dict_tcp->fp); if (dict_tcp->raw_buf)
vstring_free(dict_tcp->raw_buf); if (dict_tcp->hex_buf)
vstring_free(dict_tcp->hex_buf); if (dict->fold_buf)
vstring_free(dict->fold_buf);
dict_free(dict);
}
/* dict_tcp_open - open TCP map */
DICT *dict_tcp_open(constchar *map, int open_flags, int dict_flags)
{
DICT_TCP *dict_tcp;
/* *Sanitychecks.
*/ if (dict_flags & DICT_FLAG_NO_UNAUTH) return (dict_surrogate(DICT_TYPE_TCP, map, open_flags, dict_flags, "%s:%s map is not allowed for security sensitive data",
DICT_TYPE_TCP, map)); if (open_flags != O_RDONLY) return (dict_surrogate(DICT_TYPE_TCP, map, open_flags, dict_flags, "%s:%s map requires O_RDONLY access mode",
DICT_TYPE_TCP, map));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.