spandsp 0.0.6

rfc2198_sim.h
Go to the documentation of this file.
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
26/*! \file */
27
28/*! \page rfc2198_model_page RFC2198 simulation
29\section rfc2198_model_page_sec_1 What does it do?
30*/
31
32#if !defined(_RFC2198_SIM_H_)
33#define _RFC2198_SIM_H_
34
35/*! The definition of an element in the packet queue */
36 typedef struct rfc2198_sim_queue_element_s
37{
38 struct rfc2198_sim_queue_element_s *next;
39 struct rfc2198_sim_queue_element_s *prev;
40 int seq_no;
41 double departure_time;
42 double arrival_time;
43 int len;
44 uint8_t pkt[];
45} rfc2198_sim_queue_element_t;
46
47/*! The model definition for a complete end-to-end path */
48 typedef struct
49{
50 int redundancy_depth;
51 int next_seq_no;
52 g1050_state_t *g1050;
53 rfc2198_sim_queue_element_t *first;
54 rfc2198_sim_queue_element_t *last;
55 uint8_t tx_pkt[32][1024];
56 int tx_pkt_len[32];
57 int tx_pkt_seq_no[32];
58 int next_pkt;
59 uint8_t rx_pkt[32][1024];
60 int rx_pkt_len[32];
61 int rx_pkt_seq_no[32];
62 int rx_queued_pkts;
63} rfc2198_sim_state_t;
64
65#ifdef __cplusplus
66 extern "C"
67{
68#endif
69
70SPAN_DECLARE(rfc2198_sim_state_t *) rfc2198_sim_init(int model,
71 int speed_pattern,
72 int packet_size,
73 int packet_rate,
74 int redundancy_depth);
75
76SPAN_DECLARE(int) rfc2198_sim_put(rfc2198_sim_state_t *s,
77 const uint8_t buf[],
78 int len,
79 int seq_no,
80 double departure_time);
81
82SPAN_DECLARE(int) rfc2198_sim_get(rfc2198_sim_state_t *s,
83 uint8_t buf[],
84 int max_len,
85 double current_time,
86 int *seq_no,
87 double *departure_time,
88 double *arrival_time);
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif
95/*- End of file ------------------------------------------------------------*/
rfc2198_sim_queue_element_t
struct rfc2198_sim_queue_element_s rfc2198_sim_queue_element_t
g1050_state_t
Definition g1050.h:249
rfc2198_sim_queue_element_s
Definition rfc2198_sim.h:37
rfc2198_sim_state_t
Definition rfc2198_sim.h:49