Browse Source

Make flags more efficient.

Add 'raw' net_addr facility (needed for ARP).
tags/v0.9.3
Michael Brown 18 years ago
parent
commit
744b895077
1 changed files with 15 additions and 8 deletions
  1. 15
    8
      src/include/gpxe/llh.h

+ 15
- 8
src/include/gpxe/llh.h View File

@@ -18,6 +18,12 @@
18 18
 /** Maximum length of a network-layer address */
19 19
 #define MAX_NET_ADDR_LEN 4
20 20
 
21
+/* Network-layer address may be required to contain a raw link-layer address */
22
+#if MAX_NET_ADDR_LEN < MAX_LLH_ADDR_LEN
23
+#undef MAX_NET_ADDR_LEN
24
+#define MAX_NET_ADDR_LEN MAX_LLH_ADDR_LEN
25
+#endif
26
+
21 27
 /** A media-independent link-layer header
22 28
  *
23 29
  * This structure represents a generic link-layer header.  It never
@@ -31,16 +37,12 @@ struct gpxehdr {
31 37
 	 * ETH_P_XXX constant, in network-byte order.
32 38
 	 */
33 39
 	uint16_t net_proto;
34
-	/** Broadcast flag
35
-	 *
36
-	 * Filled in only on outgoing packets.
37
-	 */
38
-	int broadcast : 1;
39
-	/** Multicast flag
40
+	/** Flags
40 41
 	 *
41
-	 * Filled in only on outgoing packets.
42
+	 * Filled in only on outgoing packets.  Value is the
43
+	 * bitwise-OR of zero or more GPXE_FL_XXX constants.
42 44
 	 */
43
-	int multicast : 1;
45
+	uint8_t flags;
44 46
 	/** Network-layer address length 
45 47
 	 *
46 48
 	 * Filled in only on outgoing packets.
@@ -53,4 +55,9 @@ struct gpxehdr {
53 55
 	uint8_t net_addr[MAX_NET_ADDR_LEN];
54 56
 } __attribute__ (( packed ));
55 57
 
58
+/* Media-independent link-layer header flags */
59
+#define GPXE_FL_BROADCAST	0x01
60
+#define GPXE_FL_MULTICAST	0x02
61
+#define GPXE_FL_RAW		0x04
62
+
56 63
 #endif /* _LLH_H */

Loading…
Cancel
Save