aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc/nat_rewrite_trie.h
blob: 0571099c643a710fc0df1d7d5cd8fdecc9861b88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * (C) 2013 by On-Waves
 * (C) 2013 by Holger Hans Peter Freyther <zecke@selfish.org>
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
#ifndef NAT_REWRITE_FILE_H
#define NAT_REWRITE_FILE_H

#include <osmocom/core/linuxrbtree.h>

struct vty;

struct nat_rewrite_rule {
	/* For digits 0-9 and + */
	struct nat_rewrite_rule *rules[11];

	char empty;
	char prefix[14];
	char rewrite[6];
};

struct nat_rewrite {
	struct nat_rewrite_rule rule;
	size_t prefixes;
};


struct nat_rewrite *nat_rewrite_parse(void *ctx, const char *filename);
struct nat_rewrite_rule *nat_rewrite_lookup(struct nat_rewrite *, const char *prefix);
void nat_rewrite_dump(struct nat_rewrite *rewr);
void nat_rewrite_dump_vty(struct vty *vty, struct nat_rewrite *rewr);

#endif