boot net: Preparations for TCP

Add protocol number and struct for TCP header.

First minuscule part of ticket #5240.
Checked that pxehaiku_loader still compiles, too.

Changes from proposed patch:
* Simplify struct by merging flags into one 8-bit field.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38434 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Andreas Färber
2010-08-29 22:12:17 +00:00
parent 588b796bcb
commit df66656fec
+25
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2005, Ingo Weinhold <[email protected]>.
* Copyright 2010, Andreas Färber <[email protected]>
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _BOOT_NET_DEFS_H
@@ -158,6 +159,7 @@ struct ip_header {
#define IP_DEFAULT_TIME_TO_LIVE 64 /* default ttl, from RFC 1340 */
// IP protocols
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
@@ -175,6 +177,29 @@ struct udp_header
} __attribute__ ((__packed__));
// Transmission Control Protocol (TCP)
// TCP header (RFC 793, RFC 3168)
struct tcp_header
{
uint16 source; // source port
uint16 destination; // destination port
uint32 seqNumber; // sequence number
uint32 ackNumber; // acknowledgment number
#if __BYTE_ORDER == __BIG_ENDIAN
uint8 dataOffset : 4; // data offset
uint8 reserved : 4; // reserved
#elif __BYTE_ORDER == __LITTLE_ENDIAN
uint8 reserved : 4;
uint8 dataOffset : 4;
#endif
uint8 flags; // ACK, SYN, FIN, etc.
uint16 window; // window size
uint16 checksum; // checksum
uint16 urgentPointer; // urgent pointer
} __attribute__ ((__packed__));
// #pragma mark -
// NetService