4
0

totemmrp.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Copyright (c) 2005 MontaVista Software, Inc.
  3. * Copyright (c) 2006-2007, 2009 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. #ifndef TOTEMMRP_H_DEFINED
  36. #define TOTEMMRP_H_DEFINED
  37. #include <corosync/totem/totem.h>
  38. /*
  39. * Totem Single Ring Protocol
  40. * depends on poll abstraction, POSIX, IPV4
  41. */
  42. /*
  43. * Initialize the logger
  44. */
  45. extern void totemmrp_log_printf_init (
  46. void (*log_printf) (int , char *, ...),
  47. int log_level_security,
  48. int log_level_error,
  49. int log_level_warning,
  50. int log_level_notice,
  51. int log_level_debug);
  52. /*
  53. * Initialize the group messaging interface
  54. */
  55. extern int totemmrp_initialize (
  56. hdb_handle_t poll_handle,
  57. struct totem_config *totem_config,
  58. totempg_stats_t *stats,
  59. void (*deliver_fn) (
  60. unsigned int nodeid,
  61. const void *msg,
  62. unsigned int msg_len,
  63. int endian_conversion_required),
  64. void (*confchg_fn) (
  65. enum totem_configuration_type configuration_type,
  66. const unsigned int *member_list, size_t member_list_entries,
  67. const unsigned int *left_list, size_t left_list_entries,
  68. const unsigned int *joined_list, size_t joined_list_entries,
  69. const struct memb_ring_id *ring_id),
  70. void (*waiting_trans_ack_cb_fn) (
  71. int waiting_trans_ack));
  72. extern void totemmrp_finalize (void);
  73. /*
  74. * Multicast a message
  75. */
  76. extern int totemmrp_mcast (
  77. struct iovec *iovec,
  78. unsigned int iov_len,
  79. int priority);
  80. /*
  81. * Return number of available messages that can be queued
  82. */
  83. extern int totemmrp_avail (void);
  84. extern int totemmrp_callback_token_create (
  85. void **handle_out,
  86. enum totem_callback_token_type type,
  87. int delete,
  88. int (*callback_fn) (enum totem_callback_token_type type, const void *),
  89. const void *data);
  90. extern void totemmrp_callback_token_destroy (
  91. void *handle_out);
  92. extern void totemmrp_event_signal (enum totem_event_type type, int value);
  93. extern int totemmrp_ifaces_get (
  94. unsigned int nodeid,
  95. struct totem_ip_address *interfaces,
  96. char ***status,
  97. unsigned int *iface_count);
  98. extern unsigned int totemmrp_my_nodeid_get (void);
  99. extern int totemmrp_my_family_get (void);
  100. extern int totemmrp_crypto_set (unsigned int);
  101. extern int totemmrp_ring_reenable (void);
  102. extern void totemmrp_service_ready_register (
  103. void (*totem_service_ready) (void));
  104. extern int totemmrp_member_add (
  105. const struct totem_ip_address *member,
  106. int ring_no);
  107. extern int totemmrp_member_remove (
  108. const struct totem_ip_address *member,
  109. int ring_no);
  110. void totemmrp_trans_ack (void);
  111. #endif /* TOTEMMRP_H_DEFINED */