/*++ /* NAME /* anvil_clnt 3 /* SUMMARY /* connection count and rate management client interface /* SYNOPSIS /* #include <anvil_clnt.h> /* /* ANVIL_CLNT *anvil_clnt_create(void) /* /* void anvil_clnt_free(anvil_clnt) /* ANVIL_CLNT *anvil_clnt; /* /* int anvil_clnt_connect(anvil_clnt, service, addr, /* count, rate) /* ANVIL_CLNT *anvil_clnt; /* const char *service; /* const char *addr; /* int *count; /* int *rate; /* /* int anvil_clnt_mail(anvil_clnt, service, addr, msgs) /* ANVIL_CLNT *anvil_clnt; /* const char *service; /* const char *addr; /* int *msgs; /* /* int anvil_clnt_rcpt(anvil_clnt, service, addr, rcpts) /* ANVIL_CLNT *anvil_clnt; /* const char *service; /* const char *addr; /* int *rcpts; /* /* int anvil_clnt_newtls(anvil_clnt, service, addr, newtls) /* ANVIL_CLNT *anvil_clnt; /* const char *service; /* const char *addr; /* int *newtls; /* /* int anvil_clnt_newtls_stat(anvil_clnt, service, addr, newtls) /* ANVIL_CLNT *anvil_clnt; /* const char *service; /* const char *addr; /* int *newtls; /* /* int anvil_clnt_auth(anvil_clnt, service, addr, auths) /* ANVIL_CLNT *anvil_clnt; /* const char *service; /* const char *addr; /* int *auths; /* /* int anvil_clnt_disconnect(anvil_clnt, service, addr) /* ANVIL_CLNT *anvil_clnt; /* const char *service; /* const char *addr; /* /* int anvil_clnt_lookup(anvil_clnt, service, addr, count, /* rate, msgs, rcpts, ntls, auths) /* ANVIL_CLNT *anvil_clnt; /* const char *service; /* const char *addr; /* int *count; /* int *rate; /* int *msgs; /* int *rcpts; /* int *ntls; /* int *auths; /* DESCRIPTION /* anvil_clnt_create() instantiates a local anvil service /* client endpoint. /* /* anvil_clnt_connect() informs the anvil server that a /* remote client has connected, and returns the current /* connection count and connection rate for that remote client. /* /* anvil_clnt_mail() registers a MAIL FROM event and /* returns the current MAIL FROM rate for the specified remote /* client. /* /* anvil_clnt_rcpt() registers a RCPT TO event and /* returns the current RCPT TO rate for the specified remote /* client. /* /* anvil_clnt_newtls() registers a remote client request /* to negotiate a new (uncached) TLS session and returns the /* current newtls request rate for the specified remote client. /* /* anvil_clnt_newtls_stat() returns the current newtls request /* rate for the specified remote client. /* /* anvil_clnt_auth() registers an AUTH event and returns the /* current AUTH event rate for the specified remote client. /* /* anvil_clnt_disconnect() informs the anvil server that a remote /* client has disconnected. /* /* anvil_clnt_lookup() returns the current count and rate /* information for the specified client. /* /* anvil_clnt_free() destroys a local anvil service client /* endpoint. /* /* Arguments: /* .IP anvil_clnt /* Client rate control service handle. /* .IP service /* The service that the remote client is connected to. /* .IP addr /* Null terminated string that identifies the remote client. /* .IP count /* Pointer to storage for the current number of connections from /* this remote client. /* .IP rate /* Pointer to storage for the current connection rate for this /* remote client. /* .IP msgs /* Pointer to storage for the current message rate for this /* remote client. /* .IP rcpts /* Pointer to storage for the current recipient rate for this /* remote client. /* .IP newtls /* Pointer to storage for the current "new TLS session" rate /* for this remote client. /* .IP auths /* Pointer to storage for the current AUTH event rate for this /* remote client. /* DIAGNOSTICS /* The update and status query routines return /* ANVIL_STAT_OK in case of success, ANVIL_STAT_FAIL otherwise /* (either the communication with the server is broken or the /* server experienced a problem). /* SEE ALSO /* anvil(8), connection/rate limiting /* 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
/*--*/
int anvil_clnt_lookup(ANVIL_CLNT *anvil_clnt, constchar *service, constchar *addr, int *count, int *rate, int *msgs, int *rcpts, int *newtls, int *auths)
{ char *ident = ANVIL_IDENT(service, addr); int status;
/* anvil_clnt_connect - heads-up and status query */
int anvil_clnt_connect(ANVIL_CLNT *anvil_clnt, constchar *service, constchar *addr, int *count, int *rate)
{ char *ident = ANVIL_IDENT(service, addr); int status;
staticvoid usage(void)
{
vstream_printf("usage: "
ANVIL_REQ_CONN " service addr | "
ANVIL_REQ_DISC " service addr | "
ANVIL_REQ_MAIL " service addr | "
ANVIL_REQ_RCPT " service addr | "
ANVIL_REQ_NTLS " service addr | "
ANVIL_REQ_NTLS_STAT " service addr | "
ANVIL_REQ_AUTH " service addr | "
ANVIL_REQ_LOOKUP " service addr\n");
}
int main(int unused_argc, char **argv)
{
VSTRING *inbuf = vstring_alloc(1); char *bufp; char *cmd;
ssize_t cmd_len; char *service; char *addr; int count; int rate; int msgs; int rcpts; int newtls; int auths;
ANVIL_CLNT *anvil;
msg_vstream_init(argv[0], VSTREAM_ERR);
mail_conf_read();
msg_info("using config files in %s", var_config_dir); if (chdir(var_queue_dir) < 0)
msg_fatal("chdir %s: %m", var_queue_dir);
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.