2 * Copyright (c) 2015, 2016 VMware, Inc.
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 __OVS_CONNTRACK_H_
18 #define __OVS_CONNTRACK_H_ 1
27 uint32_t ipv4_aligned;
28 struct in6_addr ipv6_aligned;
38 typedef enum CT_UPDATE_RES {
44 /* Metadata mark for masked write to conntrack mark */
45 typedef struct MD_MARK {
50 /* Metadata label for masked write to conntrack label. */
51 typedef struct MD_LABELS {
52 struct ovs_key_ct_labels value;
53 struct ovs_key_ct_labels mask;
56 typedef struct _OVS_CT_KEY {
57 struct ct_endpoint src;
58 struct ct_endpoint dst;
62 } OVS_CT_KEY, *POVS_CT_KEY;
64 typedef struct OVS_CT_ENTRY {
70 struct ovs_key_ct_labels labels;
71 } OVS_CT_ENTRY, *POVS_CT_ENTRY;
73 typedef struct OvsConntrackKeyLookupCtx {
79 } OvsConntrackKeyLookupCtx;
81 #define CT_HASH_TABLE_SIZE ((UINT32)1 << 10)
82 #define CT_HASH_TABLE_MASK (CT_HASH_TABLE_SIZE - 1)
83 #define CT_ENTRY_TIMEOUT (2 * 600000000) // 2m
84 #define CT_CLEANUP_INTERVAL (2 * 600000000) // 2m
85 /* Given POINTER, the address of the given MEMBER in a STRUCT object, returns
87 #define CONTAINER_OF(POINTER, STRUCT, MEMBER) \
88 ((STRUCT *) (void *) ((char *) (POINTER) - \
89 offsetof (STRUCT, MEMBER)))
91 VOID OvsCleanupConntrack(VOID);
92 NTSTATUS OvsInitConntrack(POVS_SWITCH_CONTEXT context);
94 NDIS_STATUS OvsExecuteConntrackAction(PNET_BUFFER_LIST curNbl,
95 OVS_PACKET_HDR_INFO *layers,
98 BOOLEAN OvsConntrackValidateTcpPacket(const TCPHdr *tcp);
99 OVS_CT_ENTRY * OvsConntrackCreateTcpEntry(const TCPHdr *tcp,
100 PNET_BUFFER_LIST nbl,
102 enum CT_UPDATE_RES OvsConntrackUpdateTcpEntry(OVS_CT_ENTRY* conn_,
104 PNET_BUFFER_LIST nbl,
107 #endif /* __OVS_CONNTRACK_H_ */