pespin submitted this change.
tcap: use libosmo-asn1-tcap public API
Depends: libosmo-asn1-tcap.git Change-Id I6d97ac94be91064be7203b11cffa4de9056afce1
Related: OS#6895
Related: OS#6896
Change-Id: Ic00aa609f412a230c9e04aec280c0c4c1c81f32f
---
M src/tcap_as_loadshare.c
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/src/tcap_as_loadshare.c b/src/tcap_as_loadshare.c
index 9b6d16c..c5016cc 100644
--- a/src/tcap_as_loadshare.c
+++ b/src/tcap_as_loadshare.c
@@ -39,6 +39,7 @@
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/tcap/OCTET_STRING.h>
#include <osmocom/tcap/TCAP_TCMessage.h>
+#include <osmocom/tcap/tcap.h>
#include "mtp3_hmrt.h"
#include "ss7_as.h"
@@ -68,18 +69,16 @@
/* returns negative on error, mask with any/both OTID_SET|DTID_SET on success */
static int parse_tcap(struct osmo_ss7_as *as, const uint8_t *data, size_t len, struct tcap_parsed *ids)
{
- int rc = 0;
- asn_dec_rval_t asn_rc;
- struct TCAP_TCMessage tcap = { 0 };
+ int rc;
+ struct TCAP_TCMessage tcap;
struct TCAP_TCMessage *tcapmsg = &tcap;
OSMO_ASSERT(ids);
- asn_rc = ber_decode(0, &asn_DEF_TCAP_TCMessage, (void **)&tcapmsg, data, len);
- if (asn_rc.code != RC_OK) {
+ rc = osmo_asn1_tcap_decode(tcapmsg, data, len);
+ if (rc < 0) {
LOGPAS(as, DLTCAP, LOGL_DEBUG, "Error decoding TCAP message rc: %d, message: %s\n",
- asn_rc.code, osmo_hexdump(data, len));
- rc = -EINVAL;
+ rc, osmo_hexdump(data, len));
goto free_asn;
}
@@ -124,13 +123,8 @@
break;
}
- /* Only asn_fprint is available, but no asn_sprint:
- * asn_fprint(stdout, &asn_DEF_TCAP_TCMessage, tcapmsg);
- */
-
free_asn:
- ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_TCAP_TCMessage, tcapmsg);
-
+ osmo_asn1_tcap_TCMessage_free_contents(tcapmsg);
return rc;
}
To view, visit change 41584. To unsubscribe, or for help writing mail filters, visit settings.