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.
16 #ifndef __INCLUDE_LIB_FTP_ALG_H__
17 #define __INCLUDE_LIB_FTP_ALG_H__
18 #include "rte_ether.h"
19 #include "rte_ct_tcp.h"
20 /*CT & CGNAT integration to be resolved for this definitions*/
21 #define META_DATA_OFFSET 128
22 #define ETHERNET_START (META_DATA_OFFSET + RTE_PKTMBUF_HEADROOM)
23 #define ETH_HDR_SIZE 14
24 #define IP_START (ETHERNET_START + ETH_HDR_SIZE)
25 #define PROTOCOL_START (IP_START + 9)
26 #define TCP_START (IP_START + IP_V4_HEADER_SIZE)
27 #define TCP_MIN_HDR_SIZE 20
29 #define RTE_TCP_PROTO_ID 6
30 #define RTE_SP_DEFAULT_TTL 64
32 #define RTE_SYNPROXY_MAX_SPOOFED_PKTS 64
34 #define RTE_TCP_SYN 0x02
35 #define RTE_TCP_ACK 0x10
36 #define RTE_TCP_SYN_ACK (RTE_TCP_SYN | RTE_TCP_ACK)
37 #define IP_VERSION_4 4
38 #define IP_VERSION_6 6
39 #define IPv4_HEADER_SIZE 20
40 #define IPv6_HEADER_SIZE 40
53 enum ftp_alg_direction {
68 struct ftp_alg_table_entry {
72 uint8_t ftp_alg_direction;
73 uint32_t session_id; /*to be checked */
74 uint8_t alg_bypass_flag;
77 //uint32_t napt_entry;/* to be checked*/
78 } __rte_cache_aligned;
80 #define FTP_SERVER_PORT 21
81 #define FTP_PORT_STRING "PORT"
82 #define FTP_PORT_PARAMETER_STRING "PORT %hu,%hu,%hu,%hu,%hu,%hu\r\n"
83 #define FTP_PORT_PARAMETER_COUNT 6
84 #define FTP_PORT_RESPONSE_STRING "200 PORT command successful.\r\n"
85 #define FTP_PORT_STRING_END_MARKER '\n'
86 #define FTP_MAXIMUM_PORT_STRING_LENGTH 60
87 #define FTP_PASV_STRING "PASV"
88 #define FTP_PASV_PARAMETER_STRING "%d Entering Passive Mode (%hu,%hu,%hu,%hu,%hu,%hu)\r\n"
89 #define FTP_PASV_PARAMETER_COUNT 7
90 #define FTP_PASV_STRING_END_MARKER '\n' /* not ')' */
91 #define FTP_PASV_RETURN_CODE 227
94 struct pipeline_cgnapt *p_nat,
95 struct pipeline_cgnapt_entry_key *nat_entry_key,
97 struct rte_ct_cnxn_tracker *cgnat_cnxn_tracker,
100 void lib_ftp_alg_init(void);
101 extern int8_t rte_ct_ipversion(void *i_hdr);