int descriptorMHP_AIT (u_char *b) { int len; int tag; out_NL (4); tag = outBit_S2x_NL (4,"MHP_AIT-DescriptorTag: ", b, 0, 8, (char *(*)(u_long))dsmccStrMHP_AIT_DescriptorTAG); len = outBit_Sx_NL (4,"descriptor_length: ", b, 8, 8); // empty ?? if (len == 0) return len; // print hex buf of descriptor printhex_buf (9, b,len+2); switch (tag) { case 0x00: descriptorMHP_AIT_application (b); break; case 0x01: descriptorMHP_AIT_application_name (b); break; case 0x02: descriptorMHP_AIT_transport_protocol (b); break; case 0x03: descriptorMHP_AIT_dvb_j_application (b); break; case 0x04: descriptorMHP_AIT_dvb_j_application_location (b); break; case 0x05: descriptorMHP_AIT_external_application_authorisation (b); break; // case 0x06: reserved // case 0x07: reserved case 0x08: descriptorMHP_AIT_dvb_html_application (b); break; case 0x09: descriptorMHP_AIT_dvb_html_application_location (b); break; case 0x0A: descriptorMHP_AIT_dvb_html_application_boundary (b); break; case 0x0B: descriptorMHP_AIT_application_icons (b); break; case 0x0C: descriptorMHP_AIT_pre_fetch (b); break; case 0x0D: descriptorMHP_AIT_DII_location (b); break; case 0x0E: descriptorMHP_AIT_delegated_application (b); break; case 0x0F: descriptorMHP_AIT_plug_in (b); break; case 0x10: descriptorMHP_AIT_application_storage (b); break; case 0x11: descriptorMHP_AIT_ip_signalling (b); break; case 0x5F: descriptorDVB_PrivateDataSpecifier (b); break; default: if (tag < 0x80) { out_nl (0," ----> ERROR: unimplemented descriptor (MHP_AIT context), Report!"); } descriptor_PRIVATE (b,MHP_AIT); break; } return len+2; // (descriptor total length) }
u_long BIOP_TAG_dispatch (int v, u_char *b) { u_long id_tag; u_long len; id_tag = getBits (b, 0, 0, 32); // ID_tag prefetch switch (id_tag) { case 0x42494F50: // "BIOP" // BIOP::FileMessage // BIOP::DirectoryMessage // BIOP::StreamMessage // BIOP::StreamEventMessage len = BIOP_Message (v, b); break; case 0x49534f05: // TAG_LITE_OPTIONS len = BIOP_LiteOptionsProfileBody (v, b); break; case 0x49534f06: // TAG_BIOP // BIOPProfileBody len = BIOP_BIOPProfileBody (v, b); break; case 0x49534f40: // TAG_ConnBinder // DSM::ConnBinder len = BIOP_DSM_ConnBinder (v, b); break; case 0x49534f46: // TAG_SERVICE_LOCATION len = BIOP_DSM_ServiceLocation (v, b); break; case 0x49534f50: // TAG_ObjectLocation // DSM::ConnBinder len = BIOP_ObjectLocation (v, b); break; default: // unknown !!! // $$$ TODO: we wildly guess, that there is a 32b length field! // $$$ TODO: this may break the decoding process, if not true outBit_S2x_NL (v,"profileId_tag: ", b, 0, 32, (char *(*)(u_long)) dsmccStrIOP_ProfileID ); len = outBit_Sx_NL (v,"profile_data_length: ", b, 32, 32); print_databytes (v,"unkown profile_data:", b+8, len); len += 8; break; } out_NL (v); return len; }
static u_long body_StreamEventMessage (int v, u_char *b) { u_char *b_org = b; u_int nx,ny,n2,n8,n4; n2 = outBit_Sx_NL (v,"objectInfo_length: ", b, 0, 16); b += 2; nx = BIOP_DSM_Stream_Info_T (v, b); ny = BIOP_DSM_Event_EventList_T (v, b+nx); print_databytes (v,"ObjectInfo_byte:", b+nx, n2-nx-ny); b += n2; nx = do_ServiceContentList (v, b); b += nx; outBit_Sx_NL (v,"messageBody_length: ", b, 0, 32); n8 = outBit_Sx_NL (v,"tap_count: ", b, 32, 8); b += 5; indent (+1); for (; n8 > 0; n8--) { int nz; nz = BIOP_TAP (v, "", b); b += nz; } indent (-1); n4 = outBit_Sx_NL (v,"eventIds_count: ", b, 0, 8); b += 1; indent (+1); for (; n4 > 0; n4--) { outBit_Sx_NL (v,"eventId: ", b, 0, 16); b += 2; } indent (-1); return (u_long) (b - b_org); }
void descriptorMHP_AIT_application (u_char *b) { int len; int len2; // descriptor_tag = b[0]; len = b[1]; len2 = outBit_Sx_NL (4,"application_profile_length: ", b, 16, 8); b += 3; len -= 1; indent (+1); while (len2 > 0) { int x; out_NL(4); x = mhp_application_profile_version (4, b); b += x; len -= x; len2 -= x; } out_NL(4); indent (-1); outBit_Sx_NL (4,"service_bound_flag: ", b, 0, 1); outBit_S2x_NL(4,"visibility: ", b, 1, 2, (char *(*)(u_long)) dsmccStrMHP_visibility_state ); outBit_Sx_NL (4,"reserved: ", b, 3, 5); outBit_Sx_NL (4,"application_priority: ", b, 8, 8); b += 2; len -= 2; while (len > 0) { outBit_Sx_NL (4,"transport_protocol_label: ", b, 0, 8); b++; len--; } }
static u_long body_FileMessage (int v, u_char *b) { u_char *b_org = b; u_long nx,n2,n5; n2 = outBit_Sx_NL (v,"objectInfo_length: ", b, 0, 16); b += 2; if (n2) { // has to be >= 8 outBit64_Sx_NL (v,"DSM::File::ContentSize: ", b, 0, 64); b += 8; n2 -= 8; if (n2 > 0) { out_nl (v, "Descriptor_loop:"); indent (+1); while (n2 > 0) { int x; x = descriptor (b, DSMCC_CAROUSEL); b += x; n2 -= x; out_NL (v); } } // if n2 > 0 indent (-1); } // if n2 out_NL (v); nx = do_ServiceContentList (v, b); b += nx; outBit_Sx_NL (v,"messageBody_length: ", b, 0, 32); n5 = outBit_Sx_NL (v,"content_length: ", b, 32, 32); print_databytes(v,"content__byte:", b+8, n5); b += 8 + n5; return (u_long) (b - b_org); }
int IOP_IOR (int v, u_char *b) { u_char *b_start = b; int i,x; u_long n1; out_nl (v, "IOP::IOR:"); indent (+1); n1 = outBit_Sx_NL (v,"type_id_length: ", b, 0, 32); print_text_UTF8 (v, "type_id: ", b+4, n1); b += 4+n1; // alignment gap (CDR alignment rule), should be 0xFF x = n1 % 4; if (x) { print_databytes (v,"alignment_gap:", b, 4-x); b += 4-x; } n1 = outBit_Sx_NL (v,"taggedProfiles_count: ", b, 0, 32); b += 4; for (i=0; i < n1; i++) { u_long n2; // IOP_taggedProfile n2 = IOP_taggedProfile (v, b); b += n2; } indent (-1); return b - b_start; }
void descriptorMHP_AIT_application_icons (u_char *b) { int len; int len2; // descriptor_tag = b[0]; len = b[1]; len2 = outBit_Sx_NL (4,"icon_locator_length: ", b+2, 0, 8); print_text_UTF8 (4, "icon_locator: ", b+3, len2); b += 3 + len2; len -= 1 + len2; outBit_Sx_NL (4,"icon_flags: ", b, 0, 16); // $$$ TODO table b += 2; len -= 2; print_databytes(4,"reserved_future_use:", b, len); }
static u_long body_basic_Message (int v, u_char *b) { u_char *b_org = b; u_int nx,n2,n3; n2 = outBit_Sx_NL (v,"objectInfo_length: ", b, 0, 16); print_databytes (v,"ObjectInfo_byte:", b+2, n2); b += 2 + n2; nx = do_ServiceContentList (v, b); b += nx; n3 = outBit_Sx_NL (v,"messageBody_length: ", b, 0, 32); print_databytes (v,"MessageBody:", b+4, n3); b += 4 + n3; return (u_long) (b - b_org); }
int dsmcc_DownloadCancel (int v, u_char *b, u_int len) { int len_org = len; int len2; // already read dsmcc_MessageHeader (v, b, len, &dmh); outBit_Sx_NL (v,"downloadId: ", b, 0, 32); outBit_Sx_NL (v,"moduleId: ", b, 32, 16); outBit_Sx_NL (v,"blockNumber: ", b, 48, 16); outBit_Sx_NL (v,"downloadCancelReason: ", b, 64, 8); outBit_Sx_NL (v,"reserved: ", b, 72, 8); len2 = outBit_Sx_NL (v,"privateDataLength: ", b, 80, 16); b += 12; len -= 12; print_databytes (v, "private data: ", b, len); return len_org; }
void print_xTS_field (int v, const char *str, u_char *b, int bit_offset) { long long xTS_32_30; long long xTS_29_15; long long xTS_14_0; long long ull; int bo = bit_offset; int v1 = v+1; out_nl (v,"%s:",str); indent (+1); xTS_32_30 = outBit_Sx_NL (v1,"bit[32..30]: ", b, bo+0, 3); outBit_Sx_NL (v1,"marker_bit: ", b, bo+3, 1); xTS_29_15 = outBit_Sx_NL (v1,"bit[29..15]: ", b, bo+4, 15); outBit_Sx_NL (v1,"marker_bit: ", b, bo+19, 1); xTS_14_0 = outBit_Sx_NL (v1,"bit[14..0]: ", b, bo+20,15); outBit_Sx_NL (v1,"marker_bit: ", b, bo+35, 1); ull = (xTS_32_30<<30) + (xTS_29_15<<15) + xTS_14_0; out (v," ==> %s: ", str); print_timebase90kHz (v, ull); out_NL (v); indent (-1); }
void descriptorMHP_AIT_dvb_html_application (u_char *b) { int len; int len2; // descriptor_tag = b[0]; len = b[1]; len2 = outBit_Sx_NL (4,"appid_set_length: ", b+2, 0, 8); b += 3; len --; indent(+1); while (len2 > 0) { outBit_Sx_NL (4,"application_id: ", b, 0, 16); b += 2; len -= 2; len2 -= 2; } indent(-1); print_text_UTF8 (4, "parameter: ", b, len); }
void descriptorMHP_AIT_dvb_j_application_location (u_char *b) { int len; int len2; // descriptor_tag = b[0]; len = b[1]; b += 2; len2 = outBit_Sx_NL (4,"base_directory_length: ", b, 0, 8); print_text_UTF8 (4, "base_directory: ", b+1, len2); b += len2+1; len -= len2+1; len2 = outBit_Sx_NL (4,"classpath_extension_length: ", b, 0, 8); print_text_UTF8 (4, "classpath_extension: ", b+1, len2); b += len2+1; len -= len2+1; print_text_UTF8 (4, "initial_class: ", b, len); }
static u_long do_ServiceContentList (int v, u_char *b) { u_char *b_org = b; int n3; n3 = outBit_Sx_NL (v,"serviceContentList_count: ", b, 0, 8); b += 1; indent (+1); for (; n3 > 0; n3--) { int n4; outBit_Sx_NL (v,"context_id: ", b, 0, 32); n4 = outBit_Sx_NL (v,"context_data_length: ", b, 32, 16); print_databytes (v,"context_data:", b+6, n4); b += 6 + n4; } indent (-1); return (u_long) (b - b_org); }
int llc_snap (int v, u_char *b) { int dsap, ssap, ctrl; int oui, prot; out_nl (v,"LLC/SNAP:"); indent (+1); out_nl (v,"LLC:"); dsap = outBit_Sx_NL (v," DSAP: ", b, 0, 8); ssap = outBit_Sx_NL (v," SSAP: ", b, 8, 8); ctrl = outBit_Sx_NL (v," Control: ", b,16, 8); out_nl (v,"SNAP:"); oui = outBit_S2x_NL (v," Org. Unique ID: ", b,24,24, (char *(*)(u_long))dsmccStrOUI ); prot = outBit_S2x_NL (v," Protocol Identifier: ", b,48,16, (char *(*)(u_long))dsmccStr_LLC_SNAP_prot ); indent (-1); return 8; }
static int closed_caption_data_field (int v, u_char *b, int len) { int v1 = v+1; out_nl (v,"CC (Closed Caption) data:"); indent (+1); ebu_rfl_out (v1,b); // $$$ TODO outBit_Sx_NL (v1,"closed_caption_data_block: ", b, 8,16); indent (-1); return 3; }
static int wss_data_field (int v, u_char *b, int len) { int v1 = v+1; out_nl (v,"WSS (Wide Screen Signalling) data:"); indent (+1); ebu_rfl_out (v1,b); b++; print_wss_decode (v1, b); // 14 bit outBit_Sx_NL (v1,"reserved: ", b,14, 2); indent (-1); return 3; }
void descriptorMHP_AIT_dvb_html_application_location (u_char *b) { int len; int len2; // descriptor_tag = b[0]; len = b[1]; len2 = outBit_Sx_NL (4,"physical_root_length: ", b+2, 0, 8); print_text_UTF8 (4, "physical_root: ", b+3, len2); b += 3 + len2; len -= 1 + len2; print_text_UTF8 (4, "initial_path: ", b, len); }
void descriptorMHP_AIT_dvb_html_application_boundary (u_char *b) { int len; int len2; // descriptor_tag = b[0]; len = b[1]; len2 = outBit_Sx_NL (4,"label_length: ", b+2, 0, 8); print_text_UTF8 (4, "label: ", b+3, len2); b += 3 + len2; len -= 1 + len2; print_text_UTF8 (4, "regular_expression: ", b, len); }
void mpeg_pack_header (int v, u_char *b, int len) { /* z.B. H.222 ISO 13818-1 Table 2-33 */ /* ISO 11172-1 pack header */ int v1 = v+1; int pack_stuffing_len; if (len == 0) return; out_nl (v,"Pack_header: "); indent (+1); if (len > 0) { // -- within PES packet, not PS! outBit_Sx_NL (v1,"pack_start_code: ", b, 0, 32); } outBit_Sx_NL (v1,"fixed '01': ", b, 32, 2); print_xTS_field (v1, "system_clock_reference_base", b, 34) ; // len 36b outBit_Sx_NL (v1,"system_clock_reference_extension: ",b, 70, 9); outBit_Sx_NL (v1,"marker_bit: ", b, 79, 1); outBit_Sx (v1,"program_mux_rate: ", b, 80,22); out_nl (v1," [= x 50 bytes/sec]"); outBit_Sx_NL (v1,"marker_bit: ", b, 102, 1); outBit_Sx_NL (v1,"marker_bit: ", b, 103, 1); outBit_Sx_NL (v1,"reserved: ", b, 104, 5); pack_stuffing_len = outBit_Sx_NL (v1,"pack_stuffing_len: ", b, 109, 3); print_databytes (6,"stuffing bytes 0xFF:", b+14, pack_stuffing_len); b += 14 + pack_stuffing_len; if (len >= 0) len -= 14 + pack_stuffing_len; if (len > 0) mpeg_system_header (v1, b, len); // only if len > 0 (PES packet) indent (-1); }
void descriptorMHP_AIT_dvb_j_application (u_char *b) { int len; // descriptor_tag = b[0]; len = b[1]; b += 2; indent (+1); while (len > 0) { int len2; len2 = outBit_Sx_NL (4,"parameter_length: ", b, 0, 8); print_text_UTF8 (4, "Parameter: ", b+1, len2); b += len2+1; len -= len2+1; } indent (-1); }
void descriptorMHP_AIT_plug_in (u_char *b) { int len; // descriptor_tag = b[0]; len = b[1]; outBit_Sx_NL (4,"application_type: ", b+2, 0, 16); b += 4; len -= 2; indent(+1); while (len > 0) { int x; out_NL(4); x = mhp_application_profile_version (4, b); b += x; len -= x; } // indent(-1); }
static int monochrome_data_field (int v, u_char *b, int len) { int v1 = v+1; int n; out_nl (v,"Monochrome 4:2:2 sample data:"); indent (+1); outBit_Sx_NL (v1,"first_segment_flag: ",b, 0, 1); outBit_Sx_NL (v1,"last_segment_flag: ", b, 1, 1); outBit_Sx_NL (v1,"field_parity: ", b, 2, 1); outBit_Sx_NL (v1,"line_offset: ", b, 3, 5); outBit_Sx_NL (v1,"first_pixel_position: ",b, 8, 16); n = outBit_Sx_NL (v1,"n_pixel: ", b, 24, 8); print_databytes (v1,"Y_values:", b+3, n); indent (-1); return 3+n; }
int BIOP_TAP (int v, const char *str, u_char *b) { u_char *b_org = b; int use; int n; out_nl (v, "%s::TAP:"); indent (+1); outBit_Sx_NL (v,"id: ", b, 0, 16); use = outBit_S2x_NL(v,"use: ", b, 16, 16, (char *(*)(u_long))dsmccStrBIOP_TAP_Use ); outBit_Sx_NL (v,"association_tag: ", b, 32, 16); n = outBit_Sx_NL (v,"selector_length: ", b, 48, 8); b += 7; // -- a TAP may have a Selector() if (n >= 2) { int stype; stype = outBit_S2x_NL(v,"selector_type: ", b, 0, 16, (char *(*)(u_long))dsmccStrBIOP_TAP_SelectorType ); indent (+1); switch (stype) { case 0x0001: // MessageSelector dsmcc_print_transactionID_32 (v, b+2); outBit_S2Tx_NL (v,"timeout: ", b, 48, 32, "usec."); break; case 0x0109: // ATSC A95: TSFS_selector outBit_Sx_NL (v,"carouselId: ", b, 16, 32); outBit_S2Tx_NL (v,"DSI_timeout: ", b, 48, 32, "usec."); if (n > 10) { print_databytes (v,"URI_byte:", b+10, n-10); } break; case 0x0000: // ISO/IEC reserved default: // unknown, default print_databytes (v,"selector_data:", b+2, n-2); break; } indent (-1); } else { if (n > 0) { print_databytes (v,"selector_data:", b, n); } } b += n; indent (-1); out_NL (v); return (int) (b - b_org); }
int dsmcc_DownloadInfoIndication (int v, u_char *b, u_int len) { int len_org = len; int n_modules; int len2; int i, x; // already read dsmcc_MessageHeader (v, b, len, &dmh); outBit_Sx_NL (v,"downloadId: ", b , 0, 32); outBit_Sx_NL (v,"blockSize: ", b+ 4, 0, 16); outBit_Sx_NL (v,"windowSize: ", b+ 6, 0, 8); outBit_Sx_NL (v,"ackPeriod: ", b+ 7, 0, 8); outBit_Sx_NL (v,"tCDownloadWindow: ", b+ 8, 0, 32); outBit_Sx_NL (v,"tCDownloadScenario: ", b+12, 0, 32); b += 16; len -= 16; x = dsmcc_CompatibilityDescriptor (b); b += x; len -= x; n_modules = outBit_Sx_NL (v,"numberOfModules: ", b, 0, 16); b += 2; len -= 2; for (i=0; i < n_modules; i++) { u_int mId; out_NL (v); out_nl (v, "Module (%d):",i); indent (+1); mId = outBit_Sx (v,"moduleId: ", b, 0, 16); out_nl (4, "%s", (mId < 0xFFF0) ? "" : " [= DAVIC application]"); outBit_Sx_NL (v,"moduleSize: " , b, 16, 32); outBit_Sx_NL (v,"moduleVersion: ", b, 48, 8); len2 = outBit_Sx_NL (v,"moduleInfoLength: ", b, 56, 8); b += 8; len -= 8; // moduleInfoByte: these fields shall convey a list of descriptors // which each define one or more attributes of the described module, // except when the moduleId is within the range of 0xFFF0-0xFFFF. In // this case, the moduleInfoByte structure contains the ModuleInfo // structure as defined by DAVIC with the privateDataByte field of that // structure as a loop of descriptors. // ISO 13818-6:2000 11.3.3.2 if (mId < 0xFFF0) { BIOP_ModuleInfo (v, b, len2); } else { print_databytes (v, "moduleInfoBytes: ", b, len2); // $$$ TODO Davic } b += len2; len -= len2; indent (-1); } out_NL (v); indent (-1); len2 = outBit_Sx_NL (v,"privateDataLength: ", b, 0, 16); print_databytes (v, "privat Data: ", b+2, len2); // $$$ TODO ??? // b += 2 + len2; // len -= 2 + len2; return len_org; }
void section_TVA_RNT (u_char *b, int len) { /* TS 102 323 */ u_int len1,len2; u_int table_id; u_int section_length; out_nl (3,"RNT-decoding...."); table_id = outBit_S2x_NL (3,"Table_ID: ", b, 0, 8, (char *(*)(u_long))dvbstrTableID ); if (table_id != 0x79) { out_nl (3,"wrong Table ID"); return; } outBit_Sx_NL (3,"Section_syntax_indicator: ", b, 8, 1); outBit_Sx_NL (6,"reserved: ", b, 9, 1); outBit_Sx_NL (6,"reserved: ", b,10, 2); section_length = outBit_Sx_NL (5,"section_length: ", b,12,12); outBit_Sx_NL (3,"context_id: ", b,24, 16); outBit_Sx_NL (6,"reserved_3: ", b,40, 2); outBit_Sx_NL (3,"version_number: ", b,42, 5); outBit_S2x_NL(3,"Current_next_indicator: ", b,47, 1, (char *(*)(u_long))dvbstrCurrentNextIndicator ); outBit_Sx_NL (3,"Section_number: ", b,48, 8); outBit_Sx_NL (3,"Last_section_number: ", b,56, 8); outBit_S2x_NL(3,"context_id_type: ", b,64, 8, (char *(*)(u_long))dvbstrTVA_content_id_type ); len2 = outBit_Sx_NL (3,"common_descriptor_length: ", b,72, 12); outBit_Sx_NL (6,"reserved: ", b,84, 4); b += 11; len1 = section_length - 8; // common descriptor loop out_nl (3,"Common_descriptor_loop:"); indent (+1); while (len2 > 0) { int i; i = descriptor (b, TVA_RNT); b += i; len1 -= i; len2 -= i; out_NL (4); } indent (-1); // resolution provider info loop out_nl (3,"resolution_provider_info_loop:"); indent (+1); while (len1 > 0) { int len2, len3; len2 = outBit_Sx_NL (3,"resolution_provider_info_length: ", b, 0, 12); outBit_Sx_NL (6,"reserved: ", b, 12, 4); len3 = outBit_Sx_NL (3,"resolution_provider_name_length: ", b, 16, 8); print_std_ascii (3,"resolution_provider_name: ", b+3, len3); b += len3 + 3; len1 -= len3 + 3; len2 -= len3 + 3; // resolution_provider_descriptors loop len3 = outBit_Sx_NL (3,"resolution_provider_descriptor_length: ", b, 0, 12); outBit_Sx_NL (6,"reserved: ", b, 12, 4); b += 2; len1 -= 2; len2 -= 2; out_nl (3,"resolution_provider_descriptor_loop:"); indent (+1); while (len3 > 0) { int i; i = descriptor (b, TVA_RNT); b += i; len1 -= i; len2 -= i; len3 -= i; out_NL (4); } indent (-1); // CRID_authority loop out_nl (3,"CRID_authority_loop:"); indent (+1); while (len2 > 0) { len3 = outBit_Sx_NL (3,"CRID_authority_name_length: ", b, 0, 8); print_std_ascii (3,"CRID_authority_name: ", b+1, len3); b += len3 + 1; len1 -= len3 + 1; len2 -= len3 + 1; // CRID_authority_descriptors loop len3 = outBit_Sx_NL (3,"CRID_authority_descriptors_length: ", b, 0, 12); outBit_Sx_NL (6,"reserved: ", b, 12, 4); b += 2; len1 -= 2; len2 -= 2; out_nl (3,"CRID_authority_descriptor_loop:"); indent (+1); while (len3 > 0) { int i; i = descriptor (b, TVA_RNT); b += i; len1 -= i; len2 -= i; len3 -= i; out_NL (4); } indent (-1); } indent (-1); } indent (-1); outBit_Sx_NL (5,"CRC: ", b,0,32); }
void section_DSMCC_DATAGRAM (u_char *b, int len) { /* EN 301 192 7.x */ // $$$ TODO this differs from ISO/IEC 13818-6:1998 AMD_1_2000_Cor_1_2002 typedef struct _DATAGRAM { u_int table_id; u_int section_syntax_indicator; u_int private_indicator; u_int reserved_1; u_int section_length; u_int MAC_addr6; u_int MAC_addr5; u_int reserved_2; u_int payload_scrambling_control; u_int address_scrambling_control; u_int LLC_SNAP_flag; u_int current_next_indicator; u_int section_number; u_int last_section_number; u_int MAC_addr4; u_int MAC_addr3; // MAC-Bits: MSB first order u_int MAC_addr2; u_int MAC_addr1; // conditional // LLC SNAP according ISO 8802-2 // N ip datagram bytes u_int ip_datagram_data_bytes; // conditional u_int stuffing_bytes; // conditional unsigned long crc_checksum; } DATAGRAM; DATAGRAM d; int len1; d.table_id = b[0]; d.section_syntax_indicator = getBits (b, 0, 8, 1); d.private_indicator = getBits (b, 0, 9, 1); // $$$ TODO error indicator d.reserved_1 = getBits (b, 0, 10, 2); d.section_length = getBits (b, 0, 12, 12); d.MAC_addr6 = getBits (b, 0, 24, 8); d.MAC_addr5 = getBits (b, 0, 32, 8); d.reserved_2 = getBits (b, 0, 40, 2); d.payload_scrambling_control = getBits (b, 0, 42, 2); d.address_scrambling_control = getBits (b, 0, 44, 2); d.LLC_SNAP_flag = getBits (b, 0, 46, 1); d.current_next_indicator = getBits (b, 0, 47, 1); d.section_number = getBits (b, 0, 48, 8); d.last_section_number = getBits (b, 0, 56, 8); d.MAC_addr4 = getBits (b, 0, 64, 8); d.MAC_addr3 = getBits (b, 0, 72, 8); d.MAC_addr2 = getBits (b, 0, 80, 8); d.MAC_addr1 = getBits (b, 0, 88, 8); // MAC-Bits: MSB first ! b += 12; len1 = d.section_length - 9; out_nl (3,"DSM-CC DATAGRAM-decoding...."); out_S2B_NL (3,"Table_ID: ",d.table_id, dvbstrTableID (d.table_id)); if (d.table_id != 0x3e) { out_nl (3,"wrong Table ID"); return; } out_SB_NL (3,"section_syntax_indicator: ",d.section_syntax_indicator); out_SB_NL (3,"private_indicator: ",d.private_indicator); out_SB_NL (6,"reserved_1: ",d.reserved_1); out_SW_NL (5,"Section_length: ",d.section_length); out_SB_NL (5,"MACaddrbyte/DevicdID 6: ",d.MAC_addr6); out_SB_NL (5,"MACaddrbyte/DeviceID 5: ",d.MAC_addr5); out_SB_NL (6,"reserved_2: ",d.reserved_2); out_S2B_NL (3,"payload_scrambling_control: ",d.payload_scrambling_control, dsmccStrPayload_scrambling_control(d.payload_scrambling_control)); out_S2B_NL (3,"address_scrambling_control: ",d.address_scrambling_control, dsmccStrAddress_scrambling_control(d.address_scrambling_control)); out_SB_NL (3,"LLC_SNAP_flag: ",d.LLC_SNAP_flag); out_S2B_NL(3,"current_next_indicator: ",d.current_next_indicator, dvbstrCurrentNextIndicator(d.current_next_indicator)); out_SB_NL (3,"Section_number: ",d.section_number); out_SB_NL (3,"Last_Section_number: ",d.last_section_number); out_SB_NL (5,"MACaddrbyte/DeviceID 4: ",d.MAC_addr4); out_SB_NL (5,"MACaddrbyte/DeviceID 3: ",d.MAC_addr3); out_SB_NL (5,"MACaddrbyte/DeviceID 2: ",d.MAC_addr2); out_SB (5,"MACaddrbyte/DeviceID 1: ",d.MAC_addr1); out_nl (3," => MAC-Address/DeviceID: %02x:%02x:%02x:%02x:%02x:%02x", d.MAC_addr1,d.MAC_addr2,d.MAC_addr3, d.MAC_addr4,d.MAC_addr5,d.MAC_addr6); if (d.LLC_SNAP_flag == 0x01) { /* ISO/IEC 8802-2 */ int k; k = llc_snap (4, b); } else { net_IP_data (4, b, len1-4); } b += (len1 - 4); outBit_Sx_NL (5, (d.section_syntax_indicator) ?"CRC: " :"Checksum: ", b,0,32); }
void ebu_rfl_out (int v, u_char *b) { outBit_Sx_NL (6,"reserved: ", b, 0, 2); outBit_Sx_NL (v,"field_parity: ", b, 2, 1); outBit_Sx_NL (v,"line_offset: ", b, 3, 5); }
int dsmcc_GroupInfoIndication (int v, u_char *b, u_int len_org) { int len = len_org; int n_groups; int i; int len2; // -- due to some misbehavior of some service providers // -- we do a simple plausi check for group_counts_min_bytes > len i = getBits (b, 0, 0, 16); // group_counts i = i * 8 + 2; if (i > len_org) { // this is no GroupInfo print_databytes (v,"Data Bytes (non-standard):", b, len_org); return len_org; } out_nl (v,"GroupInfoIndication:"); indent (+1); n_groups = outBit_Sx_NL (v,"NumberOfGroups: ", b, 0, 16); b += 2; len -= 2; for (i=0; i < n_groups; i++) { out_NL (v); if (len <= 0) { out_nl (v, "... => strange len <= 0 and still group count > 0 (abort)"); break; } out_nl (v, "Group (%d):",i); indent (+1); outBit_Sx_NL (v,"GroupId: ", b, 0, 32); outBit_Sx_NL (v,"GroupSize: ", b, 32, 32); b += 8; len -= 8; // GroupCompatibility() len2 = dsmcc_CompatibilityDescriptor (b); b += len2; len -= len2; len2 = outBit_Sx_NL (v,"GroupInfoLength: ", b, 0, 16); // print_databytes (v, "GroupInfoBytes: ", b+2, len2); // $$$ TODO dsmcc_CarouselDescriptor_Loop ("GroupInfo", b+2, len2); b += 2+len2; len -= 2+len2; len2 = outBit_Sx_NL (v,"PrivateDataLength: ", b, 0, 16); print_private_data (v, b+2, len2); // $$$ What to do here? b += 2+len2; len -= 2+len2; indent (-1); } indent (-1); out_NL (v); return len_org; }
void mpeg_system_header (int v, u_char *b, int len) { /* z.B. H.222 ISO 13818-1 Table 2-34 */ /* ISO 11172-1 system header */ if (len == 0) return; out_nl (v,"System_header: "); indent (+1); if (len > 0) { // -- within PES packet, not PS! outBit_Sx_NL (v,"system_header_start_code: ", b, 0, 32); } // -- get real length from system_header data len = outBit_Sx_NL (v,"header_length: ", b, 32, 16); outBit_Sx_NL (v,"marker_bit: ", b, 48, 1); outBit_Sx_NL (v,"rate_bound: ", b, 49, 22); outBit_Sx_NL (v,"marker_bit: ", b, 71, 1); outBit_Sx_NL (v,"audio_bound: ", b, 72, 6); outBit_Sx_NL (v,"fixed_flag: ", b, 78, 1); outBit_Sx_NL (v,"CSPS_flag: ", b, 79, 1); outBit_Sx_NL (v,"system_audio_lock_flag: ", b, 80, 1); outBit_Sx_NL (v,"system_video_lock_flag: ", b, 81, 1); outBit_Sx_NL (v,"marker_bit: ", b, 82, 1); outBit_Sx_NL (v,"video_bound: ", b, 83, 5); outBit_Sx_NL (v,"packet_rate_restriction_flag: ", b, 88, 1); outBit_Sx_NL (v,"reserved_byte: ", b, 89, 7); b += 12; len -= 12; // while (nextbits () == '1') { // while ((bit = getBits (b, 0,0,1)) == 0x01) { while ( (*b & 0x80) ) { if (len <= 0) break; out_NL (v); outBit_S2x_NL(v,"Stream_id: ", b, 0, 8, (char *(*)(u_long))dvbstrPESstream_ID ); outBit_Sx_NL (v,"fixed (0x02): ", b, 8, 2); outBit_Sx_NL (v,"P-STD_buffer_bound_scale: ", b, 10, 1); outBit_Sx_NL (v,"P-STD_buffer_size_bound: ", b, 11, 13); b += 3; len -= 3; if (len < 0) out_nl (1, "$$$ something wrong here (length<0)"); } indent (-1); }
void section_PRIVATE_PremiereDE_CPT (u_char *b, int len) { u_int table_id; u_int section_syntax_indicator; u_int section_length; u_int time_MJD, time_UTC; u_int i, content_list_length; out_nl (3,"User_Defined-decoding...."); table_id = outBit_S2Tx_NL (3,"Table_ID: ", b, 0, 8, "Premiere Content Presentation Table"); if (table_id != 0xa1) { out_nl (3,"wrong Table ID"); return; } section_syntax_indicator = outBit_Sx_NL (3,"Section_syntax_indicator: ", b, 8, 1); // == 1 outBit_Sx_NL (3,"private_indicator: ", b, 9, 1); outBit_Sx_NL (6,"reserved: ", b,10, 2); section_length = outBit_Sx_NL (5,"private_section_length: ", b,12,12); outBit_Sx_NL (3,"table_id_extension: ", b, 24,16); outBit_Sx_NL (6,"reserved: ", b, 40, 2); outBit_Sx_NL (3,"Version_number: ", b, 42, 5); outBit_S2x_NL(3,"Current_next_indicator: ", b, 47, 1, (char *(*)(u_long))dvbstrCurrentNextIndicator ); outBit_Sx_NL (3,"Section_number: ", b, 48, 8); outBit_Sx_NL (3,"Last_section_number: ", b, 56, 8); b += 8; section_length -= 5; // // -- Premiere Content Presentation Table CIT // -- provided by Peter.Pavlov (Premiere.de) // outBit_Sx_NL (4,"Transport_stream_ID: ",b, 0, 16); outBit_Sx_NL (4,"Original_network_ID: ",b, 16, 16); outBit_Sx_NL (4,"virtual_channel_id: ",b, 32, 32); outBit_Sx_NL (4,"virtual_channel_name_length: ",b, 64, 8); b+=8; print_text_468A (4, "virtual_channel_name: ", b+1, *b); section_length -= 9+*b; b += *b+1; outBit_Sx_NL (4,"reserved: ",b, 0, 4); outBit_Sx_NL (4,"virtual_channel_info_length: ",b, 4, 12); b+=2; section_length -= 2; while (section_length > 4) { time_MJD = getBits (b, 0, 0, 16); time_UTC = getBits (b, 0, 16, 24); out (4,"start_time: "); print_time40 (4, time_MJD, time_UTC); out_NL (4); out_nl (4,"duration: %02x:%02x:%02x", *(b+5), *(b+6), *(b+7)); b+=8; outBit_Sx_NL (4,"virtual_event_name_length: ",b, 0, 8); print_text_468A (4, "virtual_event_name: ", b+1, *b); section_length -= *b+9; b += *b+1; outBit_Sx_NL (4,"virtual_event_info_length: ",b, 0, 8); print_text_468A (4, "virtual_event_info: ", b+1, *b); section_length -= *b+1; b += *b+1; outBit_Sx_NL (4,"reserved: ",b, 0, 4); outBit_Sx_NL (4,"content_list_length: ",b, 4, 12); content_list_length = ((b[0]&15)<<8)+b[1]; for(i=0, b+=2; i<content_list_length; i+=4, b+=4) { outBit_Sx_NL (4,"content_id: ",b, 0, 32); } section_length -= content_list_length+2; } outBit_Sx_NL (5,"CRC: ", b, 0, 32); }