receiver.c File Reference

FLUTE receiver. More...

#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <windows.h>
#include <process.h>
#include <io.h>
#include <direct.h>
#include <shellapi.h>
#include "../alclib/alc_session.h"
#include "../alclib/alc_rx.h"
#include "receiver.h"
#include "mad_zlib.h"
#include "mad_md5.h"
#include "padding_encoding.h"
#include "uri.h"
#include "fdt.h"

Include dependency graph for receiver.c:

Go to the source code of this file.

Defines

#define _WINSOCKAPI_

Functions

int all_files_received (char *file_uri_table[FILE_URI_TABLE_SIZE])
void set_file_received (char *file_uri_table[FILE_URI_TABLE_SIZE], char *file_uri)
int recvfile (int s_id, char *filepath, unsigned long long toi, unsigned long long file_len, char *md5, int rx_memory_mode, char *encoding, int verbosity)
int fdtbasedrecv (int rx_memory_mode, BOOL openfile, flute_receiver_t *receiver)
int receiver_in_fdt_based_mode (arguments_t *a, flute_receiver_t *receiver)
int receiver_in_ui_mode (arguments_t *a, flute_receiver_t *receiver)
int receiver_in_object_mode (int *s_id, arguments_t *a)
void * fdt_thread (void *s)


Detailed Description

FLUTE receiver.

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

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 receiver.c.


Define Documentation

#define _WINSOCKAPI_

Definition at line 41 of file receiver.c.


Function Documentation

int all_files_received ( char *  file_uri_table[FILE_URI_TABLE_SIZE]  ) 

This is a private function which checks if all wanted files are received.

Parameters:
file_uri_table pointers to wanted file URIs
Returns:
1 if all files are received, 0 otherwise

Definition at line 72 of file receiver.c.

Referenced by fdtbasedrecv().

Here is the caller graph for this function:

void* fdt_thread ( void *  s  ) 

This function receives and decodes an FDT Instance.

Parameters:
s pointer to alc session

Definition at line 1438 of file receiver.c.

References flute_receiver::accept_expired_fdt_inst, buffer_zlib_uncompress(), decode_fdt_payload(), file::encoding, file::es_len, fdt::expires, flute_receiver::fdt, fdt_recv(), file::fec_enc_id, file::fec_inst_id, file, fdt::file_list, flute_receiver::file_uri_table, FILE_URI_TABLE_SIZE, file::finite_field, FreeFDT(), get_session_state(), GZIP, file::location, file::max_nb_of_es, file::max_sb_len, file::nb_of_es_per_group, file::next, PAD, PrintFDT(), flute_receiver::rx_automatic, flute_receiver::s_id, SActive, set_wanted_object(), file::status, file::toi, file::transfer_len, flute_receiver::verbosity, flute_receiver::wildcard_token, and ZLIB.

Referenced by flute_file_repair(), and flute_receiver_report().

Here is the call graph for this function:

Here is the caller graph for this function:

int fdtbasedrecv ( int  rx_memory_mode,
BOOL  openfile,
flute_receiver_t receiver 
)

This is a private function which receives files defined in an FDT file using alc_recv2() or alc_recv3() function.

Parameters:
rx_memory_mode receiver memory consumtion mode
openfile open received file automatically (TRUE = yes, FALSE = no) [only in Windows]
receiver pointer to structure containing receiver information
Returns:
1 in success, 0 when state is SClosed, -1 in error cases, -2 when state is SExiting, -3 when state is STxStopped, -4 when MD5 check error occurs

Definition at line 545 of file receiver.c.

References flute_receiver::accept_expired_fdt_inst, alc_recv2(), alc_recv3(), all_files_received(), fdt::complete, file::content_len, file::encoding, file::es_len, file::expires, FALSE, flute_receiver::fdt, file::fec_enc_id, file::fec_inst_id, file, file_gzip_uncompress(), fdt::file_list, file_md5(), flute_receiver::file_uri_table, file::finite_field, free_uri(), get_session_basedir(), get_session_state(), get_uri_host_and_path(), GZ_SUFFIX, GZ_SUFFIX_LEN, GZIP, file::location, file::max_nb_of_es, MAX_PATH_LENGTH, file::max_sb_len, file::md5, MEM_ERROR, file::nb_of_es_per_group, file::next, PAD, PAD_SUFFIX, PAD_SUFFIX_LEN, padding_decoder(), parse_uri(), file::prev, flute_receiver::rx_automatic, flute_receiver::s_id, set_file_received(), set_wanted_object(), SExiting, file::status, STxStopped, file::toi, file::transfer_len, TRUE, file::type, flute_receiver::verbosity, and flute_receiver::wildcard_token.

Referenced by receiver_in_fdt_based_mode().

Here is the call graph for this function:

Here is the caller graph for this function:

int receiver_in_fdt_based_mode ( arguments_t a,
flute_receiver_t receiver 
)

This function is flute receiver's FDT based receiving function.

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

Definition at line 1059 of file receiver.c.

References arguments::alc_a, flute_receiver::fdt, fdtbasedrecv(), arguments::file_path, get_session_state(), arguments::open_file, arguments::rx_automatic, alc_arguments::rx_memory_mode, flute_receiver::s_id, arguments::sdp, sdp_attr_get(), arguments::sdp_file, SExiting, STxStopped, and alc_arguments::verbosity.

Referenced by flute_file_repair(), and flute_receiver_report().

Here is the call graph for this function:

Here is the caller graph for this function:

int receiver_in_object_mode ( int *  s_id,
arguments_t a 
)

This function is flute receiver's object mode receiving function.

Parameters:
s_id session identifier
a arguments structure where command line arguments are parsed
Returns:
0 in success, -1 in error cases, -2 when state is SExiting, -3 when state is STxStopped

Definition at line 1381 of file receiver.c.

References arguments::alc_a, alc_arguments::es_len, alc_arguments::fec_enc_id, alc_arguments::fec_inst_id, alc_arguments::fec_ratio, arguments::file_path, alc_arguments::max_sb_len, arguments::open_file, recvfile(), alc_arguments::rx_memory_mode, arguments::sdp, sdp_attr_get(), arguments::sdp_file, set_wanted_object(), arguments::toi, and alc_arguments::verbosity.

Referenced by flute_receiver_report().

Here is the call graph for this function:

Here is the caller graph for this function:

int receiver_in_ui_mode ( arguments_t a,
flute_receiver_t receiver 
)

This function is flute receiver's User Interface based receiving function.

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

Definition at line 1134 of file receiver.c.

References alc_arguments::accept_expired_fdt_inst, arguments::alc_a, file::content_len, file::encoding, file::es_len, file::expires, FALSE, flute_receiver::fdt, file::fec_enc_id, file::fec_inst_id, file, fdt::file_list, file::finite_field, free_file(), free_uri(), get_session_state(), get_uri_host_and_path(), GZIP, file::location, file::max_nb_of_es, file::max_sb_len, file::md5, file::nb_of_es_per_group, file::next, arguments::open_file, PAD, parse_uri(), file::prev, recvfile(), alc_arguments::rx_memory_mode, flute_receiver::s_id, arguments::sdp, sdp_attr_get(), arguments::sdp_file, set_wanted_object(), SExiting, STxStopped, file::toi, file::transfer_len, TRUE, and alc_arguments::verbosity.

Referenced by flute_receiver_report().

Here is the call graph for this function:

Here is the caller graph for this function:

int recvfile ( int  s_id,
char *  filepath,
unsigned long long  toi,
unsigned long long  file_len,
char *  md5,
int  rx_memory_mode,
char *  encoding,
int  verbosity 
)

This is a private function which receives file identified with TOI.

Parameters:
s_id session identifier
filepath pointer to file's path string, used when creating file and storing data to it
toi transport object identifier for the desired file
file_len the length of file
md5 MD5 checksum for the file
rx_memory_mode receiver memory consumption mode
encoding content encoding for file
verbosity verbosity level
Returns:
1 in success, 0 when state is SClosed, -1 in error cases, -2 when state is SExiting, -3 when state is STxStopped, -4 when MD5 check error occurs

Definition at line 126 of file receiver.c.

References alc_recv(), alc_recv3(), buffer_zlib_uncompress(), fdt_recv(), FDT_TOI, file_gzip_uncompress(), file_md5(), get_session_basedir(), GZ_SUFFIX, GZ_SUFFIX_LEN, MAX_PATH_LENGTH, MEM_ERROR, PAD_SUFFIX, PAD_SUFFIX_LEN, padding_decoder(), and ZLIB.

Referenced by receiver_in_object_mode(), and receiver_in_ui_mode().

Here is the call graph for this function:

Here is the caller graph for this function:

void set_file_received ( char *  file_uri_table[FILE_URI_TABLE_SIZE],
char *  file_uri 
)

This is a private function which sets file received.

Parameters:
file_uri_table pointers to wanted file URIs
file_uri pointer to file's path

Definition at line 94 of file receiver.c.

Referenced by fdtbasedrecv().

Here is the caller graph for this function:


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