Code

utils unixsock: Added wrappers for clearerr(), feof(), and ferror().
[sysdb.git] / src / include / utils / unixsock.h
index e51e4ac7f1437583bd28b6decb7264e012bbf375..d40661390d99bd466357c585eeccd2c83390a8a7 100644 (file)
@@ -28,6 +28,8 @@
 #ifndef SC_UTILS_UNIXSOCK_H
 #define SC_UTILS_UNIXSOCK_H 1
 
+#include <sys/socket.h>
+
 #include <stddef.h>
 
 #ifdef __cplusplus
@@ -49,6 +51,30 @@ sc_unixsock_client_send(sc_unixsock_client_t *client, const char *msg);
 char *
 sc_unixsock_client_recv(sc_unixsock_client_t *client, char *buffer, size_t buflen);
 
+/*
+ * sc_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.
+ *
+ * See shutdown(3) for details.
+ */
+int
+sc_unixsock_client_shutdown(sc_unixsock_client_t *client, int how);
+
+/*
+ * sc_unixsock_client_clearerr, sc_unixsock_client_eof,
+ * sc_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);
+int
+sc_unixsock_client_eof(sc_unixsock_client_t *client);
+int
+sc_unixsock_client_error(sc_unixsock_client_t *client);
+
 void
 sc_unixsock_client_destroy(sc_unixsock_client_t *client);