X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Finclude%2Futils%2Funixsock.h;h=3a38acaeb774b9f33453e176ec556ddb35ef71e4;hp=31a423efb9907597308e4c691c38998b8219da65;hb=bef7167f0dc1fd405e35d5cbffb3c0820945a9ea;hpb=3a179f6f4ad2586325656b49bd9d5a53efc8700c diff --git a/src/include/utils/unixsock.h b/src/include/utils/unixsock.h index 31a423e..3a38aca 100644 --- a/src/include/utils/unixsock.h +++ b/src/include/utils/unixsock.h @@ -1,5 +1,5 @@ /* - * syscollector - src/include/utils/unixsock.h + * SysDB - src/include/utils/unixsock.h * Copyright (C) 2012 Sebastian 'tokkee' Harl * All rights reserved. * @@ -25,8 +25,8 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SC_UTILS_UNIXSOCK_H -#define SC_UTILS_UNIXSOCK_H 1 +#ifndef SDB_UTILS_UNIXSOCK_H +#define SDB_UTILS_UNIXSOCK_H 1 #include "core/object.h" #include "utils/data.h" @@ -39,46 +39,48 @@ extern "C" { #endif -struct sc_unixsock_client; -typedef struct sc_unixsock_client sc_unixsock_client_t; +struct sdb_unixsock_client; +typedef struct sdb_unixsock_client sdb_unixsock_client_t; -typedef int (*sc_unixsock_client_data_cb)(sc_unixsock_client_t *, - size_t, sc_data_t *, sc_object_t *); +typedef int (*sdb_unixsock_client_data_cb)(sdb_unixsock_client_t *, + size_t, sdb_data_t *, sdb_object_t *); -sc_unixsock_client_t * -sc_unixsock_client_create(const char *path); +sdb_unixsock_client_t * +sdb_unixsock_client_create(const char *path); int -sc_unixsock_client_connect(sc_unixsock_client_t *client); +sdb_unixsock_client_connect(sdb_unixsock_client_t *client); int -sc_unixsock_client_send(sc_unixsock_client_t *client, const char *msg); +sdb_unixsock_client_send(sdb_unixsock_client_t *client, + const char *msg); char * -sc_unixsock_client_recv(sc_unixsock_client_t *client, char *buffer, size_t buflen); +sdb_unixsock_client_recv(sdb_unixsock_client_t *client, + char *buffer, size_t buflen); /* - * sc_unixsock_client_process_lines: + * sdb_unixsock_client_process_lines: * Reads up to 'max_lines' lines from the socket, splits each line at the * specified 'delim' and passes the data on to the specified 'callback'. If * 'max_lines' is less than zero, the function will read until EOF or an error * is encountered. If 'n_cols' is greater than zero, the function will expect * that number of columns to appear in each line. Also, it will expect that * number of further arguments, specifying the data-type to be returned for - * the respective column (see sc_data_t). The content of each column will then - * be converted accordingly. + * the respective column (see sdb_data_t). The content of each column will + * then be converted accordingly. * * Returns: * - 0 on success * - a negative value else */ int -sc_unixsock_client_process_lines(sc_unixsock_client_t *client, - sc_unixsock_client_data_cb callback, sc_object_t *user_data, +sdb_unixsock_client_process_lines(sdb_unixsock_client_t *client, + sdb_unixsock_client_data_cb callback, sdb_object_t *user_data, long int max_lines, const char *delim, int n_cols, ...); /* - * sc_unixsock_client_shutdown: + * sdb_unixsock_client_shutdown: * Shut down the client's send and/or receive operations. If appropriate, the * client will automatically re-connect on the next send / receive operation * after that. @@ -86,32 +88,32 @@ sc_unixsock_client_process_lines(sc_unixsock_client_t *client, * See shutdown(3) for details. */ int -sc_unixsock_client_shutdown(sc_unixsock_client_t *client, int how); +sdb_unixsock_client_shutdown(sdb_unixsock_client_t *client, int how); /* - * sc_unixsock_client_clearerr, sc_unixsock_client_eof, - * sc_unixsock_client_error: + * sdb_unixsock_client_clearerr, sdb_unixsock_client_eof, + * sdb_unixsock_client_error: * Check and reset the client status. See the clearerr(3), feof(3), and * ferror(3) manpages for details. */ void -sc_unixsock_client_clearerr(sc_unixsock_client_t *client); +sdb_unixsock_client_clearerr(sdb_unixsock_client_t *client); int -sc_unixsock_client_eof(sc_unixsock_client_t *client); +sdb_unixsock_client_eof(sdb_unixsock_client_t *client); int -sc_unixsock_client_error(sc_unixsock_client_t *client); +sdb_unixsock_client_error(sdb_unixsock_client_t *client); void -sc_unixsock_client_destroy(sc_unixsock_client_t *client); +sdb_unixsock_client_destroy(sdb_unixsock_client_t *client); const char * -sc_unixsock_client_path(sc_unixsock_client_t *client); +sdb_unixsock_client_path(sdb_unixsock_client_t *client); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /* ! SC_UTILS_UNIXSOCK_H */ +#endif /* ! SDB_UTILS_UNIXSOCK_H */ /* vim: set tw=78 sw=4 ts=4 noexpandtab : */