FD.io VPP  v18.07-34-g55fbdb9
Vector Packet Processing
application_namespace.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <vnet/vnet.h>
18 
19 #ifndef SRC_VNET_SESSION_APPLICATION_NAMESPACE_H_
20 #define SRC_VNET_SESSION_APPLICATION_NAMESPACE_H_
21 
22 typedef struct _app_namespace
23 {
24  /**
25  * Local sw_if_index that supports transport connections for this namespace
26  */
27  u32 sw_if_index;
28 
29  /**
30  * Network namespace (e.g., fib_index associated to the sw_if_index)
31  * wherein connections are to be established. Since v4 and v6 fibs are
32  * separate, we actually need to keep pointers to both.
33  */
34  u32 ip4_fib_index;
35  u32 ip6_fib_index;
36 
37  /**
38  * Local session table associated to ns
39  */
40  u32 local_table_index;
41 
42  /**
43  * Secret apps need to provide to authorize attachment to the namespace
44  */
45  u64 ns_secret;
46 
47  /**
48  * Application namespace id
49  */
50  u8 *ns_id;
52 
53 typedef struct _vnet_app_namespace_add_del_args
54 {
55  u8 *ns_id;
56  u64 secret;
57  u32 sw_if_index;
58  u32 ip4_fib_id;
59  u32 ip6_fib_id;
60  u8 is_add;
62 
63 #define APP_NAMESPACE_INVALID_INDEX ((u32)~0)
64 
69 const u8 *app_namespace_id (app_namespace_t * app_ns);
70 const u8 *app_namespace_id_from_index (u32 index);
71 u32 app_namespace_index_from_id (const u8 * ns_id);
72 void app_namespaces_init (void);
74  a);
77 
80 {
81  return app_namespace_get (0);
82 }
83 
84 #endif /* SRC_VNET_SESSION_APPLICATION_NAMESPACE_H_ */
85 
86 /*
87  * fd.io coding-style-patch-verification: ON
88  *
89  * Local Variables:
90  * eval: (c-set-style "gnu")
91  * End:
92  */
void app_namespaces_init(void)
a
Definition: bitmap.h:538
clib_error_t * vnet_app_namespace_add_del(vnet_app_namespace_add_del_args_t *a)
unsigned long u64
Definition: types.h:89
struct _vnet_app_namespace_add_del_args vnet_app_namespace_add_del_args_t
unsigned char u8
Definition: types.h:56
app_namespace_t * app_namespace_alloc(u8 *ns_id)
#define always_inline
Definition: clib.h:92
session_table_t * app_namespace_get_local_table(app_namespace_t *app_ns)
unsigned int u32
Definition: types.h:88
u32 app_namespace_index_from_id(const u8 *ns_id)
const u8 * app_namespace_id(app_namespace_t *app_ns)
static app_namespace_t * app_namespace_get_default(void)
app_namespace_t * app_namespace_get(u32 index)
u32 app_namespace_get_fib_index(app_namespace_t *app_ns, u8 fib_proto)
struct _app_namespace app_namespace_t
const u8 * app_namespace_id_from_index(u32 index)
struct _session_lookup_table session_table_t
app_namespace_t * app_namespace_get_from_id(const u8 *ns_id)
u32 app_namespace_index(app_namespace_t *app_ns)