yumapro  24.10-1
YumaPro SDK
Loading...
Searching...
No Matches
keymap.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023, 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#ifndef _H_keymap
12#define _H_keymap
13
14/* FILE: keymap.h
15*********************************************************************
16* *
17* P U R P O S E *
18* *
19*********************************************************************/
20
65/*********************************************************************
66* *
67* C H A N G E H I S T O R Y *
68* *
69*********************************************************************
70
71date init comment
72----------------------------------------------------------------------
7326-jun-23 abb Begun
74
75*/
76
77#include "dlq.h"
78#include "obj.h"
79#include "status_enum.h"
80
81/*** assumes procdefs.h has been included ***/
82
83#ifdef __cplusplus
84extern "C" {
85#endif
86
87/* access the cookie in the keymap_map_t struct */
88#define KEYMAP_MAP_COOKIE(M) (M)->cookie
89
90/********************************************************************
91* *
92* T Y P E S *
93* *
94*********************************************************************/
95
96
101typedef struct keymap_set_t_ {
104
110
114 dlq_hdr_t cbQ; // Q of keymap_map_t
115
117
118
119
124typedef struct keymap_map_t_ {
126 dlq_hdr_t qhdr;
127
130
134 void *cookie;
135
139 dlq_hdr_t anckeyQ; // Q of ncx_backptr_t to malloced string
140
145 dlq_hdr_t keyQ; // Q of keymap_key_t
146
148
149/********************************************************************
150* *
151* F U N C T I O N S *
152* *
153*********************************************************************/
154
155
182extern keymap_set_t *
184 uint32 anckey_cnt,
185 status_t *res);
186
187
188
197extern void
199
200
201
223extern keymap_map_t *
225 void *cookie,
226 status_t *res,
227 ...); // ancestor keys
228
229
230
238extern void
240 keymap_map_t *cb);
241
242
252extern keymap_map_t *
254 ...); // ancestor keys
255
256
257
275extern status_t
277 void *cookie,
278 ...); // list keys
279
280
293extern status_t
295 ...); // list keys
296
297
305extern void
307
308
309
338extern status_t
340 boolean getnext,
341 boolean *islast,
342 void **cookie,
343 dlq_hdr_t *keyQ,
344 ...);
345
346
349#ifdef __cplusplus
350} /* end extern 'C' */
351#endif
352
353#endif /* _H_keymap */
dlq provides general double-linked list and queue support:
status_t keymap_get_return_keys(keymap_map_t *cb, boolean getnext, boolean *islast, void **cookie, dlq_hdr_t *keyQ,...)
get the return keys for the GET or GETNEXT request
Definition: keymap.c:1522
void keymap_dump_map(keymap_map_t *cb)
debug dump a keymap
Definition: keymap.c:1461
keymap_set_t * keymap_new_set(obj_template_t *listobj, uint32 anckey_cnt, status_t *res)
create a new keymap set
Definition: keymap.c:997
status_t keymap_add_row(keymap_map_t *cb, void *cookie,...)
create a new row in a keymap
Definition: keymap.c:1280
void keymap_free_set(keymap_set_t *mapset)
free a keymap set
Definition: keymap.c:1039
void keymap_free_map(keymap_set_t *mapset, keymap_map_t *cb)
free a keymap
Definition: keymap.c:1233
keymap_map_t * keymap_get_map(keymap_set_t *mapset,...)
retrieve an existing keymap from its ancestor keys
Definition: keymap.c:1170
status_t keymap_remove_row(keymap_map_t *cb,...)
remove and delete a row in a keymap
Definition: keymap.c:1372
keymap_map_t * keymap_new_map(keymap_set_t *mapset, void *cookie, status_t *res,...)
create a new keymap
Definition: keymap.c:1084
status_t
global error return code
Definition: status_enum.h:210
Data Object Support.
global error status code enumerations
one keymap contains all row entries for one list object Used by SIL or SIL-SA code to cache list entr...
Definition: keymap.h:124
dlq_hdr_t qhdr
the queue header; TBD: support AVL tree for big CB
Definition: keymap.h:126
void * cookie
the cookie passed to the keymap_new_map function use KEYMAP_MAP_COOKIE macro to access this field
Definition: keymap.h:134
dlq_hdr_t anckeyQ
Queue of ncx_backptr_t to a malloced string Each one represents the ancestor key value to match.
Definition: keymap.h:139
keymap_set_t * mapset
the parent keymap set that this keymap is for
Definition: keymap.h:129
dlq_hdr_t keyQ
Queue of keymap_key_t struct Each one represents the entire subtree for the specific major index in t...
Definition: keymap.h:145
one set of keymaps contains all row entries for one list object Used by SIL or SIL-SA code to cache l...
Definition: keymap.h:101
obj_template_t * obj
the list object that this keymap is for
Definition: keymap.h:103
dlq_hdr_t cbQ
Queue of keymap_map_t struct Each one represents one keymap for one set of ancestor keys.
Definition: keymap.h:114
uint32 anckey_cnt
the number of ancestor keys expected for this list.
Definition: keymap.h:109
One YANG data-def-stmt.
Definition: obj.h:1229