alg.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /******************************************************************************
  2. Copyright (C) 2015 Winner Micro electronics Co., Ltd.
  3. ******************************************************************************
  4. File Name : alg.h
  5. Version : Initial Draft
  6. Author : Li Limin, lilm@winnermicro.com
  7. Created : 2015/3/7
  8. Last Modified :
  9. Description : Application layer gateway, (alg) only for apsta
  10. History :
  11. Date : 2015/3/7
  12. Author : Li Limin, lilm@winnermicro.com
  13. Modification : Created file
  14. ******************************************************************************/
  15. #ifndef __ALG_H__
  16. #define __ALG_H__
  17. #ifdef __cplusplus
  18. #if __cplusplus
  19. extern "C"{
  20. #endif
  21. #endif /* __cplusplus */
  22. /* ============================== configure ===================== */
  23. /* napt age time (second) */
  24. #define NAPT_TABLE_TIMEOUT 60
  25. /* napt port range: 15000~25000 */
  26. #define NAPT_LOCAL_PORT_RANGE_START 0x3A98
  27. #define NAPT_LOCAL_PORT_RANGE_END 0x61A8
  28. /* napt icmp id range: 3000-65535 */
  29. #define NAPT_ICMP_ID_RANGE_START 0xBB8
  30. #define NAPT_ICMP_ID_RANGE_END 0xFFFF
  31. /* napt table size */
  32. //#define NAPT_TABLE_LIMIT
  33. #ifdef NAPT_TABLE_LIMIT
  34. #define NAPT_TABLE_SIZE_MAX 3000
  35. #endif
  36. /* ============================================================ */
  37. #define NAPT_TMR_INTERVAL ((NAPT_TABLE_TIMEOUT / 2) * 1000UL)
  38. extern bool alg_napt_port_is_used(u16 port);
  39. extern int alg_napt_init(void);
  40. extern int alg_input(const u8 *bssid, u8 *pkt_body, u32 pkt_len);
  41. #ifdef __cplusplus
  42. #if __cplusplus
  43. }
  44. #endif
  45. #endif /* __cplusplus */
  46. #endif /* __ALG_H__ */