/* * Copyright (c) 1995, 1998 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* ber.h: declarations for ber.c */ #ifndef SNOOP_BER_H #define SNOOP_BER_H #define MODEL "poisson" #define BER_POISSON 0 #define BER_MARKOV 1 /* ERR_PROBs are scaled by 1e9 */ #define ERR_PROB0 65536 #define ERR_PROB1 1000000 #define TRANS_PERC0 30 #define TRANS_PERC1 70 #if !defined(TIMEV) typedef struct timeval timev; #endif struct ber_state { int model; int bytes_to_next_error; u_char protocol; u_short port; /* which TCP port? 0 ==> all ports */ int burst_rate; /* number pf pkts to blow away */ /* Update rate of Markov state machine 100 ms */ int time_granularity; /* time granularity of call */ timev last_call_time; /* This is private state dependent on the error model used */ int markov_state; int trans_perc[2]; int error_prob[2]; int disable; /* 1 if error generation is disabled, 0 otherwise */ }; extern struct ber_state ber; #define RAND_MEAN (1<<28) #define NUM_RANDS 50000 void ber_init __P ((void)); int wireless_drop __P((struct mbuf *, int)); #endif /* SNOOP_BER_H */