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

ipobj.h File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "sflsq.h"

Go to the source code of this file.

Enumerations

enum  { NOFAMILY, IPV4_FAMILY, IPV6_FAMILY }
enum  { IPV4_LEN = 4, IPV6_LEN = 16 }

Functions

int ip_familysize (int family)
int ip4_sprintx (char *s, int slen, void *ip4)
int ip6_sprintx (char *s, int slen, void *ip6)
IPADDRESSip_new (int family)
void ip_free (IPADDRESS *p)
int ip_family (IPADDRESS *p)
int ip_size (IPADDRESS *p)
int ip_set (IPADDRESS *ia, void *ip, int family)
int ip_get (IPADDRESS *ia, void *ip, int family)
int ip_equal (IPADDRESS *ia, void *ip, int family)
int ip_eq (IPADDRESS *ia, IPADDRESS *ib)
int ip_sprint (char *s, int slen, IPADDRESS *p)
int ip_fprint (FILE *fp, IPADDRESS *p)
IPSETipset_new (int family)
IPSETipset_copy (IPSET *ipset)
int ipset_family (IPSET *ipset)
void ipset_free (IPSET *ipset)
int ipset_add (IPSET *ipset, void *ip, void *mask, int notflag, int family)
int ipset_contains (IPSET *ipset, void *ip, int family)
int ipset_print (IPSET *ipset)
int ip4_parse (char *ipstr, int network_order, int *not_flag, unsigned *host, unsigned *mask)
int ip4_setparse (IPSET *ipset, char *ipstr)


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
NOFAMILY 
IPV4_FAMILY 
IPV6_FAMILY 

Definition at line 27 of file ipobj.h.

anonymous enum
 

Enumeration values:
IPV4_LEN 
IPV6_LEN 

Definition at line 33 of file ipobj.h.


Function Documentation

int ip4_parse char *  ipstr,
int  network_order,
int *  not_flag,
unsigned *  host,
unsigned *  mask
 

Break an IP4 Address down into its components

Parameters:
ipstr string to parse
use network order for return values (defaults to host order)
not_flag return value if the ip is negated
host ipv4 host argument
mask ipv4 mask argument
Returns:
0 on sucess, else failure parsing the address
Return values:
-3 encountered prematurely
-2 strdup failed
-1 null argument
-4 out of range for CIDR notation

Definition at line 538 of file ipobj.c.

References memcpy, and strstr().

Referenced by ip4_setparse().

int ip4_setparse IPSET ipset,
char *  ipstr
 

Definition at line 687 of file ipobj.c.

References ip4_parse(), ipset_add(), and IPV4_FAMILY.

Referenced by FlowPSParseOption(), and ParseIpList().

int ip4_sprintx char *  s,
int  slen,
void *  ip4
 

Definition at line 43 of file ipobj.c.

References snprintf.

Referenced by ip_sprint(), ipset_print(), and PrintPortscanConf().

int ip6_sprintx char *  s,
int  slen,
void *  ip6
 

Definition at line 60 of file ipobj.c.

References snprintf.

Referenced by ip_sprint(), and ipset_print().

int ip_eq IPADDRESS ia,
IPADDRESS ib
 

Definition at line 226 of file ipobj.c.

References IPADDRESS::family, IPADDRESS::ip, IPV4_FAMILY, IPV4_LEN, IPV6_FAMILY, IPV6_LEN, and memcmp().

int ip_equal IPADDRESS ia,
void *  ip,
int  family
 

Definition at line 206 of file ipobj.c.

References IPADDRESS::family, IPADDRESS::ip, IPV4_FAMILY, IPV4_LEN, IPV6_LEN, and memcmp().

int ip_family IPADDRESS p  ) 
 

Definition at line 157 of file ipobj.c.

References IPADDRESS::family.

int ip_familysize int  family  ) 
 

Definition at line 36 of file ipobj.c.

References IPV4_FAMILY, IPV4_LEN, IPV6_FAMILY, and IPV6_LEN.

Referenced by ip_size().

int ip_fprint FILE *  fp,
IPADDRESS p
 

Definition at line 99 of file ipobj.c.

References ip_sprint().

void ip_free IPADDRESS p  ) 
 

Definition at line 149 of file ipobj.c.

int ip_get IPADDRESS ia,
void *  ip,
int  family
 

Definition at line 189 of file ipobj.c.

References IPADDRESS::family, IPADDRESS::ip, IPV4_FAMILY, IPV4_LEN, IPV6_FAMILY, IPV6_LEN, and memcpy.

IPADDRESS* ip_new int  family  ) 
 

Definition at line 129 of file ipobj.c.

References ip_init(), IPV4_FAMILY, IPV4_LEN, IPV6_FAMILY, IPV6_LEN, and NULL.

int ip_set IPADDRESS ia,
void *  ip,
int  family
 

Definition at line 173 of file ipobj.c.

References IPADDRESS::family, IPADDRESS::ip, IPV4_FAMILY, IPV4_LEN, IPV6_FAMILY, IPV6_LEN, and memcpy.

int ip_size IPADDRESS p  ) 
 

Definition at line 165 of file ipobj.c.

References IPADDRESS::family, and ip_familysize().

Referenced by MakePortscanPkt().

int ip_sprint char *  s,
int  slen,
IPADDRESS p
 

Definition at line 80 of file ipobj.c.

References IPADDRESS::family, IPADDRESS::ip, ip4_sprintx(), ip6_sprintx(), IPV4_FAMILY, and IPV6_FAMILY.

Referenced by ip_fprint().

int ipset_add IPSET ipset,
void *  ip,
void *  mask,
int  notflag,
int  family
 

Definition at line 362 of file ipobj.c.

References IPSET::cidr_list, IPSET::family, CIDRBLOCK6::ip, CIDRBLOCK::ip, IPV4_FAMILY, IPV6_FAMILY, IPV6_LEN, CIDRBLOCK6::mask, CIDRBLOCK::mask, memcpy, CIDRBLOCK6::notflag, CIDRBLOCK::notflag, sflist_add_head(), and sflist_add_tail().

Referenced by ip4_setparse(), and ipset_copy().

int ipset_contains IPSET ipset,
void *  ip,
int  family
 

Definition at line 410 of file ipobj.c.

References IPSET::cidr_list, IPSET::family, CIDRBLOCK6::ip, CIDRBLOCK::ip, IPV4_FAMILY, IPV6_FAMILY, IPV6_LEN, CIDRBLOCK6::mask, CIDRBLOCK::mask, memcmp(), CIDRBLOCK6::notflag, CIDRBLOCK::notflag, sflist_first(), and sflist_next().

Referenced by flowps_is_ignored_ipv4(), ps_filter_ignore(), ps_ignore_ip(), server_stats_add_ipv4(), server_stats_contains(), and server_stats_hitcount_ipv4().

IPSET* ipset_copy IPSET ipset  ) 
 

Definition at line 305 of file ipobj.c.

References IPSET::cidr_list, CIDRBLOCK6::ip, CIDRBLOCK::ip, ipset_add(), ipset_family(), ipset_new(), IPV4_FAMILY, CIDRBLOCK6::mask, CIDRBLOCK::mask, CIDRBLOCK6::notflag, CIDRBLOCK::notflag, NULL, sflist_first(), and sflist_next().

Referenced by server_stats_init().

int ipset_family IPSET ipset  ) 
 

Definition at line 354 of file ipobj.c.

References IPSET::family.

Referenced by ipset_copy(), and server_stats_init().

void ipset_free IPSET ipset  ) 
 

Definition at line 346 of file ipobj.c.

References IPSET::cidr_list, and sflist_free().

Referenced by server_stats_destroy().

IPSET* ipset_new int  family  ) 
 

Definition at line 289 of file ipobj.c.

References ipset6_init(), ipset_init(), and IPV4_FAMILY.

Referenced by FlowPSParseOption(), ipset_copy(), and ParseIpList().

int ipset_print IPSET ipset  ) 
 

Definition at line 470 of file ipobj.c.

References IPSET::cidr_list, IPSET::family, CIDRBLOCK6::ip, CIDRBLOCK::ip, ip4_sprintx(), ip6_sprintx(), IPV4_FAMILY, IPV6_FAMILY, CIDRBLOCK6::mask, CIDRBLOCK::mask, CIDRBLOCK6::notflag, CIDRBLOCK::notflag, sflist_first(), and sflist_next().


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