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