diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-01-20 14:29:02 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-01-20 14:29:02 +0000 |
commit | 43a44c7faf94133305a7afd627b3d009a60aa371 (patch) | |
tree | 10cc5a0da61ecd5d2e273abedc43decc1d43fbfb /src/client/rspamdclient.h | |
parent | adc6e8a159ce05cc65f7b4d6f4a6b006300877b0 (diff) | |
download | rspamd-43a44c7faf94133305a7afd627b3d009a60aa371.tar.gz rspamd-43a44c7faf94133305a7afd627b3d009a60aa371.zip |
Write the new client library.
Diffstat (limited to 'src/client/rspamdclient.h')
-rw-r--r-- | src/client/rspamdclient.h | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/src/client/rspamdclient.h b/src/client/rspamdclient.h index a274426fa..6d6a8d469 100644 --- a/src/client/rspamdclient.h +++ b/src/client/rspamdclient.h @@ -27,17 +27,18 @@ #include "config.h" #include "ucl.h" +struct rspamd_client_connection; + /** - * Callback is called on client request completed + * Callback is called on client connection completed * @param name name of server * @param port port for server * @param result result object * @param ud opaque user data - * @param err error pointer (should be freed if not NULL) + * @param err error pointer */ typedef void (*rspamd_client_callback) ( const gchar *name, - guint16 port, ucl_object_t *result, gpointer ud, GError *err); @@ -46,22 +47,39 @@ typedef void (*rspamd_client_callback) ( * Start rspamd worker or controller command * @param ev_base event base * @param name server name (hostname or unix socket) - * @param command command name - * @param attrs additional attributes * @param port port number (in host order) * @param timeout timeout in seconds - * @param in input file or NULL if no input required - * @param ud opaque user data * @return */ -gboolean rspamd_client_command ( +struct rspamd_client_connection* rspamd_client_init ( struct event_base *ev_base, const gchar *name, guint16 port, + gdouble timeout); + +/** + * + * @param conn connection object + * @param command command name + * @param attrs additional attributes + * @param in input file or NULL if no input required + * @param cb callback to be called on command completion + * @param ud opaque user data + * @return + */ +gboolean rspamd_client_command ( + struct rspamd_client_connection *conn, const gchar *command, GHashTable *attrs, - gdouble timeout, FILE *in, - gpointer ud); + rspamd_client_callback cb, + gpointer ud, + GError **err); + +/** + * Destroy a connection to rspamd + * @param conn + */ +void rspamd_client_destroy (struct rspamd_client_connection *conn); #endif /* RSPAMDCLIENT_H_ */ |