summaryrefslogtreecommitdiff
path: root/librabbitmq/amqp_socket.h
diff options
context:
space:
mode:
Diffstat (limited to 'librabbitmq/amqp_socket.h')
-rw-r--r--librabbitmq/amqp_socket.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/librabbitmq/amqp_socket.h b/librabbitmq/amqp_socket.h
index ef3462b..695befb 100644
--- a/librabbitmq/amqp_socket.h
+++ b/librabbitmq/amqp_socket.h
@@ -34,8 +34,8 @@
AMQP_BEGIN_DECLS
/* Socket callbacks. */
-typedef ssize_t (*amqp_socket_writev_fn)(void *, const struct iovec *, int);
-typedef ssize_t (*amqp_socket_send_fn)(void *, const void *, size_t, int);
+typedef ssize_t (*amqp_socket_writev_fn)(void *, struct iovec *, int);
+typedef ssize_t (*amqp_socket_send_fn)(void *, const void *, size_t);
typedef ssize_t (*amqp_socket_recv_fn)(void *, void *, size_t, int);
typedef int (*amqp_socket_open_fn)(void *, const char *, int);
typedef int (*amqp_socket_close_fn)(void *);
@@ -61,43 +61,48 @@ struct amqp_socket_t_ {
/**
* Write to a socket.
*
- * This function is analagous to writev(2).
+ * This function wraps writev(2) functionality.
+ *
+ * This function will only reutrn on error, or when all of the bytes referred
+ * to in iov have been sent. NOTE: this function may modify the iov struct.
*
* \param [in,out] self A socket object.
* \param [in] iov One or more data vecors.
* \param [in] iovcnt The number of vectors in \e iov.
*
- * \return The number of bytes written, or -1 if an error occurred.
+ * \return AMQP_STATUS_OK on success. amqp_status_enum value otherwise
*/
ssize_t
-amqp_socket_writev(amqp_socket_t *self, const struct iovec *iov, int iovcnt);
+amqp_socket_writev(amqp_socket_t *self, struct iovec *iov, int iovcnt);
/**
* Send a message from a socket.
*
- * This function is analagous to send(2).
+ * This function wraps send(2) functionality.
+ *
+ * This function will only return on error, or when all of the bytes in buf
+ * have been sent, or when an error occurs.
*
* \param [in,out] self A socket object.
* \param [in] buf A buffer to read from.
* \param [in] len The number of bytes in \e buf.
- * \param [in] flags Send flags, implementation specific.
*
- * \return The number of bytes sent, or -1 if an error occurred.
+ * \return AMQP_STATUS_OK on success. amqp_status_enum value otherwise
*/
ssize_t
-amqp_socket_send(amqp_socket_t *self, const void *buf, size_t len, int flags);
+amqp_socket_send(amqp_socket_t *self, const void *buf, size_t len);
/**
* Receive a message from a socket.
*
- * This function is analagous to recv(2).
+ * This function wraps recv(2) functionality.
*
* \param [in,out] self A socket object.
* \param [out] buf A buffer to write to.
* \param [in] len The number of bytes at \e buf.
* \param [in] flags Receive flags, implementation specific.
*
- * \return The number of bytes received, or -1 if an error occurred.
+ * \return The number of bytes received, or < 0 on error (\ref amqp_status_enum)
*/
ssize_t
amqp_socket_recv(amqp_socket_t *self, void *buf, size_t len, int flags);