From: Sebastian Harl Date: Sun, 12 Jan 2014 21:11:34 +0000 (+0100) Subject: client: Added sdb_client_sockfd() function. X-Git-Tag: sysdb-0.1.0~226^2~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e13cc7f193e3150ebad5b16ff349896042e1389a;p=sysdb.git client: Added sdb_client_sockfd() function. This function returns the file-descriptor associated with the client's network socket. --- diff --git a/src/client/sock.c b/src/client/sock.c index a2417ad..49cefdf 100644 --- a/src/client/sock.c +++ b/src/client/sock.c @@ -190,6 +190,14 @@ sdb_client_connect(sdb_client_t *client, const char *username) return 0; } /* sdb_client_connect */ +int +sdb_client_sockfd(sdb_client_t *client) +{ + if (! client) + return -1; + return client->fd; +} /* sdb_client_sockfd */ + void sdb_client_close(sdb_client_t *client) { diff --git a/src/include/client/sock.h b/src/include/client/sock.h index c88fc9a..39e7622 100644 --- a/src/include/client/sock.h +++ b/src/include/client/sock.h @@ -76,6 +76,13 @@ sdb_client_destroy(sdb_client_t *client); int sdb_client_connect(sdb_client_t *client, const char *username); +/* + * sdb_client_sockfd: + * Return the client socket's file descriptor. + */ +int +sdb_client_sockfd(sdb_client_t *client); + /* * sdb_client_close: * Close the client connection.