/*++ /* NAME /* attr_clnt 3 /* SUMMARY /* attribute query-reply client /* SYNOPSIS /* #include <attr_clnt.h> /* /* typedef int (*ATTR_CLNT_PRINT_FN) (VSTREAM *, int, va_list); /* typedef int (*ATTR_CLNT_SCAN_FN) (VSTREAM *, int, va_list); /* typedef int (*ATTR_CLNT_HANDSHAKE_FN) (VSTREAM *); /* /* ATTR_CLNT *attr_clnt_create(server, timeout, max_idle, max_ttl) /* const char *server; /* int timeout; /* int max_idle; /* int max_ttl; /* /* int attr_clnt_request(client, /* send_flags, send_type, send_name, ..., ATTR_TYPE_END, /* recv_flags, recv_type, recv_name, ..., ATTR_TYPE_END) /* ATTR_CLNT *client; /* int send_flags; /* int send_type; /* const char *send_name; /* int recv_flags; /* int recv_type; /* const char *recv_name; /* /* void attr_clnt_free(client) /* ATTR_CLNT *client; /* /* void attr_clnt_control(client, name, value, ... ATTR_CLNT_CTL_END) /* ATTR_CLNT *client; /* int name; /* DESCRIPTION /* This module implements a client for a simple attribute-based /* protocol. The default protocol is described in attr_scan_plain(3). /* /* attr_clnt_create() creates a client handle. See auto_clnt(3) for /* a description of the arguments. /* /* attr_clnt_request() sends the specified request attributes and /* receives a reply. The reply argument specifies a name-value table. /* The other arguments are as described in attr_print_plain(3). The /* result is the number of attributes received or -1 in case of trouble. /* /* attr_clnt_free() destroys a client handle and closes its connection. /* /* attr_clnt_control() allows the user to fine tune the behavior of /* the specified client. The arguments are a list of (name, value) /* terminated with ATTR_CLNT_CTL_END. /* The following lists the names and the types of the corresponding /* value arguments. /* .IP "ATTR_CLNT_CTL_PROTO(ATTR_CLNT_PRINT_FN, ATTR_CLNT_SCAN_FN)" /* Specifies alternatives for the attr_plain_print() and /* attr_plain_scan() functions. /* .IP "ATTR_CLNT_CTL_REQ_LIMIT(int)" /* The maximal number of requests per connection (default: 0, /* i.e. no limit). To enable the limit, specify a value greater /* than zero. /* .IP "ATTR_CLNT_CTL_TRY_LIMIT(int)" /* The maximal number of attempts to send a request before /* giving up (default: 2). To disable the limit, specify a /* value equal to zero. /* .IP "ATTR_CLNT_CTL_TRY_DELAY(int)" /* The time in seconds between attempts to send a request /* (default: 1). Specify a value greater than zero. /* .IP "ATTR_CLNT_CTL_HANDSHAKE(VSTREAM *)" /* A pointer to function that will be called at the start of a /* new connection, and that returns 0 in case of success. /* DIAGNOSTICS /* Warnings: communication failure. /* SEE ALSO /* auto_clnt(3), client endpoint management /* attr_scan_plain(3), attribute protocol /* attr_print_plain(3), attribute protocol /* 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 /* /* Wietse Venema /* Google, Inc. /* 111 8th Avenue /* New York, NY 10011, USA
/*--*/
struct ATTR_CLNT {
AUTO_CLNT *auto_clnt; /* Remaining properties are set with attr_clnt_control(). */
ATTR_CLNT_PRINT_FN print;
ATTR_CLNT_SCAN_FN scan; int req_limit; int req_count; int try_limit; int try_delay;
};
int attr_clnt_request(ATTR_CLNT *client, int send_flags,...)
{ constchar *myname = "attr_clnt_request";
VSTREAM *stream; int count = 0;
va_list saved_ap;
va_list ap; int type; int recv_flags; int err; int ret;
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.