libosmocore does not build in Ubuntu

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Ruben Undheim ruben.undheim at gmail.com
Thu Feb 11 21:00:11 UTC 2016


Surely not elegant or efficient, but it makes the test pass...:

Index: libosmo-sccp/src/sccp.c
===================================================================
--- libosmo-sccp.orig/src/sccp.c    2016-02-05 16:56:35.845659264 +0100
+++ libosmo-sccp/src/sccp.c 2016-02-11 21:48:58.066093403 +0100
@@ -1392,14 +1392,26 @@
 uint32_t sccp_src_ref_to_int(struct sccp_source_reference *ref)
 {
    uint32_t src_ref = 0;
+#if OSMO_IS_LITTLE_ENDIAN
    memcpy(&src_ref, ref, sizeof(*ref));
+#elif OSMO_IS_BIG_ENDIAN
+   memcpy((((char*)(&src_ref))+3),&(ref->octet1),1);
+   memcpy((((char*)(&src_ref))+2),&(ref->octet2),1);
+   memcpy((((char*)(&src_ref))+1),&(ref->octet3),1);
+#endif
    return src_ref;
 }
 
 struct sccp_source_reference sccp_src_ref_from_int(uint32_t int_ref)
 {
    struct sccp_source_reference ref;
+#if OSMO_IS_LITTLE_ENDIAN
    memcpy(&ref, &int_ref, sizeof(ref));
+#elif OSMO_IS_BIG_ENDIAN
+   memcpy(&(ref.octet1),(((char*)(&int_ref))+3),1);
+   memcpy(&(ref.octet2),(((char*)(&int_ref))+2),1);
+   memcpy(&(ref.octet3),(((char*)(&int_ref))+1),1);
+#endif
    return ref;
 }



Cheers,
Ruben


On Thu, Feb 11, 2016 at 09:21:06PM +0100, Holger Freyther wrote:
> 
> > On 11 Feb 2016, at 21:15, Ruben Undheim <ruben.undheim at gmail.com> wrote:
> > 
> > 
> 
> Hi!
> 
> I am off for today but..
> 
> > This is an extract from the log:
> > 
> > -   outgoing: dstref(196612) 1 -> 3
> > +   outgoing: dstref(67109632) 1 -> 3
> 
> uint32_t sccp_src_ref_to_int(struct sccp_source_reference *ref)
> struct sccp_source_reference sccp_src_ref_from_int(uint32_t int_ref);
> 
> are the two candidates. You could have ntohl and htonl in them to make the format/result predictable on LE and BE machines. Or swap it on BE machines.
> 
> holger
> 



More information about the OpenBSC mailing list