git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Nearly completed physical init
[tpg/acess2.git]
/
Modules
/
IPStack
/
ipv4.h
diff --git
a/Modules/IPStack/ipv4.h
b/Modules/IPStack/ipv4.h
index
67b3dc8
..
e8c2bc3
100644
(file)
--- a/
Modules/IPStack/ipv4.h
+++ b/
Modules/IPStack/ipv4.h
@@
-12,9
+12,10
@@
typedef struct sIPv4Header tIPv4Header;
struct sIPv4Header
{
struct {
struct sIPv4Header
{
struct {
- unsigned Version: 4; // = 4
+ // Spec says Version is first, but stupid bit ordering
unsigned HeaderLength: 4; // in 4-byte chunks
unsigned HeaderLength: 4; // in 4-byte chunks
- };
+ unsigned Version: 4; // = 4
+ } __attribute__((packed));
Uint8 DiffServices; // Differentiated Services
Uint16 TotalLength;
Uint16 Identifcation;
Uint8 DiffServices; // Differentiated Services
Uint16 TotalLength;
Uint16 Identifcation;
@@
-24,7
+25,7
@@
struct sIPv4Header
unsigned DontFragment: 1;
unsigned MoreFragments: 1;
unsigned FragOffLow: 5;
unsigned DontFragment: 1;
unsigned MoreFragments: 1;
unsigned FragOffLow: 5;
- };
+ }
__attribute__((packed))
;
Uint8 FragOffHi; // Number of 8-byte blocks from the original start
Uint8 TTL; // Max number of hops effectively
Uint8 FragOffHi; // Number of 8-byte blocks from the original start
Uint8 TTL; // Max number of hops effectively
@@
-35,7
+36,7
@@
struct sIPv4Header
tIPv4 Destination;
Uint8 Options[];
tIPv4 Destination;
Uint8 Options[];
-};
+}
__attribute__((packed))
;
#define IP4PROT_ICMP 1
#define IP4PROT_TCP 6
#define IP4PROT_ICMP 1
#define IP4PROT_TCP 6
@@
-43,4
+44,9
@@
struct sIPv4Header
#define IPV4_ETHERNET_ID 0x0800
#define IPV4_ETHERNET_ID 0x0800
+// === FUNCTIONS ===
+extern int IPv4_RegisterCallback(int ID, tIPCallback Callback);
+extern Uint16 IPv4_Checksum(void *Buf, int Size);
+extern int IPv4_SendPacket(tInterface *Iface, tIPv4 Address, int Protocol, int ID, int Length, void *Data);
+
#endif
#endif
UCC
git Repository :: git.ucc.asn.au