amqp_tcp_socket.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /** \file */
  2. /*
  3. * Portions created by Alan Antonuk are Copyright (c) 2013-2014 Alan Antonuk.
  4. * All Rights Reserved.
  5. *
  6. * Portions created by Michael Steinert are Copyright (c) 2012-2013 Michael
  7. * Steinert. All Rights Reserved.
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a
  10. * copy of this software and associated documentation files (the "Software"),
  11. * to deal in the Software without restriction, including without limitation
  12. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  13. * and/or sell copies of the Software, and to permit persons to whom the
  14. * Software is furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be included in
  17. * all copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  24. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  25. * DEALINGS IN THE SOFTWARE.
  26. */
  27. /**
  28. * A TCP socket connection.
  29. */
  30. #ifndef AMQP_TCP_SOCKET_H
  31. #define AMQP_TCP_SOCKET_H
  32. #include <amqp.h>
  33. AMQP_BEGIN_DECLS
  34. /**
  35. * Create a new TCP socket.
  36. *
  37. * Call amqp_connection_close() to release socket resources.
  38. *
  39. * \return A new socket object or NULL if an error occurred.
  40. *
  41. * \since v0.4.0
  42. */
  43. AMQP_PUBLIC_FUNCTION
  44. amqp_socket_t *AMQP_CALL amqp_tcp_socket_new(amqp_connection_state_t state);
  45. /**
  46. * Assign an open file descriptor to a socket object.
  47. *
  48. * This function must not be used in conjunction with amqp_socket_open(), i.e.
  49. * the socket connection should already be open(2) when this function is
  50. * called.
  51. *
  52. * \param [in,out] self A TCP socket object.
  53. * \param [in] sockfd An open socket descriptor.
  54. *
  55. * \since v0.4.0
  56. */
  57. AMQP_PUBLIC_FUNCTION
  58. void AMQP_CALL amqp_tcp_socket_set_sockfd(amqp_socket_t *self, int sockfd);
  59. AMQP_END_DECLS
  60. #endif /* AMQP_TCP_SOCKET_H */