nat: Allow to use the prefix lookup to rewrite numbers
* Increase the rewritten rule to five digits (this is the easiest
for the unit test). This will add another 40kb to the runtime size.
* Create a unit test that tests adding and removing the prefix rules.
* Use the regexp match to replace from one package
diff --git a/openbsc/include/openbsc/nat_rewrite_trie.h b/openbsc/include/openbsc/nat_rewrite_trie.h
index 4445c3e..0571099 100644
--- a/openbsc/include/openbsc/nat_rewrite_trie.h
+++ b/openbsc/include/openbsc/nat_rewrite_trie.h
@@ -22,13 +22,15 @@
#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[4];
+ char rewrite[6];
};
struct nat_rewrite {
@@ -40,5 +42,6 @@
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