1: /*
   2:  * Copyright (c) 1982, 1986 Regents of the University of California.
   3:  * All rights reserved.
   4:  *
   5:  * Redistribution and use in source and binary forms are permitted
   6:  * provided that this notice is preserved and that due credit is given
   7:  * to the University of California at Berkeley. The name of the University
   8:  * may not be used to endorse or promote products derived from this
   9:  * software without specific prior written permission. This software
  10:  * is provided ``as is'' without express or implied warranty.
  11:  *
  12:  *	@(#)tcp.h	7.4.1.1 (Berkeley) 2/7/88
  13:  */
  14: #ifndef BYTE_ORDER
  15: /*
  16:  * Definitions for byte order,
  17:  * according to byte significance from low address to high.
  18:  */
  19: #define LITTLE_ENDIAN   1234    /* least-significant byte first (vax) */
  20: #define BIG_ENDIAN  4321    /* most-significant byte first (IBM, net) */
  21: #define PDP_ENDIAN  3412    /* LSB first in word, MSW first in long (pdp) */
  22: 
  23: #ifdef vax
  24: #define BYTE_ORDER  LITTLE_ENDIAN
  25: #else
  26: #ifdef pdp11
  27: #define BYTE_ORDER  PDP_ENDIAN
  28: #else
  29: #define BYTE_ORDER  BIG_ENDIAN  /* mc68000, tahoe, most others */
  30: #endif
  31: #endif
  32: #endif BYTE_ORDER
  33: 
  34: typedef u_long  tcp_seq;
  35: /*
  36:  * TCP header.
  37:  * Per RFC 793, September, 1981.
  38:  */
  39: struct tcphdr {
  40:     u_short th_sport;       /* source port */
  41:     u_short th_dport;       /* destination port */
  42:     tcp_seq th_seq;         /* sequence number */
  43:     tcp_seq th_ack;         /* acknowledgement number */
  44: #if BYTE_ORDER == LITTLE_ENDIAN
  45:     u_char  th_x2:4,        /* (unused) */
  46:         th_off:4;       /* data offset */
  47: #endif
  48: #if BYTE_ORDER == BIG_ENDIAN
  49:     u_char  th_off:4,       /* data offset */
  50:         th_x2:4;        /* (unused) */
  51: #endif
  52: #if BYTE_ORDER == PDP_ENDIAN
  53:     u_int   th_x2:4,        /* (unused) */
  54:         th_off:4;       /* data offset */
  55: #endif
  56:     u_char  th_flags;
  57: #define TH_FIN  0x01
  58: #define TH_SYN  0x02
  59: #define TH_RST  0x04
  60: #define TH_PUSH 0x08
  61: #define TH_ACK  0x10
  62: #define TH_URG  0x20
  63:     u_short th_win;         /* window */
  64:     u_short th_sum;         /* checksum */
  65:     u_short th_urp;         /* urgent pointer */
  66: };
  67: 
  68: #define TCPOPT_EOL  0
  69: #define TCPOPT_NOP  1
  70: #define TCPOPT_MAXSEG   2
  71: 
  72: /*
  73:  * Default maximum segment size for TCP.
  74:  * With an IP MSS of 576, this is 536,
  75:  * but 512 is probably more convenient.
  76:  */
  77: #ifdef  lint
  78: #define TCP_MSS 536
  79: #else
  80: #ifndef IP_MSS
  81: #define IP_MSS  576
  82: #endif
  83: #define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr))
  84: #endif
  85: 
  86: /*
  87:  * User-settable options (used with setsockopt).
  88:  */
  89: #define TCP_NODELAY 0x01    /* don't delay send to coalesce packets */
  90: #define TCP_MAXSEG  0x02    /* set maximum segment size */

Defined struct's

Defined macros

BIG_ENDIAN defined in line 20; used 2 times
BYTE_ORDER defined in line 29; used 4 times
IP_MSS defined in line 81; used 3 times
LITTLE_ENDIAN defined in line 19; used 2 times
PDP_ENDIAN defined in line 21; used 2 times
TCPOPT_MAXSEG defined in line 70; used 1 times
TCPOPT_NOP defined in line 69; used 1 times
TCP_MAXSEG defined in line 90; never used
TCP_NODELAY defined in line 89; never used
TH_ACK defined in line 61; used 10 times
TH_RST defined in line 59; used 10 times
TH_SYN defined in line 58; used 12 times

Usage of this include

Last modified: 1988-04-29
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3559
Valid CSS Valid XHTML 1.0 Strict