📄 nat_structures.h
字号:
{ TCP_TRANSLATION_HEADER tcp_translation_list; UDP_TRANSLATION_HEADER udp_translation_list; ICMP_TRANSLATION_HEADER icmp_translation_list; ICMP_TRANSLATION_ENTRY icmp_default_entry;} NATS_CLASS;typedef struct{ NODE node; IP_ADDRESS address; IP_ADDRESS mask;} NAT_PASSTHRU_PAIR;typedef struct NAT_CLASS{ struct NAT_TCP_STATE_TABLE *tcp_state_table; ULONG ip_translation_entry_timer; ULONG udp_translation_entry_timer; ULONG icmp_translation_entry_timer; ULONG tcp_connecting_timer; ULONG tcp_disconnected_timer; ULONG tcp_connected_timer; ULONG tcp_closing_timer; ULONG sequence_entry_timer; USHORT current_port_spoofing_number; NAT_IP_PORT_CLASS port[NUMBER_OF_IP_PORTS]; bool filter_non_corporate_addresses; bool static_entries_enabled; NAT_IP_STATIC_ENTRY static_entries[MAXIMUM_NUMBER_OF_STATIC_ENTRIES]; NAT_PORT_STATIC_ENTRY tcp_static_entries[MAXIMUM_NUMBER_OF_TCP_STATIC_ENTRIES]; NAT_PORT_STATIC_ENTRY udp_static_entries[MAXIMUM_NUMBER_OF_UDP_STATIC_ENTRIES]; NATG_CLASS natg; NATS_CLASS nats; bool enabled; bool single_global_address_enabled; bool filter_unknown_protocols; bool set_default_values; IP_ADDRESS global_address; IP_ADDRESS global_address_mask; USHORT global_port_number; /* index in port/interface table */ BOOL dynamic_global_address; IP_ADDRESS starting_global_address; /* apply to Basic NAT only */ char etherAddr[18]; /* global port's ethernet address */ LIST passthru_list; bool printing_enabled; bool printing_debug; bool initialization_printing_enabled; bool trace_printing_enabled; bool data_printing_enabled; bool error_printing_enabled; bool logging_enabled; bool initialization_logging_enabled; bool trace_logging_enabled; bool data_logging_enabled; bool error_logging_enabled; LIST agent_list; LIST bind_list; LIST session_list; NAT_AGENT_INFO * agent_info; /* active agent */ void * pFragTranResrc; /*point to the resource for fragment translation*/} NAT_CLASS;/* nat_initialize.c */STATUS nat_initialize(void);void nat_printf (enum NAT_PRINTF_GROUPS printf_group, const char* file, int line, const char *cptr_format, ...);/* nat_cleanup.c */void nat_cleanup (void);void delete_tcp_connection_entry_list (TCP_TRANSLATION_HEADER *sptr_tcp_translation_list);void delete_sequence_entry_list (SEQUENCE_HEADER *sptr_sequence_list);/* nat_timer.c */void nat_timer (void);/* nat_configure.c */ULONG nat_get_configuration_table_address (void);/* nat_tcp_state.c */void tcp_state_transistion_global_rx (BYTE_ENUM (NAT_TCP_STATE_INPUT) state_input, TCP_TRANSLATION_ENTRY *sptr_tcp_translation_entry);void tcp_state_transistion_local_rx (BYTE_ENUM (NAT_TCP_STATE_INPUT) state_input, TCP_TRANSLATION_ENTRY *sptr_tcp_translation_entry);void tcp_syn_state_handler (BYTE_ENUM (NAT_TCP_STATE_INPUT) state_input, BYTE_ENUM (NAT_TCP_PORT_STATE) current_state, BYTE_ENUM (NAT_PACKET_DIRECTION) packet_direction, TCP_TRANSLATION_ENTRY *sptr_tcp_translation_entry);void tcp_reset_state_handler (BYTE_ENUM (NAT_TCP_STATE_INPUT) state_input, BYTE_ENUM (NAT_TCP_PORT_STATE) current_state, BYTE_ENUM (NAT_PACKET_DIRECTION) packet_direction, TCP_TRANSLATION_ENTRY *sptr_tcp_translation_entry);/* nat_rx.c */enum TEST nat_rx (USHORT port_number, M_BLK* pMblk);void nat_check_for_queued_packets_to_tx_on_global_port (void);/* nat_udp.c */enum TEST handle_udp_translation_global_rx (UDP_PACKET *sptr_udp_packet);enum TEST handle_udp_translation_local_rx (UDP_PACKET *sptr_udp_packet);enum TEST handle_udp_translation_local_rx_nats (UDP_PACKET *sptr_tcp_packet);UDP_TRANSLATION_ENTRY *new_udp_translation_entry ( UDP_TRANSLATION_HEADER *sptr_udp_translation_list, IP_ADDRESS local_address, USHORT local_port, IP_ADDRESS remote_address, USHORT remote_port, bool static_entry);/* nat_filter.c */enum NAT_FILTER nat_filter_rx (u_long, USHORT port_number, enum NAT_PORT_TYPE nat_port_type);/* nat_tcp.c */enum TEST handle_tcp_translation_global_rx (TCP_PACKET *sptr_tcp_packet);enum TEST handle_tcp_translation_local_rx (TCP_PACKET *sptr_tcp_packet);enum TEST handle_tcp_translation_local_rx_nats (TCP_PACKET *sptr_tcp_packet);enum TEST handle_tcp_translation_local_rx_natg (TCP_PACKET *sptr_tcp_packet);void tcp_sequence_number_fixup_global_rx (TCP_HEADER *sptr_tcp_header, TCP_TRANSLATION_ENTRY *sptr_tcp_translation_entry);void tcp_sequence_number_fixup_local_rx (TCP_HEADER *sptr_tcp_header, TCP_TRANSLATION_ENTRY *sptr_tcp_translation_entry);TCP_TRANSLATION_ENTRY *new_tcp_translation_entry ( TCP_TRANSLATION_HEADER *sptr_tcp_translation_list, IP_ADDRESS local_address, USHORT local_port, IP_ADDRESS remote_address, USHORT remote_port, bool static_entry);/* nat_util.c */enum NAT_PORT_TYPE get_nat_port_type (USHORT port_number);ULONG_ENUM (NAT_PACKET_TYPES) nat_packet_discriminator (IP_PACKET *sptr_ip_packet);IP_TRANSLATION_ENTRY *match_sa_with_global_address (IP_ADDRESS global_address, IP_TRANSLATION_HEADER *sptr_ip_translation_list);IP_TRANSLATION_ENTRY *match_sa_with_local_address (IP_ADDRESS source_address, IP_TRANSLATION_HEADER *sptr_ip_translation_list);TCP_TRANSLATION_ENTRY *match_ports_with_tcp_entry_outbound (USHORT remote_port, USHORT local_port, IP_ADDRESS local_address, TCP_TRANSLATION_HEADER *sptr_tcp_translation_list);TCP_TRANSLATION_ENTRY *match_ports_with_tcp_entry_inbound (USHORT remote_port, USHORT local_port, IP_ADDRESS remote_address, TCP_TRANSLATION_HEADER *sptr_tcp_translation_list);TCP_TRANSLATION_ENTRY *match_ports_with_tcp_entry_global (USHORT local_port, IP_ADDRESS local_address, TCP_TRANSLATION_HEADER *sptr_udp_translation_list);TCP_TRANSLATION_ENTRY *match_spoofed_port_with_tcp_entry (USHORT spoofed_port, TCP_TRANSLATION_HEADER *sptr_tcp_translation_list, BOOL findDummy);UDP_TRANSLATION_ENTRY *match_ports_with_udp_entry_outbound (USHORT remote_port, USHORT local_port, IP_ADDRESS local_address, UDP_TRANSLATION_HEADER *sptr_udp_translation_list);UDP_TRANSLATION_ENTRY *match_ports_with_udp_entry_inbound (USHORT remote_port, USHORT local_port, IP_ADDRESS remote_address, UDP_TRANSLATION_HEADER *sptr_udp_translation_list);UDP_TRANSLATION_ENTRY *match_ports_with_udp_entry_global (USHORT local_port, IP_ADDRESS local_address, UDP_TRANSLATION_HEADER *sptr_udp_translation_list);UDP_TRANSLATION_ENTRY *match_spoofed_port_with_udp_entry (USHORT spoofed_port, UDP_TRANSLATION_HEADER *sptr_udp_translation_list, BOOL findDummy);ICMP_TRANSLATION_ENTRY *match_identifier_with_icmp_entry (USHORT spoofed_id, ICMP_TRANSLATION_HEADER *sptr_icmp_translation_list);ICMP_TRANSLATION_ENTRY *match_spoofed_identifier_with_icmp_entry (USHORT spoofed_icmp_identifier, ICMP_TRANSLATION_HEADER *sptr_icmp_translation_list);IP_TRANSLATION_ENTRY *new_ip_translation_entry (IP_TRANSLATION_HEADER *sptr_ip_translation_list, IP_ADDRESS source_address,bool static_entry);STATUS match_sa_with_static_entry (IP_ADDRESS source_address);void checksum_fixup (BYTE *bptr_checksum, BYTE *bptr_old_data, USHORT old_data_length, BYTE *bptr_new_data, USHORT new_data_length);enum TEST increment_nat_port_spoofing_number (USHORT *usptr_spoofing_number);IP_TRANSLATION_ENTRY *allocate_and_initialize_ip_translation_entry (NAT_IP_ADDRESS_ENTRY *sptr_address_entry, IP_ADDRESS local_address, IP_ADDRESS global_address, bool static_entry);IP_TRANSLATION_ENTRY *create_static_ip_entry ( IP_TRANSLATION_HEADER *sptr_ip_translation_list, IP_ADDRESS source_address, IP_ADDRESS global_address);NAT_PORT_STATIC_ENTRY *match_tcp_port_with_static_entry (USHORT port_number);NAT_PORT_STATIC_ENTRY *match_udp_port_with_static_entry (USHORT port_number);/* nat_icmp_datagram.c */enum TEST handle_icmp_translation_global_rx_datagram (ICMP_PACKET*);enum TEST handle_icmp_translation_local_rx_datagram (ICMP_PACKET*);/* nat_icmp_transaction.c */enum TEST handle_icmp_translation_global_rx_transaction (ICMP_PACKET*);enum TEST handle_icmp_translation_local_rx_transaction (ICMP_PACKET*);/* nat_ftp.c */enum TEST handle_ftp_translation_local_rx (M_BLK*);enum TEST handle_ftp_translation_global_rx (TCP_PACKET*);/* nat_ip.c */IP_TRANSLATION_ENTRY *handle_ip_translation_global_rx (IP_PACKET *sptr_ip_packet);IP_TRANSLATION_ENTRY *handle_ip_translation_local_rx (IP_PACKET *sptr_ip_packet);IP_TRANSLATION_ENTRY *handle_ip_translation_global_rx_natg (IP_PACKET *sptr_ip_packet);IP_TRANSLATION_ENTRY *handle_ip_translation_local_rx_natg (IP_PACKET *sptr_ip_packet);/* nat_fragment.c */enum TEST natFragTranAddrSave (int, void *, IP_ADDRESS);enum TEST natFragAddrTranslate (int, IP_PACKET *);void * natFragTranEntryGet (enum NAT_PORT_TYPE, IP_PACKET *);void natFragTranCleanup (void *);void * natFragTranModuleInit (void);void natFragTranTimerProcess (void);/* Function to register TCP/UDP static entry to NAT's bind and translation list */STATUS registerStaticEntryToTranslationList ( NAT_PORT_STATIC_ENTRY *staticEntry, u_short protocol);/* nat_filter_hook.c */BOOL nat_filter_hook();/* nat_dial.c */int nat_dial(int unit, int fd); /* PPP CONNECT/DISCONNECT callbacks */int nat_hangup(int unit, int fd);#endif /* Don't add anything after this line */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -