FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
svmdb.h
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * svmdb.h - shared VM database
4  *
5  * Copyright (c) 2009 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #ifndef __included_svmdb_h__
21 #define __included_svmdb_h__
22 
23 #include "svm.h"
24 
25 typedef enum
26 {
28  SVMDB_ACTION_GET, /* not clear why anyone would care */
32 
33 typedef struct
34 {
35  int pid;
36  int signum;
38  u32 opaque:28;
40 
41 typedef struct
42 {
47 
48 typedef enum
49 {
54 
55 typedef struct
56 {
58  /* pool of values */
60  uword *namespaces[SVMDB_N_NAMESPACES];
62 
63 #define SVMDB_SHM_VERSION 2
64 
65 typedef struct
66 {
67  int flags;
68  int pid;
72 
73 typedef struct
74 {
75  int add_del;
77  char *var;
79  int signum;
81  u32 opaque:28;
83 
84 typedef struct
85 {
86  const char *root_path;
91 
92 /*
93  * Must be a reasonable number, several mb smaller than
94  * SVM_GLOBAL_REGION_SIZE, or no donut for you...
95  */
96 #define SVMDB_DEFAULT_SIZE (4<<20)
97 
99 
100 void svmdb_unmap (svmdb_client_t * client);
101 void svmdb_local_unset_string_variable (svmdb_client_t * client, char *var);
103  char *var, char *val);
104 char *svmdb_local_get_string_variable (svmdb_client_t * client, char *var);
106  svmdb_namespace_t ns, char *var);
107 
109 
110 void svmdb_local_unset_vec_variable (svmdb_client_t * client, char *var);
112  char *var, void *val, u32 elsize);
113 void *svmdb_local_get_vec_variable (svmdb_client_t * client, char *var,
114  u32 elsize);
115 void svmdb_local_dump_vecs (svmdb_client_t * client);
116 
119 
121  char *var, u32 nbytes);
122 
123 int svmdb_local_serialize_strings (svmdb_client_t * client, char *filename);
124 int svmdb_local_unserialize_strings (svmdb_client_t * client, char *filename);
125 
126 
127 #endif /* __included_svmdb_h__ */
128 
129 /*
130  * fd.io coding-style-patch-verification: ON
131  *
132  * Local Variables:
133  * eval: (c-set-style "gnu")
134  * End:
135  */
svmdb_value_t::notifications
svmdb_notify_t * notifications
Definition: svmdb.h:44
svmdb_local_get_string_variable
char * svmdb_local_get_string_variable(svmdb_client_t *client, char *var)
Definition: svmdb.c:389
svmdb_unmap
void svmdb_unmap(svmdb_client_t *client)
Definition: svmdb.c:138
svmdb_local_get_variable_reference
void * svmdb_local_get_variable_reference(svmdb_client_t *client, svmdb_namespace_t ns, char *var)
Definition: svmdb.c:377
svmdb_local_dump_strings
void svmdb_local_dump_strings(svmdb_client_t *client)
Definition: svmdb.c:406
svmdb_notification_args_t::nspace
svmdb_namespace_t nspace
Definition: svmdb.h:76
svmdb_local_set_vec_variable
void svmdb_local_set_vec_variable(svmdb_client_t *client, char *var, void *val, u32 elsize)
Definition: svmdb.c:560
svmdb_map_args_t::root_path
const char * root_path
Definition: svmdb.h:86
svmdb_local_add_del_notification
int svmdb_local_add_del_notification(svmdb_client_t *client, svmdb_notification_args_t *args)
Definition: svmdb.c:193
svmdb_map
svmdb_client_t * svmdb_map(svmdb_map_args_t *)
Definition: svmdb.c:70
svmdb_client_t
Definition: svmdb.h:65
svmdb_notify_t::pid
int pid
Definition: svmdb.h:35
svmdb_notify_t::signum
int signum
Definition: svmdb.h:36
svmdb_notify_t::action
u32 action
Definition: svmdb.h:37
svmdb_client_t::pid
int pid
Definition: svmdb.h:68
svmdb_client_t::db_rp
svm_region_t * db_rp
Definition: svmdb.h:69
svmdb_namespace_t
svmdb_namespace_t
Definition: svmdb.h:48
SVMDB_ACTION_ILLEGAL
@ SVMDB_ACTION_ILLEGAL
Definition: svmdb.h:27
svmdb_shm_hdr_t::values
svmdb_value_t * values
Definition: svmdb.h:59
svmdb_notification_args_t
Definition: svmdb.h:73
svmdb_local_unserialize_strings
int svmdb_local_unserialize_strings(svmdb_client_t *client, char *filename)
Definition: svmdb.c:496
svmdb_notification_args_t::elsize
u32 elsize
Definition: svmdb.h:78
svmdb_notification_args_t::opaque
u32 opaque
Definition: svmdb.h:81
SVMDB_ACTION_GET
@ SVMDB_ACTION_GET
Definition: svmdb.h:28
svmdb_notify_t
Definition: svmdb.h:33
svmdb_client_t::shm
svmdb_shm_hdr_t * shm
Definition: svmdb.h:70
svm.h
uword
u64 uword
Definition: types.h:112
svmdb_map_args_t::gid
u32 gid
Definition: svmdb.h:89
svmdb_value_t::value
u8 * value
Definition: svmdb.h:43
svmdb_action_t
svmdb_action_t
Definition: svmdb.h:25
SVMDB_NAMESPACE_STRING
@ SVMDB_NAMESPACE_STRING
Definition: svmdb.h:50
SVMDB_ACTION_SET
@ SVMDB_ACTION_SET
Definition: svmdb.h:29
svmdb_local_serialize_strings
int svmdb_local_serialize_strings(svmdb_client_t *client, char *filename)
Definition: svmdb.c:430
svmdb_shm_hdr_t
Definition: svmdb.h:55
SVMDB_ACTION_UNSET
@ SVMDB_ACTION_UNSET
Definition: svmdb.h:30
svmdb_local_set_string_variable
void svmdb_local_set_string_variable(svmdb_client_t *client, char *var, char *val)
Definition: svmdb.c:339
svmdb_map_args_t::uid
u32 uid
Definition: svmdb.h:88
svmdb_local_unset_vec_variable
void svmdb_local_unset_vec_variable(svmdb_client_t *client, char *var)
Definition: svmdb.c:548
svmdb_local_unset_string_variable
void svmdb_local_unset_string_variable(svmdb_client_t *client, char *var)
Definition: svmdb.c:290
svmdb_notify_t::opaque
u32 opaque
Definition: svmdb.h:38
svmdb_local_find_or_add_vec_variable
void * svmdb_local_find_or_add_vec_variable(svmdb_client_t *client, char *var, u32 nbytes)
Definition: svmdb.c:627
u32
unsigned int u32
Definition: types.h:88
svmdb_notification_args_t::add_del
int add_del
Definition: svmdb.h:75
SVMDB_NAMESPACE_VEC
@ SVMDB_NAMESPACE_VEC
Definition: svmdb.h:51
svmdb_value_t::elsize
u32 elsize
Definition: svmdb.h:45
svmdb_local_dump_vecs
void svmdb_local_dump_vecs(svmdb_client_t *client)
Definition: svmdb.c:601
svmdb_shm_hdr_t::version
uword version
Definition: svmdb.h:57
svmdb_value_t
Definition: svmdb.h:41
svmdb_notification_args_t::signum
int signum
Definition: svmdb.h:79
svm_region_
Definition: svm_common.h:35
u8
unsigned char u8
Definition: types.h:56
svmdb_client_t::flags
int flags
Definition: svmdb.h:67
svmdb_notification_args_t::action
u32 action
Definition: svmdb.h:80
svmdb_map_args_t::size
uword size
Definition: svmdb.h:87
SVMDB_N_NAMESPACES
@ SVMDB_N_NAMESPACES
Definition: svmdb.h:52
svmdb_local_get_vec_variable
void * svmdb_local_get_vec_variable(svmdb_client_t *client, char *var, u32 elsize)
Definition: svmdb.c:578
svmdb_notification_args_t::var
char * var
Definition: svmdb.h:77
svmdb_map_args_t
Definition: svmdb.h:84