Iptables.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*****************************************************************
  2. *****************************************************************
  3. *** **
  4. *** (C)Copyright 2005-2006, American Megatrends Inc. **
  5. *** **
  6. *** All Rights Reserved. **
  7. *** **
  8. *** 6145-F, Northbelt Parkway, Norcross, **
  9. *** **
  10. *** Georgia - 30071, USA. Phone-(770)-246-8600. **
  11. *** **
  12. *****************************************************************
  13. *****************************************************************
  14. ******************************************************************
  15. *
  16. * Iptables.h
  17. * .
  18. *
  19. * Author: AMI MegaRAC PM Team
  20. ******************************************************************/
  21. #define IP_IPV4 0x00
  22. #define IPS_IPV4 0x01
  23. #define PORT 0x02
  24. #define PORT_RANGE 0x03
  25. #define IP_IPV4_Unlock 0x04
  26. #define IPS_IPV4_Unlock 0x05
  27. #define PORT_Release 0x06
  28. #define PORT_RANGE_Release 0x07
  29. #define FLUSH 0x08
  30. #define DISABLE_ALL 0x09
  31. #define REMOVE_DISABLE_ALL 0x0a
  32. #define GET_IPTABLE_COUNT 0x00
  33. #define GET_ENTRY_INFO 0x01
  34. #define IS_BLOCK_ALL 0x02
  35. typedef struct
  36. {
  37. INT8U protocol;
  38. INT16U Port_NO;
  39. } PACKED Port;
  40. typedef struct
  41. {
  42. INT8U protocol;
  43. INT16U starting_port;
  44. INT16U closing_port;
  45. } PACKED RANGE_Prt;
  46. typedef struct
  47. {
  48. INT8U starting_ip[4];
  49. INT8U closing_ip[4];
  50. } PACKED RANGE_Ipv4;
  51. typedef union
  52. {
  53. INT8U IPAddr_ipv4[4];
  54. RANGE_Ipv4 IPRange_ipv4;
  55. Port Port_Data;
  56. RANGE_Prt Port_Range;
  57. INT8U Block; /*1 - IPv4 only ; 2 - IPv6 only ; 3 - Both*/
  58. INT8U Unblock; /*1 - IPv4 only ; 2 - IPv6 only ; 3 - Both*/
  59. } FirewallConfUn_T;
  60. typedef struct
  61. {
  62. INT8U TYPE;
  63. INT8U State;
  64. FirewallConfUn_T Entry_info;
  65. } PACKED GetFirewallConf_T;
  66. /* Prototype Declarations */
  67. void *block_ip_ipv4 ( void *, void *);
  68. void *block_ip_range_ipv4 ( void *, void * );
  69. void *block_port ( void *, void * );
  70. void *block_range_ports ( void *, void *);
  71. void *release_range_port ( void *port_range, void * );
  72. void *release_port ( void *port_in, void *);
  73. void *release_range_ip_ipv4 ( void *range_in, void * );
  74. void *release_ip_ipv4 ( void *ip_in, void * );
  75. void convert_IPv4_string (INT8U *IP_array, INT8U *IPv4 );
  76. void *flush_iptables ( void *in );
  77. void *enable_all ( void *in);
  78. void *block_all ( void *in);
  79. int get_iptable_count ();
  80. int get_iptable_entry ( INT8U *pos, GetFirewallConf_T *pFWc);
  81. int IsBlockAllEnabled();
  82. /***********************************/