Subversion Repositories SvarDOS

Rev

Rev 616 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
207 mateuszvis 1
/*!\file netinet/tcp_debu.h
2
 * TCP debugging.
3
 */
4
 
5
/*
6
 * Copyright (c) 1982, 1986, 1993
7
 *      The Regents of the University of California.  All rights reserved.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions
11
 * are met:
12
 * 1. Redistributions of source code must retain the above copyright
13
 *    notice, this list of conditions and the following disclaimer.
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in the
16
 *    documentation and/or other materials provided with the distribution.
17
 * 3. All advertising materials mentioning features or use of this software
18
 *    must display the following acknowledgement:
19
 *      This product includes software developed by the University of
20
 *      California, Berkeley and its contributors.
21
 * 4. Neither the name of the University nor the names of its contributors
22
 *    may be used to endorse or promote products derived from this software
23
 *    without specific prior written permission.
24
 *
25
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35
 * SUCH DAMAGE.
36
 *
37
 *      @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93
38
 * $Id: tcp_debug.h,v 1.5 1996/04/13 12:45:57 bde Exp $
39
 */
40
 
41
#ifndef __NETINET_TCP_DEBUG_H
42
#define __NETINET_TCP_DEBUG_H
43
 
44
struct tcp_debug {
45
       n_time           td_time;
46
       short            td_act;
47
       short            td_ostate;
48
       caddr_t          td_tcb;
49
       struct  tcpiphdr td_ti;
50
       short            td_req;
51
       struct  tcpcb    td_cb;
52
     };
53
 
54
#define TA_INPUT        0
55
#define TA_OUTPUT       1
56
#define TA_USER         2
57
#define TA_RESPOND      3
58
#define TA_DROP         4
59
 
60
#ifdef TANAMES
61
static char *tanames[] = {
62
            "input", "output", "user", "respond", "drop"
63
          };
64
#endif
65
 
66
#define TCP_NDEBUG 100
67
 
68
#ifdef TCP_AUTO_DEBUG
69
#include <sys/wtime.h>
70
 
71
/* The following table is used as a circular buffer in which TCP
72
 * autotuning statistics can be kept.
73
 * It is intended that these statistics will be periodically read
74
 * by a debugging application using kvm.
75
 */
76
 
77
#define TAD_ENTRIES 1024            /* number of entries in monitor_table */
78
 
79
struct tad_entry {
80
       u_long         seq_no;            /* tad entry number */
81
       struct timeval time;              /* time of entry */
82
       u_long         snd_cwnd;          /* congestion window */
83
       u_long         sb_hiwat;          /* send socket buffer hi water mark */
84
       u_long         sb_target_hiwat;   /*      target for same */
85
       u_long         sb_cc;             /* space used in send socket buf */
86
       u_long         m_clused;          /* m_clusters - m_clfree */
87
       u_short        lport;             /* local port number */
88
       u_short        rport;             /* remote port number */
89
       u_long         debug;             /* used for debugging */
90
       tcp_seq        snd_max;           /* highest sequence number sent */
91
     } tad_table[TAD_ENTRIES];
92
 
93
extern struct tad_entry *tad_index;     /* insert point */
94
extern u_long tad_seq;
95
extern u_long tad_debug;
96
 
97
/* increment the index into the table
98
 */
99
#define TAD_INDEX_INCR tad_index = (struct tad_entry*)((u_long)tad_index + \
100
                                    sizeof(struct tad_entry)); \
101
                       if ((u_long) tad_index >= \
102
                           (u_long) &tad_table[TAD_ENTRIES]) \
103
                          tad_index = tad_table;
104
 
105
/* add a log entry to the table
106
 */
107
#define TAD_SNAPSHOT(tp, so)  tad_index->seq_no = tad_seq++; \
108
                   microtime(&(tad_index->time)); \
109
                   tad_index->snd_cwnd = tp->snd_cwnd; \
110
                   tad_index->sb_hiwat = so->so_snd.sb_hiwat; \
111
                   tad_index->sb_target_hiwat = so->so_snd.sb_net_target; \
112
                   tad_index->sb_cc = so->so_snd.sb_cc; \
113
                   tad_index->m_clused = mbstat.m_clusters - mbstat.m_clfree;\
114
                   tad_index->lport = tp->t_inpcb->inp_lport; \
115
                   tad_index->rport = tp->t_inpcb->inp_fport; \
116
                   tad_index->debug = tad_debug; \
117
                   tad_index->snd_max = tp->snd_max; \
118
                   TAD_INDEX_INCR;
119
 
120
#endif  /* TCP_AUTO_DEBUG */
121
 
122
#endif  /* __NETINET_TCP_DEBUG_H */