Go to the source code of this file.
Macros | |
#define | DOT "(0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F)" |
'wildcard', matches all possible values (for HEX encoding). More... | |
Functions | |
void | GNUNET_TUN_ipv4toregexsearch (const struct in_addr *ip, uint16_t port, char *rxstr) |
Create a regex in rxstr from the given ip and port. More... | |
void | GNUNET_TUN_ipv6toregexsearch (const struct in6_addr *ipv6, uint16_t port, char *rxstr) |
Create a regex in rxstr from the given ipv6 and port. More... | |
static char * | nibble_to_regex (uint8_t value, uint8_t mask) |
Convert the given 4-bit (!) number to a regex. More... | |
static char * | num_to_regex (uint16_t value, uint16_t mask) |
Convert the given 16-bit number to a regex. More... | |
static int | needs_parens (const char *arg) |
Do we need to put parents around the given argument? More... | |
static char * | compute_policy (unsigned int start, unsigned int end, unsigned int step, const struct GNUNET_STRINGS_PortPolicy *pp) |
Compute port policy for the given range of port numbers. More... | |
static char * | port_to_regex (const struct GNUNET_STRINGS_PortPolicy *pp) |
Convert a port policy to a regular expression. More... | |
static char * | address_to_regex (const void *addr, const void *mask, size_t len) |
Convert an address (IPv4 or IPv6) to a regex. More... | |
static char * | ipv4_to_regex (const struct GNUNET_STRINGS_IPv4NetworkPolicy *v4) |
Convert a single line of an IPv4 policy to a regular expression. More... | |
static char * | ipv6_to_regex (const struct GNUNET_STRINGS_IPv6NetworkPolicy *v6) |
Convert a single line of an IPv4 policy to a regular expression. More... | |
char * | GNUNET_TUN_ipv4policy2regex (const char *policy) |
Convert an exit policy to a regular expression. More... | |
char * | GNUNET_TUN_ipv6policy2regex (const char *policy) |
Convert an exit policy to a regular expression. More... | |
void | GNUNET_TUN_service_name_to_hash (const char *service_name, struct GNUNET_HashCode *hc) |
Hash the service name of a hosted service to the hash code that is used to identify the service on the network. More... | |
void | GNUNET_TUN_compute_service_cadet_port (const struct GNUNET_HashCode *desc, uint16_t ip_port, struct GNUNET_HashCode *cadet_port) |
Compute the CADET port given a service descriptor (returned from GNUNET_TUN_service_name_to_hash) and a TCP/UDP port ip_port. More... | |
#define DOT "(0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F)" |
|
static |
Convert the given 4-bit (!) number to a regex.
value | the value, only the lowest 4 bits will be looked at |
mask | which bits in value are wildcards (any value)? |
Definition at line 75 of file regex.c.
References _, DOT, GNUNET_asprintf(), GNUNET_break, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_strdup, ret, and value.
Referenced by num_to_regex().
|
static |
Convert the given 16-bit number to a regex.
value | the value |
mask | which bits in value are wildcards (any value)? |
Definition at line 138 of file regex.c.
References d, GNUNET_asprintf(), GNUNET_free, m, nibble_to_regex(), ret, and value.
Referenced by address_to_regex().
|
static |
Do we need to put parents around the given argument?
arg | part of a regular expression |
Definition at line 177 of file regex.c.
References find_typedefs::arg, GNUNET_assert, GNUNET_NO, GNUNET_YES, and op.
Referenced by compute_policy().
|
static |
Compute port policy for the given range of port numbers.
start | starting offset |
end | end offset |
step | increment level (power of 16) |
pp | port policy to convert |
Definition at line 222 of file regex.c.
References compute_policy(), DOT, end, GNUNET_STRINGS_PortPolicy::end_port, GNUNET_asprintf(), GNUNET_assert, GNUNET_free, GNUNET_snprintf(), GNUNET_strdup, GNUNET_YES, needs_parens(), GNUNET_STRINGS_PortPolicy::negate_portrange, ret, start, and GNUNET_STRINGS_PortPolicy::start_port.
Referenced by compute_policy(), and port_to_regex().
|
static |
Convert a port policy to a regular expression.
Note: this is a very simplistic implementation, we might want to consider doing something more sophisiticated (resulting in smaller regular expressions) at a later time.
pp | port policy to convert |
Definition at line 504 of file regex.c.
References compute_policy(), DOT, GNUNET_STRINGS_PortPolicy::end_port, GNUNET_asprintf(), GNUNET_free, GNUNET_malloc, GNUNET_NO, GNUNET_snprintf(), GNUNET_strdup, GNUNET_YES, GNUNET_STRINGS_PortPolicy::negate_portrange, ret, and GNUNET_STRINGS_PortPolicy::start_port.
Referenced by ipv4_to_regex(), and ipv6_to_regex().
|
static |
Convert an address (IPv4 or IPv6) to a regex.
addr | address |
mask | network mask |
len | number of bytes in addr and mask |
Definition at line 576 of file regex.c.
References GNUNET_asprintf(), GNUNET_assert, GNUNET_free, m, num_to_regex(), and ret.
Referenced by ipv4_to_regex(), and ipv6_to_regex().
|
static |
Convert a single line of an IPv4 policy to a regular expression.
v4 | line to convert |
Definition at line 622 of file regex.c.
References address_to_regex(), GNUNET_asprintf(), GNUNET_free, GNUNET_STRINGS_IPv4NetworkPolicy::netmask, GNUNET_STRINGS_IPv4NetworkPolicy::network, port_to_regex(), GNUNET_STRINGS_IPv4NetworkPolicy::pp, and ret.
Referenced by GNUNET_TUN_ipv4policy2regex().
|
static |
Convert a single line of an IPv4 policy to a regular expression.
v6 | line to convert |
Definition at line 655 of file regex.c.
References address_to_regex(), GNUNET_asprintf(), GNUNET_free, GNUNET_STRINGS_IPv6NetworkPolicy::netmask, GNUNET_STRINGS_IPv6NetworkPolicy::network, port_to_regex(), GNUNET_STRINGS_IPv6NetworkPolicy::pp, and ret.
Referenced by GNUNET_TUN_ipv6policy2regex().