summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-01-13 09:55:43 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-01-29 04:35:18 +0100
commit762afe424d9db41bb11383676a776ee9965bbb98 (patch)
tree03d58815be912a4fcb0d38bde64af40676bcdb15
parent2ac75aeb4d6589d1c2b3d2db957bd3d14b61b731 (diff)
[sccp] Add a utility for the nat..
Add a small helper to determine the type of a message
-rw-r--r--include/sccp/sccp.h6
-rw-r--r--src/sccp/sccp.c8
2 files changed, 14 insertions, 0 deletions
diff --git a/include/sccp/sccp.h b/include/sccp/sccp.h
index 3ad568c..69ef63c 100644
--- a/include/sccp/sccp.h
+++ b/include/sccp/sccp.h
@@ -143,4 +143,10 @@ extern const struct sockaddr_sccp sccp_ssn_bssap;
u_int32_t sccp_src_ref_to_int(struct sccp_source_reference *ref);
struct sccp_source_reference sccp_src_ref_from_int(u_int32_t);
+
+/*
+ * helper functions for the nat code
+ */
+int sccp_determine_msg_type(struct msgb *msg);
+
#endif
diff --git a/src/sccp/sccp.c b/src/sccp/sccp.c
index 522afcf..7e55231 100644
--- a/src/sccp/sccp.c
+++ b/src/sccp/sccp.c
@@ -1160,6 +1160,14 @@ struct sccp_source_reference sccp_src_ref_from_int(u_int32_t int_ref)
return ref;
}
+int sccp_determine_msg_type(struct msgb *msg)
+{
+ if (msgb_l2len(msg) < 1)
+ return -1;
+
+ return msg->l2h[0];
+}
+
static __attribute__((constructor)) void on_dso_load(void)
{
tall_sccp_ctx = talloc_named_const(NULL, 1, "sccp");