| 1 | // Copyright 2007 - 2021, Alan Antonuk and the rabbitmq-c contributors. |
| 2 | // SPDX-License-Identifier: mit |
| 3 | |
| 4 | /** \file */ |
| 5 | |
| 6 | /** |
| 7 | * A TCP socket connection. |
| 8 | */ |
| 9 | |
| 10 | #ifndef RABBITMQ_C_TCP_SOCKET_H |
| 11 | #define RABBITMQ_C_TCP_SOCKET_H |
| 12 | |
| 13 | #include <rabbitmq-c/amqp.h> |
| 14 | #include <rabbitmq-c/export.h> |
| 15 | |
| 16 | AMQP_BEGIN_DECLS |
| 17 | |
| 18 | /** |
| 19 | * Create a new TCP socket. |
| 20 | * |
| 21 | * Call amqp_connection_close() to release socket resources. |
| 22 | * |
| 23 | * \return A new socket object or NULL if an error occurred. |
| 24 | * |
| 25 | * \since v0.4.0 |
| 26 | */ |
| 27 | AMQP_EXPORT |
| 28 | amqp_socket_t *AMQP_CALL amqp_tcp_socket_new(amqp_connection_state_t state); |
| 29 | |
| 30 | /** |
| 31 | * Assign an open file descriptor to a socket object. |
| 32 | * |
| 33 | * This function must not be used in conjunction with amqp_socket_open(), i.e. |
| 34 | * the socket connection should already be open(2) when this function is |
| 35 | * called. |
| 36 | * |
| 37 | * \param [in,out] self A TCP socket object. |
| 38 | * \param [in] sockfd An open socket descriptor. |
| 39 | * |
| 40 | * \since v0.4.0 |
| 41 | */ |
| 42 | AMQP_EXPORT |
| 43 | void AMQP_CALL amqp_tcp_socket_set_sockfd(amqp_socket_t *self, int sockfd); |
| 44 | |
| 45 | AMQP_END_DECLS |
| 46 | |
| 47 | #endif /* RABBITMQ_C_TCP_SOCKET_H */ |