totemmrp.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * Copyright (c) 2005 MontaVista Software, Inc.
  3. * Copyright (c) 2006-2011 Red Hat, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. * Author: Steven Dake (sdake@redhat.com)
  8. *
  9. * This software licensed under BSD license, the text of which follows:
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * - Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  27. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  33. * THE POSSIBILITY OF SUCH DAMAGE.
  34. */
  35. /**
  36. * @file
  37. * Totem Single Ring Protocol
  38. *
  39. * depends on poll abstraction, POSIX, IPV4
  40. */
  41. #ifndef TOTEMMRP_H_DEFINED
  42. #define TOTEMMRP_H_DEFINED
  43. #include <corosync/totem/totem.h>
  44. /**
  45. * Initialize the logger
  46. */
  47. extern void totemmrp_log_printf_init (
  48. void (*log_printf) (int , char *, ...),
  49. int log_level_security,
  50. int log_level_error,
  51. int log_level_warning,
  52. int log_level_notice,
  53. int log_level_debug);
  54. /**
  55. * Initialize the group messaging interface
  56. */
  57. extern int totemmrp_initialize (
  58. qb_loop_t *poll_handle,
  59. struct totem_config *totem_config,
  60. totempg_stats_t *stats,
  61. void (*deliver_fn) (
  62. unsigned int nodeid,
  63. const void *msg,
  64. unsigned int msg_len,
  65. int endian_conversion_required),
  66. void (*confchg_fn) (
  67. enum totem_configuration_type configuration_type,
  68. const unsigned int *member_list, size_t member_list_entries,
  69. const unsigned int *left_list, size_t left_list_entries,
  70. const unsigned int *joined_list, size_t joined_list_entries,
  71. const struct memb_ring_id *ring_id),
  72. void (*waiting_trans_ack_cb_fn) (
  73. int waiting_trans_ack));
  74. extern void totemmrp_finalize (void);
  75. /**
  76. * Multicast a message
  77. */
  78. extern int totemmrp_mcast (
  79. struct iovec *iovec,
  80. unsigned int iov_len,
  81. int priority);
  82. /**
  83. * Return number of available messages that can be queued
  84. */
  85. extern int totemmrp_avail (void);
  86. extern int totemmrp_callback_token_create (
  87. void **handle_out,
  88. enum totem_callback_token_type type,
  89. int delete,
  90. int (*callback_fn) (enum totem_callback_token_type type, const void *),
  91. const void *data);
  92. extern void totemmrp_callback_token_destroy (
  93. void *handle_out);
  94. extern void totemmrp_event_signal (enum totem_event_type type, int value);
  95. extern int totemmrp_ifaces_get (
  96. unsigned int nodeid,
  97. struct totem_ip_address *interfaces,
  98. unsigned int interfaces_size,
  99. char ***status,
  100. unsigned int *iface_count);
  101. extern unsigned int totemmrp_my_nodeid_get (void);
  102. extern int totemmrp_my_family_get (void);
  103. extern int totemmrp_crypto_set (const char *cipher_type, const char *hash_type);
  104. extern int totemmrp_ring_reenable (void);
  105. extern void totemmrp_service_ready_register (
  106. void (*totem_service_ready) (void));
  107. extern int totemmrp_member_add (
  108. const struct totem_ip_address *member,
  109. int ring_no);
  110. extern int totemmrp_member_remove (
  111. const struct totem_ip_address *member,
  112. int ring_no);
  113. void totemmrp_threaded_mode_enable (void);
  114. void totemmrp_trans_ack (void);
  115. #endif /* TOTEMMRP_H_DEFINED */