http_file_repair.c File Reference

Point-to-point file repair. More...

#include <errno.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
#include <ctype.h>
#include <windows.h>
#include <shellapi.h>
#include <io.h>
#include <direct.h>
#include "http_file_repair.h"
#include "../alclib/alc_session.h"
#include "../alclib/transport.h"
#include "../alclib/alc_rx.h"
#include "../alclib/xor_fec.h"
#include "../alclib/rs_fec.h"
#include "../alclib/null_fec.h"
#include "uri.h"
#include "mad_md5.h"
#include "mad_zlib.h"

Include dependency graph for http_file_repair.c:

Go to the source code of this file.

Defines

#define _WINSOCKAPI_

Functions

int parse_data (chunk_t chunk, file_t *file, trans_obj_t *obj, alc_session_t *s, int openfile)
size_t write_to_buffer (void *ptr, size_t size, size_t nmemb, void *a)
char * http_file_repair (flute_receiver_t *receiver, int openfile, int *retval, CURL *curl, char *serviceURI)


Detailed Description

Point-to-point file repair.

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

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


Define Documentation

#define _WINSOCKAPI_

Definition at line 42 of file http_file_repair.c.


Function Documentation

char* http_file_repair ( flute_receiver_t receiver,
int  openfile,
int *  retval,
CURL *  curl,
char *  serviceURI 
)

This function handles PTP file repair.

Parameters:
receiver pointer to structure containing receiver information
openfile open received file automatically
retval stores return value
curl libcurl handle
serviceURI post file repair serviceURI
Returns:
session description for the PTMP repair session if 302 response received, NULL otherwise

Definition at line 611 of file http_file_repair.c.

References trans_obj::block_list, block_ready_to_decode(), trans_obj::bs, compute_blocking_structure(), create_object(), file::encoding, trans_obj::es_len, file::es_len, trans_unit::esi, trans_obj::fd, flute_receiver::fdt, trans_obj::fec_enc_id, file::fec_enc_id, trans_obj::fec_inst_id, file::fec_inst_id, file, fdt::file_list, get_alc_session(), get_session_basedir(), get_session_obj_list(), GZ_SUFFIX, insert_object(), trans_block::k, trans_obj::len, file::location, MAX_HTTP_URL_LENGTH, MAX_PATH_LENGTH, trans_obj::max_sb_len, file::max_sb_len, blocking_struct::N, trans_block::nb_of_rx_units, trans_obj::next, trans_unit::next, file::next, parse_data(), flute_receiver::rx_automatic, flute_receiver::s_id, trans_block::sbn, file::status, trans_obj::tmp_filename, file::toi, trans_obj::toi, file::transfer_len, trans_block::unit_list, flute_receiver::verbosity, and write_to_buffer().

Referenced by flute_receiver_report().

Here is the call graph for this function:

Here is the caller graph for this function:

int parse_data ( chunk_t  chunk,
file_t file,
trans_obj_t obj,
alc_session_t s,
int  openfile 
)

This is a private function which parses repair data.

Parameters:
chunk contains repair data
file pointer to the file's FDT info
obj pointer to the transport object
s pointer to the session
openfile Open repaired file automatically [in Windows only].
Returns:
0 in success, -1 in error cases, -4 when MD5 check error occurs

Definition at line 77 of file http_file_repair.c.

References blocking_struct::A_large, blocking_struct::A_small, trans_obj::block_list, trans_obj::bs, COM_NO_C_FEC_ENC_ID, create_units(), trans_unit::data, chunk::data, file::es_len, trans_unit::esi, trans_obj::fd_st, file::fec_enc_id, file::fec_inst_id, file, insert_unit(), trans_unit::len, file::max_nb_of_es, MAX_PATH_LENGTH, file::max_sb_len, trans_unit::offset, REED_SOL_FEC_INST_ID, retrieve_unit(), alc_session::rx_memory_mode, SB_SYS_FEC_ENC_ID, trans_block::sbn, SIMPLE_XOR_FEC_ENC_ID, chunk::size, trans_obj::toi, and USE_RETRIEVE_UNIT.

Referenced by http_file_repair().

Here is the call graph for this function:

Here is the caller graph for this function:

size_t write_to_buffer ( void *  ptr,
size_t  size,
size_t  nmemb,
void *  a 
)

This function writes received data to the buffer.

Parameters:
ptr pointer to the received data (it will not be zero terminated)
size the size of the data is size multiplied with nmemb
nmemb the size of the data is size multiplied with nmemb
a stores recveived data
Returns:
number of bytes written

Definition at line 590 of file http_file_repair.c.

References chunk::data, and chunk::size.

Referenced by flute_receiver_report(), and http_file_repair().

Here is the caller graph for this function:


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