Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

fw-ipf.c File Reference

#include "config.h"
#include <sys/param.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/ip_compat.h>
#include <netinet/ip_fil.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "dnet.h"

Go to the source code of this file.

Classes

struct  fw_handle

Defines

#define _NETINET_IP6_H_
#define ip_t   ipf_ip_t
#define KMEM_NAME   "/dev/kmem"
#define fi_saddr   fi_src.s_addr
#define fi_daddr   fi_dst.s_addr

Functions

static void rule_to_ipf (const struct fw_rule *rule, struct frentry *fr)
static void ipf_ports_to_rule (uint8_t cmp, uint16_t port, uint16_t top, uint16_t *range)
static void ipf_to_rule (const struct frentry *fr, struct fw_rule *rule)
fw_tfw_open (void)
int fw_add (fw_t *fw, const struct fw_rule *rule)
int fw_delete (fw_t *fw, const struct fw_rule *rule)
static int fw_kcopy (fw_t *fw, u_char *buf, off_t pos, size_t n)
int fw_loop (fw_t *fw, fw_handler callback, void *arg)
fw_tfw_close (fw_t *fw)


Define Documentation

#define _NETINET_IP6_H_
 

Definition at line 18 of file fw-ipf.c.

#define fi_daddr   fi_dst.s_addr
 

Definition at line 43 of file fw-ipf.c.

#define fi_saddr   fi_src.s_addr
 

Definition at line 42 of file fw-ipf.c.

#define ip_t   ipf_ip_t
 

Definition at line 20 of file fw-ipf.c.

#define KMEM_NAME   "/dev/kmem"
 

Definition at line 37 of file fw-ipf.c.

Referenced by fw_open().


Function Documentation

int fw_add fw_t fw,
const struct fw_rule rule
 

Definition at line 194 of file fw-ipf.c.

References NULL, and rule_to_ipf().

fw_t* fw_close fw_t fw  ) 
 

Definition at line 271 of file fw-ipf.c.

References NULL.

int fw_delete fw_t fw,
const struct fw_rule rule
 

Definition at line 206 of file fw-ipf.c.

References NULL, and rule_to_ipf().

static int fw_kcopy fw_t fw,
u_char *  buf,
off_t  pos,
size_t  n
[static]
 

Definition at line 218 of file fw-ipf.c.

References lseek.

Referenced by fw_loop().

int fw_loop fw_t fw,
fw_handler  callback,
void *  arg
 

Definition at line 235 of file fw-ipf.c.

References fw_handle::fd, fw_kcopy(), ipf_to_rule(), memset, and NULL.

fw_t* fw_open void   ) 
 

Definition at line 179 of file fw-ipf.c.

References fw_close(), KMEM_NAME, and NULL.

static void ipf_ports_to_rule uint8_t  cmp,
uint16_t  port,
uint16_t  top,
uint16_t range
[static]
 

Definition at line 103 of file fw-ipf.c.

References TCP_PORT_MAX.

Referenced by ipf_to_rule().

static void ipf_to_rule const struct frentry *  fr,
struct fw_rule rule
[static]
 

Definition at line 144 of file fw-ipf.c.

References addr_mtob(), ADDR_TYPE_IP, FW_DIR_IN, FW_DIR_OUT, FW_OP_ALLOW, FW_OP_BLOCK, IP_ADDR_LEN, ipf_ports_to_rule(), memset, and strlcpy.

Referenced by fw_loop().

static void rule_to_ipf const struct fw_rule rule,
struct frentry *  fr
[static]
 

Definition at line 52 of file fw-ipf.c.

References addr::addr_bits, addr_btom(), fw_rule::fw_device, fw_rule::fw_dir, FW_DIR_IN, fw_rule::fw_dport, fw_rule::fw_dst, fw_rule::fw_op, FW_OP_ALLOW, fw_rule::fw_proto, fw_rule::fw_sport, fw_rule::fw_src, IFNAMSIZ, IP_ADDR_LEN, memset, and strlcpy.

Referenced by fw_add(), and fw_delete().


Generated on Sun May 14 14:51:21 2006 by  doxygen 1.4.2