1 /** \file defines.h \brief Definitions
2  *
3  *  $Author: peltotal $ $Date: 2007/02/26 13:48:19 $ $Revision: 1.171 $
4  *
5  *  MAD-ALCLIB: Implementation of ALC/LCT protocols, Compact No-Code FEC,
6  *  Simple XOR FEC, Reed-Solomon FEC, and RLC Congestion Control protocol.
7  *  Copyright (c) 2003-2007 TUT - Tampere University of Technology
8  *  main authors/contacts: jani.peltotalo@tut.fi and sami.peltotalo@tut.fi
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23  *
24  *  In addition, as a special exception, TUT - Tampere University of Technology
25  *  gives permission to link the code of this program with the OpenSSL library (or
26  *  with modified versions of OpenSSL that use the same license as OpenSSL), and
27  *  distribute linked combinations including the two. You must obey the GNU
28  *  General Public License in all respects for all of the code used other than
29  *  OpenSSL. If you modify this file, you may extend this exception to your version
30  *  of the file, but you are not obligated to do so. If you do not wish to do so,
31  *  delete this exception statement from your version.
32  */
33 
34 #ifndef _DEFINES_H_
35 #define _DEFINES_H_
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /**
42  * Receiver socket buffer size
43  */
44 
45 #define RECEIVER_SOCKET_BUFFER_SIZE 2000000
46 
47 #define MAD_FCL_RELEASE_VERSION "1.7"			/**< Release version */
48 #define MAD_FCL_RELEASE_DATE "March 2, 2007"	/**< Release date */
49 
50 #ifdef _MSC_VER
51 #define timeb _timeb
52 #define ftime _ftime
53 #endif
54 
55 /**
56  * If you want to compile the code in a system where SSM is not supported
57  * undefine SSM. For example in Windows 2000 SSM is not supported. */
58 
59 #define SSM
60 
61 #define USE_ZLIB /**< Use ZLIB compression library */
62 #define USE_RETRIEVE_UNIT /**< Use retrieve_unit() function */
63 
64 #if defined(LINUX) || defined(_MSC_VER)
65 #define _BIT_FIELDS_LTOH	/**< Bit field order is compiler/OS dependant */
66 #undef _BIT_FIELDS_HTOL
67 #elif defined(SOLARIS)
68 #undef _BIT_FIELDS_LTOH
69 #define _BIT_FIELDS_HTOL	/**< Bit field order is compiler/OS dependant */
70 #endif
71 
72 #define FDT_TOI		0				/**< TOI for FDT */
73 #define EXT_FDT		192				/**< Extension header for FDT defined by FLUTE */
74 #define EXT_CENC	193				/**< Extension header for FDT content encoding defined by FLUTE */
75 
76 #define ALC_VERSION		1		/**< ALC version number */
77 #define FLUTE_VERSION	1		/**< FLUTE version number */
78 
79 #define COM_NO_C_FEC_ENC_ID		0	/**< Compact No-Code FEC scheme */
80 #define SIMPLE_XOR_FEC_ENC_ID   2	/**< Simple XOR FEC scheme */
81 #define RS_FEC_ENC_ID			3	/**< Reed-Solomon FEC scheme, identifier not yet decided, 3 used temporarily */
82 
83 #define SB_LB_E_FEC_ENC_ID		128		/**< Small Block, Large Block and Expandable FEC scheme */
84 #define SB_SYS_FEC_ENC_ID		129		/**< Small Block Systematic FEC scheme */
85 #define COM_FEC_ENC_ID			130		/**< Compact FEC scheme */
86 
87 #define REED_SOL_FEC_INST_ID	0		/**< Reed-Solomon instance id, when Small Block Systematic FEC scheme is used */
88 
89 #define Null 0			/**< Null congestion control mechanism */
90 #define RLC	1			/**< RLC congestion control mechanism */
91 
92 /* for RLC */
93 #define RLC_SP_CYCLE		250     /**< 250 ms, for fast layer addition */
94 #define RLC_WAIT_AFTER_SP	2		/**< packets to wait before start sending after syncronisation point */
95 #define RLC_DEAF_PERIOD		10000	/* time for deaf period after a dropped layer (10000 ms), due to IGMP leave latency */
96 #define RLC_LATE_ACCEPTED	0		/**< maximum number of late packets between two syncronisation points at the toplayer
97 									when a new layer can be added */
98 #define RLC_LOSS_ACCEPTED	0		/**< maximum number of lost packets between two syncronisation points at the toplayer
99 									when a new layer can be added */
100 #define RLC_PKT_TIMEOUT		500     /**< time to wait for a late packet before assuming it's lost (500 ms) */
101 #define RLC_LOSS_LIMIT		1		/**< RLC_LOSS_LIMIT / RLC_LOSS_TIMEOUT is the max loss rate for packet. If this rate
102 									is reached then we should drop the highest layer. */
103 #define RLC_LOSS_TIMEOUT	20		/**< RLC_LOSS_LIMIT / RLC_LOSS_TIMEOUT is the max loss rate for packet. If this rate
104 									is reached then we should drop the highest layer. */
105 #define RLC_MAX_LATES		100		/**< Maximum number of late packets */
106 
107 #define EXT_NOP		0		/**< No-operation extension header defined by LCT */
108 #define	EXT_AUTH	1		/**< Authentication extension header defined by LCT */
109 #define EXT_TIME	2		/**< Time extension header defined by LCT */
110 #define	EXT_FTI		64		/**< FEC object transmission information extension header defined by ALC */
111 
112 #define SENDER		0		/**< Operation mode is sender */
113 #define RECEIVER	1		/**< Operation mode is receiver */
114 
115 #define MAX_ALC_SESSIONS	        100		/**< Maximum number of ALC sessions */
116 #define MAX_CHANNELS_IN_SESSION		10		/**< Maximum number of channels per session */
117 #define MAX_PACKET_LENGTH			1500	/**< Maximum packet length */
118 #define MAX_PATH_LENGTH				1024	/**< Maximum path length */
119 #define MAX_PORT_LENGTH				10		/**< Maximum length for string that contains port number */
120 #define MAX_TX_QUEUE_SIZE			1000	/**< Maximum transmission queue size in packets */
121 
122 #define WAITING_FDT		5	/**< FDT instance is in parsing state */
123 #define OK				4	/**< Correct packet received */
124 #define EMPTY_PACKET	3	/**< Empty packet received */
125 #define HDR_ERROR		2	/**< Error in FLUTE header */
126 #define MEM_ERROR		1	/**< Error when reserving memory */
127 #define DUP_PACKET		0	/**< Duplicate packet received*/
128 
129 #define NO_TX_THREAD 0		/**< Mode when transmission thread is not used in the sender (with Null
130 							congestion control and only one channel) */
131 #define TX_THREAD 1			/**< Mode when ransmission thread is used in the sender */
132 
133 #define ZLIB 1		/**< ZLIB content encoding */
134 #define DEFLATE 2	/**< DEFLATE content encoding */
135 #define GZIP 3		/**< GZIP content encoding */
136 #define PAD 4		/**< Content padding */
137 
138 #ifdef USE_ZLIB
139 #define ZLIB_BUFLEN 16384					/**< Buffer length used with zlib library */
140 #define GZ_SUFFIX "~gz"						/**< Used GZIP suffix */
141 #define GZ_SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) /**< Length of used GZIP suffix */
142 #define ZLIB_FDT 1							/**< Use ZLIB content encoding with FDT */
143 #define ZLIB_FDT_AND_GZIP_FILES 2			/**< Use ZLIB content encoding with FDT and GZIP content encoding with files */
144 #endif
145 
146 #define PAD_FILES 3								/**< Use content padding with files */
147 #define PAD_SUFFIX "~pad"						/**< Used suffix for content padding */
148 #define PAD_SUFFIX_LEN (sizeof(PAD_SUFFIX)-1)	/**< Length of used suffix for content padding */
149 
150 #ifdef __cplusplus
151 }; //extern "C"
152 #endif
153 
154 #endif
155 
156