aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-06-25 11:44:01 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-31 16:36:40 +0200
commitddf191eafc079cb26e2956a611d59e5235de1798 (patch)
treef1c012375d24c6f58e14c8606a11fb671d3b1da2 /openbsc/include
parent85d3b34ed2c3b627fca50c82abe426b7239b62a3 (diff)
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
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/bsc_nat.h6
-rw-r--r--openbsc/include/openbsc/nat_rewrite_trie.h5
2 files changed, 10 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 195031822..f93b596d4 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -45,6 +45,7 @@ struct nat_sccp_connection;
struct bsc_nat_parsed;
struct bsc_nat;
struct bsc_nat_ussd_con;
+struct nat_rewrite_rule;
enum {
NAT_CON_TYPE_NONE,
@@ -308,6 +309,10 @@ struct bsc_nat {
char *sms_num_rewr_name;
struct llist_head sms_num_rewr;
+ /* more rewriting */
+ char *num_rewr_trie_name;
+ struct nat_rewrite *num_rewr_trie;
+
/* USSD messages we want to match */
char *ussd_lst_name;
char *ussd_query;
@@ -452,6 +457,7 @@ struct bsc_nat_num_rewr_entry {
regex_t num_reg;
char *replace;
+ uint8_t is_prefix_lookup;
};
void bsc_nat_num_rewr_entry_adapt(void *ctx, struct llist_head *head, const struct osmo_config_list *);
diff --git a/openbsc/include/openbsc/nat_rewrite_trie.h b/openbsc/include/openbsc/nat_rewrite_trie.h
index 4445c3e09..0571099c6 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 {
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