Initial commit of vpp code.
[vpp.git] / vnet / vnet / vcgn / cgse_defs.h
1 /* 
2  *------------------------------------------------------------------
3  * cgse_defs.h - CGSE specific definiitions
4  *
5  * Copyright (c) 2007-2013 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 __CGSE_DEFS_H__
21 #define __CGSE_DEFS_H__
22
23 #include "spp_platform_common.h"
24 #include <cnat_cli.h>
25
26
27 #define CGSE_SVI_TYPE_CNAT            1
28 #define CGSE_SVI_TYPE_XLAT            2
29 #define CGSE_SVI_TYPE_NAT64_STATEFUL  3
30 #define CGSE_SVI_TYPE_V6RD            4 
31 #define CGSE_SVI_TYPE_INFRA           5 
32 #define CGSE_SVI_TYPE_DS_LITE         7 
33 #define CGSE_SVI_TYPE_MAPE            9
34
35 #define CGSE_SET_TX_PKT_TYPE(type)  PLATFORM_SET_CTX_RU_TX_PKT_TYPE(ctx, type) 
36
37 #define CGSE_INVALID_UIDX 0xffff /*invalid svi app uidb index */
38 #define CGSE_INVALID_VRFID 0xffffffff /*invalid vrf id */
39
40 #define CGSE_VRF_MASK 0x3fff
41 #define CGSE_MAX_VRFMAP_ENTRIES  (CGSE_VRF_MASK + 1)
42
43 #define CGSE_VRFMAP_ENTRY_INVALID 0xffff
44
45
46 #define CGSE_INVALID_CGSE_ID  (0)
47
48 #define CGSE_TABLE_ENTRY_DELETED      0
49 #define CGSE_TABLE_ENTRY_ACTIVE       1
50 #define CGSE_TABLE_ENTRY_DORMANT      2
51 #define CGSE_TABLE_ENTRY_INVALID_UIDB 3
52
53
54 #define CGSE_CONFIG_HANDLER_DEBUG_PRINTF1(level, a)                         \
55     if (cgse_config_debug_level > level) printf(a);
56
57 #define CGSE_CONFIG_HANDLER_DEBUG_PRINTF2(level, a, b)                      \
58     if (cgse_config_debug_level > level) printf(a, b);
59
60 #define CGSE_CONFIG_HANDLER_DEBUG_PRINTF3(level, a, b, c)                   \
61     if (cgse_config_debug_level > level) printf(a, b, c);
62
63 #define CGSE_CONFIG_HANDLER_DEBUG_PRINTF4(level, a, b, c, d)                \
64     if (cgse_config_debug_level > level) printf(a, b, c, d);
65
66 #define CGSE_CONFIG_HANDLER_DEBUG_PRINTF5(level, a, b, c, d, e)             \
67     if (cgse_config_debug_level > level) printf(a, b, c, d, e);
68
69 #define CGSE_CONFIG_HANDLER_DEBUG_PRINTF6(level, a, b, c, d, e, f)          \
70     if (cgse_config_debug_level > level) printf(a, b, c, d, e, f);
71
72 #define CGSE_CONFIG_HANDLER_DEBUG_PRINTF7(level, a, b, c, d, e, f, g)       \
73     if (cgse_config_debug_level > level) printf(a, b, c, d, e, f, g);
74
75 #define CGSE_CONFIG_HANDLER_DEBUG_PRINTF8(level, a, b, c, d, e, f, g, h)    \
76     if (cgse_config_debug_level > level) printf(a, b, c, d, e, f, g, h);
77
78 #define CGSE_CONFIG_HANDLER_DEBUG_PRINTF9(level, a, b, c, d, e, f, g, h, i) \
79     if (cgse_config_debug_level > level) printf(a, b, c, d, e, f, g, h, i);
80
81 extern u16 *cgse_uidb_index_cgse_id_mapping_ptr;
82
83 #define CGSE_ADD_UIDB_INDEX_CGSE_ID_MAPPING(uidb_index, cgse_id) \
84     *(cgse_uidb_index_cgse_id_mapping_ptr + uidb_index) = cgse_id;
85
86 extern u8 my_instance_number;
87
88 #endif