FD.io VPP  v16.06
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 {
27  SVMDB_ACTION_GET, /* not clear why anyone would care */
31 
32 typedef struct {
33  int pid;
34  int signum;
35  u32 action:4;
36  u32 opaque:28;
38 
39 typedef struct {
44 
45 typedef enum {
50 
51 typedef struct {
53  /* pool of values */
55  uword *namespaces [SVMDB_N_NAMESPACES];
57 
58 #define SVMDB_SHM_VERSION 2
59 
60 typedef struct {
61  int flags;
62  int pid;
66 
67 typedef struct {
68  int add_del;
70  char *var;
72  int signum;
73  u32 action:4;
74  u32 opaque:28;
76 
77 /*
78  * Must be a reasonable number, several mb smaller than
79  * SVM_GLOBAL_REGION_SIZE, or no donut for you...
80  */
81 #define SVMDB_DEFAULT_SIZE (4<<20)
82 
84 
86 
87 svmdb_client_t *svmdb_map_chroot (char *root_path);
88 
90 
91 void svmdb_unmap (svmdb_client_t *client);
92 void svmdb_local_unset_string_variable (svmdb_client_t *client, char *var);
94  char *var, char *val);
95 char *svmdb_local_get_string_variable (svmdb_client_t *client, char *var);
98  char *var);
99 
101 
102 void svmdb_local_unset_vec_variable (svmdb_client_t *client, char *var);
104  char *var, void *val, u32 elsize);
105 void *svmdb_local_get_vec_variable (svmdb_client_t *client, char *var,
106  u32 elsize);
108 
111 
113  char *var, u32 nbytes);
114 
115 #endif /* __included_svmdb_h__ */
int flags
Definition: svmdb.h:61
svmdb_client_t * svmdb_map_chroot_size(char *root_path, uword size)
Definition: svmdb.c:140
svmdb_namespace_t nspace
Definition: svmdb.h:69
svmdb_client_t * svmdb_map_size(uword size)
Definition: svmdb.c:130
void svmdb_local_dump_strings(svmdb_client_t *client)
Definition: svmdb.c:389
void svmdb_local_set_vec_variable(svmdb_client_t *client, char *var, void *val, u32 elsize)
Definition: svmdb.c:421
int signum
Definition: svmdb.h:34
int svmdb_local_add_del_notification(svmdb_client_t *client, svmdb_notification_args_t *args)
Definition: svmdb.c:193
void svmdb_unmap(svmdb_client_t *client)
Definition: svmdb.c:145
void svmdb_local_unset_string_variable(svmdb_client_t *client, char *var)
Definition: svmdb.c:282
uword version
Definition: svmdb.h:52
svmdb_namespace_t
Definition: svmdb.h:45
void svmdb_local_unset_vec_variable(svmdb_client_t *client, char *var)
Definition: svmdb.c:410
svmdb_shm_hdr_t * shm
Definition: svmdb.h:64
svmdb_action_t
Definition: svmdb.h:25
u32 elsize
Definition: svmdb.h:42
void svmdb_local_dump_vecs(svmdb_client_t *client)
Definition: svmdb.c:460
svm_region_t * db_rp
Definition: svmdb.h:63
svmdb_notify_t * notifications
Definition: svmdb.h:41
char * svmdb_local_get_string_variable(svmdb_client_t *client, char *var)
Definition: svmdb.c:374
unsigned int u32
Definition: types.h:88
void svmdb_local_set_string_variable(svmdb_client_t *client, char *var, char *val)
Definition: svmdb.c:326
void * svmdb_local_get_variable_reference(svmdb_client_t *client, svmdb_namespace_t ns, char *var)
Definition: svmdb.c:362
u32 size
Definition: vhost-user.h:74
u64 uword
Definition: types.h:112
unsigned char u8
Definition: types.h:56
void * svmdb_local_find_or_add_vec_variable(svmdb_client_t *client, char *var, u32 nbytes)
Definition: svmdb.c:483
svmdb_client_t * svmdb_map_chroot(char *root_path)
Definition: svmdb.c:135
u8 * value
Definition: svmdb.h:40
svmdb_value_t * values
Definition: svmdb.h:54
svmdb_client_t * svmdb_map(void)
Definition: svmdb.c:125
void * svmdb_local_get_vec_variable(svmdb_client_t *client, char *var, u32 elsize)
Definition: svmdb.c:438