diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-02-08 20:02:35 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-02-08 20:02:35 +0000 |
commit | facb50396007c70e5616ff61a4aa22ff43e44001 (patch) | |
tree | 5b6cc37f430a6cf9219059dab9c1a753e1f7da3e /packet-atalk.c | |
parent | 3384ac4a63b94c2f78fb787a1fb3eae3710a7c9c (diff) |
I removed the bit-fields that depended upon gcc's ability to use any type
of variable as a bit field container. ANSI specs only allow unsigned ints
to host bit fields; IBM's C compiler is very ANSI-strict.
svn path=/trunk/; revision=183
Diffstat (limited to 'packet-atalk.c')
-rw-r--r-- | packet-atalk.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/packet-atalk.c b/packet-atalk.c index 9dbb64f0bf..0c10c1ebaa 100644 --- a/packet-atalk.c +++ b/packet-atalk.c @@ -41,12 +41,18 @@ extern packet_info pi; -typedef struct _e_ddp { +/* P = Padding, H = Hops, L = Len */ #if BYTE_ORDER == BIG_ENDIAN - guint16 pad:2,hops:4,len:10; + /* PPHHHHLL LLLLLLLL */ + #define ddp_hops(x) ( ( x >> 10) & 0x3C ) + #define ddp_len(x) ( x & 0x03ff ) #else - guint16 len:10,hops:4,pad:2; + /* LLLLLLLL PPHHHHLL*/ + #define ddp_hops(x) ( x & 0x3C ) + #define ddp_len(x) ( ntohs(x) & 0x03ff ) #endif +typedef struct _e_ddp { + guint16 hops_len; /* combines pad, hops, and len */ guint16 sum,dnet,snet; guint8 dnode,snode; guint8 dport,sport; @@ -94,8 +100,8 @@ dissect_ddp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) { "Datagram Delivery Protocol"); ddp_tree = gtk_tree_new(); add_subtree(ti, ddp_tree, ETT_IP); - add_item_to_tree(ddp_tree, offset, 1, "Hop count: %d", ddp.hops); - add_item_to_tree(ddp_tree, offset, 2, "Datagram length: %d", ddp.len); + add_item_to_tree(ddp_tree, offset, 1, "Hop count: %d", ddp_hops(ddp.hops_len)); + add_item_to_tree(ddp_tree, offset, 2, "Datagram length: %d", ddp_len(ddp.hops_len)); add_item_to_tree(ddp_tree, offset + 2, 2, "Checksum: %d",ddp.sum); add_item_to_tree(ddp_tree, offset + 4, 2, "Destination Net: %d",ddp.dnet); add_item_to_tree(ddp_tree, offset + 6, 2, "Source Net: %d",ddp.snet); |