totempg.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Copyright (c) 2003-2005 MontaVista Software, Inc.
  3. *
  4. * All rights reserved.
  5. *
  6. * Author: Steven Dake (sdake@mvista.com)
  7. *
  8. * This software licensed under BSD license, the text of which follows:
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions are met:
  12. *
  13. * - Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * - Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  26. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  27. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  28. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  29. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  30. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  31. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  32. * THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #ifndef TOTEMPG_H_DEFINED
  35. #define TOTEMPG_H_DEFINED
  36. #include <netinet/in.h>
  37. #include "aispoll.h"
  38. #include "totem.h"
  39. typedef unsigned int totempg_groups_handle;
  40. struct totempg_group {
  41. void *group;
  42. int group_len;
  43. };
  44. #define TOTEMPG_AGREED 0
  45. #define TOTEMPG_SAFE 1
  46. /*
  47. * Totem Single Ring Protocol
  48. * depends on poll abstraction, POSIX, IPV4
  49. */
  50. /*
  51. * Initialize the totem process groups abstraction
  52. */
  53. extern int totempg_initialize (
  54. poll_handle poll_handle,
  55. struct totem_config *totem_config
  56. );
  57. extern void totempg_finalize (void);
  58. extern int totempg_callback_token_create (void **handle_out,
  59. enum totem_callback_token_type type,
  60. int delete,
  61. int (*callback_fn) (enum totem_callback_token_type type, void *),
  62. void *data);
  63. extern void totempg_callback_token_destroy (void *handle);
  64. /*
  65. * Initialize a groups instance
  66. */
  67. extern int totempg_groups_initialize (
  68. totempg_groups_handle *handle,
  69. void (*deliver_fn) (
  70. unsigned int nodeid,
  71. struct iovec *iovec,
  72. int iov_len,
  73. int endian_conversion_required),
  74. void (*confchg_fn) (
  75. enum totem_configuration_type configuration_type,
  76. unsigned int *member_list, int member_list_entries,
  77. unsigned int *left_list, int left_list_entries,
  78. unsigned int *joined_list, int joined_list_entries,
  79. struct memb_ring_id *ring_id));
  80. extern int totempg_groups_finalize (
  81. totempg_groups_handle handle);
  82. extern int totempg_groups_join (
  83. totempg_groups_handle handle,
  84. struct totempg_group *groups,
  85. int gruop_cnt);
  86. extern int totempg_groups_leave (
  87. totempg_groups_handle handle,
  88. struct totempg_group *groups,
  89. int gruop_cnt);
  90. extern int totempg_groups_mcast_joined (
  91. totempg_groups_handle handle,
  92. struct iovec *iovec,
  93. int iov_len,
  94. int guarantee);
  95. extern int totempg_groups_send_ok_joined (
  96. totempg_groups_handle handle,
  97. struct iovec *iovec,
  98. int iov_len);
  99. extern int totempg_groups_mcast_groups (
  100. totempg_groups_handle handle,
  101. int guarantee,
  102. struct totempg_group *groups,
  103. int groups_cnt,
  104. struct iovec *iovec,
  105. int iov_len);
  106. extern int totempg_groups_send_ok_groups (
  107. totempg_groups_handle handle,
  108. struct totempg_group *groups,
  109. int groups_cnt,
  110. struct iovec *iovec,
  111. int iov_len);
  112. extern int totempg_ifaces_get (
  113. unsigned int nodeid,
  114. struct totem_ip_address *interfaces,
  115. unsigned int *iface_count);
  116. extern char *totempg_ifaces_print (unsigned int nodeid);
  117. #endif /* TOTEMPG_H_DEFINED */