1 /***************************************************************************
2  * DBS: Distributed Benchmark System
3  * Copyright (c) 1995, 1996, 1997 Yukio Murayama
4  * Copyright (c) 1995, 1996, 1997 Nara Institute of Science and Technology
5  * All rights reserved.
6  *
7  * Permission to use, copy, modify and distribute this software and its
8  * documentation is hereby granted, provided only with the following
9  * conditions are satisfied:
10  *
11  * 1. Both the copyright notice and this permission notice appear in
12  *    all copies of the software, derivative works or modified versions,
13  *    and any portions thereof, and that both notices appear in
14  *    supporting documentation.
15  * 2. All advertising materials mentioning features or use of this
16  *    software must display the following acknowledgement:
17  *      This product includes software developed by Nara Institute of
18  *      Science and Technology and its contributors.
19  * 3. Neither the name of Nara Institute of Science and Technology nor
20  *    the names of its contributors may be used to endorse or promote
21  *    products derived from this software without specific prior written
22  *    permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND NARA
25  * INSTITUTE OF SCIENCE AND TECHNOLOGY DISCLAIMS ANY LIABILITY OF
26  * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF
27  * THIS SOFTWARE. ALSO, THERE IS NO WARRANTY IMPLIED OR OTHERWISE,
28  * NOR IS SUPPORT PROVIDED.
29  *
30  * Feedback of the results generated from any improvements or
31  * extensions made to this software would be much appreciated.
32  * Any such feedback should be sent to:
33  *
34  *  Yukio Murayama
35  *  E-mail:  <yukio-m@is.aist-nara.ac.jp>
36  *  URL:     <http://shika.aist-nara.ac.jp/member/yukio-m/index.html>
37  *  Address: Graduate School of Information Science,
38  *           Nara Institute of Science and Technology,
39  *           Takayama 8916-5, Ikoma, Nara, Japan
40  *
41  * Nara Institute of Science and Technology has the rights to
42  * redistribute these changes.
43  ***************************************************************************/
44 /*****************************************************************
45  * Distributed Benchmark System
46  * RECORD Header File
47  * $Revision: 1.11 $
48  * $Date: 1997/07/11 00:54:09 $
49  * $Author: yukio-m $
50  *****************************************************************/
51 
52 #include <sys/types.h>
53 /*#include <sys/socket.h>*/
54 #include <sys/socketvar.h>
55 /*#define PRUREQUESTS*/
56 
57 #if !defined(sony_news) && !defined(__linux__)
58 #include <sys/protosw.h>
59 #endif
60 
61 #include <sys/file.h>
62 
63 #include <net/route.h>
64 #include <net/if.h>
65 
66 #include <netinet/in.h>
67 #include <netinet/in_systm.h>
68 #include <netinet/ip.h>
69 #include <netinet/tcp.h>
70 
71 #ifndef __linux__
72 #if !defined(__FreeBSD__) && !defined(__DragonFly__)
73 #include <netinet/in_pcb.h>
74 #endif
75 #include <netinet/ip_var.h>
76 #include <netinet/tcpip.h>
77 /*#define TCPSTATES*/
78 #include <netinet/tcp_fsm.h>
79 #include <netinet/tcp_seq.h>
80 /*#define TCPTIMERS*/
81 #include <netinet/tcp_timer.h>
82 #include <netinet/tcp_var.h>
83 /*#define TANAMES*/
84 #include <netinet/tcp_debug.h>
85 #endif
86 
87 /*#include <arpa/inet.h>*/
88 
89 #ifdef __linux__
90 #define TA_INPUT   0
91 #define TA_OUTPUT  1
92 #define TA_USER    2
93 #define TA_RESPOND 3
94 #define TA_DROP    4
95 #endif
96 
97 /***** Time Record Structure *****/
98 struct record_d {
99     struct timeval tv;
100     int    packet_no;
101     int    packet_size;
102 };
103 
104 struct record {
105     struct record_d *d;
106     int    n;
107     int    size;
108 };
109 
110 struct tcp_trace {
111     struct tcp_debug *d;
112     int     n;
113     caddr_t tcp_addr;
114     int     size;
115     int     memf;
116     int     p;
117 };
118 
119 /***** sendrecv.c *****/
120 int tcp_send __P((struct dbsd_param * volatile cmd, char *data, struct record *rd, struct record *rd2, struct tcp_trace *  volatile rt));
121 int tcp_recv __P((struct dbsd_param * volatile cmd, char *data, struct record *rd, struct record *rd2, struct tcp_trace *  volatile rt));
122 int udp_send __P((struct dbsd_param * volatile cmd, char *data, struct record *rd));
123 int udp_recv __P((struct dbsd_param * volatile cmd, char *data, struct record *rd));
124 
125 /***** tcp_trace.c *****/
126 void record_tcp_trace __P((struct tcp_trace *rt, struct assosiation *a, int act));
127 void record_tcp_trace2 __P((struct tcp_trace *rt, struct assosiation *a, int act));
128 void init_so_debug    __P((struct tcp_trace *rt, struct assosiation *a, int act, int flg));
129 
130 
131 
132