All pastes #67982 Raw Edit

Anonymous

public text v1 · immutable
#67982 ·published 2006-06-20 21:18 UTC
rendered paste body
diff -urN chillispot.old/src/dhcp.h chillispot.dev/src/dhcp.h
--- chillispot.old/src/dhcp.h   2005-09-19 23:49:28.000000000 +0200
+++ chillispot.dev/src/dhcp.h   2006-06-20 23:09:10.000000000 +0200
@@ -87,6 +87,8 @@
   uint16_t prot;
 };

+#include <endian.h>
+
 /* Constants for IP packet */
 #define DHCP_IP_ALEN   4
 #define DHCP_IP_HLEN  20
@@ -94,8 +96,15 @@
 #define DHCP_IP_TCP    6 /* TCP Protocol number */

 struct dhcp_iphdr_t {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
   uint8_t  ihl:4;
   uint8_t  version:4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+  uint8_t  version:4;
+  uint8_t  ihl:4;
+#else
+#error "Could not determine the system's endianness"
+#endif
   uint8_t  tos;
   uint16_t tot_len;
   uint16_t id;