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

fw-ipfw.c File Reference

#include "config.h"
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/ip_fw.h>
#include <assert.h>
#include <errno.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

Functions

static void fr_to_ipfw_device (const char *device, char *name, short *unit)
static void fr_to_ipfw (const struct fw_rule *fr, struct ip_fw *ipfw)
static void ipfw_to_fr (const struct ip_fw *ipfw, struct fw_rule *fr)
fw_t * fw_open (void)
int fw_add (fw_t *fw, const struct fw_rule *rule)
static int fw_cmp (const struct fw_rule *a, const struct fw_rule *b)
int fw_delete (fw_t *fw, const struct fw_rule *rule)
int fw_loop (fw_t *fw, fw_handler callback, void *arg)
fw_t * fw_close (fw_t *fw)


Function Documentation

static void fr_to_ipfw (  const struct fw_rule *  fr,
struct ip_fw *  ipfw
)  [static]
 

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

References addr::addr_bits, addr_btom(), fr_to_ipfw_device(), 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, IP_ADDR_LEN, IP_PROTO_ICMP, IP_PROTO_TCP, IP_PROTO_UDP, and memset.

Referenced by fw_add().

static void fr_to_ipfw_device (  const char *  device,
char *  name,
short *  unit
)  [static]
 

Definition at line 33 of file fw-ipfw.c.

References strlcpy, and strpbrk().

Referenced by fr_to_ipfw().

int fw_add (  fw_t *  fw,
const struct fw_rule *  rule
) 
 

Definition at line 197 of file fw-ipfw.c.

References fr_to_ipfw(), and NULL.

fw_t* fw_close (  fw_t *  fw  ) 
 

Definition at line 316 of file fw-ipfw.c.

References NULL.

static int fw_cmp (  const struct fw_rule *  a,
const struct fw_rule *  b
)  [static]
 

Definition at line 210 of file fw-ipfw.c.

References addr_cmp(), fw_rule::fw_device, fw_rule::fw_dir, fw_rule::fw_dport, fw_rule::fw_dst, fw_rule::fw_op, fw_rule::fw_proto, fw_rule::fw_sport, fw_rule::fw_src, and memcmp().

Referenced by fw_delete().

int fw_delete (  fw_t *  fw,
const struct fw_rule *  rule
) 
 

Definition at line 223 of file fw-ipfw.c.

References errno, fw_handle::fd, fw_cmp(), ipfw_to_fr(), and NULL.

int fw_loop (  fw_t *  fw,
fw_handler  callback,
void *  arg
) 
 

Definition at line 276 of file fw-ipfw.c.

References fw_handle::fd, ipfw_to_fr(), and NULL.

fw_t* fw_open (  void   ) 
 

Definition at line 185 of file fw-ipfw.c.

References fw_close(), and NULL.

static void ipfw_to_fr (  const struct ip_fw *  ipfw,
struct fw_rule *  fr
)  [static]
 

Definition at line 112 of file fw-ipfw.c.

References addr_mtob(), ADDR_TYPE_IP, FW_DIR_IN, FW_DIR_OUT, FW_OP_ALLOW, FW_OP_BLOCK, IP_ADDR_LEN, IP_PROTO_ICMP, IP_PROTO_TCP, IP_PROTO_UDP, memset, snprintf, and TCP_PORT_MAX.

Referenced by fw_delete(), and fw_loop().


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