evs_initialize.3 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. .\"/*
  2. .\" * Copyright (c) 2004 MontaVista Software, Inc.
  3. .\" *
  4. .\" * All rights reserved.
  5. .\" *
  6. .\" * Author: Steven Dake (sdake@redhat.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. .TH EVS_INITIALIZE 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
  35. .SH NAME
  36. evs_initialize \- Create a new connection to the EVS service
  37. .SH SYNOPSIS
  38. .B #include <corosync/evs.h>
  39. .sp
  40. .BI "int evs_initialize(evs_handle_t *" handle ", evs_callbacks_t *" callbacks ");
  41. .SH DESCRIPTION
  42. The
  43. .B evs_initialize
  44. function is used to initialize a connection to the extended virtual synchrony API.
  45. .PP
  46. Each application may have several connections to the EVS API. Each application
  47. uses the
  48. .I handle
  49. argument to uniquely identify the connection. The
  50. .I handle
  51. argument is then used in other function calls to identify the connection to be used
  52. for communication with the EVS service.
  53. .PP
  54. Every time an EVS event occurs, one of the callbacks specified by the argument
  55. .I callbacks
  56. is called. The callback functions are described by the following type definitions:
  57. .PP
  58. .IP
  59. .RS
  60. .ne 18
  61. .nf
  62. .ta 4n 20n 32n
  63. typedef void (*evs_deliver_fn_t) (
  64. struct evs_address source_addr,
  65. const void *msg,
  66. size_t msg_len);
  67. typedef void (*evs_confchg_fn_t) (
  68. const struct evs_address *member_list, size_t member_list_entries,
  69. const struct evs_address *left_list, size_t left_list_entries,
  70. const struct evs_address *joined_list, size_t joined_list_entries);
  71. .ta
  72. .fi
  73. .RE
  74. .IP
  75. .PP
  76. .PP
  77. The
  78. .I callbacks
  79. argument is of the type:
  80. .IP
  81. .RS
  82. .ne 18
  83. .nf
  84. .PP
  85. typedef struct {
  86. evs_deliver_fn_t evs_deliver_fn;
  87. evs_confchg_fn_t evs_confchg_fn;
  88. } evs_callbacks_t;
  89. .ta
  90. .fi
  91. .RE
  92. .IP
  93. .PP
  94. When a configuration change occurs or a message is to be delivered one of the callbacks
  95. is called from the
  96. .B evs_dispatch()
  97. function. If a configuration change occurs,
  98. .I evs_confchg_fn
  99. is called. If a delivery of a message occurs,
  100. .I evs_deliver_fn
  101. is called.
  102. The
  103. .I evs_address
  104. structure is defined
  105. .IP
  106. .RS
  107. .ne 18
  108. .nf
  109. .PP
  110. struct evs_address {
  111. unsigned int nodeid;
  112. unsigned short family;
  113. unsigned char addr[TOTEMIP_ADDRLEN];
  114. };
  115. .ta
  116. .fi
  117. .RE
  118. .IP
  119. .PP
  120. where nodeid is a 32 bit unique node identifier, family is of the value AF_INET for an IPV4 network, or AF_INET6 for an IPV6 network, and addr is a 32 bit address for an IPV4 network, or 128 bit address for an IPV6 network.
  121. .SH RETURN VALUE
  122. This call returns the EVS_OK value if successful, otherwise an error is returned.
  123. .PP
  124. .SH ERRORS
  125. The errors are undocumented.
  126. .SH "SEE ALSO"
  127. .BR evs_overview (8),
  128. .BR evs_finalize (3),
  129. .BR evs_fd_get (3),
  130. .BR evs_dispatch (3),
  131. .BR evs_join (3),
  132. .BR evs_leave (3),
  133. .BR evs_mcast_joined (3),
  134. .BR evs_mcast_groups (3),
  135. .BR evs_mmembership_get (3)
  136. .PP