Quellcode durchsuchen

(Logical change 1.127)

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@451 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake vor 21 Jahren
Ursprung
Commit
47eb95d3a8
6 geänderte Dateien mit 354 neuen und 10 gelöschten Zeilen
  1. 118 0
      include/ipc_clm.h
  2. 79 0
      include/ipc_gen.h
  3. 155 0
      include/saClm.h
  4. 1 1
      lib/Makefile
  5. 1 1
      test/Makefile
  6. 0 8
      test/testamf5.c

+ 118 - 0
include/ipc_clm.h

@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef IPC_CLM_H_DEFINED
+#define IPC_CLM_H_DEFINED
+
+#include <netinet/in.h>
+#include "ais_types.h"
+#include "saClm.h"
+#include "ipc_gen.h"
+
+enum req_clm_types {
+	MESSAGE_REQ_CLM_TRACKSTART = 1,
+	MESSAGE_REQ_CLM_TRACKSTOP,
+	MESSAGE_REQ_CLM_NODEGET,
+	MESSAGE_REQ_CLM_NODEGETASYNC
+};
+
+enum res_clm_types {
+	MESSAGE_RES_CLM_TRACKCALLBACK = 1,
+	MESSAGE_RES_CLM_TRACKSTART,
+	MESSAGE_RES_CLM_TRACKSTOP,
+	MESSAGE_RES_CLM_NODEGET,
+	MESSAGE_RES_CLM_NODEGETASYNC,
+	MESSAGE_RES_CLM_NODEGETCALLBACK
+};
+
+struct req_clm_clustertrack {
+	struct req_header header;
+	SaUint8T trackFlags;
+};
+
+struct res_clm_clustertrack {
+	struct res_header header;
+};
+struct req_clm_trackstop {
+	struct req_header header;
+	SaSizeT dataRead;
+	SaErrorT error;
+};
+
+struct res_clm_trackstop {
+	struct res_header header;
+};
+
+struct res_clm_trackcallback {
+	struct res_header header;
+	SaUint64T viewNumber;
+	SaUint32T numberOfItems;
+	SaUint32T numberOfMembers;
+	SaClmClusterNotificationT notification[0];
+};
+
+struct req_clm_nodeget {
+	struct req_header header;
+	SaInvocationT invocation;
+	SaClmNodeIdT nodeId;
+};
+
+struct res_clm_nodeget {
+	struct res_header header;
+	SaInvocationT invocation;
+	SaClmClusterNodeT clusterNode;
+	int valid;
+};
+
+struct req_clm_nodegetasync {
+	struct req_header header;
+	SaInvocationT invocation;
+	SaClmNodeIdT nodeId;
+};
+
+struct res_clm_nodegetasync {
+	struct res_header header;
+};
+
+struct res_clm_nodegetcallback {
+	struct res_header header;
+	SaInvocationT invocation;
+	SaClmClusterNodeT clusterNode;
+};
+
+struct req_exec_clm_nodejoin {
+	struct req_header header;
+	SaClmClusterNodeT clusterNode;
+};
+
+#endif /* IPC_CLM_H_DEFINED */

+ 79 - 0
include/ipc_gen.h

@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef IPC_GEN_H_DEFINED
+#define IPC_GEN_H_DEFINED
+
+enum req_init_types {
+	MESSAGE_REQ_EVS_INIT,
+	MESSAGE_REQ_CLM_INIT,
+	MESSAGE_REQ_AMF_INIT,
+	MESSAGE_REQ_CKPT_INIT,
+	MESSAGE_REQ_CKPT_CHECKPOINT_INIT,
+	MESSAGE_REQ_CKPT_SECTIONITERATOR_INIT,
+	MESSAGE_REQ_EVT_INIT
+};
+
+enum res_init_types {
+	MESSAGE_RES_INIT
+};
+
+#define	MESSAGE_REQ_LIB_ACTIVATEPOLL 0
+#define	MESSAGE_RES_LIB_ACTIVATEPOLL 50
+
+enum nodeexec_message_types {
+	MESSAGE_REQ_EXEC_EVS_MCAST,
+	MESSAGE_REQ_EXEC_CLM_NODEJOIN,
+	MESSAGE_REQ_EXEC_AMF_COMPONENTREGISTER,
+	MESSAGE_REQ_EXEC_AMF_COMPONENTUNREGISTER,
+	MESSAGE_REQ_EXEC_AMF_ERRORREPORT,
+	MESSAGE_REQ_EXEC_AMF_ERRORCANCELALL,
+	MESSAGE_REQ_EXEC_AMF_READINESSSTATESET,
+	MESSAGE_REQ_EXEC_AMF_HASTATESET,
+	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTOPEN,
+	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTCLOSE,
+	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTUNLINK,
+	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTRETENTIONDURATIONSET,
+	MESSAGE_REQ_EXEC_CKPT_CHECKPOINTRETENTIONDURATIONEXPIRE,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONCREATE,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONDELETE,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONEXPIRATIONTIMESET,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONWRITE,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONOVERWRITE,
+	MESSAGE_REQ_EXEC_CKPT_SECTIONREAD,
+	MESSAGE_REQ_EXEC_EVT_EVENTDATA,
+	MESSAGE_REQ_EXEC_EVT_CHANCMD,
+	MESSAGE_REQ_EXEC_EVT_RECOVERY_EVENTDATA
+};
+
+#endif /* IPC_GEN_H_DEFINED */

+ 155 - 0
include/saClm.h

@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2002-2005 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "ais_types.h"
+
+#ifndef AIS_CLM_H_DEFINED
+#define AIS_CLM_H_DEFINED
+
+typedef SaUint64T SaClmHandleT;
+
+typedef SaUint32T SaClmNodeIdT;
+
+#define SA_CLM_LOCAL_NODE_ID 0xffffffff
+
+#define SA_CLM_MAX_ADDRESS_LENGTH 64
+
+typedef enum {
+		SA_CLM_AF_INET = 1,
+		SA_CLM_AF_INET6 = 2
+} SaClmNodeAddressFamilyT;
+
+typedef struct {
+	SaClmNodeAddressFamilyT family;
+	SaUint16T length;
+	SaUint8T value[SA_CLM_MAX_ADDRESS_LENGTH];
+} SaClmNodeAddressT;
+
+typedef struct {
+	SaClmNodeIdT nodeId;
+	SaClmNodeAddressT nodeAddress;
+	SaNameT nodeName;
+	SaBoolT member;
+	SaTimeT bootTimestamp;
+	SaUint64T initialViewNumber;
+} SaClmClusterNodeT;
+
+typedef enum {
+	SA_CLM_NODE_NO_CHANGE = 1,
+	SA_CLM_NODE_JOINED = 2,
+	SA_CLM_NODE_LEFT = 3,
+	SA_CLM_NODE_RECONFIGURED = 4
+} SaClmClusterChangesT;
+
+typedef struct {
+	SaClmClusterNodeT clusterNode;
+	SaClmClusterChangesT clusterChange;
+} SaClmClusterNotificationT;
+
+typedef struct {
+	SaUint64T viewNumber;
+	SaUint32T numberOfItems;
+	SaClmClusterNotificationT *notification;
+} SaClmClusterNotificationBufferT;
+
+typedef void (*SaClmClusterNodeGetCallbackT)(
+	SaInvocationT invocation,
+	const SaClmClusterNodeT *clusterNode,
+	SaAisErrorT error);
+
+typedef void (*SaClmClusterTrackCallbackT) (
+	const SaClmClusterNotificationBufferT *notificationBuffer,
+	SaUint32T numberOfMembers,
+	SaAisErrorT error);
+
+typedef struct {
+	SaClmClusterNodeGetCallbackT saClmClusterNodeGetCallback;
+	SaClmClusterTrackCallbackT saClmClusterTrackCallback;
+} SaClmCallbacksT;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SaAisErrorT
+saClmInitialize (
+	SaClmHandleT *clmHandle,
+	const SaClmCallbacksT *clmCallbacks,
+	SaVersionT *version);
+
+
+SaAisErrorT
+saClmSelectionObjectGet (
+		SaClmHandleT clmHandle,
+		SaSelectionObjectT *selectionObject);
+
+SaAisErrorT
+saClmDispatch (
+	SaClmHandleT clmHandle,
+	SaDispatchFlagsT dispatchFlags);
+
+SaAisErrorT
+saClmFinalize (
+	SaClmHandleT clmHandle);
+
+SaAisErrorT
+saClmClusterTrack (
+	SaClmHandleT clmHandle,
+	SaUint8T trackFlags,
+	SaClmClusterNotificationBufferT *notificationBuffer);
+
+SaAisErrorT
+saClmClusterTrackStop (
+	SaClmHandleT clmHandle);
+
+SaAisErrorT
+saClmClusterNodeGet (
+	SaClmHandleT clmHandle,
+	SaClmNodeIdT nodeId,
+	SaTimeT timeout,
+	SaClmClusterNodeT *clusterNode);
+
+SaAisErrorT
+saClmClusterNodeGetAsync (
+	SaClmHandleT clmHandle,
+	SaInvocationT invocation,
+	SaClmNodeIdT nodeId);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AIS_CLM_H_DEFINED */
+
+

+ 1 - 1
lib/Makefile

@@ -82,7 +82,7 @@ util.o: ../include/ais_types.h ../include/ais_msg.h ../include/ais_types.h
 util.o: util.h ../include/ais_msg.h ../include/evs.h
 amf.o: ../include/ais_types.h ../include/ais_amf.h ../include/ais_types.h
 amf.o: ../include/ais_msg.h util.h
-clm.o: ../include/ais_types.h ../include/ais_clm.h ../include/ais_types.h
+clm.o: ../include/ais_types.h ../include/saClm.h ../include/ais_types.h
 clm.o: ../include/ais_msg.h util.h
 ckpt.o: ../include/list.h ../include/ais_types.h ../include/ais_ckpt.h
 ckpt.o: ../include/ais_types.h ../include/ais_msg.h util.h

+ 1 - 1
test/Makefile

@@ -138,7 +138,7 @@ depend:
 	makedepend -Y -- $(CFLAGS) $(TEST_SRC) > /dev/null 2>&1
 # DO NOT DELETE
 
-testclm.o: ../include/ais_types.h ../include/ais_clm.h
+testclm.o: ../include/ais_types.h ../include/saClm.h
 testamf.o: ../include/ais_types.h ../include/ais_amf.h ../include/ais_msg.h
 testamf.o: ../include/evs.h
 testamf1.o: ../include/ais_types.h ../include/ais_amf.h

+ 0 - 8
test/testamf5.c

@@ -44,14 +44,6 @@
 #include "ais_types.h"
 #include "ais_amf.h"
 
-void printSaClmNodeAddressT (SaClmNodeAddressT *nodeAddress) {
-	int i;
-
-	for (i = 0; i < nodeAddress->length; i++) {
-		printf ("%d.", nodeAddress->value[i]);
-	}
-}
-
 void printSaNameT (SaNameT *name)
 {
 	int i;