Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: marc.gibian@acm.org (Marc S. Gibian)
Subject: Re: Data structure alignment question
Date: 24 Mar 2003 11:49:41 -0800	[thread overview]
Message-ID: <8df11a0.0303241149.598578d2@posting.google.com> (raw)
In-Reply-To: slrnb7n873.5ge.dek@wuzzy.berkeley.edu

David Konerding <dek@compbio.berkeley.edu> wrote in message news:<slrnb7n873.5ge.dek@wuzzy.berkeley.edu>...
> > Rather than get into the merits of binary vs. text based protocols,
> > this is not an open issue for my current effort because I am porting
> > software that has been around for quite a while, with a significant
> > installed base. Thus, we need to avoid changing the protocol to
> > maintain compatibility with the existing installed product.
> 
> I appreciate your need to maintain protocol compatibility.
> 
> However, my point was to avoid taking a struct, and writing it over the
> network directly.  Attempting to get a struct to have the alignment of
> fields you need by using compiler options is iffy.  Even if you don't use
> a platform-neutral data encoder like XDR or CORBA, you can achieve layout
> of fields in memory without using structs- you have to do the work by
> hand, but this is more reliable and portable.  Effectively, you end up
> writing a function which "packs" a struct into a binary representation
> that is equivalent to your protocol format, and another function which
> "unpacks" a struct.  Is source compatibility still a requirement?
> You would have to rewrite some core routines to handle this.

Yup... I also need to maintain source compatibility, primarily due to
the large size of the existing code base and the "small" effort being
directed to the current porting effort. Thus far, it appears that my
one padding addition from which my example was drawn has addressed the
major issues. There are probably other cases that have not been
surfaced yet, but that's the nature of any porting activity.

My preference for a distributed application such as this one would
have been to use some kind of middleware to handle the messaging, and
with it all of the encoding and alignment issues. I suspect CORBA
would be overkill, and I am unfamiliar with XDR. I'd have loved to use
a universally available RPC (once that was DCE RPC which was
everywhere and interoperated with Microsoft RPC), but RPC seems out of
vogue now. All of the new XML relatives seem poorly suited to this
particular application since it includes very high volume data
transfer (> 1 million data records could conceivably be getting moved
between the server and client involved), so its text based format
would introduce far more inefficiency than this application could
accept. DRDA, the wire protocol standard that is used for DB2, seems a
reasonable approach, though it would not leave room for application
specific messaging, which IS a requirement. I could see something like
the old ASN.1 based self-describing data encoding, though that takes a
sophisticated parser that probably is not available any longer.

So, while it is not a possibility for my current task to change the
protocol, I do wonder what would be a good engineering choice were I
designing this application from scratch?

In the meantime, anyone have any thoughts on my alignment problem? Or
am I stuck doing by-hand padding/alignment?

Thanks for your thoughts and help,
Marc


  reply	other threads:[~2003-03-24 19:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-20  0:36 Data structure alignment question Marc S. Gibian
2003-03-20 16:59 ` Brian Haley
2003-03-20 19:55 ` David Konerding
2003-03-21 20:48   ` Marc S. Gibian
2003-03-21 23:21     ` David Konerding
2003-03-24 19:49       ` Marc S. Gibian [this message]
2003-04-16  1:05         ` Marc S. Gibian
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox