pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-sigtran/+/41584?usp=email )


Change subject: tcap: use libosmo-asn1-tcap public API
......................................................................

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, 6 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran 
refs/changes/84/41584/1

diff --git a/src/tcap_as_loadshare.c b/src/tcap_as_loadshare.c
index 9b6d16c..af381b1 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;
+       int rc;
        struct TCAP_TCMessage tcap = { 0 };
        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 https://gerrit.osmocom.org/c/libosmo-sigtran/+/41584?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Ic00aa609f412a230c9e04aec280c0c4c1c81f32f
Gerrit-Change-Number: 41584
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to