sender.c File Reference

FLUTE sender. More...

#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <process.h>
#include "../alclib/blocking_alg.h"
#include "../alclib/alc_session.h"
#include "../alclib/alc_tx.h"
#include "sender.h"
#include "uri.h"
#include "mad_zlib.h"
#include "flute.h"
#include "fdt.h"

Include dependency graph for sender.c:

Go to the source code of this file.

Defines

#define _WINSOCKAPI_

Functions

int send_fdt_instance (char *fdt_instance, unsigned long long fdt_inst_len, int s_id, int tx_mode, unsigned short eslen, unsigned int max_sblen, unsigned char fec_enc_id, unsigned short fec_inst_id, int verbosity)
int send_file (char *tx_file, int s_id, int tx_mode, unsigned short es_len, unsigned int max_sb_len, unsigned char fec_enc_id, unsigned short fec_inst_id, file_t *file, unsigned long long fdt_inst_len, char *fdt_inst_buf, int verbosity)
char * create_fdt_instance (file_t *file, int nb_of_files, fdt_t *fdt, int s_id, unsigned long long *fdt_inst_len)
int remove_gz_files (char *fdt_file, char *base_dir, char *file_path)
int fdtbasedsend (flute_sender_t *sender, int tx_mode, arguments_t *a)
BOOL IsFECOTIInFDT (fdt_t *fdt)
int sender_in_fdt_based_mode (arguments_t *a, flute_sender_t *sender)


Detailed Description

FLUTE sender.

Author
peltotal
Date
2007/02/28 08:58:01
Revision
1.63

MAD-FLUTELIB: Implementation of FLUTE 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 sender.c.


Define Documentation

#define _WINSOCKAPI_

Definition at line 41 of file sender.c.


Function Documentation

char* create_fdt_instance ( file_t file,
int  nb_of_files,
fdt_t fdt,
int  s_id,
unsigned long long *  fdt_inst_len 
)

This is a private function which creates FDT Instance string buffer from file structure(s).

Parameters:
file pointer to first file structure to be defined in an FDT Instance
nb_of_files number of files to be defined in an FDT Instance
fdt pointer to Complete FDT to be splitted to FDT Instances
s_id session identifier
fdt_inst_len stores length of created FDT Instance
Returns:
pointer to created FDT Instance string buffer, NULL in error cases

Definition at line 426 of file sender.c.

References fdt::complete, file::content_len, file::encoding, fdt::encoding, file::es_len, fdt::es_len, fdt::expires, fdt, file::fec_enc_id, fdt::fec_enc_id, file::fec_inst_id, fdt::fec_inst_id, file, file::finite_field, fdt::finite_field, get_alc_session(), file::location, file::max_nb_of_es, fdt::max_nb_of_es, MAX_PATH_LENGTH, file::max_sb_len, fdt::max_sb_len, file::md5, file::nb_of_es_per_group, fdt::nb_of_es_per_group, fdt::nb_of_files, file::next, RS_FEC_ENC_ID, SB_SYS_FEC_ENC_ID, file::toi, file::transfer_len, file::type, fdt::type, and alc_session::use_fec_oti_ext_hdr.

Referenced by fdtbasedsend().

Here is the call graph for this function:

Here is the caller graph for this function:

int fdtbasedsend ( flute_sender_t sender,
int  tx_mode,
arguments_t a 
)

This is a private function which sends files defined in the FDT.

Parameters:
sender structure containing sender information
tx_mode transmission mode (NO_TX_THREAD or TX_THREAD)
a pointer to arguments structure where command line arguments are parsed
Returns:
0 in success, -1 in error cases, -2 when state is SExiting

Definition at line 1321 of file sender.c.

References arguments::alc_a, alc_arguments::base_dir, buffer_zlib_compress(), fdt::complete, arguments::complete_fdt, file::content_len, create_fdt_instance(), alc_arguments::encode_content, file::encoding, file::es_len, alc_arguments::es_len, fdt::expires, FALSE, flute_sender::fdt, file::fec_enc_id, alc_arguments::fec_enc_id, file::fec_inst_id, alc_arguments::fec_inst_id, file, fdt::file_list, arguments::file_path, free_uri(), get_fdt_instance_id(), GZ_SUFFIX, file::location, MAX_PATH_LENGTH, file::max_sb_len, alc_arguments::max_sb_len, fdt::nb_of_files, parse_uri(), uri::path, flute_sender::s_id, send_fdt_instance(), set_fdt_instance_id(), set_session_state(), SExiting, file::toi, file::transfer_len, TRUE, TX_THREAD, alc_arguments::verbosity, ZLIB_FDT, and ZLIB_FDT_AND_GZIP_FILES.

Referenced by sender_in_fdt_based_mode().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL IsFECOTIInFDT ( fdt_t fdt  ) 

This is a private function which checks if there is FEC OTI in the FDT.

Parameters:
fdt pointer to the Complete FDT
Returns:
TRUE if there is FEC OTI in the FDT, FALSE otherwise

Definition at line 1632 of file sender.c.

References file::es_len, FALSE, fdt, file::fec_enc_id, file::fec_inst_id, file, fdt::file_list, file::max_nb_of_es, file::max_sb_len, file::next, SB_SYS_FEC_ENC_ID, and TRUE.

Referenced by sender_in_fdt_based_mode().

Here is the caller graph for this function:

int remove_gz_files ( char *  fdt_file,
char *  base_dir,
char *  file_path 
)

This is a private function which removes tempororary ~gz files in sender side.

Parameters:
fdt_file pointer to buffer containing FDT file name
base_dir pointer to buffer containing base directory
file_path pointer to buffer containing file or directory
Returns:
0 in success, -1 otherwise

Definition at line 1217 of file sender.c.

References decode_fdt_payload(), fdt, file, fdt::file_list, GZ_SUFFIX, file::location, MAX_PATH_LENGTH, file::next, parse_uri(), and uri::path.

Referenced by sender_in_fdt_based_mode().

Here is the call graph for this function:

Here is the caller graph for this function:

int send_fdt_instance ( char *  fdt_instance,
unsigned long long  fdt_inst_len,
int  s_id,
int  tx_mode,
unsigned short  eslen,
unsigned int  max_sblen,
unsigned char  fec_enc_id,
unsigned short  fec_inst_id,
int  verbosity 
)

This is a private function which sends one FDT instance.

Parameters:
fdt_instance pointer to buffer containing FDT instance
fdt_inst_len length of the FDT instance
s_id session identifier
tx_mode transmission mode
eslen encoding symbol length
max_sblen maximum source block length
fec_enc_id FEC encoding id
fec_inst_id FEC instance id
verbosity verbosity level
Returns:
0 in success, -1 in error cases, -2 when state is SExiting

Definition at line 75 of file sender.c.

References blocking_struct::A_large, blocking_struct::A_small, alc_send(), compute_blocking_structure(), FDT_TOI, get_fdt_instance_id(), get_session_state(), set_object_sent_bytes(), SExiting, and TX_THREAD.

Referenced by fdtbasedsend(), and send_file().

Here is the call graph for this function:

Here is the caller graph for this function:

int send_file ( char *  tx_file,
int  s_id,
int  tx_mode,
unsigned short  es_len,
unsigned int  max_sb_len,
unsigned char  fec_enc_id,
unsigned short  fec_inst_id,
file_t file,
unsigned long long  fdt_inst_len,
char *  fdt_inst_buf,
int  verbosity 
)

This is a private function which sends one file.

Parameters:
tx_file pointer to buffer containing filepath
s_id session identifier
tx_mode transmission mode
es_len encoding symbol length
max_sb_len maximum source block length
fec_enc_id FEC encoding id
fec_inst_id FEC instance id
file FDT information for the file
fdt_inst_len length of the FDT instance
fdt_inst_buf pointer to buffer containing FDT instance
verbosity verbosity level
Returns:
0 in success, -1 in error cases, -2 when state is SExiting

Definition at line 185 of file sender.c.

References blocking_struct::A_large, blocking_struct::A_small, alc_send(), compute_blocking_structure(), file::content_len, alc_session::def_eslen, alc_session::def_fec_enc_id, alc_session::def_fec_inst_id, alc_session::def_max_sblen, file::encoding, FDT_INTERVAL, file, get_alc_session(), get_object_last_print_tx_percent(), get_object_sent_bytes(), blocking_struct::N, send_fdt_instance(), set_object_last_print_tx_percent(), set_object_sent_bytes(), set_session_tx_toi(), file::toi, file::transfer_len, and TX_THREAD.

Here is the call graph for this function:

int sender_in_fdt_based_mode ( arguments_t a,
flute_sender_t sender 
)

This function is flute sender's fdt based sending function.

Parameters:
a pointer to arguments structure where command line arguments are parsed
sender structure containing sender information
Returns:
0 in success, -1 in error cases, -2 when state is SExiting

Definition at line 1668 of file sender.c.

References arguments::alc_a, alc_arguments::base_dir, alc_arguments::cc_id, arguments::cont, decode_fdt_payload(), alc_arguments::encode_content, fdt::expires, FALSE, flute_sender::fdt, arguments::fdt_file, fdtbasedsend(), arguments::file_path, get_alc_session(), IsFECOTIInFDT(), alc_arguments::nb_channel, alc_arguments::nb_tx, NO_TX_THREAD, Null, remove_gz_files(), RLC, flute_sender::s_id, set_session_state(), SExiting, alc_arguments::start_time, alc_session::state, TRUE, alc_session::tx_queue_begin, TX_THREAD, alc_arguments::use_fec_oti_ext_hdr, and ZLIB_FDT_AND_GZIP_FILES.

Referenced by flute_sender().

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Fri Mar 9 20:03:24 2007 for MAD-FCL by  doxygen 1.5.0