policy_parse.h File Reference

Header file for policy_parse.c. More...

#include "lib/testsupport/testsupport.h"

Go to the source code of this file.


addr_policy_trouter_parse_addr_policy_item_from_string (const char *s, int assume_action, int *malformed_list)
addr_policy_trouter_parse_addr_policy (struct directory_token_t *tok, unsigned fmt_flags)

Detailed Description

Header file for policy_parse.c.

Definition in file policy_parse.h.

Function Documentation

◆ router_parse_addr_policy()

addr_policy_t* router_parse_addr_policy ( directory_token_t tok,
unsigned  fmt_flags 

Given a K_ACCEPT[6] or K_REJECT[6] token and a router, create and return a new exit_policy_t corresponding to the token. If TAPMP_EXTENDED_STAR is set in fmt_flags, K_ACCEPT6 and K_REJECT6 tokens followed by * expand to IPv6-only policies, otherwise they expand to IPv4 and IPv6 policies

Definition at line 136 of file policy_parse.c.

Referenced by router_add_exit_policy().

◆ router_parse_addr_policy_item_from_string()

addr_policy_t* router_parse_addr_policy_item_from_string ( const char *  s,
int  assume_action,
int *  malformed_list 

Parse the addr policy in the string s and return it. If assume_action is nonnegative, then insert its action (ADDR_POLICY_ACCEPT or ADDR_POLICY_REJECT) for items that specify no action.

Returns NULL on policy errors.

Set *malformed_list to true if the entire policy list should be discarded. Otherwise, set it to false, and only this item should be ignored on error - the rest of the policy list can continue to be processed and used.

The addr_policy_t returned by this function can have its address set to AF_UNSPEC for '*'. Use policy_expand_unspec() to turn this into a pair of AF_INET and AF_INET6 items.

Definition at line 44 of file policy_parse.c.