In article <1191893579.696576.127790@k79g2000hse.googlegroups .com>,
grocery_stocker <cdalten@gmail.com> wrote:
> Is there anykind of significance to putting a structure inside another
> stucture when assembling a TCP/IP packet by hand? In the following
> code snippet, struct iphdr and struct tcphdr are inside another
> stucture. The only thing I can think of is that it's to ensure some
> kind of memory alignmen
>
> struct tpack{
> struct iphdr ip;
> struct tcphdr tcp;
> }tpack; /*Why put the structures inside another structure?*/
Because that's how the packet is actually laid out. It also allows
applications that want to do stuff with the whole header to use a single
variable rather than two.
--
Barry Margolin,
barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***