Added support for mis-ordered packets in rapid
[samplevnf.git] / VNFs / vCGNAPT / pipeline / pipeline_cgnapt.h
1 /*
2 // Copyright (c) 2017 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #ifndef __INCLUDE_PIPELINE_CGNAPT_H__
18 #define __INCLUDE_PIPELINE_CGNAPT_H__
19
20 /**
21  * @file
22  * Pipeline CG-NAPT FE.
23  *
24  * PipelineCG-NAPT Front End (FE).
25  * Runs on the Master pipeline, responsible for CLI commands.
26  *
27  */
28
29 #include "pipeline.h"
30 #include "pipeline_cgnapt_common.h"
31 #include <civetweb.h>
32 #include <json-c/json.h>
33
34 /**
35  * Add NAPT rule to the NAPT rule table.
36  * Both IPv4 and IPv6 rules can be added.
37  *
38  * @param app
39  *  A pointer to the pipeline app parameters.
40  * @param pipeline_id
41  *  Pipeline id
42  * @param key
43  *  A pointer to the NAPT key corresponding to the entry being added.
44  * @param entry_params
45  *  A pointer to the NAPT entry being added.
46  *
47  * @return
48  *  0 on success, negative on error.
49  */
50 #if 0
51 int
52 app_pipeline_cgnapt_add_entry(struct app_params *app,
53                                                 uint32_t pipeline_id,
54                                                 struct pipeline_cgnapt_entry_key *key,
55                                                 struct app_pipeline_cgnapt_entry_params
56                                                 *entry_params);
57 #endif
58 int app_pipeline_cgnapt_add_entry(
59         struct app_params *app,
60         uint32_t pipeline_id,
61         struct app_pipeline_cgnapt_entry_params *entry_params);
62 /**
63  * Delete NAPT rule from the NAPT rule table.
64  * Both IPv4 and IPv6 rules can be added.
65  *
66  * @param app
67  *  A pointer to the pipeline app parameters.
68  * @param pipeline_id
69  *  Pipeline id
70  * @param key
71  *  A pointer to the NAPT key corresponding to the entry being added.
72  *
73  * @return
74  *  0 on success, negative on error.
75  */
76 int
77 app_pipeline_cgnapt_delete_entry(struct app_params *app,
78                                  uint32_t pipeline_id,
79                                  struct pipeline_cgnapt_entry_key *key);
80
81 /**
82  * Add multiple NAPT rule to the NAPT rule table.
83  * Both IPv4 and IPv6 rules can be added.
84  *
85  * @param app
86  *  A pointer to the pipeline app parameters.
87  * @param pipeline_id
88  *  Pipeline id
89  * @param entry_params
90  *  A pointer to the multiple NAPT entry params being added.
91  *
92  * @return
93  *  0 on success, negative on error.
94  */
95 int app_pipeline_cgnapt_addm_entry(struct app_params *app, uint32_t pipeline_id,
96                                                 struct app_pipeline_cgnapt_mentry_params
97                                          *entry_params);
98
99 /**
100  * Add Network Specific Prefix for NAT64.
101  *
102  * @param app
103  *  A pointer to the pipeline app parameters.
104  * @param pipeline_id
105  *  Pipeline id
106  * @param nsp
107  *  A pointer to NSP being added.
108  *
109  * @return
110  *  0 on success, negative on error.
111  */
112 int
113 app_pipeline_cgnapt_nsp_add_entry(struct app_params *app,
114                                         uint32_t pipeline_id,
115                                         struct pipeline_cgnapt_nsp_t *nsp);
116
117 /**
118  * Delete a Network Specific Prefix for NAT64.
119  *
120  * @param app
121  *  A pointer to the pipeline app parameters.
122  * @param pipeline_id
123  *  Pipeline id
124  * @param nsp
125  *  A pointer to NSP being deleted.
126  *
127  * @return
128  *  0 on success, negative on error.
129  */
130 int
131 app_pipeline_cgnapt_nsp_del_entry(struct app_params *app,
132                                         uint32_t pipeline_id,
133                                         struct pipeline_cgnapt_nsp_t *nsp);
134 #ifdef REST_API_SUPPORT
135 /* REST api's are defined here */
136 int cgnapt_cmd_ver_handler(struct mg_connection *conn, void *cbdata);
137 int cgnapt_stats_handler(struct mg_connection *conn, void *cbdata);
138 void rest_api_cgnapt_init(struct mg_context *ctx, struct app_params *app);
139 #endif
140
141 /*
142  * Pipeline type
143  */
144 extern struct pipeline_type pipeline_cgnapt;
145
146 #endif