📄 main.c
字号:
if(strcmp(a.sdp_file, "") != 0) { sf_free(a.src_filt); free(a.src_filt); sdp_free(a.sdp); free(a.sdp); } if(a.log_fd != -1) { close(a.log_fd); } #ifdef WIN32 WSACleanup();#endif close_alc_session(s_id); return retval; } if(strcmp(a.sdp_file, "") != 0) { sf_free(a.src_filt); free(a.src_filt); sdp_free(a.sdp); free(a.sdp); } /* To avoid recvfrom() failed, because of socket closing. */ set_session_state(s_id, SExiting); if(a.alc_a.cc_id == Null) { while(a.alc_a.nb_channel) { retcode = remove_alc_channel(s_id, ch_id[a.alc_a.nb_channel - 1]); a.alc_a.nb_channel--; } } else if(a.alc_a.cc_id == RLC) { retcode = remove_alc_channel(s_id, ch_id[0]); printf("%i packets were lost in the session\n", get_alc_session(s_id)->lost_packets); fflush(stdout); } if(a.name_incomplete_objects) { /* name incomplete objects, so that all received data is used */ retval = name_incomplete_objects(&fdt_th_args); } if(fdt_th_args.fdt != NULL) { FreeFDT(fdt_th_args.fdt); } close_alc_session(s_id); } if(a.log_fd != -1) { close(a.log_fd); } #ifdef WIN32 WSACleanup();#endif return retval;}/* * This function receives and handles signals. * * Params: int sig: Must be, not used for anything. * * Return: void * */void signal_handler(int sig){ /*int session_state = get_session_state(s_id); if(session_state != -1) { printf("\nExiting...\n\n"); fflush(stdout); set_session_state(s_id, SExiting); }*/ printf("\nExiting...\n"); fflush(stdout); set_session_state2(SExiting); }/* * This function print programs usage information. * * Params: void * * Return: void * */void usage(void) { printf("\nFLUTE Version %s, %s\n\n", MAD_FCL_RELEASE_VERSION, MAD_FCL_RELEASE_DATE); printf(" Copyright (c) 2003-2006 TUT - Tampere University of Technology\n"); printf(" main authors/contacts: jani.peltotalo@tut.fi and sami.peltotalo@tut.fi\n"); printf(" web site: http://www.atm.tut.fi/mad\n\n"); printf(" This is free software, and you are welcome to redistribute it\n"); printf(" under certain conditions; See the GNU General Public License\n"); printf(" as published by the Free Software Foundation, version 2 or later,\n"); printf(" for more details.\n\n"); printf(" * mad_rlc.c & mad_rlc.h -- Portions of code derived from MCL library by\n"); printf(" * Vincent Roca et al. (http://www.inrialpes.fr/planete/people/roca/mcl/)\n"); printf(" *\n"); printf(" * Copyright (c) 1999-2004 INRIA - Universite Paris 6 - All rights reserved\n"); printf(" * (main author: Julien Laboure - julien.laboure@inrialpes.fr\n"); printf(" * Vincent Roca - vincent.roca@inrialpes.fr)\n\n"); printf(" * fec.c & fec.h -- forward error correction based on Vandermonde matrices\n"); printf(" * 980624\n"); printf(" * (C) 1997-98 Luigi Rizzo (luigi@iet.unipi.it)\n"); printf(" *\n"); printf(" * Portions derived from code by Phil Karn (karn@ka9q.ampr.org),\n"); printf(" * Robert Morelos-Zaragoza (robert@spectra.eng.hawaii.edu) and\n"); printf(" * Hari Thirumoorthy (harit@spectra.eng.hawaii.edu), Aug 1995\n"); printf(" *\n"); printf(" * Redistribution and use in source and binary forms, with or without\n"); printf(" * modification, are permitted provided that the following conditions\n"); printf(" * are met:\n"); printf(" *\n"); printf(" * 1. Redistributions of source code must retain the above copyright\n"); printf(" * notice, this list of conditions and the following disclaimer.\n"); printf(" * 2. Redistributions in binary form must reproduce the above\n"); printf(" * copyright notice, this list of conditions and the following\n"); printf(" * disclaimer in the documentation and/or other materials\n"); printf(" * provided with the distribution.\n"); printf(" *\n"); printf(" * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND\n"); printf(" * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n"); printf(" * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\n"); printf(" * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS\n"); printf(" * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n"); printf(" * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n"); printf(" * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n"); printf(" * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n"); printf(" * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR\n"); printf(" * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\n"); printf(" * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY\n"); printf(" * OF SUCH DAMAGE.\n"); printf("\nUsage: flute [-S] [-U] [-m:str] [-p:int] [-i:str] [-c:int] [-t:ull]\n"); printf(" [-o:ull] [-e:int] [-F:str,str,...] [-a:str] [-b:int] [-h]\n"); printf(" [-f:str] [-K] [-l:int] [-r:int] [-v:int] [[-n:int] | [-C]]\n"); printf(" [-T:int] [-P:float,float] [-L:int] [-H] [-A] [-B:str] [-s:str]\n"); printf(" [-D:ull] [-E] [-V:str] [-G]"); #ifdef WIN32 printf(" [-I:int]");#else printf(" [-I:str]");#endif printf(" [-d:str]"); printf(" [-x:int] [-X:int]\n"); printf(" [-w:int] [-z:int]");#ifdef WIN32 printf(" [-O]");#endif#ifdef SSM printf(" [-M]");#endif printf(" [-N] [-Z]"); printf("\n\n"); printf("Common options:\n\n"); printf(" -S Act as sender, send data; otherwise receive data\n"); printf(" -U Address type is unicast, default: multicast\n"); printf(" -m:str IPv4 or IPv6 address for base channel,\n"); printf(" default: %s or %s\n", DEF_MCAST_IPv4_ADDR, DEF_MCAST_IPv6_ADDR); printf(" -p:int Port number for base channel, default: %s\n", DEF_MCAST_PORT); printf(" -i:str Local interface to bind to, default: INADDR_ANY\n"); printf(" -t:ull TSI for the session, default: %i\n", DEF_TSI); printf(" -w:int Congestion control scheme [0 = Null, 1 = RLC],\n"); printf(" default: %i; the number of channels, defined by -c option,\n", DEF_CC); printf(" are used with both schemes and bitrate of each channel is\n"); printf(" set according to RLC rules\n"); printf(" -a:str Address family [IPv4 or IPv6], default: IPv4\n"); printf(" -v:int Log verbosity level [0 = No output, 1 = File level,\n"); printf(" 2 = 1 + percent, 3 = 2 + blocks, 4 = 3 + FDT].\n"); printf(" If not set file table output is used.\n"); printf(" -V:str Print logs to 'str' file, default: print to stdout\n"); printf(" -P[:float,float] Simulate packet losses, default: %.1f,%.1f\n", (float)P_LOSS_WHEN_OK, (float)P_LOSS_WHEN_LOSS); printf(" -d:str SDP file (start/join FLUTE session based on SDP file),\n"); printf(" default: no\n"); printf(" -h Print this help\n"); printf("\nSender options:\n\n"); printf(" -c:int Number of used channels, default: %i\n", DEF_NB_CHANNEL);#ifdef USE_ZLIB printf(" -z:int Encode content [0 = no, 1 = ZLIB FDT,\n"); printf(" 2 = ZLIB FDT and GZIP files,\n"); printf(" 3 = PAD files], default: 0\n");#else printf(" -z:int Encode content [0 = no, 3 = PAD files],\n"); printf(" default: 0\n");#endif printf(" -D:ull Duration of the session in seconds, default: %i\n", DEF_DURATION); printf(" -f:str FDT file (send based on FDT), default: %s\n", DEF_FDT); printf(" -K Send a Complete FDT in the beginning of the session\n"); printf(" -l:int Encoding symbol length in bytes, default: %i\n", DEF_SYMB_LENGTH); printf(" -r:int Transmission rate at base channel in kbits/s, default: %i\n", DEF_TX_RATE); printf(" -T:int Time To Live or Hop Limit for the session, default: %i\n", DEF_TTL); printf(" -e:int FEC-OTI for file objects\n"); printf(" [0 = FEC-OTI in FDT, 1 = FEC-OTI in EXT_FTI], default: 0\n"); printf(" -F:str File or directory to be sent\n"); printf(" -G Calculate session size but do not send anything\n"); printf(" -n:int Number of transmissions, default: %i\n", DEF_TX_NB); printf(" -C Continuous transmission, default: not used\n"); printf(" -x:int FEC Encoding [0 = Null, 1 = Simple XOR,\n"); printf(" 2 = Reed-Solomon], default: %i\n", DEF_FEC); printf(" -X:int FEC ratio percent, default: %i\n", DEF_FEC_RATIO); printf(" -L:int Maximum source block length in multiple of encoding\n"); printf(" symbols, default: %i\n", DEF_MAX_SB_LEN); printf(" -H Use Half-word (when used TSI field could be 16, 32 or 48\n"); printf(" bits long and TOI field could be 16, 32, 48 or 64 bits\n"); printf(" long), default: not used\n"); printf(" -B:str Base directory for files to be sent,\n"); printf(" default: working directory\n"); printf(" -Z Optimize transmission rate (use more CPU)\n"); printf("\nReceiver options:\n\n"); printf(" -A Receive files automatically\n"); printf(" -F:str,str,... File(s) to be received\n"); printf(" -b:int Receiver's memory consumption [0 = high, 1 = medium,\n"); printf(" 2 = low], default: 1\n"); printf(" -c:int Maximum number of channels, default: %i\n", DEF_NB_CHANNEL); printf(" -B:str Base directory for downloaded files,\n"); printf(" default: %s\n", DEF_BASE_DIR); printf(" -s:str Source IPv4 or IPv6 address of this session. If not set,\n"); printf(" receiver locks to the first IP address found from the\n"); printf(" FLUTE packets.\n"); printf(" -o:ull TOI for the object to be received\n");#ifdef WIN32 printf(" -O Open received file(s) automatically, default: no\n");#endif#ifdef SSM printf(" -M Use Source-Specific Multicast, default: no\n");#endif printf(" -E Accept Expired FDT Instances\n");#ifdef WIN32 printf(" -I:int Local interface index for IPv6 multicast join, use for\n"); printf(" example 'ipv6 if' command to see interface indexes;\n"); printf(" otherwise OS default\n");#else printf(" -I:str Local interface name for IPv6 multicast join, use for\n"); printf(" example 'ifconfig' command to see interface names;\n"); printf(" otherwise OS default\n");#endif printf(" -N Name incomplete objects\n"); printf("\nExample use cases:\n\n"); printf("1. Send a file or directory n times\n\n\tflute -S -m:224.1.1.1 -p:4000 -t:2 -r:100 -F:files/flute-draft.txt\n"); printf("\t -n:2\n\n"); printf("2. Send a file or directory in a loop\n\n\tflute -S -m:224.1.1.1 -p:4000 -t:2 -r:100 -F:files/flute-draft.txt\n"); printf("\t -C\n\n"); printf("3. Send files defined in an FDT file\n\n\tflute -S -m:224.1.1.1 -p:4000 -t:2 -r:100 -f:fdt2.xml\n\n"); printf("4. Send files defined in an FDT file in a loop\n\n\tflute -S -m:224.1.1.1 -p:4000 -t:2 -r:100 -f:fdt2.xml -C\n\n"); printf("5. Send using unicast\n\n\tflute -S -U -m:1.2.3.4 -p:4000 -t:2 -r:100 -f:fdt2.xml -C\n\n"); printf("6. Receive one object\n\n\tflute -m:224.1.1.1 -p:4000 -t:2 -s:2.2.2.2 -o:1\n\n"); printf("7. Receive file(s) defined by file name(s)\n\n\tflute -m:224.1.1.1 -p:4000 -t:2 -s:2.2.2.2\n"); printf("\t -F:files/flute-man.txt,flute-draft.txt\n\n"); printf("8. Receive file(s) defined by wild card option\n\n\tflute -m:224.1.1.1 -p:4000 -t:2 -s:2.2.2.2 -F:*.jpg\n\n"); printf("9. Receive file(s) with User Interface\n\n\tflute -m:224.1.1.1 -p:4000 -t:2 -s:2.2.2.2\n\n"); printf("10. Receive file(s) automatically from session\n\n\tflute -A -m:224.1.1.1 -p:4000 -t:2 -s:2.2.2.2\n\n"); printf("11. Receive using unicast\n\n\tflute -A -U -p:4000 -t:2 -s:2.2.2.2\n\n"); exit(1);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -