xref: /openbsd/lib/librpcsvc/spray.x (revision 09467b48)
1 /*	$OpenBSD: spray.x,v 1.5 2010/09/01 14:43:34 millert Exp $	*/
2 
3 /*
4  * Copyright (c) 2010, Oracle America, Inc.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above
13  *       copyright notice, this list of conditions and the following
14  *       disclaimer in the documentation and/or other materials
15  *       provided with the distribution.
16  *     * Neither the name of the "Oracle America, Inc." nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /*
35  * Spray a server with packets
36  * Useful for testing flakiness of network interfaces
37  */
38 
39 #ifndef RPC_HDR
40 #endif
41 
42 #ifdef RPC_HDR
43 %#ifndef _RPCSVC_SPRAY_H_
44 %#define _RPCSVC_SPRAY_H_
45 %
46 #endif
47 
48 const SPRAYOVERHEAD = 86;		/* size of rpc packet when size=0 */
49 const SPRAYMAX = 8845;			/* max amount can spray */
50 
51 
52 /*
53  * GMT since 0:00, 1 January 1970
54  */
55 struct spraytimeval {
56 	unsigned int sec;
57 	unsigned int usec;
58 };
59 
60 /*
61  * spray statistics
62  */
63 struct spraycumul {
64 	unsigned int counter;
65 	spraytimeval clock;
66 };
67 
68 /*
69  * spray data
70  */
71 typedef opaque sprayarr<SPRAYMAX>;
72 
73 program SPRAYPROG {
74 	version SPRAYVERS {
75 		/*
76 		 * Just throw away the data and increment the counter
77 		 * This call never returns, so the client should always
78 		 * time it out.
79 		 */
80 		void
81 		SPRAYPROC_SPRAY(sprayarr) = 1;
82 
83 		/*
84 		 * Get the value of the counter and elapsed time  since
85 		 * last CLEAR.
86 		 */
87 		spraycumul
88 		SPRAYPROC_GET(void) = 2;
89 
90 		/*
91 		 * Clear the counter and reset the elapsed time
92 		 */
93 		void
94 		SPRAYPROC_CLEAR(void) = 3;
95 	} = 1;
96 } = 100012;
97 
98 
99 #ifdef RPC_HDR
100 %
101 %#endif /* _RPCSVC_SPRAY_H_ */
102 #endif
103