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