diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-07-22 07:16:58 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-07-22 07:16:58 +0000 |
commit | e284539fe4d076330ca7f09cc791bdfb4164c0ce (patch) | |
tree | ce098f92974ac157f0a567e9288ef1cc704621e6 /src/tun | |
parent | f3adc188b34d52c03d0abbe05edbee3b0c227483 (diff) | |
download | gnunet-e284539fe4d076330ca7f09cc791bdfb4164c0ce.tar.gz gnunet-e284539fe4d076330ca7f09cc791bdfb4164c0ce.zip |
-move all code that deals with IP/policy to regex/string conversion to tun
Diffstat (limited to 'src/tun')
-rw-r--r-- | src/tun/regex.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tun/regex.c b/src/tun/regex.c index 5ec454637..0d259a8d5 100644 --- a/src/tun/regex.c +++ b/src/tun/regex.c | |||
@@ -138,4 +138,37 @@ GNUNET_TUN_ipv6toregex (const struct in6_addr *ipv6, unsigned int prefixlen, | |||
138 | strcat (rxstr, "(0|1)+"); | 138 | strcat (rxstr, "(0|1)+"); |
139 | } | 139 | } |
140 | 140 | ||
141 | |||
142 | /** | ||
143 | * Convert an exit policy to a regular expression. The exit policy | ||
144 | * specifies a set of subnets this peer is willing to serve as an | ||
145 | * exit for; the resulting regular expression will match the | ||
146 | * IPv4 address strings as returned by 'GNUNET_TUN_ipv4toregex'. | ||
147 | * | ||
148 | * @param policy exit policy specification | ||
149 | * @return regular expression, NULL on error | ||
150 | */ | ||
151 | char * | ||
152 | GNUNET_TUN_ipv4policy2regex (const char *policy) | ||
153 | { | ||
154 | return GNUNET_strdup (policy); | ||
155 | } | ||
156 | |||
157 | |||
158 | /** | ||
159 | * Convert an exit policy to a regular expression. The exit policy | ||
160 | * specifies a set of subnets this peer is willing to serve as an | ||
161 | * exit for; the resulting regular expression will match the | ||
162 | * IPv4 address strings as returned by 'GNUNET_TUN_ipv4toregex'. | ||
163 | * | ||
164 | * @param policy exit policy specification | ||
165 | * @return regular expression, NULL on error | ||
166 | */ | ||
167 | char * | ||
168 | GNUNET_TUN_ipv6policy2regex (const char *policy) | ||
169 | { | ||
170 | return GNUNET_strdup (policy); | ||
171 | } | ||
172 | |||
173 | |||
141 | /* end of regex.c */ | 174 | /* end of regex.c */ |