Fixed newline characters throughout the code
[com/gs-lite.git] / src / lib / gscphost / include / callbackregistries.h
1 /* ------------------------------------------------
2  Copyright 2014 AT&T Intellectual Property
3  Licensed under the Apache License, Version 2.0 (the "License");
4  you may not use this file except in compliance with the License.
5  You may obtain a copy of the License at
6  
7  http://www.apache.org/licenses/LICENSE-2.0
8  
9  Unless required by applicable law or agreed to in writing, software
10  distributed under the License is distributed on an "AS IS" BASIS,
11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  See the License for the specific language governing permissions and
13  limitations under the License.
14  ------------------------------------------- */
15 #ifndef CALLBACKREGISTRIES_H
16 #define CALLBACKREGISTRIES_H
17 #include "gsconfig.h"
18 #include "gstypes.h"
19
20 #include "fta.h"
21 #include "gscpipc.h"
22
23
24 /* This registry is used to keep track of FTAswithin the current process
25  * they are registerd when they are initiated and unregisterd if
26  * they are freed
27  */
28
29 /* registers an alloc function of an FTA and returns a unique index */
30 gs_retval_t ftacallback_add_alloc(FTAname name, alloc_fta fta_alloc_functionptr, gs_uint64_t prefilter);
31
32 /* unregisters an alloc function of an FTA and makes the index available
33  * for reuse
34  */
35
36 gs_retval_t ftacallback_rm_alloc(gs_uint32_t index);
37
38 /* returns the function pointer of the callback function for a given
39  * index
40  */
41
42 alloc_fta ftacallback_get_alloc(gs_int32_t index);
43
44 /* returns the prefilter for a given
45  * index
46  */
47
48 gs_uint64_t ftacallback_get_prefilter(gs_int32_t index);
49
50 /* The second registry is used to keep track of to which process a particular
51  stream ID should be posted too.
52  */
53
54 /* associate ringbuffer with streamid (using refcounting) */
55 gs_retval_t ftacallback_add_streamid(struct ringbuf * r, gs_uint32_t streamid);
56
57 /* unassosciate a ringbuffer from a streamid */
58
59 gs_retval_t ftacallback_rm_streamid(struct ringbuf * r, gs_uint32_t streamid);
60
61 /* starts an itteration through all ringbuffers for a particular streamid */
62
63 gs_retval_t ftacallback_start_streamid(gs_int32_t streamid);
64
65 /* returns all the ringbuffer associated with the streamid passed in
66  * ftacallback_start_streamid
67  */
68 struct ringbuf * ftacallback_next_streamid(gs_int32_t * state);
69
70 /* set the state for a given streamid and destination process */
71
72 gs_retval_t ftacallback_state_streamid(gs_int32_t streamid,FTAID process, gs_int32_t state);
73
74 /* The third registry is used to keep track of which process is blocked
75  on which ringbuf
76  */
77
78 /* associate msgid with ringbuf  */
79 gs_retval_t ftacallback_add_wakeup(FTAID ftaid, struct ringbuf * r);
80
81 /* starts an itteration through all msgids associated with
82  a streamid. This also uses data kept in the second
83  registry
84  */
85 gs_retval_t ftacallback_start_wakeup(gs_uint32_t streamid);
86
87 /* returns all the msgid blocked on the streamid passed in
88  * ftacallback_start_streamid and removes the msgid from
89  * the wakeup list
90  */
91 FTAID * ftacallback_next_wakeup();
92
93
94 /*
95  * the following two functions insert and remove an  instance
96  * of an FTA from the active list.
97  */
98
99 gs_retval_t ftaexec_insert(struct FTA * after, struct FTA * new);
100 gs_retval_t ftaexec_remove(struct FTA * id);
101
102 /*
103  * FTA's cannot be dynamically installed (since we currently don't
104  * have a run-time linker in the card).  however, new parameterized
105  * instances of previously installed FTAs can be created.  The FTA
106  * template IDs have to defined in an include file.  the following
107  * call will result in a call to the FTA's alloc_fta function.
108  */
109
110 struct FTA * ftaexec_alloc_instance(gs_uint32_t index, struct FTA * reuse,
111                                     gs_uint32_t reusable,
112                                     gs_int32_t command, gs_int32_t sz, void *  data);
113
114
115 /*
116  * the next two functions result in callouts to the corresponding FTA
117  * functions (fta_free, control_fta).
118  */
119
120 gs_retval_t ftaexec_free_instance(struct FTA * FTA_id, gs_uint32_t recursive);
121
122 gs_retval_t ftaexec_control(struct FTA * FTA_id, gs_int32_t command, gs_int32_t sz, void * value);
123
124 gs_retval_t ftaexec_process_control(gs_int32_t command, gs_int32_t sz, void * value);
125
126 /* Start itteration through list of active FTA */
127
128 gs_retval_t ftaexec_start();
129
130 /* get one FTA at a time */
131
132 struct FTA * ftaexec_next();
133
134
135 /* HFTA internal print function*/
136
137 gs_retval_t add_printfunction_to_stream(struct FTA * ftaid, gs_sp_t schema, gs_sp_t path, gs_sp_t basename,
138                                         gs_sp_t temporal_field, gs_sp_t split_field, gs_uint32_t delta, gs_uint32_t split);
139
140 gs_retval_t print_stream(struct FTA * self, gs_int32_t sz, void *tuple);
141
142
143 #endif