2 * Copyright (C) 2006 Red Hat, Inc.
3 * Copyright (C) 2006 Sun Microsystems, Inc.
7 * Author: Steven Dake (sdake@redhat.com)
9 * This software licensed under BSD license, the text of which follows:
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
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.
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.
36 #ifndef AIS_MAR_CLM_H_DEFINED
37 #define AIS_MAR_CLM_H_DEFINED
44 #define MAR_CLM_MAX_ADDRESS_LENGTH 64
49 } mar_clm_node_address_family_t
;
52 * Marshalling the SaClmNodeAdressT data structure
55 unsigned short length
__attribute__((aligned(8)));
56 mar_clm_node_address_family_t family
__attribute__((aligned(8)));
57 unsigned char value
[MAR_CLM_MAX_ADDRESS_LENGTH
] __attribute__((aligned(8)));
58 } mar_clm_node_address_t
;
60 static inline void swab_mar_clm_node_address_t(mar_clm_node_address_t
*to_swab
)
62 swab_mar_uint16_t (&to_swab
->length
);
63 swab_mar_uint32_t (&to_swab
->family
);
66 static inline void marshall_from_mar_clm_node_address_t (
67 SaClmNodeAddressT
*dest
,
68 mar_clm_node_address_t
*src
)
70 dest
->family
= src
->family
;
71 dest
->length
= src
->length
;
72 memcpy (dest
->value
, src
->value
, SA_CLM_MAX_ADDRESS_LENGTH
);
75 static inline void marshall_to_mar_clm_node_address_t (
76 mar_clm_node_address_t
*dest
,
77 SaClmNodeAddressT
*src
)
79 dest
->family
= src
->family
;
80 dest
->length
= src
->length
;
81 memcpy (dest
->value
, src
->value
, SA_CLM_MAX_ADDRESS_LENGTH
);
85 * Marshalling the SaClmClusterNodeT data structure
88 mar_uint32_t node_id
__attribute__((aligned(8)));
89 mar_clm_node_address_t node_address
__attribute__((aligned(8)));
90 mar_name_t node_name
__attribute__((aligned(8)));
91 mar_uint32_t member
__attribute__((aligned(8)));
92 mar_uint64_t boot_timestamp
__attribute__((aligned(8)));
93 mar_uint64_t initial_view_number
__attribute__((aligned(8)));
94 } mar_clm_cluster_node_t
;
96 static inline void swab_mar_clm_cluster_node_t(mar_clm_cluster_node_t
*to_swab
)
98 swab_mar_uint32_t (&to_swab
->node_id
);
99 swab_mar_uint32_t (&to_swab
->member
);
100 swab_mar_clm_node_address_t (&to_swab
->node_address
);
101 swab_mar_name_t (&to_swab
->node_name
);
102 swab_mar_uint64_t (&to_swab
->boot_timestamp
);
103 swab_mar_uint64_t (&to_swab
->initial_view_number
);
106 static inline void marshall_to_mar_clm_cluster_node_t (
107 mar_clm_cluster_node_t
*dest
,
108 SaClmClusterNodeT
*src
)
110 dest
->node_id
= src
->nodeId
;
111 marshall_to_mar_clm_node_address_t (&dest
->node_address
,
113 marshall_to_mar_name_t (&dest
->node_name
, &src
->nodeName
);
114 dest
->member
= src
->member
;
115 dest
->boot_timestamp
= src
->bootTimestamp
;
116 dest
->initial_view_number
= src
->initialViewNumber
;
119 static inline void marshall_from_mar_clm_cluster_node_t (
120 SaClmClusterNodeT
*dest
,
121 mar_clm_cluster_node_t
*src
)
123 dest
->nodeId
= src
->node_id
;
124 marshall_from_mar_clm_node_address_t (&dest
->nodeAddress
,
126 marshall_from_mar_name_t (&dest
->nodeName
, &src
->node_name
);
127 dest
->member
= src
->member
;
128 dest
->bootTimestamp
= src
->boot_timestamp
;
129 dest
->initialViewNumber
= src
->initial_view_number
;
133 MAR_NODE_NO_CHANGE
= 1,
136 MAR_NODE_RECONFIGURED
= 4
137 } mar_clm_cluster_change_t
;
140 * Marshalling the SaClmClusterNotificationT data structure
143 mar_clm_cluster_node_t cluster_node
__attribute__((aligned(8)));
144 mar_clm_cluster_change_t cluster_change
__attribute__((aligned(8)));
145 } mar_clm_cluster_notification_t
;
147 static inline void marshall_to_mar_clm_cluster_notification_t (
148 mar_clm_cluster_notification_t
*dest
,
149 SaClmClusterNotificationT
*src
)
151 marshall_to_mar_clm_cluster_node_t (&dest
->cluster_node
,
153 dest
->cluster_change
= src
->clusterChange
;
156 static inline void marshall_from_mar_clm_cluster_notification_t (
157 SaClmClusterNotificationT
*dest
,
158 mar_clm_cluster_notification_t
*src
)
160 marshall_from_mar_clm_cluster_node_t (&dest
->clusterNode
,
162 dest
->clusterChange
= src
->cluster_change
;
166 unsigned long long view_number
__attribute__((aligned(8)));
167 unsigned int number_of_items
__attribute__((aligned(8)));
168 unsigned long long notification
__attribute__((aligned(8)));
169 } mar_clm_cluster_notification_buffer_t
;
171 static inline void marshall_to_mar_cluster_notification_buffer_t (
172 mar_clm_cluster_notification_buffer_t
*dest
,
173 SaClmClusterNotificationBufferT
*src
)
175 dest
->view_number
= src
->viewNumber
;
176 dest
->number_of_items
= src
->numberOfItems
;
177 memcpy (&dest
->notification
, &src
->notification
,
178 sizeof (SaClmClusterNotificationBufferT
*));
181 static inline void marshall_from_mar_cluster_notification_buffer_t (
182 SaClmClusterNotificationBufferT
*dest
,
183 mar_clm_cluster_notification_buffer_t
*src
)
185 dest
->viewNumber
= src
->view_number
;
186 dest
->numberOfItems
= src
->number_of_items
;
187 memcpy (&dest
->notification
, &src
->notification
,
188 sizeof (SaClmClusterNotificationBufferT
*));
191 #endif /* AIS_MAR_CLM_H_DEFINED */