2 * Copyright (c) 2015, 2016 Nicira, 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 CONNTRACK_PRIVATE_H
18 #define CONNTRACK_PRIVATE_H 1
20 #include <sys/types.h>
21 #include <netinet/in.h>
22 #include <netinet/ip6.h>
24 #include "conntrack.h"
26 #include "openvswitch/hmap.h"
27 #include "openvswitch/list.h"
28 #include "openvswitch/types.h"
30 #include "unaligned.h"
34 ovs_16aligned_be32 ipv4
;
35 union ovs_16aligned_in6_addr ipv6
;
36 ovs_be32 ipv4_aligned
;
37 struct in6_addr ipv6_aligned
;
53 /* Changes to this structure need to be reflected in conn_key_hash() */
55 struct ct_endpoint src
;
56 struct ct_endpoint dst
;
65 struct conn_key rev_key
;
67 struct ovs_list exp_node
;
68 struct hmap_node node
;
80 struct conn
*(*new_conn
)(struct conntrack_bucket
*, struct dp_packet
*pkt
,
82 bool (*valid_new
)(struct dp_packet
*pkt
);
83 enum ct_update_res (*conn_update
)(struct conn
*conn
,
84 struct conntrack_bucket
*,
85 struct dp_packet
*pkt
, bool reply
,
87 void (*conn_get_protoinfo
)(const struct conn
*,
88 struct ct_dpif_protoinfo
*);
91 extern struct ct_l4_proto ct_proto_tcp
;
92 extern struct ct_l4_proto ct_proto_other
;
93 extern struct ct_l4_proto ct_proto_icmp4
;
94 extern struct ct_l4_proto ct_proto_icmp6
;
96 extern long long ct_timeout_val
[];
99 conn_init_expiration(struct conntrack_bucket
*ctb
, struct conn
*conn
,
100 enum ct_timeout tm
, long long now
)
102 conn
->expiration
= now
+ ct_timeout_val
[tm
];
103 ovs_list_push_back(&ctb
->exp_lists
[tm
], &conn
->exp_node
);
107 conn_update_expiration(struct conntrack_bucket
*ctb
, struct conn
*conn
,
108 enum ct_timeout tm
, long long now
)
110 ovs_list_remove(&conn
->exp_node
);
111 conn_init_expiration(ctb
, conn
, tm
, now
);
114 #endif /* conntrack-private.h */