aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-04-16 16:02:59 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-04-18 17:32:38 +0200
commite5d324981d6378306d3e492cc8c04d4cf8f3d589 (patch)
tree9829acea08ee04a2cf9b5912651e15ca2d57017b /openbsc
parenta64037cd4a74d45d5da593e96faa9a7d8c746c9a (diff)
nat: Remove magic numbers, use enum values for conn classification
Remove the usage of 0, 1, 2 and start using enum values. We can still assume con_local is a number.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/bsc_nat.h10
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c8
2 files changed, 14 insertions, 4 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index dd29c7aa5..02290231d 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -55,6 +55,16 @@ enum {
};
/*
+ * Is this terminated to the MSC, to the local machine (release
+ * handling for IMSI filtering) or to a USSD provider?
+ */
+enum {
+ NAT_CON_END_MSC,
+ NAT_CON_END_LOCAL,
+ NAT_CON_END_USSD,
+};
+
+/*
* Per BSC data structure
*/
struct bsc_connection {
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index d38256587..e395ba516 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -399,7 +399,7 @@ static void bsc_send_con_release(struct bsc_connection *bsc, struct sccp_connect
ipaccess_prepend_header(rlsd, IPAC_PROTO_SCCP);
queue_for_msc(con->msc_con, rlsd);
}
- con->con_local = 1;
+ con->con_local = NAT_CON_END_LOCAL;
con->msc_con = NULL;
/* 2. release the BSC side */
@@ -465,7 +465,7 @@ static void bsc_send_con_refuse(struct bsc_connection *bsc,
/* declare it local and assign a unique remote_ref */
con->con_type = NAT_CON_TYPE_LOCAL_REJECT;
- con->con_local = 1;
+ con->con_local = NAT_CON_END_LOCAL;
con->has_remote_ref = 1;
con->remote_ref = con->patched_ref;
@@ -942,7 +942,7 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
/* hand data to a side channel */
if (bsc_check_ussd(con, parsed, msg) == 1)
- con->con_local = 2;
+ con->con_local = NAT_CON_END_USSD;
/*
* Optionally rewrite setup message. This can
@@ -1414,7 +1414,7 @@ int bsc_close_ussd_connections(struct bsc_nat *nat)
{
struct sccp_connections *con;
llist_for_each_entry(con, &nat->sccp_connections, list_entry) {
- if (con->con_local != 2)
+ if (con->con_local != NAT_CON_END_USSD)
continue;
if (!con->bsc)
continue;