2 * Copyright (c) 2015 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 NETLINK_CONNTRACK_H
18 #define NETLINK_CONNTRACK_H
20 #include <linux/netfilter/nfnetlink_cttimeout.h>
22 #include "byte-order.h"
25 #include "openvswitch/dynamic-string.h"
26 #include "openvswitch/hmap.h"
27 #include "openvswitch/ofpbuf.h"
32 enum nl_ct_event_type
{
33 NL_CT_EVENT_NEW
= 1 << 0,
34 NL_CT_EVENT_UPDATE
= 1 << 1,
35 NL_CT_EVENT_DELETE
= 1 << 2,
38 #define NL_CT_TIMEOUT_POLICY_MAX_ATTR (CTA_TIMEOUT_TCP_MAX + 1)
40 struct nl_ct_timeout_policy
{
41 char name
[CTNL_TIMEOUT_NAME_MAX
];
44 uint32_t attrs
[NL_CT_TIMEOUT_POLICY_MAX_ATTR
];
48 struct nl_ct_dump_state
;
49 struct nl_ct_timeout_policy_dump_state
;
51 int nl_ct_dump_start(struct nl_ct_dump_state
**, const uint16_t *zone
,
53 int nl_ct_dump_next(struct nl_ct_dump_state
*, struct ct_dpif_entry
*);
54 int nl_ct_dump_done(struct nl_ct_dump_state
*);
56 int nl_ct_flush(void);
57 int nl_ct_flush_zone(uint16_t zone
);
58 int nl_ct_flush_tuple(const struct ct_dpif_tuple
*, uint16_t zone
);
60 int nl_ct_set_timeout_policy(const struct nl_ct_timeout_policy
*nl_tp
);
61 int nl_ct_get_timeout_policy(const char *tp_name
,
62 struct nl_ct_timeout_policy
*nl_tp
);
63 int nl_ct_del_timeout_policy(const char *tp_name
);
64 int nl_ct_timeout_policy_dump_start(
65 struct nl_ct_timeout_policy_dump_state
**statep
);
66 int nl_ct_timeout_policy_dump_next(
67 struct nl_ct_timeout_policy_dump_state
*state
,
68 struct nl_ct_timeout_policy
*nl_tp
);
69 int nl_ct_timeout_policy_dump_done(
70 struct nl_ct_timeout_policy_dump_state
*state
);
72 bool nl_ct_parse_entry(struct ofpbuf
*, struct ct_dpif_entry
*,
73 enum nl_ct_event_type
*);
74 void nl_ct_format_event_entry(const struct ct_dpif_entry
*,
75 enum nl_ct_event_type
, struct ds
*,
76 bool verbose
, bool print_stats
);
78 #endif /* NETLINK_CONNTRACK_H */