Expose confdb write to the library.
[openais.git] / include / saEvt.h
blobadb38adfdeb4cc5ce7fb7512a7db4f53dc79cb5c
1 /*
2 * Copyright (c) 2004-2005 Mark Haverkamp
3 * Copyright (c) 2004-2005 Open Source Development Lab
5 * All rights reserved.
7 * This software licensed under BSD license, the text of which follows:
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
12 * - Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * - Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 * - Neither the name of the Open Source Developement Lab nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
34 #include "saAis.h"
36 #ifndef AIS_EVT_H_DEFINED
37 #define AIS_EVT_H_DEFINED
39 typedef SaUint64T SaEvtHandleT;
40 typedef SaUint64T SaEvtEventHandleT;
41 typedef SaUint64T SaEvtChannelHandleT;
42 typedef SaUint32T SaEvtSubscriptionIdT;
45 typedef void
46 (*SaEvtEventDeliverCallbackT)(
47 SaEvtSubscriptionIdT subscriptionId,
48 const SaEvtEventHandleT eventHandle,
49 const SaSizeT eventDataSize
52 typedef void
53 (*SaEvtChannelOpenCallbackT)(
54 SaInvocationT invocation,
55 SaEvtChannelHandleT channelHandle,
56 SaAisErrorT error
59 typedef struct{
60 SaEvtChannelOpenCallbackT saEvtChannelOpenCallback;
61 SaEvtEventDeliverCallbackT saEvtEventDeliverCallback;
62 } SaEvtCallbacksT;
64 #define SA_EVT_CHANNEL_PUBLISHER 0X1
65 #define SA_EVT_CHANNEL_SUBSCRIBER 0X2
66 #define SA_EVT_CHANNEL_CREATE 0X4
67 typedef SaUint8T SaEvtChannelOpenFlagsT;
69 typedef struct {
70 SaSizeT allocatedSize;
71 SaSizeT patternSize;
72 SaUint8T *pattern;
73 } SaEvtEventPatternT;
76 #define SA_EVT_HIGHEST_PRIORITY 0
77 #define SA_EVT_LOWEST_PRIORITY 3
80 * Event ID values from 0 to 1000 are have special meanings
81 * and aren't used for regular events.
85 * Event ID for an allocated but not yet published event.
87 #define SA_EVT_EVENTID_NONE 0
90 * Event ID for a "lost event".
92 #define SA_EVT_EVENTID_LOST 1
95 * Pattern to indicate a "lost event" message.
97 #define SA_EVT_LOST_EVENT "SA_EVT_LOST_EVENT_PATTERN"
100 * Size of the biggest data attachment to an event.
102 #define SA_EVT_DATA_MAX_LEN (64 * 1024)
104 typedef struct {
105 SaSizeT allocatedNumber;
106 SaSizeT patternsNumber;
107 SaEvtEventPatternT *patterns;
108 } SaEvtEventPatternArrayT;
110 typedef SaUint8T SaEvtEventPriorityT;
111 typedef SaUint64T SaEvtEventIdT;
113 typedef enum {
114 SA_EVT_PREFIX_FILTER = 1,
115 SA_EVT_SUFFIX_FILTER = 2,
116 SA_EVT_EXACT_FILTER = 3,
117 SA_EVT_PASS_ALL_FILTER = 4
118 } SaEvtEventFilterTypeT;
120 typedef struct {
121 SaEvtEventFilterTypeT filterType;
122 SaEvtEventPatternT filter;
123 } SaEvtEventFilterT;
125 typedef struct {
126 SaSizeT filtersNumber;
127 SaEvtEventFilterT *filters;
128 } SaEvtEventFilterArrayT;
131 #ifdef __cplusplus
132 extern "C" {
133 #endif
135 SaAisErrorT
136 saEvtInitialize(
137 SaEvtHandleT *evtHandle,
138 const SaEvtCallbacksT *callbacks,
139 SaVersionT *version);
141 SaAisErrorT
142 saEvtSelectionObjectGet(
143 SaEvtHandleT evtHandle,
144 SaSelectionObjectT *selectionObject);
146 SaAisErrorT
147 saEvtDispatch(
148 SaEvtHandleT evtHandle,
149 SaDispatchFlagsT dispatchFlags);
151 SaAisErrorT
152 saEvtFinalize(
153 SaEvtHandleT evtHandle);
155 SaAisErrorT
156 saEvtChannelOpen(
157 SaEvtHandleT evtHandle,
158 const SaNameT *channelName,
159 SaEvtChannelOpenFlagsT channelOpenFlags,
160 SaTimeT timeout,
161 SaEvtChannelHandleT *channelHandle);
163 SaAisErrorT
164 saEvtChannelOpenAsync(
165 SaEvtHandleT evtHandle,
166 SaInvocationT invocation,
167 const SaNameT *channelName,
168 SaEvtChannelOpenFlagsT channelOpenFlags);
170 SaAisErrorT
171 saEvtChannelClose(
172 SaEvtChannelHandleT channelHandle);
174 SaAisErrorT
175 saEvtChannelUnlink(
176 SaEvtHandleT evtHandle,
177 const SaNameT *channelName);
179 SaAisErrorT
180 saEvtEventAllocate(
181 SaEvtChannelHandleT channelHandle,
182 SaEvtEventHandleT *eventHandle);
184 SaAisErrorT
185 saEvtEventFree(
186 SaEvtEventHandleT eventHandle);
188 SaAisErrorT
189 saEvtEventAttributesSet(
190 SaEvtEventHandleT eventHandle,
191 const SaEvtEventPatternArrayT *patternArray,
192 SaEvtEventPriorityT priority,
193 SaTimeT retentionTime,
194 const SaNameT *publisherName);
196 SaAisErrorT
197 saEvtEventAttributesGet(
198 SaEvtEventHandleT eventHandle,
199 SaEvtEventPatternArrayT *patternArray,
200 SaEvtEventPriorityT *priority,
201 SaTimeT *retentionTime,
202 SaNameT *publisherName,
203 SaTimeT *publishTime,
204 SaEvtEventIdT *eventId);
206 SaAisErrorT
207 saEvtEventDataGet(
208 SaEvtEventHandleT eventHandle,
209 void *eventData,
210 SaSizeT *eventDataSize);
212 SaAisErrorT
213 saEvtEventPublish(
214 SaEvtEventHandleT eventHandle,
215 const void *eventData,
216 SaSizeT eventDataSize,
217 SaEvtEventIdT *eventId);
219 SaAisErrorT
220 saEvtEventSubscribe(
221 SaEvtChannelHandleT channelHandle,
222 const SaEvtEventFilterArrayT *filters,
223 SaEvtSubscriptionIdT subscriptionId);
225 SaAisErrorT
226 saEvtEventUnsubscribe(
227 SaEvtChannelHandleT channelHandle,
228 SaEvtSubscriptionIdT subscriptionId);
230 SaAisErrorT
231 saEvtEventRetentionTimeClear(
232 SaEvtChannelHandleT channelHandle,
233 SaEvtEventIdT eventId);
235 #ifdef __cplusplus
237 #endif
238 #endif /* AIS_EVT_H_DEFINED */