Add the `packed' attribute to structures which describe wire protocol

data formats.
This commit is contained in:
thorpej 1999-11-19 20:41:19 +00:00
parent a3f0dc54de
commit e1ed9178a1
9 changed files with 36 additions and 36 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_arc.h,v 1.12 1999/09/25 17:49:28 is Exp $ */
/* $NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -45,7 +45,7 @@
*/
struct arc_addr {
u_int8_t arc_addr_octet[1];
};
} __attribute__((__packed__));
/*
* Structure of a 2.5MB/s Arcnet header.
@ -68,7 +68,7 @@ struct arc_header {
u_int8_t arc_type2; /* same as arc_type */
u_int8_t arc_flag2; /* real flag value */
u_int16_t arc_seqid2; /* real seqid value */
};
} __attribute__((__packed__));
#define ARC_ADDR_LEN 1

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_atm.h,v 1.10 1999/07/01 08:12:48 itojun Exp $ */
/* $NetBSD: if_atm.h,v 1.11 1999/11/19 20:41:19 thorpej Exp $ */
/*
*
@ -127,7 +127,7 @@ struct pvctxreq {
struct atmllc {
u_int8_t llchdr[6]; /* aa.aa.03.00.00.00 */
u_int8_t type[2]; /* "ethernet" type */
};
} __attribute__((__packed__));
/* ATM_LLC macros: note type code in host byte order */
#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1]))

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ether.h,v 1.12 1999/08/10 18:16:07 thorpej Exp $ */
/* $NetBSD: if_ether.h,v 1.13 1999/11/19 20:41:19 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -54,7 +54,7 @@
*/
struct ether_addr {
u_int8_t ether_addr_octet[ETHER_ADDR_LEN];
};
} __attribute__((__packed__));
/*
* Structure of a 10Mb/s Ethernet header.
@ -63,7 +63,7 @@ struct ether_header {
u_int8_t ether_dhost[ETHER_ADDR_LEN];
u_int8_t ether_shost[ETHER_ADDR_LEN];
u_int16_t ether_type;
};
} __attribute__((__packed__));
#include <net/ethertypes.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_fddi.h,v 1.7 1999/05/18 23:57:20 thorpej Exp $ */
/* $NetBSD: if_fddi.h,v 1.8 1999/11/19 20:41:19 thorpej Exp $ */
/*
* Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com)
@ -37,7 +37,7 @@ struct fddi_header {
u_char fddi_fc;
u_char fddi_dhost[6];
u_char fddi_shost[6];
};
} __attribute__((__packed__));
#define FDDIIPMTU 4352
#define FDDIMTU 4470

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_gre.h,v 1.4 1998/12/22 01:33:45 thorpej Exp $ */
/* $NetBSD: if_gre.h,v 1.5 1999/11/19 20:41:19 thorpej Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -76,12 +76,12 @@ struct gre_h {
struct gre_sre[] routing Routing fileds (see below)
Present if (rt_pres == 1)
*/
};
} __attribute__((__packed__));
struct greip {
struct ip gi_i;
struct gre_h gi_g;
};
} __attribute__((__packed__));
#define gi_pr gi_i.ip_p
#define gi_len gi_i.ip_len
@ -120,12 +120,12 @@ struct mobile_h {
u_int16_t hcrc; /* header checksum */
u_int32_t odst; /* original destination address */
u_int32_t osrc; /* original source addr, if S-bit set */
};
} __attribute__((__packed__));
struct mobip_h {
struct ip mi;
struct mobile_h mh;
};
} __attribute__((__packed__));
#define MOB_H_SIZ_S (sizeof(struct mobile_h) - sizeof(u_int32_t))

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_hippi.h,v 1.5 1999/05/18 23:57:20 thorpej Exp $ */
/* $NetBSD: if_hippi.h,v 1.6 1999/11/19 20:41:19 thorpej Exp $ */
/*
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -50,7 +50,7 @@ struct hippi_fp {
u_int16_t fp_offsets;
#define HIPPI_FP_D2_MASK 0x07
u_int32_t fp_d2_len;
};
} __attribute__((__packed__));
struct hippi_le {
u_int32_t le_dest_switch;
@ -59,12 +59,12 @@ struct hippi_le {
u_int8_t le_dest_addr[6];
u_int16_t le_local_admin;
u_int8_t le_src_addr[6];
};
} __attribute__((__packed__));
struct hippi_header {
struct hippi_fp hi_fp;
struct hippi_le hi_le;
};
} __attribute__((__packed__));
#define HIPPI_HDRLEN (sizeof(struct hippi_header))

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_llc.h,v 1.11 1999/03/22 22:29:27 bad Exp $ */
/* $NetBSD: if_llc.h,v 1.12 1999/11/19 20:41:19 thorpej Exp $ */
/*
* Copyright (c) 1988, 1993
@ -55,15 +55,15 @@ struct llc {
u_int8_t format_id;
u_int8_t class;
u_int8_t window_x2;
} type_u;
} type_u __attribute__((__packed__));
struct {
u_int8_t num_snd_x2;
u_int8_t num_rcv_x2;
} type_i;
} type_i __attribute__((__packed__));
struct {
u_int8_t control;
u_int8_t num_rcv_x2;
} type_s;
} type_s __attribute__((__packed__));
struct {
u_int8_t control;
/*
@ -75,18 +75,18 @@ struct llc {
u_int8_t frmr_control;
u_int8_t frmr_control_ext;
u_int8_t frmr_cause;
} type_frmr;
} type_frmr __attribute__((__packed__));
struct {
u_int8_t control;
u_int8_t org_code[3];
u_int16_t ether_type;
} type_snap;
} type_snap __attribute__((__packed__));
struct {
u_int8_t control;
u_int8_t control_ext;
} type_raw;
} llc_un;
};
} type_raw __attribute__((__packed__));
} llc_un /* XXX __attribute__((__packed__)) ??? */;
} __attribute__((__packed__));
struct frmrinfo {
u_int8_t frmr_rej_pdu0;
@ -94,7 +94,7 @@ struct frmrinfo {
u_int8_t frmr_control;
u_int8_t frmr_control_ext;
u_int8_t frmr_cause;
};
} __attribute__((__packed__));
#define llc_control llc_un.type_u.control
#define llc_control_ext llc_un.type_raw.control_ext

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_spppsubr.c,v 1.5 1999/07/30 10:35:38 itojun Exp $ */
/* $NetBSD: if_spppsubr.c,v 1.6 1999/11/19 20:41:19 thorpej Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
@ -195,14 +195,14 @@ struct ppp_header {
u_char address;
u_char control;
u_short protocol;
};
} __attribute__((__packed__));
#define PPP_HEADER_LEN sizeof (struct ppp_header)
struct lcp_header {
u_char type;
u_char ident;
u_short len;
};
} __attribute__((__packed__));
#define LCP_HEADER_LEN sizeof (struct lcp_header)
struct cisco_packet {
@ -212,7 +212,7 @@ struct cisco_packet {
u_short rel;
u_short time0;
u_short time1;
};
} __attribute__((__packed__));
#define CISCO_PACKET_LEN 18
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_token.h,v 1.5 1999/05/30 00:39:07 bad Exp $ */
/* $NetBSD: if_token.h,v 1.6 1999/11/19 20:41:19 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -46,7 +46,7 @@ struct token_header {
u_int8_t token_fc; /* frame control field */
u_int8_t token_dhost[ISO88025_ADDR_LEN]; /* dest. address */
u_int8_t token_shost[ISO88025_ADDR_LEN]; /* source address */
};
} __attribute__((__packed__));
#define TOKEN_MAX_BRIDGE 8
@ -54,7 +54,7 @@ struct token_header {
struct token_rif {
u_int16_t tr_rcf; /* route control field */
u_int16_t tr_rdf[TOKEN_MAX_BRIDGE]; /* route-designator fields */
};
} __attribute__((__packed__));
/* standard values for adress control and frame control field */
#define TOKEN_AC 0x10