1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/srtp/src/include/ut_sim.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,80 @@ 1.4 +/* 1.5 + * ut-sim.h 1.6 + * 1.7 + * an unreliable transport simulator 1.8 + * (for testing replay databases and suchlike) 1.9 + * 1.10 + * David A. McGrew 1.11 + * Cisco Systems, Inc. 1.12 + */ 1.13 + 1.14 +/* 1.15 + * 1.16 + * Copyright (c) 2001-2006, Cisco Systems, Inc. 1.17 + * All rights reserved. 1.18 + * 1.19 + * Redistribution and use in source and binary forms, with or without 1.20 + * modification, are permitted provided that the following conditions 1.21 + * are met: 1.22 + * 1.23 + * Redistributions of source code must retain the above copyright 1.24 + * notice, this list of conditions and the following disclaimer. 1.25 + * 1.26 + * Redistributions in binary form must reproduce the above 1.27 + * copyright notice, this list of conditions and the following 1.28 + * disclaimer in the documentation and/or other materials provided 1.29 + * with the distribution. 1.30 + * 1.31 + * Neither the name of the Cisco Systems, Inc. nor the names of its 1.32 + * contributors may be used to endorse or promote products derived 1.33 + * from this software without specific prior written permission. 1.34 + * 1.35 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.36 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.37 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 1.38 + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 1.39 + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 1.40 + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 1.41 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 1.42 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1.43 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 1.44 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.45 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 1.46 + * OF THE POSSIBILITY OF SUCH DAMAGE. 1.47 + * 1.48 + */ 1.49 + 1.50 + 1.51 + 1.52 +#ifndef UT_SIM_H 1.53 +#define UT_SIM_H 1.54 + 1.55 +#include "integers.h" /* for uint32_t */ 1.56 + 1.57 +#define UT_BUF 160 /* maximum amount of packet reorder */ 1.58 + 1.59 +typedef struct { 1.60 + uint32_t index; 1.61 + uint32_t buffer[UT_BUF]; 1.62 +} ut_connection; 1.63 + 1.64 +/* 1.65 + * ut_init(&u) initializes the ut_connection 1.66 + * 1.67 + * this function should always be the first one called on a new 1.68 + * ut_connection 1.69 + */ 1.70 + 1.71 +void 1.72 +ut_init(ut_connection *utc); 1.73 + 1.74 +/* 1.75 + * ut_next_index(&u) returns the next index from the simulated 1.76 + * unreliable connection 1.77 + */ 1.78 + 1.79 +uint32_t 1.80 +ut_next_index(ut_connection *utc); 1.81 + 1.82 + 1.83 +#endif /* UT_SIM_H */