lct_hdr.c

Go to the documentation of this file.
00001 
00034 #ifdef _MSC_VER
00035 #include <winsock2.h>
00036 #else
00037 #include <arpa/inet.h>
00038 #endif
00039 
00040 #include "lct_hdr.h"
00041 
00042 int add_fdt_lct_he(def_lct_hdr_t *def_lct_hdr, int hdrlen, unsigned int fdt_instance_id) {
00043 
00044         unsigned int word;
00045         int len = 0;
00046 
00047         word = ((EXT_FDT << 24) | ((FLUTE_VERSION & 0xF) << 20) | (fdt_instance_id & 0x000FFFFF));
00048         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen) = htonl(word);
00049         len += 4;
00050 
00051         return len;
00052 
00053 }
00054 
00055 int add_cenc_lct_he(def_lct_hdr_t *def_lct_hdr, int hdrlen, unsigned char content_enc_algo) {
00056 
00057         unsigned int word;
00058         int len = 0;
00059 
00060         word = ((EXT_CENC << 24) | (content_enc_algo << 16) | (0 & 0x0000FFFF));
00061         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen) = htonl(word);
00062         len += 4;
00063 
00064         return len;
00065 }
00066 
00067 int add_fti_0_2_128_130_lct_he(def_lct_hdr_t *def_lct_hdr, int hdrlen,
00068                                                         unsigned long long transferlen,
00069                                                         unsigned short fec_inst_id, unsigned short eslen, unsigned int max_sblen) {
00070 
00071         unsigned int word;
00072         unsigned short tmp;
00073         int len = 0;
00074         
00075         tmp = ((unsigned int)(transferlen >> 32) & 0x0000FFFF);
00076         word = ((EXT_FTI << 24) | (4 << 16) | tmp);
00077         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen) = htonl(word);
00078         len += 4;
00079 
00080         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl((unsigned int)transferlen);
00081         len += 4;
00082 
00083         word = ((fec_inst_id << 16) | eslen);
00084         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl(word);
00085         len += 4;
00086 
00087         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl(max_sblen);
00088         len += 4;
00089         
00090         return len;
00091 }
00092 
00093 int add_fti_3_lct_he(def_lct_hdr_t *def_lct_hdr, int hdrlen,
00094                                            unsigned long long transferlen,
00095                                            unsigned char m, unsigned char G, unsigned short eslen,
00096                                            unsigned short max_sblen, unsigned short mxnbofes) {
00097 
00098   unsigned int word;
00099   unsigned short tmp;
00100   int len = 0;
00101   
00102   tmp = ((unsigned int)(transferlen >> 32) & 0x0000FFFF);
00103   word = ((EXT_FTI << 24) | (4 << 16) | tmp);
00104   *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen) = htonl(word);
00105   len += 4;
00106   
00107   *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl((unsigned int)transferlen);
00108   len += 4;
00109   
00110   word = ((m << 24) | (G << 16) | eslen);
00111   *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl(word);
00112   len += 4;
00113   
00114   word = ((max_sblen << 16) | mxnbofes);
00115   *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl(word);
00116   len += 4;
00117   
00118   return len;
00119 }
00120 
00121 int add_fti_129_lct_he(def_lct_hdr_t *def_lct_hdr, int hdrlen,
00122                                          unsigned long long transferlen,
00123                                          unsigned short fec_inst_id, unsigned short eslen,
00124                                          unsigned short max_sblen, unsigned short mxnbofes) {
00125 
00126         unsigned int word;
00127         unsigned short tmp;
00128         int len = 0;
00129         
00130         tmp = ((unsigned int)(transferlen >> 32) & 0x0000FFFF);
00131         word = ((EXT_FTI << 24) | (4 << 16) | tmp);
00132         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen) = htonl(word);
00133         len += 4;
00134 
00135         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl((unsigned int)transferlen);
00136         len += 4;
00137 
00138         word = ((fec_inst_id << 16) | eslen);
00139         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl(word);
00140         len += 4;
00141 
00142         word = ((max_sblen << 16) | mxnbofes);
00143         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl(word);
00144         len += 4;
00145         
00146         return len;
00147 }
00148 
00149 int add_nop_lct_he(void) {
00150         int len = 0;
00151         /* TODO */
00152         return len;
00153 }
00154 
00155 int add_auth_lct_he(void) {
00156         int len = 0;
00157         /* TODO */
00158         return len;
00159 }
00160 
00161 int add_time_lct_he(void) {
00162         int len = 0;
00163         /* TODO */
00164         return len;
00165 }

Generated on Fri Mar 9 19:59:51 2007 for MAD-FCL by  doxygen 1.5.0