OpenClovis Logo

clEventApi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2012 OpenClovis Solutions Inc. All Rights Reserved.
3  *
4  * This file is available under a commercial license from the
5  * copyright holder or the GNU General Public License Version 2.0.
6  *
7  * The source code for this program is not published or otherwise
8  * divested of its trade secrets, irrespective of what has been
9  * deposited with the U.S. Copyright office.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * For more information, see the file COPYING provided with this
17  * material.
18  */
19 /*******************************************************************************
20  * ModuleName : event
21  * File : clEventApi.h
22  *******************************************************************************/
23 
24 /*******************************************************************************
25  * Description :
26  * This header file contains the various API available with EM.
27  *
28  *
29  *****************************************************************************/
30 
31 
44 #ifndef _CL_EVENT_API_H_
45 # define _CL_EVENT_API_H_
46 
47 # ifdef __cplusplus
48 extern "C"
49 {
50 # endif
51 
52 # include "clCommon.h"
53 # include "clCommonErrors.h"
54 # include "clOsalApi.h"
55 # include "clCntApi.h"
56 # include "clCommon.h"
57 # include "clEventErrors.h"
58 
59 
60 /******************************************************************************
61  EM Definitions
62 ******************************************************************************/
63 
67 # define CL_EVENT_LOCAL_CHANNEL (0x0)
68 
72 # define CL_EVENT_GLOBAL_CHANNEL (0x1)
73 
77 # define CL_EVENT_CHANNEL_SUBSCRIBER (0x2)
78 
82 # define CL_EVENT_CHANNEL_PUBLISHER (0x4)
83 
87 # define CL_EVENT_CHANNEL_CREATE (0x8)
88 
92 # define CL_EVENT_HIGHEST_PRIORITY (0x0)
93 
97 # define CL_EVENT_LOWEST_PRIORITY (0x3)
98 
102 # define CL_EVENT_VERSION {(ClUint8T)'B', 0x1, 0x1}
103 # define CL_EVENT_VERSION_SET(version) (version).releaseCode = (ClUint8T)'B', \
104  (version).majorVersion = 0x1,\
105  (version).minorVersion = 0x1
106 
107 /******************************************************************************
108  EM Data types
109 ******************************************************************************/
110 
115  typedef ClUint64T ClEventIdT;
116 
121  typedef ClUint8T ClEventPriorityT;
122 
140  typedef ClUint8T ClEventChannelOpenFlagsT;
141 
142 
143 
144  /*
145  * Various Event handles
146  */
147 
153  typedef ClHandleT ClEventInitHandleT;
154 
158  typedef ClHandleT ClEventHandleT;
159 
164  typedef ClHandleT ClEventChannelHandleT;
165 
171  typedef ClUint32T ClEventSubscriptionIdT;
172 
173 
174 
175 /******************************************************************************
176  EM Callbacks
177 ******************************************************************************/
178 
206  typedef void (*ClEventDeliverCallbackT)(
207  ClEventSubscriptionIdT subscriptionId,
208  ClEventHandleT eventHandle,
209  ClSizeT eventDataSize);
210 
233  typedef void (*ClEventChannelOpenCallbackT) (
234  ClInvocationT invocation,
235  ClEventChannelHandleT channelHandle,
236  ClRcT error);
237 
238 
243  typedef struct
244  {
245 
250 
255 
257 
258  typedef struct
259  {
260  ClUint8T version;
261  ClEventCallbacksT callbacks;
262  } ClEventVersionCallbacksT;
263 
264 /******************************************************************************
265  EM Data structures
266 ******************************************************************************/
267 
275  typedef struct
276  {
277 
282 
287 
291  ClUint8T *pPattern;
292 
293  } ClEventPatternT;
294 
298  typedef struct
299  {
300 
305 
310 
315 
317 
318 
323  typedef enum
324  {
341 
343 
349  typedef struct
350  {
351 
356 
361 
362  } ClEventFilterT;
363 
374  typedef struct
375  {
376 
381 
386 
388 
389 /******************************************************************************
390  EM External functions
391 ******************************************************************************/
392 
438  ClRcT clEventInitialize(CL_OUT ClEventInitHandleT *pEvtHandle,
439  CL_IN const ClEventCallbacksT * pEvtCallbacks,
440  CL_INOUT ClVersionT *pVersion);
441 
442  ClRcT clEventInitializeWithVersion(CL_OUT ClEventInitHandleT *pEvtHandle,
443  CL_IN const ClEventVersionCallbacksT *pEvtCallbackTable,
444  CL_IN ClUint32T numCallbacks,
445  CL_INOUT ClVersionT *pVersion);
446 
483  ClRcT clEventSelectionObjectGet(ClEventInitHandleT evtHandle,
484  ClSelectionObjectT * pSelectionObject);
485 
486 
487 
519  ClRcT clEventDispatch(ClEventInitHandleT evtHandle,
520  ClDispatchFlagsT dispatchFlags);
521 
522 
557  ClRcT clEventFinalize(CL_IN ClEventInitHandleT evtHandle);
558 
614  ClRcT clEventChannelOpen(CL_IN ClEventInitHandleT evtHandle,
615  CL_IN const ClNameT *pEvtChannelName,
616  CL_IN ClEventChannelOpenFlagsT evtChannelOpenFlag,
617  CL_IN ClTimeT timeout,
618  CL_OUT ClEventChannelHandleT *pChannelHandle);
619 
620 
676  ClRcT clEventChannelOpenAsync(CL_IN ClEventInitHandleT evtHandle,
677  CL_IN ClInvocationT invocation,
678  CL_IN const ClNameT *pEvtChannelName,
679  CL_IN ClEventChannelOpenFlagsT
680  channelOpenFlags);
681 
714  ClRcT clEventChannelClose(CL_IN ClEventChannelHandleT channelHandle);
715 
716 
760  ClRcT clEventChannelUnlink(CL_IN ClEventInitHandleT evtHandle,
761  CL_IN const ClNameT *pEvtChannelName);
762 
763 
796  ClRcT clEventAllocate(CL_IN ClEventChannelHandleT channelHandle,
797  CL_OUT ClEventHandleT *pEventHandle);
798 
799  ClRcT clEventAllocateWithVersion(CL_IN ClEventChannelHandleT channelHandle,
800  CL_IN ClUint8T version,
801  CL_OUT ClEventHandleT *pEventHandle);
802 
803 
829  ClRcT clEventFree(CL_IN ClEventHandleT eventHandle);
830 
831 
874  ClRcT clEventAttributesSet(CL_IN ClEventHandleT eventHandle,
875  CL_IN const ClEventPatternArrayT *pPatternArray,
876  CL_IN ClEventPriorityT priority,
877  CL_IN ClTimeT retentionTime,
878  CL_IN const ClNameT *pPublisherName);
879 
880 
959  ClRcT clEventAttributesGet(CL_IN ClEventHandleT eventHandle,
960  CL_IN ClEventPatternArrayT *pPatternArray,
961  CL_OUT ClEventPriorityT * pPriority,
962  CL_OUT ClTimeT *pRetentionTime,
963  CL_OUT ClNameT *pPublisherName,
964  CL_OUT ClTimeT *pPublishTime,
965  CL_OUT ClEventIdT * pEventId);
966 
967 
1020  ClRcT clEventDataGet(CL_IN ClEventHandleT eventHandle,
1021  CL_INOUT void *pEventData,
1022  CL_INOUT ClSizeT *pEventDataSize);
1023 
1024 
1053  ClRcT clEventCookieGet(CL_IN ClEventHandleT eventHandle,
1054  CL_OUT void **ppCookie);
1055 
1123  ClRcT clEventPublish(CL_IN ClEventHandleT eventHandle,
1124  CL_IN const void *pEventData,
1125  CL_IN ClSizeT eventDataSize,
1126  CL_OUT ClEventIdT * pEventId);
1127 
1128 
1186  ClRcT clEventSubscribe(CL_IN ClEventChannelHandleT channelHandle,
1187  CL_IN const ClEventFilterArrayT *pFilters,
1188  CL_IN ClEventSubscriptionIdT subscriptionId,
1189  CL_IN void *pCookie);
1190 
1191 
1228  ClRcT clEventUnsubscribe(CL_IN ClEventChannelHandleT channelHandle,
1229  CL_IN ClEventSubscriptionIdT subscriptionId);
1230 
1231 
1232 /*
1233  ************************************
1234  * \brief Clears the retention event.
1235  *
1236  * \par Header File:
1237  * clEventApi.h
1238  *
1239  * \param channelHandle The handle of the event channel on which the event has been
1240  * published. \e channelHandle must be obtained earlier by either the
1241  * \e clEventChannelOpen() function or \e clEvtChannelOpenCallback() function.
1242  *
1243  * \param eventId Identifier of the event.
1244  *
1245  * \retval CL_OK The function completed successfully.
1246  * \retval CL_EVENT_ERR_INIT_NOT_DONE Event library has not been initialized.
1247  * \retval CL_EVENT_ERR_BAD_HANDLE On passing an invalid handle.
1248  * \retval CL_EVENT_INTERNAL_ERROR An unexpected problem occurred within the Event Manager.
1249  * \retval CL_EVENT_ERR_INVALID_PARAM On passing an invalid parameter.
1250  *
1251  * \par Description:
1252  * This function is used to clear the retention time of a published event, designated
1253  * by \e eventId. It indicates that EM need not keep the event any longer
1254  * for potential new subscribers. Once the value of the retention time is reset to
1255  * zero, the event is no longer available for new subscribers.
1256  *
1257  * \par Library File:
1258  * ClEventClient
1259  *
1260  * \sa clEventPublish(), ::ClEventDeliverCallbackT
1261  *
1262  */
1263  ClRcT clEventRetentionTimeClear(CL_IN ClEventChannelHandleT channelHandle,
1264  CL_IN const ClEventIdT eventId);
1265 
1266 # ifdef __cplusplus
1267 }
1268 # endif
1269 
1270 
1271 #endif /* _CL_EVENT_API_H_ */
1272 

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen