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.
19 #include "rte_ct_tcp.h"
20 #include "rte_cnxn_tracking.h"
22 uint8_t rte_ct_udp_new_connection(__rte_unused struct rte_ct_cnxn_tracker *ct,
23 struct rte_ct_cnxn_data *cd,
24 __rte_unused struct rte_mbuf *pkt)
26 /* printf("New connection UDP packet received\n"); */
27 cd->connstatus = RTE_INIT_CONN;
30 enum rte_ct_packet_action rte_ct_udp_packet(struct rte_ct_cnxn_tracker *ct,
31 struct rte_ct_cnxn_data *cd,
32 __rte_unused struct rte_mbuf *pkt,
33 uint8_t key_was_flipped)
35 enum rte_ct_pkt_direction dir;
37 dir = (cd->key_is_client_order == !key_was_flipped);
38 /* printf("packet received verify"); */
39 if (dir == RTE_CT_DIR_REPLY &&
40 cd->connstatus == RTE_INIT_CONN) {
41 rte_ct_set_cnxn_timer_for_udp(ct, cd, RTE_CT_UDP_REPLIED);
42 cd->connstatus = RTE_ASSURED_CONN;
43 } else if (dir == RTE_CT_DIR_REPLY &&
44 cd->connstatus == RTE_ASSURED_CONN)
45 rte_ct_set_cnxn_timer_for_udp(ct, cd, RTE_CT_UDP_REPLIED);
47 rte_ct_set_cnxn_timer_for_udp(ct, cd, RTE_CT_UDP_UNREPLIED);
48 return RTE_CT_FORWARD_PACKET;