gearmand_con.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Gearman server and library
  2. * Copyright (C) 2008 Brian Aker, Eric Day
  3. * All rights reserved.
  4. *
  5. * Use and distribution licensed under the BSD license. See
  6. * the COPYING file in the parent directory for full text.
  7. */
  8. /**
  9. * @file
  10. * @brief Connection Declarations
  11. */
  12. #ifndef __GEARMAND_CON_H__
  13. #define __GEARMAND_CON_H__
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /**
  18. * @addtogroup gearmand_con Connection Declarations
  19. * @ingroup gearmand
  20. *
  21. * Connection handling for gearmand.
  22. *
  23. * @{
  24. */
  25. /**
  26. * Create a new gearmand connection.
  27. * @param gearmand Server instance structure previously initialized with
  28. * gearmand_create.
  29. * @param fd File descriptor of new connection.
  30. * @param host Host of peer connection.
  31. * @param port Port of peer connection.
  32. * @param add_fn Optional callback to use when adding the connection to an
  33. I/O thread.
  34. * @return Pointer to an allocated gearmand structure.
  35. */
  36. GEARMAN_API
  37. gearman_return_t gearmand_con_create(gearmand_st *gearmand, int fd,
  38. const char *host, const char *port,
  39. gearman_con_add_fn *add_fn);
  40. /**
  41. * Free resources used by a connection.
  42. * @param dcon Connection previously initialized with gearmand_con_create.
  43. */
  44. GEARMAN_API
  45. void gearmand_con_free(gearmand_con_st *dcon);
  46. /**
  47. * Check connection queue for a thread.
  48. */
  49. GEARMAN_API
  50. void gearmand_con_check_queue(gearmand_thread_st *thread);
  51. /**
  52. * Callback function used for setting events in libevent.
  53. */
  54. GEARMAN_API
  55. gearman_return_t gearmand_con_watch(gearman_con_st *con, short events,
  56. void *context);
  57. /** @} */
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif /* __GEARMAND_CON_H__ */