home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / netinet / h / tcp < prev    next >
Encoding:
Text File  |  1995-09-11  |  2.1 KB  |  88 lines

  1. /* -*-C-*-
  2.  *
  3.  * $Header: /ax/networking:include/netinet/tcp.h:networking  1.1  $
  4.  * $Source: /ax/networking:include/netinet/tcp.h: $
  5.  *
  6.  * Copyright (c) 1995 Acorn Computers Ltd., Cambridge, England
  7.  *
  8.  * $Log:    tcp.h,v $
  9.  * Revision 1.2  95/09/11  15:20:00  kbracey
  10.  * Changed bitfields to ints
  11.  *
  12.  * Revision 1.1  95/01/11  10:17:00  kwelton
  13.  * Initial revision
  14.  *
  15.  */
  16.  
  17. #ifndef BYTE_ORDER
  18. /*
  19.  * Definitions for byte order,
  20.  * according to byte significance from low address to high.
  21.  */
  22. #define LITTLE_ENDIAN    1234    /* least-significant byte first (vax) */
  23. #define BIG_ENDIAN    4321    /* most-significant byte first (IBM, net) */
  24. #define PDP_ENDIAN    3412    /* LSB first in word, MSW first in long (pdp) */
  25.  
  26. #if defined(vax) || defined(__arm)
  27. #define BYTE_ORDER    LITTLE_ENDIAN
  28. #else
  29. #define BYTE_ORDER    BIG_ENDIAN    /* mc68000, tahoe, most others */
  30. #endif
  31. #endif BYTE_ORDER
  32.  
  33. typedef u_long    tcp_seq;
  34. /*
  35.  * TCP header.
  36.  * Per RFC 793, September, 1981.
  37.  */
  38. struct tcphdr {
  39.     u_short th_sport;        /* source port */
  40.     u_short th_dport;        /* destination port */
  41.     tcp_seq th_seq;            /* sequence number */
  42.     tcp_seq th_ack;            /* acknowledgement number */
  43. #if BYTE_ORDER == LITTLE_ENDIAN
  44.     u_int    th_x2:4,        /* (unused) */
  45.         th_off:4;        /* data offset */
  46. #endif
  47. #if BYTE_ORDER == BIG_ENDIAN
  48.     u_int    th_off:4,        /* data offset */
  49.         th_x2:4;        /* (unused) */
  50. #endif
  51.     u_char    th_flags;
  52. #define TH_FIN    0x01
  53. #define TH_SYN    0x02
  54. #define TH_RST    0x04
  55. #define TH_PUSH 0x08
  56. #define TH_ACK    0x10
  57. #define TH_URG    0x20
  58.     u_short th_win;            /* window */
  59.     u_short th_sum;            /* checksum */
  60.     u_short th_urp;            /* urgent pointer */
  61. };
  62.  
  63. #define TCPOPT_EOL    0
  64. #define TCPOPT_NOP    1
  65. #define TCPOPT_MAXSEG    2
  66.  
  67. /*
  68.  * Default maximum segment size for TCP.
  69.  * With an IP MSS of 576, this is 536,
  70.  * but 512 is probably more convenient.
  71.  */
  72. #ifdef    lint
  73. #define TCP_MSS 536
  74. #else
  75. #ifndef IP_MSS
  76. #define IP_MSS    576
  77. #endif
  78. #define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr))
  79. #endif
  80.  
  81. /*
  82.  * User-settable options (used with setsockopt).
  83.  */
  84. #define TCP_NODELAY    0x01    /* don't delay send to coalesce packets */
  85. #define TCP_MAXSEG    0x02    /* set maximum segment size */
  86.  
  87. /* EOF tcp.h */
  88.