1272850Shrs/*-
2272850Shrs * Copyright (c) 2010, Oracle America, Inc.
3272850Shrs *
4272850Shrs * Redistribution and use in source and binary forms, with or without
5272850Shrs * modification, are permitted provided that the following conditions are
6272850Shrs * met:
7272850Shrs *
8272850Shrs *     * Redistributions of source code must retain the above copyright
9272850Shrs *       notice, this list of conditions and the following disclaimer.
10272850Shrs *     * Redistributions in binary form must reproduce the above
11272850Shrs *       copyright notice, this list of conditions and the following
12272850Shrs *       disclaimer in the documentation and/or other materials
13272850Shrs *       provided with the distribution.
14272850Shrs *     * Neither the name of the "Oracle America, Inc." nor the names of its
15272850Shrs *       contributors may be used to endorse or promote products derived
16272850Shrs *       from this software without specific prior written permission.
17272850Shrs *
18272850Shrs *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19272850Shrs *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20272850Shrs *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21272850Shrs *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22272850Shrs *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23272850Shrs *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24272850Shrs *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25272850Shrs *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26272850Shrs *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27272850Shrs *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28272850Shrs *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29272850Shrs *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
301832Swollman */
311832Swollman
321832Swollman/*
331832Swollman * Spray a server with packets
341832Swollman * Useful for testing flakiness of network interfaces
351832Swollman */
361832Swollman
371832Swollman#ifndef RPC_HDR
381832Swollman%#ifndef lint
391832Swollman%/*static char sccsid[] = "from: @(#)spray.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/
401832Swollman%/*static char sccsid[] = "from: @(#)spray.x	2.1 88/08/01 4.0 RPCSRC";*/
411832Swollman%#endif /* not lint */
42114629Sobrien%#include <sys/cdefs.h>
43114629Sobrien%__FBSDID("$FreeBSD$");
441832Swollman#endif
451832Swollman
461832Swollmanconst SPRAYMAX = 8845;	/* max amount can spray */
471832Swollman
481832Swollman/*
491832Swollman * GMT since 0:00, 1 January 1970
501832Swollman */
511832Swollmanstruct spraytimeval {
521832Swollman	unsigned int sec;
531832Swollman	unsigned int usec;
541832Swollman};
551832Swollman
561832Swollman/*
571832Swollman * spray statistics
581832Swollman */
591832Swollmanstruct spraycumul {
601832Swollman	unsigned int counter;
611832Swollman	spraytimeval clock;
621832Swollman};
631832Swollman
641832Swollman/*
651832Swollman * spray data
661832Swollman */
671832Swollmantypedef opaque sprayarr<SPRAYMAX>;
681832Swollman
691832Swollmanprogram SPRAYPROG {
701832Swollman	version SPRAYVERS {
711832Swollman		/*
721832Swollman		 * Just throw away the data and increment the counter
731832Swollman		 * This call never returns, so the client should always
741832Swollman		 * time it out.
751832Swollman		 */
761832Swollman		void
771832Swollman		SPRAYPROC_SPRAY(sprayarr) = 1;
781832Swollman
791832Swollman		/*
801832Swollman		 * Get the value of the counter and elapsed time  since
811832Swollman		 * last CLEAR.
821832Swollman		 */
831832Swollman		spraycumul
841832Swollman		SPRAYPROC_GET(void) = 2;
851832Swollman
861832Swollman		/*
871832Swollman		 * Clear the counter and reset the elapsed time
881832Swollman		 */
891832Swollman		void
901832Swollman		SPRAYPROC_CLEAR(void) = 3;
911832Swollman	} = 1;
921832Swollman} = 100012;
93