home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / header45.zip / stack16 / netinet / tcp.h < prev    next >
Text File  |  1999-05-11  |  7KB  |  159 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_int   th_x2:4,                /* (unused) */
  59.                 th_off:4,               /* data offset */
  60.                 th_flags:8,
  61.                 th_win:16;
  62. #endif
  63. #if BYTE_ORDER == BIG_ENDIAN
  64.         u_int   th_win:16,
  65.                 th_flags:8,
  66.                 th_off:4,               /* data offset */
  67.                 th_x2:4;                /* (unused) */
  68. #endif
  69. #define TH_FIN  0x01
  70. #define TH_SYN  0x02
  71. #define TH_RST  0x04
  72. #define TH_PUSH 0x08
  73. #define TH_ACK  0x10
  74. #define TH_URG  0x20
  75.         u_short th_sum;                 /* checksum */
  76.         u_short th_urp;                 /* urgent pointer */
  77. };
  78. #pragma pack()
  79.  
  80. #define TCPOPT_EOL      0
  81. #define TCPOPT_NOP      1
  82. #define TCPOPT_MAXSEG   2
  83.  
  84. /*
  85.  * Default maximum segment size for TCP.
  86.  * With an IP MSS of 576, this is 536,
  87.  * but 512 is probably more convenient.
  88.  */
  89. #ifdef  lint
  90. #define TCP_MSS 536
  91. #else
  92. #ifndef IP_MSS
  93. #define IP_MSS  576
  94. #endif
  95. #define TCP_MSS MIN(512, IP_MSS - 40)
  96. #endif
  97.  
  98. /*
  99.  * User-settable options (used with setsockopt).
  100.  */
  101. #define TCP_NODELAY     0x01    /* don't delay send to coalesce packets */
  102. #define TCP_MAXSEG      0x02    /* set maximum segment size */
  103.  
  104. #pragma pack(1)
  105. struct  tcpstat {
  106.         u_long  tcps_connattempt;       /* connections initiated */
  107.         u_long  tcps_accepts;           /* connections accepted */
  108.         u_long  tcps_connects;          /* connections established */
  109.         u_long  tcps_drops;             /* connections dropped */
  110.         u_long  tcps_conndrops;         /* embryonic connections dropped */
  111.         u_long  tcps_closed;            /* conn. closed (includes drops) */
  112.         u_long  tcps_segstimed;         /* segs where we tried to get rtt */
  113.         u_long  tcps_rttupdated;        /* times we succeeded */
  114.         u_long  tcps_delack;            /* delayed acks sent */
  115.         u_long  tcps_timeoutdrop;       /* conn. dropped in rxmt timeout */
  116.         u_long  tcps_rexmttimeo;        /* retransmit timeouts */
  117.         u_long  tcps_persisttimeo;      /* persist timeouts */
  118.         u_long  tcps_keeptimeo;         /* keepalive timeouts */
  119.         u_long  tcps_keepprobe;         /* keepalive probes sent */
  120.         u_long  tcps_keepdrops;         /* connections dropped in keepalive */
  121.  
  122.         u_long  tcps_sndtotal;          /* total packets sent */
  123.         u_long  tcps_sndpack;           /* data packets sent */
  124.         u_long  tcps_sndbyte;           /* data bytes sent */
  125.         u_long  tcps_sndrexmitpack;     /* data packets retransmitted */
  126.         u_long  tcps_sndrexmitbyte;     /* data bytes retransmitted */
  127.         u_long  tcps_sndacks;           /* ack-only packets sent */
  128.         u_long  tcps_sndprobe;          /* window probes sent */
  129.         u_long  tcps_sndurg;            /* packets sent with URG only */
  130.         u_long  tcps_sndwinup;          /* window update-only packets sent */
  131.         u_long  tcps_sndctrl;           /* control (SYN|FIN|RST) packets sent */
  132.         u_long  tcps_sndrst;            /* RST packets sent, MIB II ... */
  133.  
  134.         u_long  tcps_rcvtotal;          /* total packets received */
  135.         u_long  tcps_rcvpack;           /* packets received in sequence */
  136.         u_long  tcps_rcvbyte;           /* bytes received in sequence */
  137.         u_long  tcps_rcvbadsum;         /* packets received with ccksum errs */
  138.         u_long  tcps_rcvbadoff;         /* packets received with bad offset */
  139.         u_long  tcps_rcvshort;          /* packets received too short */
  140.         u_long  tcps_rcvduppack;        /* duplicate-only packets received */
  141.         u_long  tcps_rcvdupbyte;        /* duplicate-only bytes received */
  142.         u_long  tcps_rcvpartduppack;    /* packets with some duplicate data */
  143.         u_long  tcps_rcvpartdupbyte;    /* dup. bytes in part-dup. packets */
  144.         u_long  tcps_rcvoopack;         /* out-of-order packets received */
  145.         u_long  tcps_rcvoobyte;         /* out-of-order bytes received */
  146.         u_long  tcps_rcvpackafterwin;   /* packets with data after window */
  147.         u_long  tcps_rcvbyteafterwin;   /* bytes rcvd after window */
  148.         u_long  tcps_rcvafterclose;     /* packets rcvd after "close" */
  149.         u_long  tcps_rcvwinprobe;       /* rcvd window probe packets */
  150.         u_long  tcps_rcvdupack;         /* rcvd duplicate acks */
  151.         u_long  tcps_rcvacktoomuch;     /* rcvd acks for unsent data */
  152.         u_long  tcps_rcvackpack;        /* rcvd ack packets */
  153.         u_long  tcps_rcvackbyte;        /* bytes acked by rcvd acks */
  154.         u_long  tcps_rcvwinupd;         /* rcvd window update packets */
  155. };
  156. #pragma pack()
  157.  
  158. #endif
  159.