2 // Copyright (c) 2017 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __INCLUDE_PIPELINE_CGNAPT_H__
18 #define __INCLUDE_PIPELINE_CGNAPT_H__
22 * Pipeline CG-NAPT FE.
24 * PipelineCG-NAPT Front End (FE).
25 * Runs on the Master pipeline, responsible for CLI commands.
30 #include "pipeline_cgnapt_common.h"
32 #include <json-c/json.h>
35 * Add NAPT rule to the NAPT rule table.
36 * Both IPv4 and IPv6 rules can be added.
39 * A pointer to the pipeline app parameters.
43 * A pointer to the NAPT key corresponding to the entry being added.
45 * A pointer to the NAPT entry being added.
48 * 0 on success, negative on error.
52 app_pipeline_cgnapt_add_entry(struct app_params *app,
54 struct pipeline_cgnapt_entry_key *key,
55 struct app_pipeline_cgnapt_entry_params
58 int app_pipeline_cgnapt_add_entry(
59 struct app_params *app,
61 struct app_pipeline_cgnapt_entry_params *entry_params);
63 * Delete NAPT rule from the NAPT rule table.
64 * Both IPv4 and IPv6 rules can be added.
67 * A pointer to the pipeline app parameters.
71 * A pointer to the NAPT key corresponding to the entry being added.
74 * 0 on success, negative on error.
77 app_pipeline_cgnapt_delete_entry(struct app_params *app,
79 struct pipeline_cgnapt_entry_key *key);
82 * Add multiple NAPT rule to the NAPT rule table.
83 * Both IPv4 and IPv6 rules can be added.
86 * A pointer to the pipeline app parameters.
90 * A pointer to the multiple NAPT entry params being added.
93 * 0 on success, negative on error.
95 int app_pipeline_cgnapt_addm_entry(struct app_params *app, uint32_t pipeline_id,
96 struct app_pipeline_cgnapt_mentry_params
100 * Add Network Specific Prefix for NAT64.
103 * A pointer to the pipeline app parameters.
107 * A pointer to NSP being added.
110 * 0 on success, negative on error.
113 app_pipeline_cgnapt_nsp_add_entry(struct app_params *app,
114 uint32_t pipeline_id,
115 struct pipeline_cgnapt_nsp_t *nsp);
118 * Delete a Network Specific Prefix for NAT64.
121 * A pointer to the pipeline app parameters.
125 * A pointer to NSP being deleted.
128 * 0 on success, negative on error.
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);
144 extern struct pipeline_type pipeline_cgnapt;