Qsmtp  0.30dev
Functions
match.h File Reference

functions for matching IP and domains against patterns More...

#include <netinet/in.h>
#include <sys/types.h>

Go to the source code of this file.

Functions

int ip4_matchnet (const struct in6_addr *, const struct in_addr *, const unsigned char)
 
int ip6_matchnet (const struct in6_addr *, const struct in6_addr *, const unsigned char)
 
int matchdomain (const char *, const size_t, const char *)
 

Detailed Description

functions for matching IP and domains against patterns

Function Documentation

int ip4_matchnet ( const struct in6_addr *  ip,
const struct in_addr *  net,
const unsigned char  mask 
)

check if an IPv4 address is in a given network

Parameters
ipthe IP address to check (network byte order)
netthe network to check (network byte order)
maskthe network mask, must be 0 <= netmask <= 32
Returns
if address is within net/mask
Return values
1on match
0no match
int ip6_matchnet ( const struct in6_addr *  ip,
const struct in6_addr *  net,
const unsigned char  mask 
)

check if an IPv6 address is in a given network

Parameters
ipthe IP address to check (network byte order)
netthe network to check (network byte order)
maskthe network mask, must be 0 <= netmask <= 128
Returns
if address is within net/mask
Return values
1address is within the net/mask
0address is not within net/mask
int matchdomain ( const char *  domain,
const size_t  dl,
const char *  expr 
)

check if a given expression matches a domain

Parameters
domainthe domain to check
dllength of domain
exprthe expression to match
Return values
1on match
0otherwise