comparison spandsp-0.0.6pre17/spandsp-sim/spandsp/rfc2198_sim.h @ 4:26cd8f1ef0b1

import spandsp-0.0.6pre17
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 15:50:58 +0200
parents
children
comparison
equal deleted inserted replaced
3:c6c5a16ce2f2 4:26cd8f1ef0b1
1 /*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * rfc2198_sim.h - Simulate the behaviour of RFC2198 (or UDPTL) redundancy.
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2007 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 2.1,
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 * $Id: rfc2198_sim.h,v 1.6 2009/05/31 14:47:10 steveu Exp $
26 */
27
28 /*! \file */
29
30 /*! \page rfc2198_model_page RFC2198 simulation
31 \section rfc2198_model_page_sec_1 What does it do?
32 */
33
34 #if !defined(_RFC2198_SIM_H_)
35 #define _RFC2198_SIM_H_
36
37 /*! The definition of an element in the packet queue */
38 typedef struct rfc2198_sim_queue_element_s
39 {
40 struct rfc2198_sim_queue_element_s *next;
41 struct rfc2198_sim_queue_element_s *prev;
42 int seq_no;
43 double departure_time;
44 double arrival_time;
45 int len;
46 uint8_t pkt[];
47 } rfc2198_sim_queue_element_t;
48
49 /*! The model definition for a complete end-to-end path */
50 typedef struct
51 {
52 int redundancy_depth;
53 int next_seq_no;
54 g1050_state_t *g1050;
55 rfc2198_sim_queue_element_t *first;
56 rfc2198_sim_queue_element_t *last;
57 uint8_t tx_pkt[32][1024];
58 int tx_pkt_len[32];
59 int tx_pkt_seq_no[32];
60 int next_pkt;
61 uint8_t rx_pkt[32][1024];
62 int rx_pkt_len[32];
63 int rx_pkt_seq_no[32];
64 int rx_queued_pkts;
65 } rfc2198_sim_state_t;
66
67 #ifdef __cplusplus
68 extern "C"
69 {
70 #endif
71
72 SPAN_DECLARE(rfc2198_sim_state_t *) rfc2198_sim_init(int model,
73 int speed_pattern,
74 int packet_size,
75 int packet_rate,
76 int redundancy_depth);
77
78 SPAN_DECLARE(int) rfc2198_sim_put(rfc2198_sim_state_t *s,
79 const uint8_t buf[],
80 int len,
81 int seq_no,
82 double departure_time);
83
84 SPAN_DECLARE(int) rfc2198_sim_get(rfc2198_sim_state_t *s,
85 uint8_t buf[],
86 int max_len,
87 double current_time,
88 int *seq_no,
89 double *departure_time,
90 double *arrival_time);
91
92 #ifdef __cplusplus
93 }
94 #endif
95
96 #endif
97 /*- End of file ------------------------------------------------------------*/

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.