blob: da3f6017961fdc38d8346a99de2d525e4055d3ba [file] [log] [blame]
Florin Corascea194d2017-10-02 00:18:51 -07001/*
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>
17
18#ifndef SRC_VNET_SESSION_APPLICATION_NAMESPACE_H_
19#define SRC_VNET_SESSION_APPLICATION_NAMESPACE_H_
20
21typedef struct _app_namespace
22{
23 /**
24 * Local sw_if_index that supports transport connections for this namespace
25 */
26 u32 sw_if_index;
27
28 /**
29 * Network namespace (e.g., fib_index associated to the sw_if_index)
30 * wherein connections are to be established. Since v4 and v6 fibs are
31 * separate, we actually need to keep pointers to both.
32 */
33 u32 ip4_fib_index;
34 u32 ip6_fib_index;
35
36 /**
37 * Local session table associated to ns
38 */
39 u32 local_table_index;
40
41 /**
42 * Secret apps need to provide to authorize attachment to the namespace
43 */
44 u64 ns_secret;
45
46 /**
47 * Application namespace id
48 */
49 u8 *ns_id;
50} app_namespace_t;
51
52typedef struct _vnet_app_namespace_add_del_args
53{
54 u8 *ns_id;
55 u64 secret;
56 u32 sw_if_index;
57 u32 ip4_fib_id;
58 u32 ip6_fib_id;
59 u8 is_add;
60} vnet_app_namespace_add_del_args_t;
61
62#define APP_NAMESPACE_INVALID_INDEX ((u32)~0)
63
64app_namespace_t *app_namespace_alloc (u8 * ns_id);
65app_namespace_t *app_namespace_get (u32 index);
66app_namespace_t *app_namespace_get_from_id (const u8 * ns_id);
67u32 app_namespace_index (app_namespace_t * app_ns);
68const u8 *app_namespace_id (app_namespace_t * app_ns);
69const u8 *app_namespace_id_from_index (u32 index);
70u32 app_namespace_index_from_id (const u8 * ns_id);
71void app_namespaces_init (void);
72clib_error_t *vnet_app_namespace_add_del (vnet_app_namespace_add_del_args_t *
73 a);
74
75#endif /* SRC_VNET_SESSION_APPLICATION_NAMESPACE_H_ */
76
77/*
78 * fd.io coding-style-patch-verification: ON
79 *
80 * Local Variables:
81 * eval: (c-set-style "gnu")
82 * End:
83 */