rfc2198_sim.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * rfc2198_sim.h - Simulate the behaviour of RFC2198 (or UDPTL) redundancy.
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2007 Steve Underwood
00009  *
00010  * All rights reserved.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 2.1,
00014  * as published by the Free Software Foundation.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  *
00025  * $Id: rfc2198_sim.h,v 1.4 2008/09/09 16:13:12 steveu Exp $
00026  */
00027 
00028 /*! \file */
00029 
00030 /*! \page rfc2198_model_page RFC2198 simulation
00031 \section rfc2198_model_page_sec_1 What does it do?
00032 */
00033 
00034 #if !defined(_RFC2198_SIM_H_)
00035 #define _RFC2198_SIM_H_
00036 
00037 /*! The definition of an element in the packet queue */
00038 typedef struct rfc2198_sim_queue_element_s
00039 {
00040     struct rfc2198_sim_queue_element_s *next;
00041     struct rfc2198_sim_queue_element_s *prev;
00042     int seq_no;
00043     double departure_time;
00044     double arrival_time;
00045     int len;
00046     uint8_t pkt[];
00047 } rfc2198_sim_queue_element_t;
00048 
00049 /*! The model definition for a complete end-to-end path */
00050 typedef struct
00051 {
00052     int redundancy_depth;
00053     int next_seq_no;
00054     g1050_state_t *g1050;
00055     rfc2198_sim_queue_element_t *first;
00056     rfc2198_sim_queue_element_t *last;
00057     uint8_t tx_pkt[32][1024];
00058     int tx_pkt_len[32];
00059     int tx_pkt_seq_no[32];
00060     int next_pkt;
00061     uint8_t rx_pkt[32][1024];
00062     int rx_pkt_len[32];
00063     int rx_pkt_seq_no[32];
00064     int rx_queued_pkts;
00065 } rfc2198_sim_state_t;
00066 
00067 #ifdef  __cplusplus
00068 extern "C"
00069 {
00070 #endif
00071 
00072 rfc2198_sim_state_t *rfc2198_sim_init(int model,
00073                                       int speed_pattern,
00074                                       int packet_size,
00075                                       int packet_rate,
00076                                       int redundancy_depth);
00077 
00078 int rfc2198_sim_put(rfc2198_sim_state_t *s,
00079                     const uint8_t buf[],
00080                     int len,
00081                     int seq_no,
00082                     double departure_time);
00083 
00084 int rfc2198_sim_get(rfc2198_sim_state_t *s,
00085                     uint8_t buf[],
00086                     int max_len,
00087                     double current_time,
00088                     int *seq_no,
00089                     double *departure_time,
00090                     double *arrival_time);
00091 
00092 #ifdef  __cplusplus
00093 }
00094 #endif
00095 
00096 #endif
00097 /*- End of file ------------------------------------------------------------*/

Generated on Tue Oct 7 20:25:47 2008 for spandsp by  doxygen 1.5.6