Open Source Telephony
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: ofono@ofono.org
Subject: Re: [patch 5/6] IP support for PPP
Date: Thu, 18 Mar 2010 12:26:15 +0100	[thread overview]
Message-ID: <1268911575.2700.134.camel@localhost.localdomain> (raw)
In-Reply-To: <20100317171200.5a7f1719@kcaccard-MOBL3>

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

Hi Kristen,

> > > +static guint32 bytes_to_32(guint8 *bytes)
> > > +{
> > > +	union addr {
> > > +		guint8 bytes[4];
> > > +		guint32 word;
> > > +	} a;
> > > +
> > > +	memcpy(a.bytes, bytes, 4);
> > > +	return(ntohl(a.word));
> > > +}
> > 
> > This works, but is pretty ugly.
> > 
> > Doesn't GLib has functions to ensure retrieve unaligned data? BlueZ has
> > the GCC magic that is required to do this right.
> >
> 
> I have looked everywhere for something nice from glib, but I'm not
> seeing it.  As far as I can tell, most people just do the bit shifting
> manually -- but that's what I had originally and you didn't like it.
> So I'm only seeing 2 options here, this way or the original way.  If
> you know of the glib function to use, please let me know what it is.

I don't see how bit shifting is gonna help you against the unaligned
access of your buffer.

Regards

Marcel



  reply	other threads:[~2010-03-18 11:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100317000824.420232401@linux.intel.com>
2010-03-17  0:13 ` [patch 1/6] Add PPP protocol support with HDLC framing Kristen Carlson Accardi
2010-03-17  6:28   ` Marcel Holtmann
2010-03-17  0:13 ` [patch 2/6] Generic PPP control protocol Kristen Carlson Accardi
2010-03-17  7:06   ` Marcel Holtmann
2010-03-18 23:03     ` Kristen Carlson Accardi
2010-03-19  3:57       ` Marcel Holtmann
2010-03-17  0:13 ` [patch 3/6] LCP support Kristen Carlson Accardi
2010-03-17  7:09   ` Marcel Holtmann
2010-03-17 18:59     ` Kristen Carlson Accardi
2010-03-17 19:31       ` Marcel Holtmann
2010-03-17  0:13 ` [patch 4/6] CHAP with MD5 authentication Kristen Carlson Accardi
2010-03-17  7:12   ` Marcel Holtmann
2010-03-17  0:13 ` [patch 5/6] IP support for PPP Kristen Carlson Accardi
2010-03-17  6:38   ` Marcel Holtmann
2010-03-18  0:12     ` Kristen Carlson Accardi
2010-03-18 11:26       ` Marcel Holtmann [this message]
2010-03-19 17:58         ` Kristen Carlson Accardi
2010-03-17  0:13 ` [patch 6/6] Allow gsmdial to use gatchat ppp support Kristen Carlson Accardi
2010-03-17  6:42   ` Marcel Holtmann
2010-03-23  0:05 [PATCH 0/6] PPP Patches v3 Kristen Carlson Accardi
2010-03-23  0:06 ` [PATCH 5/6] IP support for PPP Kristen Carlson Accardi
     [not found] <20100319194705.214150215@linux.intel.com>
2010-03-19 19:46 ` [patch " Kristen Carlson Accardi
     [not found] <20100311214022.838696145@linux.intel.com>
2010-03-11 22:00 ` kristen
2010-03-14 20:22   ` Marcel Holtmann
2010-03-16 22:53     ` Kristen Carlson Accardi
2010-03-17  4:39       ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1268911575.2700.134.camel@localhost.localdomain \
    --to=marcel@holtmann.org \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox