1/*
2 * Copyright (c) 2012, 2015, The Linux Foundation. All rights reserved.
3 * Permission to use, copy, modify, and/or distribute this software for
4 * any purpose with or without fee is hereby granted, provided that the
5 * above copyright notice and this permission notice appear in all copies.
6 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
7 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
8 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
9 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
10 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
11 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
12 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
13 */
14
15
16#ifndef _NAPT_HELPER_H
17#define _NAPT_HELPER_H
18
19
20
21#define USING_LINUX2631 1
22
23#ifdef USING_LINUX2631
24
25void
26napt_ct_task_start(int (*task)(void*), const char *task_name);
27void
28napt_ct_task_stop(void);
29int
30napt_ct_task_should_stop(void);
31void
32napt_ct_task_sleep(int secs);
33void
34napt_ct_list_lock(void);
35void
36napt_ct_list_unlock(void);
37uint32_t
38napt_ct_list_iterate(uint32_t *hash, uint32_t *pos) ;
39void
40napt_ct_to_hw_entry(uint32_t ct_addr, void *napt);
41void
42napt_ct_aging_enable(uint32_t ct_addr);
43void
44napt_ct_aging_disable(uint32_t ct_addr);
45int
46napt_ct_aging_is_enable(uint32_t ct_addr);
47uint64_t
48napt_ct_pkts_get(uint32_t ct_addr);
49int
50napt_ct_type_is_nat(uint32_t ct_addr);
51int
52napt_ct_type_is_nat_alg(uint32_t ct_addr);
53int
54napt_ct_status_is_estab(uint32_t ct_addr);
55uint32_t
56napt_ct_priv_ip_get(uint32_t ct_addr);
57int
58napt_ct_intf_is_expected(uint32_t ct_addr);
59
60
61
62#define NAPT_CT_TASK_START          napt_ct_task_start
63#define NAPT_CT_TASK_STOP           napt_ct_task_stop
64#define NAPT_CT_TASK_SHOULD_STOP    napt_ct_task_should_stop
65#define NAPT_CT_TASK_SLEEP          napt_ct_task_sleep
66
67#define NAPT_CT_LIST_LOCK           napt_ct_list_lock
68#define NAPT_CT_LIST_UNLOCK         napt_ct_list_unlock
69#define NAPT_CT_LIST_ITERATE        napt_ct_list_iterate
70
71#define NAPT_CT_AGING_IS_ENABLE     napt_ct_aging_is_enable
72#define NAPT_CT_AGING_ENABLE        napt_ct_aging_enable
73#define NAPT_CT_AGING_DISABLE       napt_ct_aging_disable
74
75#define NAPT_CT_TYPE_IS_NAT         napt_ct_type_is_nat
76#define NAPT_CT_STATUS_IS_ESTAB     napt_ct_status_is_estab
77#define NAPT_CT_PRIV_IP_GET         napt_ct_priv_ip_get
78#define NAPT_CT_PKTS_GET            napt_ct_pkts_get
79#define NAPT_CT_TO_HW_ENTRY         napt_ct_to_hw_entry
80#define NAPT_CT_TYPE_IS_NAT_ALG     napt_ct_type_is_nat_alg
81#define NAPT_CT_INTF_EXPECTED       napt_ct_intf_is_expected
82
83
84#else
85
86
87
88#endif
89
90
91#endif
92