Initial commit of vpp code.
[vpp.git] / vnet / vnet / vcgn / nat64_tcp_sm.h
1 /*
2  *------------------------------------------------------------------
3  * nat64_tcp_sm.h - Stateful NAT64 translation TCP State machine 
4  *
5  * Copyright (c) 2011 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 #ifndef __NAT64_TCP_SM_H__
20 #define __NAT64_TCP_SM_H__
21
22
23 /* TCP States */
24 typedef enum {
25     TCP_CLOSED,
26     TCP_V4_INIT,
27     TCP_V6_INIT, 
28     TCP_ESTABLISHED,
29     TCP_V4_FIN_RCV,
30     TCP_V6_FIN_RCV,
31     TCP_V4V6_FIN_RCV,
32     TCP_TRANS,
33     TCP_NONE
34 } nat64_tcp_states;
35
36 /* TCP Events */
37 typedef enum {
38     TCP_TIMEOUT_EV,
39     TCP_V6_SYN_EV,
40     TCP_V4_SYN_EV,
41     TCP_V6_FIN_EV,
42     TCP_V4_FIN_EV,
43     TCP_V6_RST_EV,
44     TCP_V4_RST_EV,
45     TCP_DEFAULT_EV,
46     TCP_EV_COUNT
47 } nat64_tcp_events;
48
49 /* TCP Actions */
50 typedef enum {
51     TCP_FORWARD,
52     TCP_COND_FORWARD, /* Conditional forward, based on presence of
53                        * session and bib entries */
54     TCP_STORE,
55     TCP_PROBE,
56     TCP_CREATE_SESSION,
57     TCP_DELETE_SESSION,
58     TCP_DROP,
59     TCP_ACTION_NONE,
60     TCP_ACTION_COUNT
61 } nat64_tcp_actions;
62
63 typedef struct {
64     nat64_tcp_states next_state;
65     nat64_tcp_actions action;
66 } nat64_tcp_trans_t;
67
68 typedef struct {
69     nat64_tcp_trans_t event[TCP_EV_COUNT];
70 } nat64_tcp_state_trans_t;
71
72 extern nat64_tcp_state_trans_t nat64_tcp_sm_lookup[TCP_NONE];  
73
74 /*
75 inline void
76 nat64_update_v6_to_v4_tcp (nat64_v6_to_v4_pipeline_data_t *pctx_ptr,
77                             nat64_bib_entry_t *bib_ptr);
78
79 inline u8 nat64_v6_to_v4_tcp_perform_action (
80       spp_ctx_t *ctx,
81       nat64_v6_to_v4_pipeline_data_t *pctx_ptr,
82       nat64_bib_entry_t *bib_db,
83       nat64_session_entry_t *session_db);
84
85 inline void
86 nat64_copy_tcp_into_pctx (nat64_v6_to_v4_pipeline_data_t *pctx_ptr);
87 */
88
89
90
91 #endif