home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcp30tkt.zip / PGMG1.ZIP / INCLUDE / NETINET / TCP.H < prev   
Text File  |  1995-12-04  |  4KB  |  102 lines

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