From b62c9a19cfca6a8230e33eea2140720ee4518686 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 13 Jan 2010 09:55:43 +0100 Subject: [sccp] Add a utility for the nat.. Add a small helper to determine the type of a message --- openbsc/include/sccp/sccp.h | 6 ++++++ openbsc/src/sccp/sccp.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/openbsc/include/sccp/sccp.h b/openbsc/include/sccp/sccp.h index 3ad568c0b..69ef63c25 100644 --- a/openbsc/include/sccp/sccp.h +++ b/openbsc/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/openbsc/src/sccp/sccp.c b/openbsc/src/sccp/sccp.c index 522afcf7a..7e55231e5 100644 --- a/openbsc/src/sccp/sccp.c +++ b/openbsc/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"); -- cgit v1.2.3