⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dvb_descriptor.c

📁 dvbsnoop is a DVB/MPEG stream analyzer program. The program can be used to sniff, monitor, debug, d
💻 C
📖 第 1 页 / 共 5 页
字号:
{ typedef struct  _descDataBroadcast {    u_int      descriptor_tag;    u_int      descriptor_length;		    u_int      data_broadcast_id;    u_int      component_tag;    int        selector_length;    // N   bytes    u_char     ISO639_2_language_code[4];    u_int      text_length;    // N2  char  } descDataBroadcast; descDataBroadcast d; d.descriptor_tag		 = b[0]; d.descriptor_length       	 = b[1]; d.data_broadcast_id		 = getBits (b, 0, 16, 16); d.component_tag		 = getBits (b, 0, 32, 8); d.selector_length		 = getBits (b, 0, 40, 8); b  += 6;  out_S2W_NL (4,"Data_broadcast_ID: ",d.data_broadcast_id,	dvbstrDataBroadcast_ID(d.data_broadcast_id)); out_SB_NL (4,"Component_tag: ",d.component_tag); out_SB_NL (5,"Selector_length: ",d.selector_length); indent (+1); if (d.data_broadcast_id == 0x0005) {	 /* -- EN 301 192 Multi-protocol-encapsulation! */ 		typedef struct  _descMultiProtEncaps {			u_int	MAC_address_range;			u_int	MAC_ip_mapping_flag;			u_int	alignment_indicator;			u_int   reserved;			u_int   max_sections_per_datagram; 		} descMultiProtEncaps;		descMultiProtEncaps e; 		out_nl    (4,"Multi_Protocol_Encapsulation [EN 301 192]:"); 		e.MAC_address_range	 = getBits (b, 0,  0,  3); 		e.MAC_ip_mapping_flag	 = getBits (b, 0,  3,  1); 		e.alignment_indicator	 = getBits (b, 0,  4,  1); 		e.reserved		 = getBits (b, 0,  5,  3); 		e.max_sections_per_datagram = getBits (b, 0,  8,  8); 		out_S2B_NL (5,"MAC_address_range: ",e.MAC_address_range,			dsmccStrMultiProtEncapsMACAddrRangeField (e.MAC_address_range) ); 		out_SB_NL (5,"MAC_ip_mapping_flag: ",e.MAC_ip_mapping_flag); 		out_S2B_NL (5,"alignment_indicator: ",e.alignment_indicator,					(e.alignment_indicator) ?"32 bit": "8 bit"); 		out_SB_NL (6,"reserved: ",e.reserved); 		out_SB_NL (5,"max_sections_per_datagram: ",e.max_sections_per_datagram); } else if (d.data_broadcast_id == 0x0006) {	 /* --  EN 301 192 8.3.1 */ 		typedef struct  _descDATA_CAROUSEL_INFO {			u_int	carousel_type_id;			u_int	reserved_1;			u_long	transaction_id;			u_long  timeout_value_DSI;			u_long  timeout_value_DII;			u_int	reserved_2;			u_long	leak_rate; 		} descDATA_CAROUSEL_INFO;		descDATA_CAROUSEL_INFO c; 		out_nl    (4,"Data_Carousel_info:"); 		c.carousel_type_id		= getBits (b, 0,  0,  2); 		c.reserved_1			= getBits (b, 0,  2,  6); 		c.transaction_id		= getBits (b, 0,  8, 32); 		c.timeout_value_DSI		= getBits (b, 0, 40, 32); 		c.timeout_value_DII		= getBits (b, 0, 72, 32); 		c.reserved_2			= getBits (b, 0,104,  2); 		c.leak_rate			= getBits (b, 0,106, 22); 		out_S2B_NL (5,"carousel_type_id: ",c.carousel_type_id,			dsmccStrCarouselType_ID (c.carousel_type_id) ); 		out_SB_NL (6,"reserved_1: ",c.reserved_1); 		out_SL_NL (5,"transaction_id: ",c.transaction_id); 		out_SL_NL (5,"timeout_value_DSI: ",c.timeout_value_DSI); 		out_SL_NL (5,"timeout_value_DII: ",c.timeout_value_DII); 		out_SB_NL (6,"reserved_2: ",c.reserved_2); 		out_SL_NL (5,"leak_rate: ",c.leak_rate); } else if (d.data_broadcast_id == 0x0007) {	 /* -- EN 301 192 9.3.2 */ 		typedef struct  _descOBJECT_CAROUSEL_INFO {			u_int	carousel_type_id;			u_int	reserved_1;			u_long	transaction_id;			u_long  timeout_value_DSI;			u_long  timeout_value_DII;			u_int	reserved_2;			u_long	leak_rate;			// -- 		} descOBJECT_CAROUSEL_INFO;		descOBJECT_CAROUSEL_INFO c;		u_char                   *b1; 		int                      len1;		out_nl    (4,"Object_Carousel_Info:"); 		c.carousel_type_id		= getBits (b, 0,  0,  2); 		c.reserved_1			= getBits (b, 0,  2,  6); 		c.transaction_id		= getBits (b, 0,  8, 32); 		c.timeout_value_DSI		= getBits (b, 0, 40, 32); 		c.timeout_value_DII		= getBits (b, 0, 72, 32); 		c.reserved_2			= getBits (b, 0,104,  2); 		c.leak_rate			= getBits (b, 0,106, 22); 		out_S2B_NL (5,"carousel_type_id: ",c.carousel_type_id,			dsmccStrCarouselType_ID (c.carousel_type_id) ); 		out_SB_NL (6,"reserved_1: ",c.reserved_1); 		out_SL_NL (5,"transaction_id: ",c.transaction_id); 		out_SL_NL (5,"timeout_value_DSI: ",c.timeout_value_DSI); 		out_SL_NL (5,"timeout_value_DII: ",c.timeout_value_DII); 		out_SB_NL (6,"reserved_2: ",c.reserved_2); 		out_SL_NL (5,"leak_rate: ",c.leak_rate);		b1 = b + 16;		len1 = d.selector_length - 16;		while (len1 > 0) {    			u_char     ISO639_2_language_code[4];			int        object_name_length; 			getISO639_3 (ISO639_2_language_code, b1);			object_name_length		 = getBits (b1, 0, 24, 8);			out_nl    (5,"ISO639_2_language_code:  %3.3s", ISO639_2_language_code);			out_SB_NL (5,"object_name_length: ",object_name_length);			print_text_468A (5, "object_name: ", b1+4,object_name_length);			b1   += (4 + object_name_length);			len1 -= (4 + object_name_length);		}/* $$$ TODO  what is 0x0008 */ } else if (d.data_broadcast_id == 0x0009) {	 /* --  EN 301 192 10.2.1 */ 		typedef struct  _descHIGH_PROT_ASYNC_DATA_INFO {			u_int	higher_protocol_id;			u_int	reserved;			// private data 		} descHIGH_PROT_ASYNC_DATA_INFO;		descHIGH_PROT_ASYNC_DATA_INFO  c;		out_nl    (4,"higher_protocol_asynchronous_data_info:"); 		c.higher_protocol_id 		= getBits (b, 0,  0,  4); 		c.reserved			= getBits (b, 0,  4,  4); 		out_S2B_NL (5,"higher_protocol_id: ",c.higher_protocol_id,			dsmccStrHigherProtocol_ID (c.higher_protocol_id) ); 		out_SB_NL (6,"reserved: ",c.reserved);		print_private_data (5, b+1, d.selector_length-1); } else if (d.data_broadcast_id == 0x000A) {	 /* TR 102 006 */ 		typedef struct  _descSUI {    		   int      OUI_data_length;		   u_long   OUI;		   u_int    updt_type;		   int      selector_length2;		} descSUI;		descSUI  s;		int      len2;		out_nl    (4,"Software_update_info:");		s.OUI_data_length = outBit_Sx_NL (4,"OUI_data_length: ", b,0,8);    		b++;   		while (s.OUI_data_length > 0) {    		   outBit_S2x_NL (4,"OUI: ", 			b,0,24,				   (char *(*)(u_long))dsmccStrOUI);    		   outBit_Sx_NL (6,"reserved: ", 		b,24, 4);    		   s.updt_type = outBit_S2x_NL (4,"update_type: ",b,28, 4,				   (char *(*)(u_long))dsmccStrUpdateType_ID);    		   outBit_Sx_NL (6,"reserved: ", 		b,32, 2);    		   outBit_Sx_NL (4,"update_versioning_flag: ", 	b,34, 1);    		   outBit_Sx    (4,"update_version: ", 		b,35, 5);		   	if (s.updt_type == 0x02 || s.updt_type == 0x03) {		   		out (4, "  [--> refers to UNT version number]");		   	}		   	out_NL (4);		   s.selector_length2 = outBit_Sx_NL (4,"selector_length: ", b,40, 8);		   b += 6;		   s.OUI_data_length -= 6;        	   print_databytes (4,"Selector bytes:", b,s.selector_length2);			b += s.selector_length2;			s.OUI_data_length -= s.selector_length2;    		}		len2 = d.selector_length - s.OUI_data_length -1;    		if (len2 > 0) {		   print_private_data (4, b,len2);    		} } else {	// 0x0002 == asynchronous Data Streaming	// 0x0003 == indicate a synchronous data stream	// 0x0004 == synchronised data streams	// ... 	print_databytes (4,"Selector bytes:",  b, d.selector_length); } indent (-1); b += d.selector_length; getISO639_3 (d.ISO639_2_language_code, b); d.text_length			 = getBits (b, 0, 24, 8); out_nl    (4,"ISO639_2_language_code:  %3.3s", d.ISO639_2_language_code); out_SB_NL (5,"Text_length: ",d.text_length); print_text_468A (4, "Text: ", b+4,d.text_length);}/*  0x65  CA System descriptor   ETSI EN 300 468     6.2.x*/void descriptorDVB_CASystem (u_char *b){  descriptor_any (b);}/*  0x66  Data Broadcast ID  descriptor   ETSI EN 300 468     6.2.xx*/void descriptorDVB_DataBroadcastID  (u_char *b){ typedef struct  _descDataBroadcastID {    u_int      descriptor_tag;    u_int      descriptor_length;		    u_int      data_broadcast_id;    //  N ... id_selector bytes } descDataBroadcastID; descDataBroadcastID   d; int 		       len; d.descriptor_tag		 = b[0]; d.descriptor_length       	 = b[1]; d.data_broadcast_id		 = getBits (b, 0, 16, 16); b+=4; len = d.descriptor_length -2;  out_S2W_NL (4,"Data_broadcast_ID: ",d.data_broadcast_id,	dvbstrDataBroadcast_ID(d.data_broadcast_id)); // $$$ ID selector bytes may depend on databroadcast_id // $$$ do further more selection here // $$$ EN 301 192 Stuff TODO if (d.data_broadcast_id == 0x000A) {	// TR 102 006  Software update  S.12	int  OUI_data_len;	int  i;	out_nl    (4,"system_software_update_info [TR 102 006]:"); 	OUI_data_len = outBit_Sx_NL (4,"OUI_data_length: ",	b, 0, 8);	b++;	len--;	i = OUI_data_len;	while (i > 0) {		int len2;		out_NL (5);		indent (+1);	    	outBit_S2x_NL(5,"OUI: ", 		b, 0,24,				   (char *(*)(u_long))dsmccStrOUI ); 		outBit_Sx_NL (6,"reserved_1: ",		b,24, 4); 		outBit_S2x_NL(5,"update_type: ",	b,28, 4,				   (char *(*)(u_long)) dsmccStrUpdateType_ID ); 		outBit_Sx_NL (6,"reserved_2: ",		b,32, 2); 		outBit_Sx_NL (5,"update_versioning_flag: ",	b,34, 1); 		outBit_Sx_NL (5,"update_version: ",	b,35, 5); 		len2 = outBit_Sx_NL (5,"selector_length: ",	b,40, 8);		b += 6;		len -= 6;		i   -= 6;	     	print_databytes (5,"Selector bytes:", b, len2);		b += len2;		len -= len2;		i   -= len2;		indent (-1);	}	print_private_data (5, b, len); } else if (d.data_broadcast_id == 0x000B) {	 // -- EN 301 192 PSI Signalling IP/MAC Notification Table	 { 		typedef struct  _descIPMAC_NOTIF_TABLE {			int	platform_id_data_length;			// inner loop			u_long	platform_id;			u_int	action_type;			u_int	reserved;			u_int	INT_versioning_flag;			u_int	INT_version; 		} descIPMAC_NOTIF_TABLE;		descIPMAC_NOTIF_TABLE   d;		int 		 	len2; 		out_nl    (4,"IP/MAC Notification [EN 301 192]:"); 		d.platform_id_data_length = getBits (b, 0,  0,  8); 		out_SW_NL (5,"Platform_id_data_length: ",d.platform_id_data_length);		b++;		len--;		len2 = d.platform_id_data_length;		indent (+1);		while (len2 > 0) {		   out_NL (5);        	   d.platform_id  		= getBits (b, 0,  0, 24);        	   d.action_type		= getBits (b, 0, 24,  8);        	   d.reserved			= getBits (b, 0, 32,  2);        	   d.INT_versioning_flag	= getBits (b, 0, 34,  1);        	   d.INT_version		= getBits (b, 0, 35,  5);		   b += 5;		   len -= 5;		   len2 -= 5; 		   out_S2T_NL  (5,"Platform_id: ",d.platform_id,				   dsmccStrPlatform_ID (d.platform_id)); 		   out_S2B_NL  (5,"Action_type: ",d.action_type,				   dsmccStrAction_Type(d.action_type)); 		   out_SB_NL  (5,"reserved: ",d.reserved); 		   out_SB_NL  (5,"INT_versioning_flag: ",d.INT_versioning_flag); 		   out_SB_NL  (5,"INT_version: ",d.INT_version);		}		indent (-1); 	     		print_private_data (5, b, len);	 }	 } else {     	print_databytes(4,"ID_selector_bytes:", b, len); }}/*  0x67  Transport Stream  descriptor   ETSI EN 300 468     6.2.xx*/void descriptorDVB_TransportStream  (u_char *b){ typedef struct  _descTransportStream {    u_int      descriptor_tag;    u_int      descriptor_length;		    //   N ... bytes } descTransportStream; descTransportStream   d; d.descriptor_tag		 = b[0]; d.descriptor_length       	 = b[1];  print_databytes (4,"transport_stream_bytes:", b+2, d.descriptor_length);}/*  0x68  DSNG  descriptor   ETSI EN 300 468     6.2.xx*/void descriptorDVB_DSNG  (u_char *b){ typedef struct  _descDSNG {    u_int      descriptor_tag;    u_int      descriptor_length;		    //  N ... bytes } descDSNG; descDSNG   d; d.descriptor_tag		 = b[0]; d.descriptor_length       	 = b[1]; print_databytes (4,"DSNG_bytes:", b+2, d.descriptor_length);}/*  0x69  PDC  descriptor   ETSI EN 300 468     6.2.xx*/void descriptorDVB_PDC  (u_char *b){ typedef struct  _descPDC {    u_int      descriptor_tag;    u_int      descriptor_length;    u_int      reserved_1;    u_long     programme_identification_label;    // ... splits in    u_int     day;    u_int     month;    u_int     hour;    u_int     minute; } descPDC; descPDC   d; d.descriptor_tag		 = b[0]; d.descriptor_length       	 = b[1]; d.reserved_1			 = getBits (b, 0, 16, 4); d.programme_identification_label = getBits (b, 0, 20, 20);    d.day     = getBits (b,0,20,5);    d.month   = getBits (b,0,25,4);    d.hour    = getBits (b,0,29,5);    d.minute  = getBits (b,0,34,6); out_SB_NL (6,"reserved_1: ",d.reserved_1); out       (4,"Programme_identification_label: 0x%05lx ",	d.programme_identification_label); out       (4,"[= month=%d  day=%d   hour=%d  min=%d]",	d.month, d.day, d.hour, d.minute); out_NL (4);}/*  0x6A  AC-3  descriptor   ETSI EN 300 468    ANNEX E */void descriptorDVB_AC3  (u_char *b){ typedef struct  _descAC3 {    u_int      descriptor_tag;    u_int      descriptor_length;    u_int      AC3_type_flag;    u_int      bsid_flag;    u_int      mainid_flag;    u_int      asvc_flag;    u_int      reserved_1;    // conditional vars    u_int      AC3_type;    u_int      bsid_type;    u_int      mainid_type;    u_int      asvc_type;    // N ...  bytes add info } descAC3; descAC3   d; int       len; d.descriptor_tag		 = b[0]; d.descriptor_length       	 = b[1]; d.AC3_type_flag		 = getBits (b, 0, 16, 1); d.bsid_flag			 = getBits (b, 0, 17, 1); d.mainid_flag			 = getBits (b, 0, 18, 1); d.asvc_flag			 = getBits (b, 0, 19, 1); d.reserved_1			 = getBits (b, 0, 20, 4); out_SB_NL (4,"AC3_type_flag: ",d.AC3_type_flag); out_SB_NL (4,"bsid_flag: ",d.bsid_flag); out_SB_NL (4,"mainid_flag: ",d.mainid_flag); out_SB_NL (4,"asvc_flag: ",d.asvc_flag); out_SB_NL (6,"reserved_1: ",d.reserved_1); b   += 3; len  = d.descriptor_length - 2; if (d.AC3_type_flag) {     d.AC3_type			 = b[0];     b++;     len--;     out_SB_NL (4,"AC3_type: ",d.AC3_type); } if (d.bsid_flag) {     d.bsid_flag		 = b[0];     b++;     len--;     out_SB_NL (4,"bsid_flag: ",d.bsid_flag); } if (d.mainid_flag) {     d.mainid_flag		 = b[0];     b++;     len--;     out_SB_NL (4,"mainid_flag: ",d.mainid_flag); } if (d.a

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -