alc_tx.c File Reference

ALC level sending. More...

#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <sys/timeb.h>
#include <process.h>
#include "alc_tx.h"
#include "alc_channel.h"
#include "alc_session.h"
#include "transport.h"
#include "lct_hdr.h"
#include "null_fec.h"
#include "xor_fec.h"
#include "rs_fec.h"
#include "alc_hdr.h"
#include "mad_rlc.h"
#include "fec.h"

Include dependency graph for alc_tx.c:

Go to the source code of this file.

Functions

int add_pkt_to_tx_queue (alc_session_t *s, unsigned char *sendbuf, unsigned int sendlen)
int send_unit (trans_unit_t *tr_unit, trans_block_t *tr_block, alc_session_t *s, alc_channel_t *ch, unsigned long long toi, unsigned long long transfer_len, unsigned int max_sb_len, unsigned short es_len, unsigned char fec_enc_id, unsigned short fec_inst_id)
int calculate_packet_length (alc_session_t *s)
float session_kbit_rate (const alc_session_t *s)
int alc_send (int s_id, int tx_mode, char *buf, int buf_len, unsigned long long toi, unsigned long long transfer_len, unsigned short es_len, unsigned int max_sb_len, unsigned int sbn, unsigned char fec_enc_id, unsigned short fec_inst_id)
int send_session_close_packet (int s_id)
void * tx_thread (void *s)


Detailed Description

ALC level sending.

Author
peltotal
Date
2007/02/28 08:58:00
Revision
1.114

MAD-ALCLIB: Implementation of ALC/LCT protocols, Compact No-Code FEC, Simple XOR FEC, Reed-Solomon FEC, and RLC Congestion Control protocol. Copyright (c) 2003-2007 TUT - Tampere University of Technology main authors/contacts: jani.peltotalo@tut.fi and sami.peltotalo@tut.fi

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

In addition, as a special exception, TUT - Tampere University of Technology gives permission to link the code of this program with the OpenSSL library (or with modified versions of OpenSSL that use the same license as OpenSSL), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.

Definition in file alc_tx.c.


Function Documentation

int add_pkt_to_tx_queue ( alc_session_t s,
unsigned char *  sendbuf,
unsigned int  sendlen 
)

This is a private function which adds packet to transmission queue when TX_THREAD mode is used.

Parameters:
s pointer to the session
sendbuf pointer to data to be added to transmission queue
sendlen lenght of data
Returns:
> 0 in success, 0 or -1 in error cases.

Definition at line 73 of file alc_tx.c.

References alc_session::cc_id, alc_channel::ch_id, alc_session::ch_list, tx_queue_struct::data, tx_queue_struct::datalen, FALSE, MAX_TX_QUEUE_SIZE, alc_session::nb_channel, tx_queue_struct::nb_tx_ch, tx_queue_struct::next, alc_channel::queue_ptr, alc_channel::ready, RLC, RLC_WAIT_AFTER_SP, alc_channel::start_sending, alc_session::tx_queue_begin, alc_session::tx_queue_end, alc_session::tx_queue_size, and alc_channel::wait_after_sp.

Referenced by send_unit().

Here is the caller graph for this function:

int alc_send ( int  s_id,
int  tx_mode,
char *  buf,
int  buf_len,
unsigned long long  toi,
unsigned long long  transfer_len,
unsigned short  es_len,
unsigned int  max_sb_len,
unsigned int  sbn,
unsigned char  fec_enc_id,
unsigned short  fec_inst_id 
)

This function sends source block from object to the channel or transmission queue.

Parameters:
s_id session identifier
tx_mode transmission mode (NO_TX_THREAD or TX_THREAD)
buf pointer to data to be sent
buf_len lenght of data to be sent
toi transport object identifier
transfer_len length of transport object
es_len encoding symbol length
max_sb_len maximum source block length
sbn source block number
fec_enc_id,: FEC encoding id
fec_inst_id,: FEC instance id
Return: int: number of sent bytes after succesfull sending, -1 -2 otherwise

Definition at line 598 of file alc_tx.c.

References alc_session::addr_family, alc_session::ch_list, COM_FEC_ENC_ID, COM_NO_C_FEC_ENC_ID, alc_session::def_fec_ratio, FDT_TOI, get_alc_session(), trans_block::n, null_fec_encode_src_block(), REED_SOL_FEC_INST_ID, RS_FEC_ENC_ID, rs_fec_encode_src_block(), SActive, SB_LB_E_FEC_ENC_ID, SB_SYS_FEC_ENC_ID, SExiting, SIMPLE_XOR_FEC_ENC_ID, SPaused, alc_session::state, TX_THREAD, trans_block::unit_list, alc_session::use_fec_oti_ext_hdr, and xor_fec_encode_src_block().

Referenced by send_fdt_instance(), send_file(), and send_repair_data().

Here is the call graph for this function:

Here is the caller graph for this function:

int calculate_packet_length ( alc_session_t s  ) 

This is a private function which calculates packet length used in session.

Parameters:
s pointer to the session
Returns:
packet length for the session

Definition at line 500 of file alc_tx.c.

References alc_session::addr_family, COM_FEC_ENC_ID, COM_NO_C_FEC_ENC_ID, alc_session::def_eslen, alc_session::def_fec_enc_id, RS_FEC_ENC_ID, SB_LB_E_FEC_ENC_ID, SB_SYS_FEC_ENC_ID, SIMPLE_XOR_FEC_ENC_ID, and alc_session::use_fec_oti_ext_hdr.

Referenced by tx_thread().

Here is the caller graph for this function:

int send_session_close_packet ( int  s_id  ) 

This function sends A flag packet to channel.

Parameters:
s_id session identifier
Returns:
0 in success, -1 otherwise

Definition at line 940 of file alc_tx.c.

References add_session_sent_bytes(), alc_session::addr_family, alc_channel::addrinfo, ALC_VERSION, alc_session::cc_id, def_lct_hdr::cci, alc_channel::ch_id, alc_session::ch_list, def_lct_hdr::codepoint, alc_session::def_fec_enc_id, def_lct_hdr::flag_a, def_lct_hdr::flag_b, def_lct_hdr::flag_c, def_lct_hdr::flag_h, def_lct_hdr::flag_o, def_lct_hdr::flag_r, def_lct_hdr::flag_s, def_lct_hdr::flag_t, get_alc_session(), def_lct_hdr::hdr_len, mad_rlc_fill_header(), MAX_PACKET_LENGTH, def_lct_hdr::reserved, RLC, alc_channel::s, alc_session::tsi, alc_channel::tx_sock, and def_lct_hdr::version.

Referenced by flute_sender().

Here is the call graph for this function:

Here is the caller graph for this function:

int send_unit ( trans_unit_t tr_unit,
trans_block_t tr_block,
alc_session_t s,
alc_channel_t ch,
unsigned long long  toi,
unsigned long long  transfer_len,
unsigned int  max_sb_len,
unsigned short  es_len,
unsigned char  fec_enc_id,
unsigned short  fec_inst_id 
)

This function a private function which sends one unit to channel or tx_queue.

Parameters:
tr_unit pointer to transport unit to be sent
tr_block pointer to transport block that this units belongs
s pointer to session
ch pointer to channel
toi transport object identifier
transfer_len length of transport object
max_sb_len maximum source block length
es_len encoding symbol length
fec_enc_id FEC encoding id
fec_inst_id FEC instance id
Returns:
0 in success, -1 or -2 in error cases/stopping situations

Definition at line 154 of file alc_tx.c.

References add_alc_fpi_0_130(), add_alc_fpi_129(), add_alc_fpi_2_128(), add_alc_fpi_3(), add_cenc_lct_he(), add_fdt_lct_he(), add_fti_0_2_128_130_lct_he(), add_fti_129_lct_he(), add_fti_3_lct_he(), add_pkt_to_tx_queue(), add_session_sent_bytes(), alc_session::addr_family, alc_channel::addrinfo, ALC_VERSION, alc_session::calculate_session_size, def_lct_hdr::cci, def_lct_hdr::codepoint, COM_FEC_ENC_ID, COM_NO_C_FEC_ENC_ID, trans_unit::data, alc_session::encode_content, trans_unit::esi, FALSE, alc_session::fdt_instance_id, FDT_TOI, def_lct_hdr::flag_a, def_lct_hdr::flag_b, def_lct_hdr::flag_c, def_lct_hdr::flag_h, def_lct_hdr::flag_o, def_lct_hdr::flag_r, def_lct_hdr::flag_s, def_lct_hdr::flag_t, GF_BITS, alc_session::half_word, def_lct_hdr::hdr_len, trans_block::k, trans_unit::len, trans_block::max_k, trans_block::max_n, MAX_PACKET_LENGTH, def_lct_hdr::reserved, RS_FEC_ENC_ID, alc_channel::s, alc_session::s_id, SB_LB_E_FEC_ENC_ID, SB_SYS_FEC_ENC_ID, trans_block::sbn, SExiting, SIMPLE_XOR_FEC_ENC_ID, alc_session::state, alc_session::tsi, alc_channel::tx_sock, alc_session::use_fec_oti_ext_hdr, def_lct_hdr::version, ZLIB, ZLIB_FDT, and ZLIB_FDT_AND_GZIP_FILES.

Here is the call graph for this function:

float session_kbit_rate ( const alc_session_t s  ) 

This is a private function which calculates actual bitrate for the session.

Parameters:
s pointer to the session
Returns:
actual bitrate for the session

Definition at line 579 of file alc_tx.c.

References alc_session::def_tx_rate, ftime, alc_session::ftimestarttime, alc_session::sent_bytes, and timeb.

void* tx_thread ( void *  s  ) 

This function sends packets to the all channels in the session when TX_THREAD mode is used.

Parameters:
s pointer to the session

Definition at line 1032 of file alc_tx.c.

References calculate_packet_length(), alc_session::calculate_session_size, alc_session::cc_id, alc_session::ch_list, alc_session::def_tx_rate, FALSE, alc_session::nb_channel, alc_session::optimize_tx_rate, RLC, SActive, sec(), alc_channel::start_sending, alc_session::state, alc_session::tx_queue_begin, and alc_channel::wait_after_sp.

Referenced by open_alc_session().

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Fri Mar 9 20:08:54 2007 for MAD-FCL by  doxygen 1.5.0