Distributed Publish & Subscribe for IoT
dispatcher.h
Go to the documentation of this file.
1 
6 /*
7  *******************************************************************
8  *
9  * Copyright 2019 Intel Corporation All rights reserved.
10  *
11  *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
12  *
13  * Licensed under the Apache License, Version 2.0 (the "License");
14  * you may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  *
25  *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
26  */
27 
28 #ifndef _DPS_DISPATCHER_H
29 #define _DPS_DISPATCHER_H
30 
31 #include <dps/err.h>
32 #include <dps/dps.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
47 typedef struct _DPS_Dispatcher DPS_Dispatcher;
48 
57 typedef void (*DPS_DispatchFunc)(DPS_Node* node, DPS_Dispatcher* dispatcher, void* data);
58 
67 
80 DPS_Status DPS_Dispatch(DPS_Dispatcher* dispatcher, void* data, int delay);
81 
87 void DPS_DestroyDispatcher(DPS_Dispatcher* dispatcher);
88 
97 typedef void (*DPS_DelayedFunc)(DPS_Node* node, void* data);
98 
113 DPS_Status DPS_ScheduleCall(DPS_Node* node, DPS_DelayedFunc func, void* data, int delay);
114 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif
Public APIs.
int DPS_Status
The status code type.
Definition: err.h:41
DPS_Dispatcher * DPS_CreateDispatcher(DPS_Node *node, DPS_DispatchFunc func)
Create a dispatcher and register the function to be called.
DPS_Status DPS_ScheduleCall(DPS_Node *node, DPS_DelayedFunc func, void *data, int delay)
Wrapper function that creates a dispatcher and schedules a function to be called after a delay...
Status codes.
struct _DPS_Dispatcher DPS_Dispatcher
Opaque type for an dispatcher.
Definition: dispatcher.h:47
DPS_Status DPS_Dispatch(DPS_Dispatcher *dispatcher, void *data, int delay)
Call the function registered when the dispatcher was created.
void DPS_DestroyDispatcher(DPS_Dispatcher *dispatcher)
Destroy a dispatcher and free resources.
void(* DPS_DispatchFunc)(DPS_Node *node, DPS_Dispatcher *dispatcher, void *data)
Prototype for function to be called by a dispatcher.
Definition: dispatcher.h:57
void(* DPS_DelayedFunc)(DPS_Node *node, void *data)
Prototype for a delayed dispatched function call.
Definition: dispatcher.h:97
struct _DPS_Node DPS_Node
Opaque type for a node.
Definition: dps.h:450