yumapro  20.10-12
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
ses.h
NETCONF Session Common definitions module.
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
val.h
Value Node Basic Support.
status_enum.h
global error status code enumerations
log_debug3
void void void void void void void void void void void log_debug3(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG3 log entry.
obj_is_list
boolean obj_is_list(const obj_template_t *obj)
Check if object is a YANG list.
Definition: obj.c:13349
dlq_insertAhead
void dlq_insertAhead(void *newP, void *nodeP)
insert the new queue entry before the current entry
Definition: dlq.c:447
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
xpath.h
Schema and data model Xpath search support.
log_debug4
void void void void void void void void void void void void void log_debug4(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG4 log entry.
obj_get_name
const xmlChar * obj_get_name(const obj_template_t *obj)
Get the name field for this obj.
Definition: obj.c:10511
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
dlq_remove
void dlq_remove(void *nodeP)
remove the queue entry from its queue list entry MUST have been enqueued somehow before this function...
Definition: dlq.c:519
rpc.h
NETCONF protocol remote procedure call common definitions.
ERR_INTERNAL_INIT_SEQ
@ ERR_INTERNAL_INIT_SEQ
007
Definition: status_enum.h:197
yang.h
YANG Module parser utilities.
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
agt.h
Multi-Protocol Network Management Server.
obj_is_container
boolean obj_is_container(const obj_template_t *obj)
Check if object is a YANG container.
Definition: obj.c:13405
obj_get_mod_name
const xmlChar * obj_get_mod_name(const obj_template_t *obj)
Get the module name for this object.
Definition: obj.c:12176
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
obj.h
Data Object Support.
xpath_find_schema_target_int
status_t xpath_find_schema_target_int(const xmlChar *target, obj_template_t **targobj)
@
Definition: xpath.c:2475
dlq_enque
void dlq_enque(REG void *newP, REG dlq_hdrT *listP)
add a queue node to the end of a queue list Add newP to listP
Definition: dlq.c:246
agt_slot.h
Experimental SIL Slot Interface (not used)
obj_get_typestr
const xmlChar * obj_get_typestr(const obj_template_t *obj)
Get the name of the object type.
Definition: obj.c:11392
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297