index 8ab2e1ee7b3a22adb1481fb7cfecb09daaef77c7..f3f1a871d83e48c28e96bee92fd8a40ac4e3188a 100644 (file)
#ifndef SDB_UTILS_PROTO_H
#define SDB_UTILS_PROTO_H 1
+#include "utils/strbuf.h"
+
#include <stdint.h>
#include <unistd.h>
extern "C" {
#endif
+enum {
+ SDB_PROTO_SELECTIN = 0,
+ SDB_PROTO_SELECTOUT,
+ SDB_PROTO_SELECTERR,
+};
+
+/*
+ * sdb_proto_select:
+ * Wait for a file-descriptor to become ready for I/O operations of the
+ * specified type. This is a simple wrapper around the select() system call.
+ * The type argument may be any of the SDB_PROTO_SELECT* constants.
+ *
+ * Returns:
+ * - the number of file descriptors ready for I/O
+ * - a negative value on error
+ */
+int
+sdb_proto_select(int fd, int type);
+
ssize_t
sdb_proto_send(int fd, size_t msg_len, const char *msg);
sdb_proto_send_msg(int fd, uint32_t code,
uint32_t msg_len, const char *msg);
+uint32_t
+sdb_proto_get_int(sdb_strbuf_t *buf, size_t offset);
+
#ifdef __cplusplus
} /* extern "C" */
#endif