author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:27:01 +0100 | |
branch | Symbian2 |
changeset 3 | e1b950c65cb4 |
parent 0 | 061f57f2323e |
child 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@2 | 1 |
/* TCP.H |
williamr@2 | 2 |
* |
williamr@2 | 3 |
* Portions copyright (c) 1997-1999 Symbian Ltd. All rights reserved. |
williamr@2 | 4 |
*/ |
williamr@2 | 5 |
|
williamr@2 | 6 |
/** @file |
williamr@2 | 7 |
@publishedAll |
williamr@2 | 8 |
@released |
williamr@2 | 9 |
*/ |
williamr@2 | 10 |
|
williamr@2 | 11 |
/* |
williamr@2 | 12 |
* Copyright (c) 1982, 1986 Regents of the University of California. |
williamr@2 | 13 |
* All rights reserved. The Berkeley software License Agreement |
williamr@2 | 14 |
* specifies the terms and conditions for redistribution. |
williamr@2 | 15 |
*/ |
williamr@2 | 16 |
|
williamr@2 | 17 |
#ifndef _NETINET_TCP_H |
williamr@2 | 18 |
#define _NETINET_TCP_H |
williamr@2 | 19 |
|
williamr@2 | 20 |
#ifdef __cplusplus |
williamr@2 | 21 |
extern "C" { |
williamr@2 | 22 |
#endif |
williamr@2 | 23 |
|
williamr@2 | 24 |
typedef u_long tcp_seq; |
williamr@2 | 25 |
/** |
williamr@2 | 26 |
TCP header. |
williamr@2 | 27 |
Per RFC 793, September, 1981. |
williamr@2 | 28 |
@internalComponent |
williamr@2 | 29 |
*/ |
williamr@2 | 30 |
struct tcphdr { |
williamr@2 | 31 |
u_short th_sport; /* source port */ |
williamr@2 | 32 |
u_short th_dport; /* destination port */ |
williamr@2 | 33 |
tcp_seq th_seq; /* sequence number */ |
williamr@2 | 34 |
tcp_seq th_ack; /* acknowledgement number */ |
williamr@2 | 35 |
#ifdef _BIT_FIELDS_LTOH |
williamr@2 | 36 |
u_int th_x2:4, /* (unused) */ |
williamr@2 | 37 |
th_off:4; /* data offset */ |
williamr@2 | 38 |
#else |
williamr@2 | 39 |
u_int th_off:4, /* data offset */ |
williamr@2 | 40 |
th_x2:4; /* (unused) */ |
williamr@2 | 41 |
#endif |
williamr@2 | 42 |
u_char th_flags; |
williamr@2 | 43 |
/** |
williamr@2 | 44 |
@internalComponent |
williamr@2 | 45 |
*/ |
williamr@2 | 46 |
#define TH_FIN 0x01 |
williamr@2 | 47 |
/** |
williamr@2 | 48 |
@internalComponent |
williamr@2 | 49 |
*/ |
williamr@2 | 50 |
#define TH_SYN 0x02 |
williamr@2 | 51 |
/** |
williamr@2 | 52 |
@internalComponent |
williamr@2 | 53 |
*/ |
williamr@2 | 54 |
#define TH_RST 0x04 |
williamr@2 | 55 |
/** |
williamr@2 | 56 |
@internalComponent |
williamr@2 | 57 |
*/ |
williamr@2 | 58 |
#define TH_PUSH 0x08 |
williamr@2 | 59 |
/** |
williamr@2 | 60 |
@internalComponent |
williamr@2 | 61 |
*/ |
williamr@2 | 62 |
#define TH_ACK 0x10 |
williamr@2 | 63 |
/** |
williamr@2 | 64 |
@internalComponent |
williamr@2 | 65 |
*/ |
williamr@2 | 66 |
#define TH_URG 0x20 |
williamr@2 | 67 |
u_short th_win; /* window */ |
williamr@2 | 68 |
u_short th_sum; /* checksum */ |
williamr@2 | 69 |
u_short th_urp; /* urgent pointer */ |
williamr@2 | 70 |
}; |
williamr@2 | 71 |
|
williamr@2 | 72 |
#define TCPOPT_EOL 0 |
williamr@2 | 73 |
#define TCPOPT_NOP 1 |
williamr@2 | 74 |
#define TCPOPT_MAXSEG 2 |
williamr@2 | 75 |
|
williamr@2 | 76 |
/** |
williamr@2 | 77 |
Default maximum segment size for TCP. |
williamr@2 | 78 |
With an IP MSS of 576, this is 536, |
williamr@2 | 79 |
but 512 is probably more convenient. |
williamr@2 | 80 |
*/ |
williamr@2 | 81 |
#ifdef lint |
williamr@2 | 82 |
#define TCP_MSS 536 |
williamr@2 | 83 |
#else |
williamr@2 | 84 |
#define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) |
williamr@2 | 85 |
#endif |
williamr@2 | 86 |
|
williamr@2 | 87 |
/** |
williamr@2 | 88 |
User-settable options (used with setsockopt). |
williamr@2 | 89 |
*/ |
williamr@2 | 90 |
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ |
williamr@2 | 91 |
#define TCP_MAXSEG 0x02 /* set maximum segment size */ |
williamr@2 | 92 |
|
williamr@2 | 93 |
#define TCP_NOTIFY_THRESHOLD 0x10 |
williamr@2 | 94 |
#define TCP_ABORT_THRESHOLD 0x11 |
williamr@2 | 95 |
#define TCP_CONN_NOTIFY_THRESHOLD 0x12 |
williamr@2 | 96 |
#define TCP_CONN_ABORT_THRESHOLD 0x13 |
williamr@2 | 97 |
|
williamr@2 | 98 |
|
williamr@2 | 99 |
#ifdef __cplusplus |
williamr@2 | 100 |
} |
williamr@2 | 101 |
#endif |
williamr@2 | 102 |
|
williamr@2 | 103 |
#endif /* _NETINET_TCP_H */ |