yumapro  21.10T-9
YumaPro SDK
agt_slot.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 - 2021, YumaWorks, Inc., All Rights Reserved.
3  *
4  * Unless required by applicable law or agreed to in writing,
5  * software distributed under the License is distributed on an
6  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
7  * KIND, either express or implied. See the License for the
8  * specific language governing permissions and limitations
9  * under the License.
10  */
11 
18 #if 0 // temp for now so code size not increased.
19 
20 #ifndef _H_agt_slot
21 #define _H_agt_slot
22 
23 /* FILE: agt_slot.h
24 *********************************************************************
25 * *
26 * P U R P O S E *
27 * *
28 *********************************************************************
29 
30  NETCONF Server Slots handler
31 
32 *********************************************************************
33 * *
34 * C H A N G E H I S T O R Y *
35 * *
36 *********************************************************************
37 
38 date init comment
39 ----------------------------------------------------------------------
40 02-Aug-17 am Begun;
41 */
42 
43 #include "agt.h"
44 #include "rpc.h"
45 #include "ses.h"
46 #include "status_enum.h"
47 #include "val.h"
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 /********************************************************************
54 * *
55 * C O N S T A N T S *
56 * *
57 *********************************************************************/
58 
59 
60 /********************************************************************
61 * *
62 * T Y P E S *
63 * *
64 *********************************************************************/
65 
66 /* Typedef of the agt_slot_cb_t callback
67 *
68 *
69 * INPUTS:
70 * input == val_value_t to use for write operations
71 * output == val_value_t to use for retrieval
72 *
73 * OUTPUTS:
74 * none
75 *
76 * RETURNS:
77 * status
78 */
79 typedef status_t
80  (*agt_slot_cb_t) (val_value_t *input,
81  val_value_t *output);
82 
83 
84 /* header for all the SLOTS records
85  * specified by the object template
86  */
87 typedef struct agt_slot_t_ {
88  dlq_hdr_t qhdr;
89 
90  /* target object node for the callback */
91  obj_template_t *obj; // back ptr to obj
92  const xmlChar *defpath;
93  agt_slot_cb_t slot_cb;
94 } agt_slot_t;
95 
96 
97 /********************************************************************
98 * *
99 * F U N C T I O N S *
100 * *
101 *********************************************************************/
102 
103 
104 /********************************************************************
105 * FUNCTION agt_slot_new_slot
106 *
107 * Create a new SLOT
108 *
109 * INPUTS:
110 * obj == object template to use
111 * slot_cb == callback function to use
112 *
113 * RETURNS:
114 * pointer to initialized SLOT, or NULL if malloc error
115 *
116 *********************************************************************/
117 extern agt_slot_t *
118  agt_slot_new_slot (obj_template_t *obj,
119  const xmlChar *defpath,
120  agt_slot_cb_t slot_cb);
121 
122 
123 /********************************************************************
124 * FUNCTION agt_slot_free_slot
125 *
126 * Free a Slot
127 *
128 * INPUTS:
129 * slot == SLOT to free
130 * RETURNS:
131 * none
132 *********************************************************************/
133 extern void
134  agt_slot_free_slot (agt_slot_t *slot);
135 
136 
137 /********************************************************************
138 * FUNCTION agt_slot_init
139 *
140 * Init the agent slots
141 *
142 * RETURNS:
143 * status
144 *********************************************************************/
145 extern status_t
146  agt_slot_init (void);
147 
148 
149 /********************************************************************
150 * FUNCTION agt_slot_cleanup
151 *
152 * CLeanup the agent slots
153 *
154 *********************************************************************/
155 extern void
156  agt_slot_cleanup (void);
157 
158 
159 /********************************************************************
160 * FUNCTION agt_slot_register_slot
161 *
162 * Register a slot into slots Register
163 *
164 * INPUTS:
165 * obj == object template that represent a slot
166 * slot_cbfn == address of callback function to register
167 *
168 * RETURNS:
169 * status
170 *********************************************************************/
171 extern status_t
172  agt_slot_register_slot (const xmlChar *defpath,
173  agt_slot_cb_t slot_cbfn);
174 
175 
176 /********************************************************************
177 * FUNCTION agt_slot_unregister_slot
178 *
179 * Unregister all slots inthe Register
180 *
181 * INPUTS:
182 * obj == object template that represent a slot
183 *
184 * RETURNS:
185 * none
186 *********************************************************************/
187 extern void
188  agt_slot_unregister_slot (const xmlChar *defpath);
189 
190 
191 /********************************************************************
192 * FUNCTION agt_slot_invoke_callback
193 *
194 * Invoke Callbacks for the specified object template
195 *
196 *
197 * INPUT
198 * obj == obj template to use
199 * input == input val_value_t for the callback
200 * output == output val_value_t for the callback
201 *
202 * RETURN
203 * status of the operation (usually returned from the callback)
204 * NO USER CALLBACK FOUND == NO_ERR
205 *
206 ********************************************************************/
207 extern status_t
208  agt_slot_invoke_callback (obj_template_t *obj,
209  val_value_t *input,
210  val_value_t *output);
211 
212 
213 #ifdef __cplusplus
214 } /* end extern 'C' */
215 #endif
216 
217 #endif /* _H_agt_slot */
218 
219 
220 #endif
One YANG data-def-stmt.
Definition: obj.h:1140
NETCONF Session Common definitions module.
Value Node Basic Support.
one value to match one type
Definition: val.h:870
status_t
global error return code
Definition: status_enum.h:186
Multi-Protocol Network Management Server.
NETCONF protocol remote procedure call common definitions.
global error status code enumerations