diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-01-29 06:27:21 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-01-30 10:33:07 +0100 |
commit | 55b4f5cc2e7fd8d97547f2ee4db3a925428e9c25 (patch) | |
tree | 2db9fda797ef6e90ccc1f8a7cfd7b3e473fb4e88 /openbsc/include | |
parent | 1ac5ac75a9b15d8a1cea8bf852853eb336ba68fa (diff) |
[nat] Prepare more sophisicated filtering and patching
Introduce a bsc_nat_parse method to parse a IP Access method
into various parts. Write out the IPA Proto, in case SCCP is used,
store the msg type, pointers to the source/dest local reference and
other information.
Use the result of bsc_nat_parse inside the bsc_nat_filter method
to decide if the message should be dropped or not.
In the future the bsc_nat_parse result will be used for patching
SCCP references and other parts of the message.
The filter language should be able to filter the msg type of SCCP
messages and gain the "NOT" word in the filter language.
Diffstat (limited to 'openbsc/include')
-rw-r--r-- | openbsc/include/openbsc/bsc_nat.h | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index ea30cae22..b8a533fff 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -23,11 +23,55 @@ #define BSC_NAT_H #include <sys/types.h> +#include <sccp/sccp_types.h> #include "msgb.h" +#define FILTER_NONE 0 +#define FILTER_TO_BSC 1 +#define FILTER_TO_MSC 2 +#define FILTER_TO_BOTH 3 + +/* + * For the NAT we will need to analyze and later patch + * the received message. This would require us to parse + * the IPA and SCCP header twice. Instead of doing this + * we will have one analyze structure and have the patching + * and filter operate on the same structure. + */ +struct bsc_nat_parsed { + /* ip access prototype */ + int ipa_proto; + + /* source local reference */ + struct sccp_source_reference *src_local_ref; + + /* destination local reference */ + struct sccp_source_reference *dest_local_ref; + + /* called ssn number */ + int called_ssn; + + /* calling ssn number */ + int calling_ssn; + + /* sccp message type */ + int sccp_type; + + /* bssap type, e.g. 0 for BSS Management */ + int bssap; + + /* the gsm0808 message type */ + int gsm_type; +}; + +/** + * parse the given message into the above structure + */ +struct bsc_nat_parsed *bsc_nat_parse(struct msgb *msg); + /** * filter based on IP Access header in both directions */ -int bsc_nat_filter_ipa(struct msgb *msg); +int bsc_nat_filter_ipa(struct msgb *msg, struct bsc_nat_parsed *parsed); #endif |