blob: f8e58703e18c8797812137f5c96d1fdaaf37a5b8 [file] [log] [blame]
/*
* Copyright (c) 2012, 2015, 2017, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _NAT_HELPER_H
#define _NAT_HELPER_H
#include "sw.h"
#define NAPT_TABLE_BITS 10
#define NAPT_TABLE_SIZE (1 << NAPT_TABLE_BITS)
//#define NAPT_TABLE_SIZE 1024
#define S17_WAN_PORT nat_helper_wan_port_get()
void host_helper_init(a_uint32_t portbmp);
void host_helper_exit(void);
void napt_helper_init(void);
void napt_helper_exit(void);
void nat_ipt_helper_init(void);
void nat_ipt_helper_exit(void);
void nat_helper_bg_task_init(void);
void nat_helper_bg_task_exit(void);
a_uint32_t nat_helper_wan_port_get(void);
uint32_t get_next_hop(uint32_t daddr, uint32_t saddr);
void hnat_log_msg(int level, char *string, ...);
#define NAT_LOG_MAX_SIZE 1024
enum {
HNAT_LOG_LEVEL_DEBUG = 0,
HNAT_LOG_LEVEL_INFO,
HNAT_LOG_LEVEL_ERR,
HNAT_LOG_LEVEL_DISABLE
};
#define HNAT_PRINTK(arg...) \
hnat_log_msg(HNAT_LOG_LEVEL_DEBUG, arg)
#define HNAT_INFO_PRINTK(arg...) \
hnat_log_msg(HNAT_LOG_LEVEL_INFO, arg)
#define HNAT_ERR_PRINTK(arg...) \
hnat_log_msg(HNAT_LOG_LEVEL_ERR, arg)
#endif