yumapro  23.10T-7
YumaPro SDK
Loading...
Searching...
No Matches
agt_acm_yuma.h
1#ifdef WITH_YUMA_NACM
2/*
3 * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
4 * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
5 *
6 * Unless required by applicable law or agreed to in writing,
7 * software distributed under the License is distributed on an
8 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9 * KIND, either express or implied. See the License for the
10 * specific language governing permissions and limitations
11 * under the License.
12 */
13#ifndef _H_agt_acm_yuma
14#define _H_agt_acm_yuma
15
16/* FILE: agt_acm_yuma.h
17*********************************************************************
18* *
19* P U R P O S E *
20* *
21*********************************************************************/
22
32/*********************************************************************
33* *
34* C H A N G E H I S T O R Y *
35* *
36*********************************************************************
37
38date init comment
39----------------------------------------------------------------------
4018-jun-12 abb Begun; split from agt_acm.h
41
42*/
43
44#include <xmlstring.h>
45
46#ifndef _H_agt
47#include "agt.h"
48#endif
49
50#ifndef _H_dlq
51#include "dlq.h"
52#endif
53
54#ifndef _H_obj
55#include "obj.h"
56#endif
57
58#ifndef _H_ses
59#include "ses.h"
60#endif
61
62#ifndef _H_status
63#include "status.h"
64#endif
65
66#ifndef _H_val
67#include "val.h"
68#endif
69
70#ifndef _H_xml_msg
71#include "xmlmsg.h"
72#endif
73
74#ifndef _H_xmlns
75#include "xmlns.h"
76#endif
77
78#ifndef _H_xpath
79#include "xpath.h"
80#endif
81
82#ifdef __cplusplus
83extern "C" {
84#endif
85
86/********************************************************************
87* *
88* C O N S T A N T S *
89* *
90*********************************************************************/
91
92
93/********************************************************************
94* *
95* T Y P E S *
96* *
97*********************************************************************/
98
99
100/********************************************************************
101* *
102* F U N C T I O N S *
103* *
104*********************************************************************/
105
106
107/********************************************************************
108* FUNCTION agt_acm_yuma_init1
109*
110* Phase 1:
111* Load the yuma-nacm.yang module
112*
113* INPUTS:
114* none
115* RETURNS:
116* status of the initialization procedure
117*********************************************************************/
118extern status_t
119 agt_acm_yuma_init1 (void);
120
121
122/********************************************************************
123* FUNCTION agt_acm_yuma_init2
124*
125* Phase 2:
126* Initialize the yuma-nacm.yang configuration data structures
127*
128* INPUTS:
129* none
130* RETURNS:
131* status of the initialization procedure
132*********************************************************************/
133extern status_t
134 agt_acm_yuma_init2 (void);
135
136
137/********************************************************************
138* FUNCTION agt_acm_yuma_cleanup
139*
140* Cleanup the yuma-nacm.yang access control module
141*
142* INPUTS:
143* none
144* RETURNS:
145* none
146*********************************************************************/
147extern void
148 agt_acm_yuma_cleanup (void);
149
150
151/********************************************************************
152* FUNCTION agt_acm_yuma_rpc_allowed
153*
154* Check if the specified user is allowed to invoke an RPC
155*
156* INPUTS:
157* msg == XML header in incoming message in progress
158* user == user name string
159* rpcobj == obj_template_t for the RPC method to check
160*
161* RETURNS:
162* TRUE if user allowed invoke this RPC; FALSE otherwise
163*********************************************************************/
164extern boolean
165 agt_acm_yuma_rpc_allowed (xml_msg_hdr_t *msg,
166 const xmlChar *user,
167 const obj_template_t *rpcobj);
168
169
170/********************************************************************
171* FUNCTION agt_acm_yuma_notif_allowed
172*
173* Check if the specified user is allowed to receive
174* a notification event
175*
176* INPUTS:
177* user == user name string
178* notifobj == obj_template_t for the notification event to check
179*
180* RETURNS:
181* TRUE if user allowed receive this notification event;
182* FALSE otherwise
183*********************************************************************/
184extern boolean
185 agt_acm_yuma_notif_allowed (const xmlChar *user,
186 const obj_template_t *notifobj);
187
188
189/********************************************************************
190* FUNCTION agt_acm_yuma_val_write_allowed
191*
192* Check if the specified user is allowed to access a value node
193* The val->obj template will be checked against the val->editop
194* requested access and the user's configured max-access
195*
196* INPUTS:
197* msg == XML header from incoming message in progress
198* newval == val_value_t in progress to check
199* (may be NULL, if curval set)
200* curval == val_value_t in progress to check
201* (may be NULL, if newval set)
202* val == val_value_t in progress to check
203* editop == requested CRUD operation
204*
205* RETURNS:
206* TRUE if user allowed this level of access to the value node
207*********************************************************************/
208extern boolean
209 agt_acm_yuma_val_write_allowed (xml_msg_hdr_t *msg,
210 const xmlChar *user,
211 const val_value_t *newval,
212 const val_value_t *curval,
213 op_editop_t editop);
214
215
216/********************************************************************
217* FUNCTION agt_acm_yuma_val_read_allowed
218*
219* Check if the specified user is allowed to read a value node
220*
221* INPUTS:
222* msg == XML header from incoming message in progress
223* user == user name string
224* val == val_value_t in progress to check
225*
226* RETURNS:
227* TRUE if user allowed read access to the value node
228*********************************************************************/
229extern boolean
230 agt_acm_yuma_val_read_allowed (xml_msg_hdr_t *msg,
231 const xmlChar *user,
232 const val_value_t *val);
233
234
235/********************************************************************
236* FUNCTION agt_acm_yuma_init_msg_cache
237*
238* Malloc and initialize an agt_acm_cache_t struct
239* and attach it to the incoming message
240*
241* INPUTS:
242* scb == session control block to use
243* msg == message to use
244*
245* OUTPUTS:
246* scb->acm_cache pointer may be set, if it was NULL
247* msg->acm_cache pointer set
248*
249* RETURNS:
250* status
251*********************************************************************/
252extern status_t
253 agt_acm_yuma_init_msg_cache (ses_cb_t *scb,
254 xml_msg_hdr_t *msg);
255
256
257/********************************************************************
258* FUNCTION agt_acm_yuma_clear_session_cache
259*
260* Clear an agt_acm_cache_t struct in a session control block
261*
262* INPUTS:
263* scb == session control block to use
264*
265* OUTPUTS:
266* scb->acm_cache pointer is freed and set to NULL
267*
268*********************************************************************/
269extern void agt_acm_yuma_clear_session_cache (ses_cb_t *scb);
270
271
272/********************************************************************
273* FUNCTION agt_acm_yuma_invalidate_session_cache
274*
275* Invalidate an agt_acm_cache_t struct in a session control block
276*
277* INPUTS:
278* scb == session control block to use
279*
280* OUTPUTS:
281* scb->acm_cache pointer is freed and set to NULL
282*
283*********************************************************************/
284extern void agt_acm_yuma_invalidate_session_cache (ses_cb_t *scb);
285
286
287/********************************************************************
288* FUNCTION agt_acm_yuma_session_cache_valid
289*
290* Check if a session ACM cache is valid
291*
292* INPUTS:
293* scb == session control block to check
294*
295* RETURNS:
296* TRUE if cache calid
297* FALSE if cache invalid or NULL
298*********************************************************************/
299extern boolean agt_acm_yuma_session_cache_valid (const ses_cb_t *scb);
300
301
302#ifdef __cplusplus
303} /* end extern 'C' */
304#endif
305
306#endif /* _H_agt_acm_yuma */
307#endif // WITH_YUMA_NACM
Multi-Protocol Network Management Server.
dlq provides general double-linked list and queue support:
op_editop_t
NETCONF edit-config operation types.
Definition: op.h:122
status_t
global error return code
Definition: status_enum.h:210
Data Object Support.
NETCONF Session Common definitions module.
Global error messages for status code enumerations.
One YANG data-def-stmt.
Definition: obj.h:1209
Session Control Block.
Definition: ses.h:573
one value to match one type
Definition: val.h:911
Common Encoding Message Header No longer XML specific!! Used by JSON and CBOR parsing as well!...
Definition: xml_msg.h:397
Value Node Basic Support.
XML namespace support.
Schema and data model Xpath search support.