netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
libarptc.c File Reference
#include <assert.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>
#include "libarptc/libarptc.h"
#include "libarptc_incl.c"
Include dependency graph for libarptc.c:

Macros

#define IP_VERSION   4
 
#define IP_OFFSET   0x1FFF
 
#define STRUCT_ENTRY_TARGET   struct arpt_entry_target
 
#define STRUCT_ENTRY   struct arpt_entry
 
#define STRUCT_ENTRY_MATCH   struct arpt_entry_match
 
#define STRUCT_GETINFO   struct arpt_getinfo
 
#define STRUCT_GET_ENTRIES   struct arpt_get_entries
 
#define STRUCT_COUNTERS   struct arpt_counters
 
#define STRUCT_COUNTERS_INFO   struct arpt_counters_info
 
#define STRUCT_STANDARD_TARGET   struct arpt_standard_target
 
#define STRUCT_REPLACE   struct arpt_replace
 
#define STRUCT_TC_HANDLE   struct arptc_handle
 
#define TC_HANDLE_T   arptc_handle_t
 
#define ENTRY_ITERATE   ARPT_ENTRY_ITERATE
 
#define TABLE_MAXNAMELEN   ARPT_TABLE_MAXNAMELEN
 
#define FUNCTION_MAXNAMELEN   ARPT_FUNCTION_MAXNAMELEN
 
#define GET_TARGET   arpt_get_target
 
#define ERROR_TARGET   ARPT_ERROR_TARGET
 
#define ARPT_CHAINLABEL   arpt_chainlabel
 
#define TC_DUMP_ENTRIES   dump_entries
 
#define TC_IS_CHAIN   arptc_is_chain
 
#define TC_FIRST_CHAIN   arptc_first_chain
 
#define TC_NEXT_CHAIN   arptc_next_chain
 
#define TC_FIRST_RULE   arptc_first_rule
 
#define TC_NEXT_RULE   arptc_next_rule
 
#define TC_GET_TARGET   arptc_get_target
 
#define TC_BUILTIN   arptc_builtin
 
#define TC_GET_POLICY   arptc_get_policy
 
#define TC_INSERT_ENTRY   arptc_insert_entry
 
#define TC_REPLACE_ENTRY   arptc_replace_entry
 
#define TC_APPEND_ENTRY   arptc_append_entry
 
#define TC_DELETE_ENTRY   arptc_delete_entry
 
#define TC_DELETE_NUM_ENTRY   arptc_delete_num_entry
 
#define TC_CHECK_PACKET   arptc_check_packet
 
#define TC_FLUSH_ENTRIES   arptc_flush_entries
 
#define TC_ZERO_ENTRIES   arptc_zero_entries
 
#define TC_READ_COUNTER   arptc_read_counter
 
#define TC_ZERO_COUNTER   arptc_zero_counter
 
#define TC_SET_COUNTER   arptc_set_counter
 
#define TC_CREATE_CHAIN   arptc_create_chain
 
#define TC_GET_REFERENCES   arptc_get_references
 
#define TC_DELETE_CHAIN   arptc_delete_chain
 
#define TC_RENAME_CHAIN   arptc_rename_chain
 
#define TC_SET_POLICY   arptc_set_policy
 
#define TC_GET_RAW_SOCKET   arptc_get_raw_socket
 
#define TC_INIT   arptc_init
 
#define TC_COMMIT   arptc_commit
 
#define TC_STRERROR   arptc_strerror
 
#define TC_AF   AF_INET
 
#define TC_IPPROTO   IPPROTO_IP
 
#define SO_SET_REPLACE   ARPT_SO_SET_REPLACE
 
#define SO_SET_ADD_COUNTERS   ARPT_SO_SET_ADD_COUNTERS
 
#define SO_GET_INFO   ARPT_SO_GET_INFO
 
#define SO_GET_ENTRIES   ARPT_SO_GET_ENTRIES
 
#define SO_GET_VERSION   ARPT_SO_GET_VERSION
 
#define STANDARD_TARGET   ARPT_STANDARD_TARGET
 
#define LABEL_RETURN   ARPTC_LABEL_RETURN
 
#define LABEL_ACCEPT   ARPTC_LABEL_ACCEPT
 
#define LABEL_DROP   ARPTC_LABEL_DROP
 
#define LABEL_QUEUE   ARPTC_LABEL_QUEUE
 
#define ALIGN   ARPT_ALIGN
 
#define RETURN   ARPT_RETURN
 
#define IP_PARTS_NATIVE(n)
 
#define IP_PARTS(n)   IP_PARTS_NATIVE(ntohl(n))
 

Typedefs

typedef unsigned int socklen_t
 

Functions

int dump_entry (STRUCT_ENTRY *e, const TC_HANDLE_T handle)
 

Macro Definition Documentation

#define ALIGN   ARPT_ALIGN

Referenced by ip_set_elem_len(), and TC_CREATE_CHAIN().

#define ARPT_CHAINLABEL   arpt_chainlabel

Referenced by TC_CREATE_CHAIN(), and TC_RENAME_CHAIN().

#define ENTRY_ITERATE   ARPT_ENTRY_ITERATE
#define ERROR_TARGET   ARPT_ERROR_TARGET

Referenced by TC_CREATE_CHAIN().

#define FUNCTION_MAXNAMELEN   ARPT_FUNCTION_MAXNAMELEN
#define GET_TARGET   arpt_get_target

Referenced by dump_entry().

#define IP_OFFSET   0x1FFF

Referenced by ip_set_get_ip4_port().

#define IP_PARTS (   n)    IP_PARTS_NATIVE(ntohl(n))

Referenced by dump_entry().

#define IP_PARTS_NATIVE (   n)
Value:
(unsigned int)((n)>>24)&0xFF, \
(unsigned int)((n)>>16)&0xFF, \
(unsigned int)((n)>>8)&0xFF, \
(unsigned int)((n)&0xFF)
#define IP_VERSION   4
#define LABEL_ACCEPT   ARPTC_LABEL_ACCEPT
#define LABEL_DROP   ARPTC_LABEL_DROP
#define LABEL_QUEUE   ARPTC_LABEL_QUEUE

Referenced by TC_CREATE_CHAIN(), and TC_RENAME_CHAIN().

#define LABEL_RETURN   ARPTC_LABEL_RETURN

Referenced by TC_CREATE_CHAIN(), and TC_RENAME_CHAIN().

#define RETURN   ARPT_RETURN

Referenced by dump_entry(), and TC_CREATE_CHAIN().

#define SO_GET_ENTRIES   ARPT_SO_GET_ENTRIES

Referenced by TC_INIT().

#define SO_GET_INFO   ARPT_SO_GET_INFO

Referenced by TC_INIT().

#define SO_GET_VERSION   ARPT_SO_GET_VERSION
#define SO_SET_ADD_COUNTERS   ARPT_SO_SET_ADD_COUNTERS

Referenced by TC_COMMIT().

#define SO_SET_REPLACE   ARPT_SO_SET_REPLACE

Referenced by TC_COMMIT().

#define STANDARD_TARGET   ARPT_STANDARD_TARGET

Referenced by dump_entry(), and TC_CREATE_CHAIN().

#define STRUCT_COUNTERS   struct arpt_counters
#define STRUCT_COUNTERS_INFO   struct arpt_counters_info

Referenced by TC_COMMIT().

#define STRUCT_ENTRY_MATCH   struct arpt_entry_match
#define STRUCT_GET_ENTRIES   struct arpt_get_entries

Referenced by TC_INIT().

#define STRUCT_GETINFO   struct arpt_getinfo

Referenced by TC_INIT().

#define STRUCT_REPLACE   struct arpt_replace

Referenced by TC_COMMIT().

#define STRUCT_STANDARD_TARGET   struct arpt_standard_target

Referenced by TC_CREATE_CHAIN(), and TC_SET_POLICY().

#define STRUCT_TC_HANDLE   struct arptc_handle
#define TABLE_MAXNAMELEN   ARPT_TABLE_MAXNAMELEN

Referenced by TC_INIT().

#define TC_AF   AF_INET

Referenced by TC_INIT().

#define TC_APPEND_ENTRY   arptc_append_entry
#define TC_BUILTIN   arptc_builtin
#define TC_CHECK_PACKET   arptc_check_packet
#define TC_COMMIT   arptc_commit
#define TC_CREATE_CHAIN   arptc_create_chain
#define TC_DELETE_CHAIN   arptc_delete_chain
#define TC_DELETE_ENTRY   arptc_delete_entry
#define TC_DELETE_NUM_ENTRY   arptc_delete_num_entry
#define TC_DUMP_ENTRIES   dump_entries
#define TC_FIRST_CHAIN   arptc_first_chain
#define TC_FIRST_RULE   arptc_first_rule
#define TC_FLUSH_ENTRIES   arptc_flush_entries
#define TC_GET_POLICY   arptc_get_policy
#define TC_GET_RAW_SOCKET   arptc_get_raw_socket
#define TC_GET_REFERENCES   arptc_get_references
#define TC_GET_TARGET   arptc_get_target
#define TC_HANDLE_T   arptc_handle_t

Referenced by TC_INIT().

#define TC_INIT   arptc_init
#define TC_INSERT_ENTRY   arptc_insert_entry
#define TC_IPPROTO   IPPROTO_IP

Referenced by TC_COMMIT(), and TC_INIT().

#define TC_IS_CHAIN   arptc_is_chain
#define TC_NEXT_CHAIN   arptc_next_chain
#define TC_NEXT_RULE   arptc_next_rule
#define TC_READ_COUNTER   arptc_read_counter
#define TC_RENAME_CHAIN   arptc_rename_chain
#define TC_REPLACE_ENTRY   arptc_replace_entry
#define TC_SET_COUNTER   arptc_set_counter
#define TC_SET_POLICY   arptc_set_policy
#define TC_STRERROR   arptc_strerror
#define TC_ZERO_COUNTER   arptc_zero_counter
#define TC_ZERO_ENTRIES   arptc_zero_entries

Typedef Documentation

typedef unsigned int socklen_t

Function Documentation

int dump_entry ( STRUCT_ENTRY e,
const TC_HANDLE_T  handle 
)

References ARPT_ERROR_TARGET, data, GET_TARGET, IFNAMSIZ, IP_PARTS, NF_ACCEPT, NF_DROP, NF_QUEUE, pos, RETURN, STANDARD_TARGET, and STRUCT_ENTRY_TARGET.

Referenced by TC_DELETE_ENTRY(), and TC_DUMP_ENTRIES().

Here is the caller graph for this function: