changeset 3:6801fe7e04ff

updated to ariv25v023
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 17 Feb 2009 01:40:56 +0900
parents 8ac7c59fefc9
children 43d177fa65c9
files arib25v021/arib25/.cproject arib25v021/arib25/.project arib25v021/arib25/.settings/org.eclipse.core.resources.prefs arib25v021/arib25/Makefile arib25v021/arib25/arib_std_b25.sln arib25v021/arib25/arib_std_b25.vcproj arib25v021/arib25/readme.txt arib25v021/arib25/src/Makefile arib25v021/arib25/src/arib_std_b25.c arib25v021/arib25/src/arib_std_b25.h arib25v021/arib25/src/arib_std_b25_error_code.h arib25v021/arib25/src/b_cas_card.c arib25v021/arib25/src/b_cas_card.h arib25v021/arib25/src/b_cas_card_error_code.h arib25v021/arib25/src/makefile.win arib25v021/arib25/src/multi2.c arib25v021/arib25/src/multi2.h arib25v021/arib25/src/multi2_error_code.h arib25v021/arib25/src/portable.h arib25v021/arib25/src/td.c arib25v021/arib25/src/ts_common_types.h arib25v021/arib25/src/ts_section_parser.c arib25v021/arib25/src/ts_section_parser.h arib25v021/arib25/src/ts_section_parser_error_code.h arib25v021/libccid_Info.plist arib25v021/readme.txt arib25v021/smartcard_list.txt arib25v023/arib25/.cproject arib25v023/arib25/.project arib25v023/arib25/.settings/org.eclipse.core.resources.prefs arib25v023/arib25/Makefile arib25v023/arib25/arib_std_b25.sln arib25v023/arib25/arib_std_b25.vcproj arib25v023/arib25/readme.txt arib25v023/arib25/src/Makefile arib25v023/arib25/src/arib_std_b25.c arib25v023/arib25/src/arib_std_b25.h arib25v023/arib25/src/arib_std_b25_error_code.h arib25v023/arib25/src/b_cas_card.c arib25v023/arib25/src/b_cas_card.h arib25v023/arib25/src/b_cas_card_error_code.h arib25v023/arib25/src/makefile.win arib25v023/arib25/src/multi2.c arib25v023/arib25/src/multi2.h arib25v023/arib25/src/multi2_error_code.h arib25v023/arib25/src/portable.h arib25v023/arib25/src/td.c arib25v023/arib25/src/ts_common_types.h arib25v023/arib25/src/ts_section_parser.c arib25v023/arib25/src/ts_section_parser.h arib25v023/arib25/src/ts_section_parser_error_code.h arib25v023/libccid_Info.plist arib25v023/readme.txt arib25v023/smartcard_list.txt recpt1/Makefile recpt1/decoder.h recpt1/recpt1.c recpt1/recpt1.h
diffstat 58 files changed, 8766 insertions(+), 8748 deletions(-) [+]
line wrap: on
line diff
--- a/arib25v021/arib25/.cproject	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?fileVersion 4.0.0?>
-
-<cproject>
-<storageModule moduleId="org.eclipse.cdt.core.settings">
-<cconfiguration id="0.2092644647">
-<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.2092644647" moduleId="org.eclipse.cdt.core.settings" name="デフォルト">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="cdtBuildSystem" version="4.0.0">
-<configuration artifactName="arib25" buildProperties="" description="" id="0.2092644647" name="デフォルト" parent="org.eclipse.cdt.build.core.prefbase.cfg">
-<folderInfo id="0.2092644647." name="/" resourcePath="">
-<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.688074301" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
-<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.688074301.278752691" name=""/>
-<builder autoBuildTarget="all" buildPath="${workspace_loc:/arib25}" cleanBuildTarget="clean" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.700134985" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
-<tool id="org.eclipse.cdt.build.core.settings.holder.libs.310034476" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
-<tool id="org.eclipse.cdt.build.core.settings.holder.763264754" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
-<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1029322776" name="インクルード・パス" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
-<listOptionValue builtIn="false" value="/usr/include/PCSC"/>
-</option>
-<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1774263112" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
-</tool>
-<tool id="org.eclipse.cdt.build.core.settings.holder.1843852156" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
-<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1633338499" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
-<listOptionValue builtIn="false" value="/usr/include/PCSC"/>
-</option>
-<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.68868800" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
-</tool>
-<tool id="org.eclipse.cdt.build.core.settings.holder.1110713882" name="アセンブリー" superClass="org.eclipse.cdt.build.core.settings.holder">
-<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1161623323" languageId="org.eclipse.cdt.core.assembly" languageName="アセンブリー" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
-</tool>
-</toolChain>
-</folderInfo>
-</configuration>
-</storageModule>
-
-<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
-<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
-<storageModule moduleId="scannerConfiguration">
-<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="makefileGenerator">
-<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<scannerConfigBuildInfo instanceId="0.2092644647">
-<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="specsFile">
-<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
-<buildOutputProvider>
-<openAction enabled="true" filePath=""/>
-<parser enabled="true"/>
-</buildOutputProvider>
-<scannerInfoProvider id="makefileGenerator">
-<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
-<parser enabled="true"/>
-</scannerInfoProvider>
-</profile>
-</scannerConfigBuildInfo>
-</storageModule>
-</cconfiguration>
-</storageModule>
-<storageModule moduleId="cdtBuildSystem" version="4.0.0">
-<project id="arib25.null.793956085" name="arib25"/>
-</storageModule>
-</cproject>
--- a/arib25v021/arib25/.project	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>arib25</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
-			<triggers>clean,full,incremental,</triggers>
-			<arguments>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
-					<value>all</value>
-				</dictionary>
-				<dictionary>
-					<key>?name?</key>
-					<value></value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
-					<value>false</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.buildLocation</key>
-					<value>${workspace_loc:/arib25}</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.enableFullBuild</key>
-					<value>true</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
-					<value>true</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
-					<value>clean</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.append_environment</key>
-					<value>true</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.contents</key>
-					<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
-					<value>true</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.buildArguments</key>
-					<value></value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.buildCommand</key>
-					<value>make</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
-					<value>all</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.stopOnError</key>
-					<value>true</value>
-				</dictionary>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.cdt.core.cnature</nature>
-		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
-		<nature>org.eclipse.cdt.core.ccnature</nature>
-		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
-	</natures>
-</projectDescription>
--- a/arib25v021/arib25/.settings/org.eclipse.core.resources.prefs	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-#Wed Jan 23 22:50:22 JST 2008
-eclipse.preferences.version=1
-encoding/<project>=Windows-31J
--- a/arib25v021/arib25/Makefile	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-all:
-	cd src; make all
-
-clean:
-	cd src; make clean
-	
--- a/arib25v021/arib25/arib_std_b25.sln	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "arib_std_b25", "arib_std_b25.vcproj", "{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Win32 = Debug|Win32
-		Release|Win32 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}.Debug|Win32.ActiveCfg = Debug|Win32
-		{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}.Debug|Win32.Build.0 = Debug|Win32
-		{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}.Release|Win32.ActiveCfg = Release|Win32
-		{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}.Release|Win32.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
--- a/arib25v021/arib25/arib_std_b25.vcproj	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-<?xml version="1.0" encoding="shift_jis"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="arib_std_b25"
-	ProjectGUID="{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}"
-	RootNamespace="arib_std_b25"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				UseUnicodeResponseFiles="false"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="winscard.lib"
-				OutputFile="$(OutDir)\b25.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				UseUnicodeResponseFiles="false"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				RuntimeLibrary="0"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="winscard.lib"
-				OutputFile="$(OutDir)\b25.exe"
-				LinkIncremental="1"
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="\[X t@C"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath=".\src\arib_std_b25.c"
-				>
-			</File>
-			<File
-				RelativePath=".\src\b_cas_card.c"
-				>
-			</File>
-			<File
-				RelativePath=".\src\multi2.c"
-				>
-			</File>
-			<File
-				RelativePath=".\src\td.c"
-				>
-			</File>
-			<File
-				RelativePath=".\src\ts_section_parser.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="wb_[ t@C"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath=".\src\arib_std_b25.h"
-				>
-			</File>
-			<File
-				RelativePath=".\src\arib_std_b25_error_code.h"
-				>
-			</File>
-			<File
-				RelativePath=".\src\b_cas_card.h"
-				>
-			</File>
-			<File
-				RelativePath=".\src\b_cas_card_error_code.h"
-				>
-			</File>
-			<File
-				RelativePath=".\src\multi2.h"
-				>
-			</File>
-			<File
-				RelativePath=".\src\multi2_error_code.h"
-				>
-			</File>
-			<File
-				RelativePath=".\src\portable.h"
-				>
-			</File>
-			<File
-				RelativePath=".\src\ts_common_types.h"
-				>
-			</File>
-			<File
-				RelativePath=".\src\ts_section_parser.h"
-				>
-			</File>
-			<File
-				RelativePath=".\src\ts_section_parser_error_code.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="\[X t@C"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
--- a/arib25v021/arib25/readme.txt	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,334 +0,0 @@
-ýz
-
-@ARIB STD-B25 dlmFeXgvO\[XR[h
-
-yo[Wz
-
-@0.2.0
-
-yҁz
-
-@Ζ am (MOGI, Kazuhiro) 
-@kazhiro@marumo.ne.jp
-
-yꎟzzz
-
-@http://www.marumo.ne.jp/db2008_4.htm#09
-
-@邢
-
-@http://www.marumo.ne.jp/junk/arib_std_b25-0.2.1.lzh
-
-yړIz
-
-@ARIB STD-B25 ̎dl𗝉ׂ́AQlp̎ƂČJ
-
-ywiz
-
-@2011 N 7 ̒nAiOgTAȒnfW^
-@M@̔̔҂Ă
-
-@AARIB ̕W͂킴ƔɂĊJ܂
-@悤ƂĂƂvȂقǂɈӖsĂȋLqɂȂĂ
-@̂܂܂ł͒ቿiM@̊JȂǕs”\Ɏv
-
-@ŁAȂ ARIB Wǂ݁A͈͂\[X
-@R[ȟ`ɂ܂Ƃ߂ČJ邱Ƃɂ
-
-@̃R[hȎM@̊J̈ꏕƂȂ邱Ƃ҂
-
-@ȂA܂łdlړIƂ̂ł邽߁Arhς
-@oCit@C͔zzȂ
-
-ý͈z
-
-@CA VXe (B-CAS J[h֘A) 𒆐S ECM ̏ƃXg[
-@Í̕AEMM ܂ł
-
-@EMM bZ[W֘A͖ƂȂĂ
-
-yvO̓‹z
-
-@ISO 7816 Ή IC J[h[_CXg[ꂽ Windows PC 
-@z蓮‹Ƃ
-
-@ISO 7816 ΉX}[gJ[h[_[͈ʂ
-@uZJ[hΉ IC J[h[_vue-Tax Ή IC J[h[_v
-@ȂǂƂ 4000 ~xŔ̔Ă̂p”\ł
-
-@}NZ HX-520UJJ Őɓ삷邱ƂmFĂ
-
-y\[XR[h̃CZXɂ‚āz
-
-@E\[XR[h𗘗pƂɂāÃguĂ
-@@Ζ am͐ӔC𕉂Ȃ
-@E\[XR[h𗘗pƂɂāAvOɖ肪Ă
-@@Ζ am͐ӔC𕉂Ȃ
-
-@L 2 ɓӂč쐬ꂽ񎟓I앨ɑ΂āAΖ am
-@҂ɗ^鏔sgȂ
-
-yvO̍\z
-
-@Earib_std_b25.h/c
-
-@@ARIB STD-B25 Lڂ̏s߂̃W[
-@@MPEG-2 TS ̕ACA VXe (B-CAS J[h) @\̌ĂяoA
-@@MULTI2 @\̌ĂяoS
-
-@Ets_section_parser.h/c
-
-@@MPEG-2 TS ̃ZNV`f[^̕S
-
-@Eb_cas_card.h/c
-
-@@CA VXe (B-CAS J[h) ̃\[XǗђڂ̐
-@@S
-
-@Emulti2.h/c
-
-@@MULTI2 Í̕ƕS
-
-@Etd.c
-
-@@eXghCo
-@@PAT/PMT/ECM ܂ MPEG-2 TS t@Cǂݍ݁A
-@@MPEG-2 TS t@Co͂
-
-@@R}hCIvV MULTI2 Í̃Ehw”\
-@@Ehw肵Ȃꍇ̏l 4
-
-@@̃Eh 4  MULTI2 pł 32 ɑ
-
-@@ARIB STD-B25 ł MULTI2 ̃Eh͔Jp[^
-@@Ŏۂ̃Eh͐”\ł
-
-y̗z
-
-@EN
-
-@@1 AvP[V B_CAS_CARD W[̃CX^X
-@@@쐬AB_CAS_CARD W[ɁA˗
-
-@@1.a B_CAS_CARD W[ WIN32 API ̃X}[gJ[h֘A
-@@@@API ĂяoACA VXeɐڑ
-@@1.b B_CAS_CARD W[ ARIB STD-B25 Lڂ́u
-@@@@ݒR}h CA VXeɔsAVXe (64 byte)
-@@@@ CBC  (8 byte) 󂯎 
-
-@@2 AvP[V ARIB_STD_B25 W[̃CX^X
-@@@쐬AB_CAS_CARD W[ ARIB_STD_B25 W[
-@@@o^
-
-@Ef[^
-
-@@1 AvP[V ARIB_STD_B25 W[ɏf[^
-@@@񋟂AARIB_STD_B25 W[珈f[^
-@@@ăt@Cɏo͂Ă
-
-@@EARIB_STD_B25 W[
-
-@@@1 TS pPbg̃jbgTCY (188/192/204 ȂǂʓI) 
-@@@@肳ĂȂꍇ 8K ܂œ̓f[^obt@ĂA
-@@@@jbgTCY肷
-@@@@jbgTCYłȂꍇ́AG[I
-
-@@@2 PAT ĂȂꍇAPAT ł܂œ
-@@@@f[^obt@
-@@@@PAT łɃobt@TCY 16M 𒴉߂ꍇ
-@@@@G[I
-@@@@PAT łꍇAvOz쐬 PID }bv
-@@@@zɓo^
-
-@@@3 PAT ɓo^Ă PMT ׂĂ邩Aǂꂩ
-@@@@ЂƂ‚ PMT  2 –ڂ̃ZNV܂œ
-@@@@f[^obt@
-@@@@L𖞂Ƀobt@TCY 32M 𒴉߂ꍇ
-@@@@G[I
-@@@@PMT 閈 ECM ̗LmFAECM ݂
-@@@@ꍇ̓fNv^쐬ăvOɏXg[
-@@@@ PID }bvŊ֘At
-
-@@@4 PMT ɓo^Ă ECM ׂĂ邩Aǂꂩ
-@@@@ЂƂ‚ ECM  2 –ڂ̃ZNV܂œ
-@@@@f[^obt@
-@@@@L𖞂Ƀobt@TCY 32M 𒴉߂ꍇ
-@@@@G[I
-@@@@e ECM ɑ΂āAŏ̃ZNVf[^_
-@@@@MULTI2 W[̃CX^XfNv^ɍ쐬
-@@@@ECM ZNVf[^ B_CAS_CARD W[ɒ񋟂
-@@@@XNu󂯎AMULTI2 W[ɃVXeA
-@@@@ CBC ԁAXNunAMULTI2 ̏
-@@@@s
-
-@@@5.a ÍĂ TS pPbgł΁APID Ή
-@@@@@ECM Xg[肵AfNv^ MULTI2 W[
-@@@@@ɕďo̓obt@ɐς
-@@@@
-@@@5.b ÍĂȂ TS pPbgł΁Â܂܏o
-@@@@@obt@ɐς
-
-@@@5.c CAT oꍇAEMM  PID 擾 EMM ̏
-@@@@@s
-
-@@@5.d EMM 󂯎ꍇAB-CAS J[h ID ƔrA
-@@@@@Ă EMM ł B-CAS J[hɈnď
-@@@@@# EMM IvVw肳Ăꍇ
-
-@@@6 ECM XVꂽꍇAB_CAS_CARD W[ɏ
-@@@@˗Ao͂ꂽXNu MULTI2 W[
-@@@@o^
-
-@@@7 PMT XVꂽꍇAECM PID ωĂΐV
-@@@@fNv^쐬 4 ɖ߂
-
-@@@8 PAT XVꂽꍇAvOzj
-@@@@3 ɖ߂
-
-@EI
-
-@@1 eW[mۂ\[X
-
-yXVz
-
-@E2008, 4/9 - ver. 0.2.1
-
-@@PAT XVɕRꂪĂoOC
-@@(ver. 0.2.0 ł̃GoO)
-
-@@ PID (PMT ɋLڂĂȂXg[) ݂ꍇ
-@@TS  ECM ЂƂ‚Ȃ΁A ECM ŕ`ɕύX
-
-@@EMM  B-CAS J[hւ̑MIvVőI”\ɕύX (-m)
-@@i󋵂̕\IvVőI”\ɕύX (-v)
-@@ʓd (EMMMp) \IvVlj (-p)
-
-@@http://www.marumo.ne.jp/db2008_4.htm#9 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.2.1.lzh
-
-@E2008, 4/6 - ver. 0.2.0
-
-@@EMM Ή
-@@p B-CAS J[h ID  EMM oꍇAEMM 
-@@B-CAS J[hɓnlj
-
-@@ECM ̍ۂɖ_񉞓ԂꂽꍇA׌ÿׁA
-@@ȍ~A PID  ECM  B-CAS J[hŏȂ悤ɕ
-@@X (EMM ꍇ͍Ă ECM 悤ɖ߂)
-
-@@i nn.nn% ̏ŕWG[o͂ɕ\悤ɕύX
-@@
-@@http://www.marumo.ne.jp/db2008_4.htm#6 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.2.0.lzh
-
-@E2008, 3/31 - ver. 0.1.9
-
-@@MULTI2 W[̃CX^X쐻̏󋵂ŁAMULTI2 
-@@@\ĂяoėO𔭐邱ƂoOC
-
-@@# pb`񋟂ĂꂽɊ
-
-@@http://www.marumo.ne.jp/db2008_3.htm#31 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.9.lzh
-
-@E2008, 3/24 - ver. 0.1.8
-
-@@-s IvV (NULL pPbg̍폜) lj
-@@-s 1  NULL pPbgo̓t@Cɂ͕ۑȂȂ
-@@ftHg -s 0  NULL pPbgێ
-
-@@http://www.marumo.ne.jp/db2008_3.htm#24 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.8.lzh
-
-@E2008, 3/17 - ver. 0.1.7
-
-@@arib_std_b25.h Ɂuextern "C" {v‚R[hȂ 
-@@(C++ R[h痘pꍇɃRpCG[𔭐) 
-@@C
-
-@@TS pPbg̒rŃXg[؂ւP[XŖ肪
-@@ɂȂ悤ɁAarib_std_b25.c ̃R[hC
-
-@@http://www.marumo.ne.jp/db2008_3.htm#17 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.7.lzh
-
-@E2008, 3/16 - ver. 0.1.6
-
-@@PMT XV̍ہAECM ֘Ȁ󋵂ύX (XNu - mXN
-@@u̐؂ւAECM PID ̕ύX) sĂAꂪ
-@@fĂȂC
-
-@@http://www.marumo.ne.jp/db2008_3.htm#16 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.6.lzh
-
-@E2008, 2/14
-
-@@readme.txt (̃t@C) C
-@@\[XR[h̃CZXɂ‚Ă̋Lqlj
-
-@E2008, 2/12 - ver. 0.1.5
-
-@@PMT ̍XVɔAǂ̃vOɂȂȂ PID (Xg
-@@[) ŃpPbgMꑱꍇÃpPbg̕
-@@łȂȂĂC
-
-@@http://www.marumo.ne.jp/db2008_2.htm#12 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.5.lzh
-
-@E2008, 2/2 - ver. 0.1.4
-
-@@ver. 0.1.3 ł PMT @ύXɖ肪APMT XVꂽ
-@@ꍇAȍ~ŐȏsȂȂĂoOC
-
-@@B-CAS J[hƂ̒ʐMŃG[ꍇ̃gC@\
-@@ĂȂoOC
-
-@@http://www.marumo.ne.jp/db2008_2.htm#2 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.4.lzh
-
-@E2008, 2/1 - ver. 0.1.3
-
-@@LŖ_Ԃ B-CAS J[hgۂɁA擾
-@@ĂȂɂ炸AԈŕĂɑΏ
-
-@@擾łȂ ECM Ɋ֘AtꂽXg[ł͕
-@@s킸AXNutOc܂ܓ͂fʂ`ɕύX
-@@擾łȂ ECM ݂ꍇAIɃ`lԍ
-@@B-CAS J[h擾łG[ԍxbZ[WƂĕ\
-@@`ɕύX
-
-@@ÍĂȂvOŗO𔭐ĂoOC
-
-@@http://www.marumo.ne.jp/db2008_2.htm#1 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.3.lzh
-
-@E2008, 1/11 - ver. 0.1.2
-
-@@fW^ BS ŁAPAT ɓo^Ă̂ɁAXg[
-@@PMT ؏oȂƂꍇɑΉ
-
-@@PMT ̋Lqq̈ 2  CA_descriptor ݂ꍇɑΉ
-@@ arib_std_b25.c ł̏\ύX
-
-@@ʃvOƓs邽߂ɃX}[gJ[h̔rw
-@@ύX
-
-@@http://www.marumo.ne.jp/db2008_1.htm#11 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.2.lzh
-
-@E2008, 1/7 - ver. 0.1.1
-
-@@ZNV (PAT/PMT/ECM )  TS pPbgɕĂ
-@@ꍇɁAɏłȂAO𔭐邱Ƃ
-@@oOC
-
-@@http://www.marumo.ne.jp/db2008_1.htm#7 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.1.lzh
-
-@E2007, 11/25 - ver. 0.1.0
-
-@@J
-
-@@http://www.marumo.ne.jp/db2007_b.htm#25 
-@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.0.lzh
-
--- a/arib25v021/arib25/src/Makefile	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-# PC/SC Lite libraries and headers.
-PCSC_CFLAGS ?= `pkg-config libpcsclite --cflags`
-PCSC_LDLIBS ?= `pkg-config libpcsclite --libs`
-
-CC     = gcc
-CFLAGS = -Wall -O2 -g $(PCSC_CFLAGS) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-LDLIBS = $(PCSC_LDLIBS) -lm
- 
-TARGET = b25
-OBJS   = arib_std_b25.o b_cas_card.o multi2.o td.o ts_section_parser.o
-
-all: $(TARGET)
-
-arib_std_b25.o: arib_std_b25.c arib_std_b25.h portable.h b_cas_card.h arib_std_b25_error_code.h multi2.h ts_section_parser.h ts_common_types.h
-b_cas_card.o: b_cas_card.c b_cas_card.h portable.h b_cas_card_error_code.h 
-multi2.o: multi2.c multi2.h portable.h multi2_error_code.h 
-td.o: td.c arib_std_b25.h portable.h b_cas_card.h 
-ts_section_parser.o: ts_section_parser.c ts_section_parser.h ts_common_types.h portable.h ts_section_parser_error_code.h
-
-$(TARGET): $(OBJS)
-	$(CC) $(LDLIBS) -o $(TARGET) $(OBJS)
-
-clean:
-	rm -f *.o
-	rm -f $(TARGET)
--- a/arib25v021/arib25/src/arib_std_b25.c	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2592 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-
-#include "arib_std_b25.h"
-#include "arib_std_b25_error_code.h"
-#include "multi2.h"
-#include "ts_common_types.h"
-#include "ts_section_parser.h"
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- inner structures
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-typedef struct {
-	int32_t           pid;
-	int32_t           type;
-	void             *prev;
-	void             *next;
-} TS_STREAM_ELEM;
-
-typedef struct {
-	TS_STREAM_ELEM   *head;
-	TS_STREAM_ELEM   *tail;
-	int32_t           count;
-} TS_STREAM_LIST;
-
-typedef struct {
-	
-	uint8_t          *pool;
-	uint8_t          *head;
-	uint8_t          *tail;
-	int32_t           max;
-	
-} TS_WORK_BUFFER;
-
-typedef struct {
-
-	int32_t            phase;
-
-	int32_t            program_number;
-
-	int32_t            pmt_pid;
-	TS_SECTION_PARSER *pmt;
-
-	int32_t            pcr_pid;
-
-	TS_STREAM_LIST     streams;
-	TS_STREAM_LIST     old_strm;
-
-} TS_PROGRAM;
-
-typedef struct {
-
-	int32_t            ref;
-	int32_t            phase;
-
-	int32_t            locked;
-
-	int32_t            ecm_pid;
-	TS_SECTION_PARSER *ecm;
-
-	MULTI2            *m2;
-
-	int32_t            unpurchased;
-	int32_t            last_error;
-
-	void              *prev;
-	void              *next;
-
-} DECRYPTOR_ELEM;
-
-typedef struct {
-	DECRYPTOR_ELEM    *head;
-	DECRYPTOR_ELEM    *tail;
-	int32_t            count;
-} DECRYPTOR_LIST;
-
-typedef struct {
-	uint32_t           ref;
-	uint32_t           type;
-	int64_t            normal_packet;
-	int64_t            undecrypted;
-	void              *target;
-} PID_MAP;
-
-typedef struct {
-
-	int32_t            multi2_round;
-	int32_t            strip;
-	int32_t            emm_proc_on;
-	
-	int32_t            unit_size;
-
-	int32_t            sbuf_offset;
-
-	TS_SECTION_PARSER *pat;
-	TS_SECTION_PARSER *cat;
-
-	TS_STREAM_LIST     strm_pool;
-	
-	int32_t            p_count;
-	TS_PROGRAM        *program;
-
-	DECRYPTOR_LIST     decrypt;
-
-	PID_MAP            map[0x2000];
-
-	B_CAS_CARD        *bcas;
-	B_CAS_ID           casid;
-
-	int32_t            emm_pid;
-	TS_SECTION_PARSER *emm;
-
-	TS_WORK_BUFFER     sbuf;
-	TS_WORK_BUFFER     dbuf;
-	
-} ARIB_STD_B25_PRIVATE_DATA;
-
-typedef struct {
-	int64_t            card_id;
-	int32_t            associated_information_length;
-	int32_t            protocol_number;
-	int32_t            broadcaster_group_id;
-	int32_t            update_number;
-	int32_t            expiration_date;
-} EMM_FIXED_PART;
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- constant values
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-enum TS_STREAM_TYPE {
-	TS_STREAM_TYPE_11172_2_VIDEO                = 0x01,
-	TS_STREAM_TYPE_13818_2_VIDEO                = 0x02,
-	TS_STREAM_TYPE_11172_3_AUDIO                = 0x03,
-	TS_STREAM_TYPE_13818_3_AUDIO                = 0x04,
-	TS_STREAM_TYPE_13818_1_PRIVATE_SECTIONS     = 0x05,
-	TS_STREAM_TYPE_13818_1_PES_PRIVATE_DATA     = 0x06,
-	TS_STREAM_TYPE_13522_MHEG                   = 0x07,
-	TS_STREAM_TYPE_13818_1_DSM_CC               = 0x08,
-	TS_STREAM_TYPE_H_222_1                      = 0x09,
-	TS_STREAM_TYPE_13818_6_TYPE_A               = 0x0a,
-	TS_STREAM_TYPE_13818_6_TYPE_B               = 0x0b,
-	TS_STREAM_TYPE_13818_6_TYPE_C               = 0x0c,
-	TS_STREAM_TYPE_13818_6_TYPE_D               = 0x0d,
-	TS_STREAM_TYPE_13818_1_AUX                  = 0x0e,
-	TS_STREAM_TYPE_13818_7_AUDIO_ADTS           = 0x0f,
-	TS_STREAM_TYPE_14496_2_VISUAL               = 0x10,
-	TS_STREAM_TYPE_14496_3_AUDIO_LATM           = 0x11,
-	TS_STREAM_TYPE_14496_1_PES_SL_PACKET        = 0x12,
-	TS_STREAM_TYPE_14496_1_SECTIONS_SL_PACKET   = 0x13,
-	TS_STREAM_TYPE_13818_6_SYNC_DWLOAD_PROTCOL  = 0x14,
-};
-
-enum TS_SECTION_ID {
-	TS_SECTION_ID_PROGRAM_ASSOCIATION           = 0x00,
-	TS_SECTION_ID_CONDITIONAL_ACCESS            = 0x01,
-	TS_SECTION_ID_PROGRAM_MAP                   = 0x02,
-	TS_SECTION_ID_DESCRIPTION                   = 0x03,
-	TS_SECTION_ID_14496_SCENE_DESCRIPTION       = 0x04,
-	TS_SECTION_ID_14496_OBJECT_DESCRIPTION      = 0x05,
-
-	/* ARIB STD-B10 stuff */
-	TS_SECTION_ID_DSM_CC_HEAD                   = 0x3a,
-	TS_SECTION_ID_DSM_CC_TAIL                   = 0x3f,
-	TS_SECTION_ID_NIT_ACTUAL                    = 0x40,
-	TS_SECTION_ID_NIT_OTHER                     = 0x41,
-	TS_SECTION_ID_SDT_ACTUAL                    = 0x42,
-	TS_SECTION_ID_SDT_OTHER                     = 0x46,
-	TS_SECTION_ID_BAT                           = 0x4a,
-	TS_SECTION_ID_EIT_ACTUAL_CURRENT            = 0x4e,
-	TS_SECTION_ID_EIT_OTHER_CURRENT             = 0x4f,
-	TS_SECTION_ID_EIT_ACTUAL_SCHEDULE_HEAD      = 0x50,
-	TS_SECTION_ID_EIT_ACTUAL_SCHEDULE_TAIL      = 0x5f,
-	TS_SECTION_ID_EIT_OTHER_SCHEDULE_HEAD       = 0x60,
-	TS_SECTION_ID_EIT_OTHER_SCHEDULE_TAIL       = 0x6f,
-	TS_SECTION_ID_TDT                           = 0x70,
-	TS_SECTION_ID_RST                           = 0x71,
-	TS_SECTION_ID_ST                            = 0x72,
-	TS_SECTION_ID_TOT                           = 0x73,
-	TS_SECTION_ID_AIT                           = 0x74,
-	TS_SECTION_ID_DIT                           = 0x7e,
-	TS_SECTION_ID_SIT                           = 0x7f,
-	TS_SECTION_ID_ECM_S                         = 0x82,
-	TS_SECTION_ID_ECM                           = 0x83,
-	TS_SECTION_ID_EMM_S                         = 0x84,
-	TS_SECTION_ID_EMM_MESSAGE                   = 0x85,
-	TS_SECTION_ID_DCT                           = 0xc0,
-	TS_SECTION_ID_DLT                           = 0xc1,
-	TS_SECTION_ID_PCAT                          = 0xc2,
-	TS_SECTION_ID_SDTT                          = 0xc3,
-	TS_SECTION_ID_BIT                           = 0xc4,
-	TS_SECTION_ID_NBIT_BODY                     = 0xc5,
-	TS_SECTION_ID_NBIT_REFERENCE                = 0xc6,
-	TS_SECTION_ID_LDT                           = 0xc7,
-	TS_SECTION_ID_CDT                           = 0xc8,
-	TS_SECTION_ID_LIT                           = 0xd0,
-	TS_SECTION_ID_ERT                           = 0xd1,
-	TS_SECTION_ID_ITT                           = 0xd2,
-};
-
-enum TS_DESCRIPTOR_TAG {
-	TS_DESCRIPTOR_TAG_VIDEO_STREAM              = 0x02,
-	TS_DESCRIPTOR_TAG_AUDIO_STREAM              = 0x03,
-	TS_DESCRIPTOR_TAG_HIERARCHY                 = 0x04,
-	TS_DESCRIPTOR_TAG_REGISTRATION              = 0x05,
-	TS_DESCRIPTOR_TAG_DATA_STREAM_ALIGNMENT     = 0x06,
-	TS_DESCRIPTOR_TAG_TARGET_BACKGROUND_GRID    = 0x07,
-	TS_DESCRIPTOR_TAG_VIDEO_WINDOW              = 0x08,
-	TS_DESCRIPTOR_TAG_CA                        = 0x09,
-	TS_DESCRIPTOR_TAG_ISO_639_LANGUAGE          = 0x0a,
-	TS_DESCRIPTOR_TAG_SYSTEM_CLOCK              = 0x0b,
-	TS_DESCRIPTOR_TAG_MULTIPLEX_BUF_UTILIZ      = 0x0c,
-	TS_DESCRIPTOR_TAG_COPYRIGHT                 = 0x0d,
-	TS_DESCRIPTOR_TAG_MAXIMUM_BITRATE           = 0x0e,
-	TS_DESCRIPTOR_TAG_PRIVATE_DATA_INDICATOR    = 0x0f,
-	TS_DESCRIPTOR_TAG_SMOOTHING_BUFFER          = 0x10,
-	TS_DESCRIPTOR_TAG_STD                       = 0x11,
-	TS_DESCRIPTOR_TAG_IBP                       = 0x12,
-	TS_DESCRIPTOR_TAG_MPEG4_VIDEO               = 0x1b,
-	TS_DESCRIPTOR_TAG_MPEG4_AUDIO               = 0x1c,
-	TS_DESCRIPTOR_TAG_IOD                       = 0x1d,
-	TS_DESCRIPTOR_TAG_SL                        = 0x1e,
-	TS_DESCRIPTOR_TAG_FMC                       = 0x1f,
-	TS_DESCRIPTOR_TAG_EXTERNAL_ES_ID            = 0x20,
-	TS_DESCRIPTOR_TAG_MUXCODE                   = 0x21,
-	TS_DESCRIPTOR_TAG_FMX_BUFFER_SIZE           = 0x22,
-	TS_DESCRIPTOR_TAG_MULTIPLEX_BUFFER          = 0x23,
-	TS_DESCRIPTOR_TAG_AVC_VIDEO                 = 0x28,
-	TS_DESCRIPTOR_TAG_AVC_TIMING_HRD            = 0x2a,
-
-	/* ARIB STD-B10 stuff */
-	TS_DESCRIPTOR_TAG_NETWORK_NAME              = 0x40,
-	TS_DESCRIPTOR_TAG_SERVICE_LIST              = 0x41,
-	TS_DESCRIPTOR_TAG_STUFFING                  = 0x42,
-	TS_DESCRIPTOR_TAG_SATELLITE_DELIVERY_SYS    = 0x43,
-	TS_DESCRIPTOR_TAG_CABLE_DISTRIBUTION        = 0x44,
-	TS_DESCRIPTOR_TAG_BOUNQUET_NAME             = 0x47,
-	TS_DESCRIPTOR_TAG_SERVICE                   = 0x48,
-	TS_DESCRIPTOR_TAG_COUNTRY_AVAILABILITY      = 0x49,
-	TS_DESCRIPTOR_TAG_LINKAGE                   = 0x4a,
-	TS_DESCRIPTOR_TAG_NVOD_REFERENCE            = 0x4b,
-	TS_DESCRIPTOR_TAG_TIME_SHIFTED_SERVICE      = 0x4c,
-	TS_DESCRIPTOR_TAG_SHORT_EVENT               = 0x4d,
-	TS_DESCRIPTOR_TAG_EXTENDED_EVENT            = 0x4e,
-	TS_DESCRIPTOR_TAG_TIME_SHIFTED_EVENT        = 0x4f,
-	TS_DESCRIPTOR_TAG_COMPONENT                 = 0x50,
-	TS_DESCRIPTOR_TAG_MOSAIC                    = 0x51,
-	TS_DESCRIPTOR_TAG_STREAM_IDENTIFIER         = 0x52,
-	TS_DESCRIPTOR_TAG_CA_IDENTIFIER             = 0x53,
-	TS_DESCRIPTOR_TAG_CONTENT                   = 0x54,
-	TS_DESCRIPTOR_TAG_PARENTAL_RATING           = 0x55,
-	TS_DESCRIPTOR_TAG_LOCAL_TIME_OFFSET         = 0x58,
-	TS_DESCRIPTOR_TAG_PARTIAL_TRANSPORT_STREAM  = 0x63,
-	TS_DESCRIPTOR_TAG_HIERARCHICAL_TRANSMISSION = 0xc0,
-	TS_DESCRIPTOR_TAG_DIGITAL_COPY_CONTROL      = 0xc1,
-	TS_DESCRIPTOR_TAG_NETWORK_IDENTIFICATION    = 0xc2,
-	TS_DESCRIPTOR_TAG_PARTIAL_TRANSPORT_TIME    = 0xc3,
-	TS_DESCRIPTOR_TAG_AUDIO_COMPONENT           = 0xc4,
-	TS_DESCRIPTOR_TAG_HYPERLINK                 = 0xc5,
-	TS_DESCRIPTOR_TAG_TARGET_REGION             = 0xc6,
-	TS_DESCRIPTOR_TAG_DATA_COTENT               = 0xc7,
-	TS_DESCRIPTOR_TAG_VIDEO_DECODE_CONTROL      = 0xc8,
-	TS_DESCRIPTOR_TAG_DOWNLOAD_CONTENT          = 0xc9,
-	TS_DESCRIPTOR_TAG_CA_EMM_TS                 = 0xca,
-	TS_DESCRIPTOR_TAG_CA_CONTRACT_INFORMATION   = 0xcb,
-	TS_DESCRIPTOR_TAG_CA_SERVICE                = 0xcc,
-	TS_DESCRIPTOR_TAG_TS_INFORMATION            = 0xcd,
-	TS_DESCRIPTOR_TAG_EXTENDED_BROADCASTER      = 0xce,
-	TS_DESCRIPTOR_TAG_LOGO_TRANSMISSION         = 0xcf,
-	TS_DESCRIPTOR_TAG_BASIC_LOCAL_EVENT         = 0xd0,
-	TS_DESCRIPTOR_TAG_REFERENCE                 = 0xd1,
-	TS_DESCRIPTOR_TAG_NODE_RELATION             = 0xd2,
-	TS_DESCRIPTOR_TAG_SHORT_NODE_INFORMATION    = 0xd3,
-	TS_DESCRIPTOR_TAG_STC_REFERENCE             = 0xd4,
-	TS_DESCRIPTOR_TAG_SERIES                    = 0xd5,
-	TS_DESCRIPTOR_TAG_EVENT_GROUP               = 0xd6,
-	TS_DESCRIPTOR_TAG_SI_PARAMETER              = 0xd7,
-	TS_DESCRIPTOR_TAG_BROADCASTER_NAME          = 0xd8,
-	TS_DESCRIPTOR_TAG_COMPONENT_GROUP           = 0xd9,
-	TS_DESCRIPTOR_TAG_SI_PRIME_TS               = 0xda,
-	TS_DESCRIPTOR_TAG_BOARD_INFORMATION         = 0xdb,
-	TS_DESCRIPTOR_TAG_LDT_LINKAGE               = 0xdc,
-	TS_DESCRIPTOR_TAG_CONNECTED_TRANSMISSION    = 0xdd,
-	TS_DESCRIPTOR_TAG_CONTENT_AVAILABILITY      = 0xde,
-	TS_DESCRIPTOR_TAG_VALUE_EXTENSION           = 0xdf,
-	TS_DESCRIPTOR_TAG_SERVICE_GROUP             = 0xe0,
-	TS_DESCRIPTOR_TAG_CARUSEL_COMPOSITE         = 0xf7,
-	TS_DESCRIPTOR_TAG_CONDITIONAL_PLAYBACK      = 0xf8,
-	TS_DESCRIPTOR_TAG_CABLE_TS_DIVISSION        = 0xf9,
-	TS_DESCRIPTOR_TAG_TERRESTRIAL_DELIVERY_SYS  = 0xfa,
-	TS_DESCRIPTOR_TAG_PARTIAL_RECEPTION         = 0xfb,
-	TS_DESCRIPTOR_TAG_EMERGENCY_INFOMATION      = 0xfc,
-	TS_DESCRIPTOR_TAG_DATA_COMPONENT            = 0xfd,
-	TS_DESCRIPTOR_TAG_SYSTEM_MANAGEMENT         = 0xfe,
-};
-
-enum PID_MAP_TYPE {
-	PID_MAP_TYPE_UNKNOWN                        = 0x0000,
-	PID_MAP_TYPE_PAT                            = 0x0100,
-	PID_MAP_TYPE_PMT                            = 0x0200,
-	PID_MAP_TYPE_NIT                            = 0x0300,
-	PID_MAP_TYPE_PCR                            = 0x0400,
-	PID_MAP_TYPE_ECM                            = 0x0500,
-	PID_MAP_TYPE_EMM                            = 0x0600,
-	PID_MAP_TYPE_EIT                            = 0x0700,
-	PID_MAP_TYPE_CAT                            = 0x0800,
-	PID_MAP_TYPE_OTHER                          = 0xff00,
-};
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- function prottypes (interface method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static void release_arib_std_b25(void *std_b25);
-static int set_multi2_round_arib_std_b25(void *std_b25, int32_t round);
-static int set_strip_arib_std_b25(void *std_b25, int32_t strip);
-static int set_emm_proc_arib_std_b25(void *std_b25, int32_t on);
-static int set_b_cas_card_arib_std_b25(void *std_b25, B_CAS_CARD *bcas);
-static int reset_arib_std_b25(void *std_b25);
-static int flush_arib_std_b25(void *std_b25);
-static int put_arib_std_b25(void *std_b25, ARIB_STD_B25_BUFFER *buf);
-static int get_arib_std_b25(void *std_b25, ARIB_STD_B25_BUFFER *buf);
-static int get_program_count_arib_std_b25(void *std_b25);
-static int get_program_info_arib_std_b25(void *std_b25, ARIB_STD_B25_PROGRAM_INFO *info, int idx);
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- global function implementation
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-ARIB_STD_B25 *create_arib_std_b25()
-{
-	int n;
-	
-	ARIB_STD_B25 *r;
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-
-	n  = sizeof(ARIB_STD_B25_PRIVATE_DATA);
-	n += sizeof(ARIB_STD_B25);
-	
-	prv = (ARIB_STD_B25_PRIVATE_DATA *)calloc(1, n);
-	if(prv == NULL){
-		return NULL;
-	}
-
-	prv->multi2_round = 4;
-
-	r = (ARIB_STD_B25 *)(prv+1);
-	r->private_data = prv;
-
-	r->release = release_arib_std_b25;
-	r->set_multi2_round = set_multi2_round_arib_std_b25;
-	r->set_strip = set_strip_arib_std_b25;
-	r->set_emm_proc = set_emm_proc_arib_std_b25;
-	r->set_b_cas_card = set_b_cas_card_arib_std_b25;
-	r->reset = reset_arib_std_b25;
-	r->flush = flush_arib_std_b25;
-	r->put = put_arib_std_b25;
-	r->get = get_arib_std_b25;
-	r->get_program_count = get_program_count_arib_std_b25;
-	r->get_program_info = get_program_info_arib_std_b25;
-
-	return r;
-}
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- function prottypes (private method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static ARIB_STD_B25_PRIVATE_DATA *private_data(void *std_b25);
-static void teardown(ARIB_STD_B25_PRIVATE_DATA *prv);
-static int select_unit_size(ARIB_STD_B25_PRIVATE_DATA *prv);
-static int find_pat(ARIB_STD_B25_PRIVATE_DATA *prv);
-static int proc_pat(ARIB_STD_B25_PRIVATE_DATA *prv);
-static int check_pmt_complete(ARIB_STD_B25_PRIVATE_DATA *prv);
-static int find_pmt(ARIB_STD_B25_PRIVATE_DATA *prv);
-static int proc_pmt(ARIB_STD_B25_PRIVATE_DATA *prv, TS_PROGRAM *pgrm);
-static int32_t find_ca_descriptor_pid(uint8_t *head, uint8_t *tail);
-static int32_t add_ecm_stream(ARIB_STD_B25_PRIVATE_DATA *prv, TS_STREAM_LIST *list, int32_t ecm_pid);
-static int check_ecm_complete(ARIB_STD_B25_PRIVATE_DATA *prv);
-static int find_ecm(ARIB_STD_B25_PRIVATE_DATA *prv);
-static int proc_ecm(DECRYPTOR_ELEM *dec, B_CAS_CARD *bcas, int32_t multi2_round);
-static int proc_arib_std_b25(ARIB_STD_B25_PRIVATE_DATA *prv);
-
-static int proc_cat(ARIB_STD_B25_PRIVATE_DATA *prv);
-static int proc_emm(ARIB_STD_B25_PRIVATE_DATA *prv);
-
-static void release_program(ARIB_STD_B25_PRIVATE_DATA *prv, TS_PROGRAM *pgrm);
-
-static void unref_stream(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid);
-
-static DECRYPTOR_ELEM *set_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid);
-static void remove_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, DECRYPTOR_ELEM *dec);
-static DECRYPTOR_ELEM *select_active_decryptor(DECRYPTOR_ELEM *a, DECRYPTOR_ELEM *b, int32_t pid);
-static void bind_stream_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid, DECRYPTOR_ELEM *dec);
-static void unlock_all_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv);
-
-static TS_STREAM_ELEM *get_stream_list_head(TS_STREAM_LIST *list);
-static TS_STREAM_ELEM *find_stream_list_elem(TS_STREAM_LIST *list, int32_t pid);
-static TS_STREAM_ELEM *create_stream_elem(int32_t pid, int32_t type);
-static void put_stream_list_tail(TS_STREAM_LIST *list, TS_STREAM_ELEM *elem);
-static void clear_stream_list(TS_STREAM_LIST *list);
-
-static int reserve_work_buffer(TS_WORK_BUFFER *buf, int32_t size);
-static int append_work_buffer(TS_WORK_BUFFER *buf, uint8_t *data, int32_t size);
-static void reset_work_buffer(TS_WORK_BUFFER *buf);
-static void release_work_buffer(TS_WORK_BUFFER *buf);
-
-static void extract_ts_header(TS_HEADER *dst, uint8_t *src);
-static void extract_emm_fixed_part(EMM_FIXED_PART *dst, uint8_t *src);
-
-static int check_unit_invert(unsigned char *head, unsigned char *tail);
-
-static uint8_t *resync(uint8_t *head, uint8_t *tail, int32_t unit);
-static uint8_t *resync_force(uint8_t *head, uint8_t *tail, int32_t unit);
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- interface method implementation
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static void release_arib_std_b25(void *std_b25)
-{
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-
-	prv = private_data(std_b25);
-	if(prv == NULL){
-		return;
-	}
-
-	teardown(prv);
-	free(prv);
-}
-
-static int set_multi2_round_arib_std_b25(void *std_b25, int32_t round)
-{
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-
-	prv = private_data(std_b25);
-	if(prv == NULL){
-		return ARIB_STD_B25_ERROR_INVALID_PARAM;
-	}
-
-	prv->multi2_round = round;
-
-	return 0;
-}
-
-static int set_strip_arib_std_b25(void *std_b25, int32_t strip)
-{
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-
-	prv = private_data(std_b25);
-	if(prv == NULL){
-		return ARIB_STD_B25_ERROR_INVALID_PARAM;
-	}
-
-	prv->strip = strip;
-
-	return 0;
-}
-
-static int set_emm_proc_arib_std_b25(void *std_b25, int32_t on)
-{
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-
-	prv = private_data(std_b25);
-	if(prv == NULL){
-		return ARIB_STD_B25_ERROR_INVALID_PARAM;
-	}
-
-	prv->emm_proc_on = on;
-
-	return 0;
-}
-
-static int set_b_cas_card_arib_std_b25(void *std_b25, B_CAS_CARD *bcas)
-{
-	int n;
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-
-	prv = private_data(std_b25);
-	if(prv == NULL){
-		return ARIB_STD_B25_ERROR_INVALID_PARAM;
-	}
-
-	prv->bcas = bcas;
-	if(prv->bcas != NULL){
-		n = prv->bcas->get_id(prv->bcas, &(prv->casid));
-		if(n < 0){
-			return ARIB_STD_B25_ERROR_INVALID_B_CAS_STATUS;
-		}
-	}
-
-	return 0;
-}
-
-static int reset_arib_std_b25(void *std_b25)
-{
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-
-	prv = private_data(std_b25);
-	if(prv == NULL){
-		return ARIB_STD_B25_ERROR_INVALID_PARAM;
-	}
-
-	teardown(prv);
-
-	return 0;
-}
-
-static int flush_arib_std_b25(void *std_b25)
-{
-	int r;
-	int m,n;
-
-	int32_t crypt;
-	int32_t unit;
-	int32_t pid;
-
-	uint8_t *p;
-	uint8_t *curr;
-	uint8_t *tail;
-
-	TS_HEADER hdr;
-	DECRYPTOR_ELEM *dec;
-	TS_PROGRAM *pgrm;
-
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-
-	prv = private_data(std_b25);
-	if(prv == NULL){
-		return ARIB_STD_B25_ERROR_INVALID_PARAM;
-	}
-
-	if(prv->unit_size < 188){
-		r = select_unit_size(prv);
-		if(r < 0){
-			return r;
-		}
-	}
-
-	r = proc_arib_std_b25(prv);
-	if(r < 0){
-		return r;
-	}
-
-	unit = prv->unit_size;
-	curr = prv->sbuf.head;
-	tail = prv->sbuf.tail;
-
-	m = prv->dbuf.tail - prv->dbuf.head;
-	n = tail - curr;
-	if(!reserve_work_buffer(&(prv->dbuf), m+n)){
-		return ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-	}
-
-	r = 0;
-
-	while( (curr+188) <= tail ){
-		
-		if(curr[0] != 0x47){
-			p = resync_force(curr, tail, unit);
-			if(p == NULL){
-				goto LAST;
-			}
-			curr = p;
-		}
-		
-		extract_ts_header(&hdr, curr);
-		crypt = hdr.transport_scrambling_control;
-		pid = hdr.pid;
-		
-		if( (pid == 0x1fff) && (prv->strip) ){
-			goto NEXT;
-		}
-		
-		p = curr+4;
-		if(hdr.adaptation_field_control & 0x02){
-			p += (p[0]+1);
-		}
-		n = 188 - (p-curr);
-		if( (n < 1) && ((n < 0) || (hdr.adaptation_field_control & 0x01)) ){
-			/* broken packet */
-			curr += 1;
-			continue;
-		}
-
-		if( (crypt != 0) &&
-		    (hdr.adaptation_field_control & 0x01) ){
-			
-			if(prv->map[pid].type == PID_MAP_TYPE_OTHER){
-				dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
-			}else{
-				dec = NULL;
-			}
-
-			if( (dec != NULL) && (dec->m2 != NULL) ){
-				m = dec->m2->decrypt(dec->m2, crypt, p, n);
-				if(m < 0){
-					r = ARIB_STD_B25_ERROR_DECRYPT_FAILURE;
-					goto LAST;
-				}
-				curr[3] &= 0x3f;
-				prv->map[pid].normal_packet += 1;
-			}else{
-				prv->map[pid].undecrypted += 1;
-			}
-		}else{
-			prv->map[pid].normal_packet += 1;
-		}
-
-		if(!append_work_buffer(&(prv->dbuf), curr, 188)){
-			r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-			goto LAST;
-		}
-
-		if(prv->map[pid].type == PID_MAP_TYPE_ECM){
-			dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
-			if( (dec == NULL) || (dec->ecm == NULL) ){
-				/* this code will never execute */
-				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = dec->ecm->put(dec->ecm, &hdr, p, n);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = dec->ecm->get_count(dec->ecm);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-				goto LAST;
-			}
-			if(m == 0){
-				goto NEXT;
-			}
-			r = proc_ecm(dec, prv->bcas, prv->multi2_round);
-			if(r < 0){
-				goto LAST;
-			}
-		}else if(prv->map[pid].type == PID_MAP_TYPE_PMT){
-			pgrm = (TS_PROGRAM *)(prv->map[pid].target);
-			if( (pgrm == NULL) || (pgrm->pmt == NULL) ){
-				/* this code will never execute */
-				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = pgrm->pmt->put(pgrm->pmt, &hdr, p, n);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = pgrm->pmt->get_count(pgrm->pmt);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-				goto LAST;
-			}
-			if(m == 0){
-				goto NEXT;
-			}
-			r = proc_pmt(prv, pgrm);
-			if(r < 0){
-				goto LAST;
-			}
-		}else if(prv->map[pid].type == PID_MAP_TYPE_EMM){
-			if( prv->emm_proc_on == 0){
-				goto NEXT;
-			}
-			if( prv->emm == NULL ){
-				prv->emm = create_ts_section_parser();
-				if(prv->emm == NULL){
-					r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
-					goto LAST;
-				}
-			}
-			m = prv->emm->put(prv->emm, &hdr, p, n);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = prv->emm->get_count(prv->emm);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
-				goto LAST;
-			}
-			if(m == 0){
-				goto NEXT;
-			}
-			r = proc_emm(prv);
-			if(r < 0){
-				goto LAST;
-			}
-		}else if(pid == 0x0001){
-			if( prv->cat == NULL ){
-				prv->cat = create_ts_section_parser();
-				if(prv->cat == NULL){
-					r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-					goto LAST;
-				}
-			}
-			m = prv->cat->put(prv->cat, &hdr, p, n);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = prv->cat->get_count(prv->cat);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
-				goto LAST;
-			}
-			if(m == 0){
-				goto NEXT;
-			}
-			r = proc_cat(prv);
-			if(r < 0){
-				goto LAST;
-			}
-		}else if(pid == 0x0000){
-			if( prv->pat == NULL ){
-				prv->pat = create_ts_section_parser();
-				if(prv->pat == NULL){
-					r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-					goto LAST;
-				}
-			}
-			m = prv->pat->put(prv->pat, &hdr, p, n);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = prv->pat->get_count(prv->pat);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
-				goto LAST;
-			}
-			if(m == 0){
-				goto NEXT;
-			}
-			r = proc_pat(prv);
-			if(r < 0){
-				goto LAST;
-			}
-		}
-			
-	NEXT:
-		curr += unit;
-	}
-
-LAST:
-	
-	m = curr - prv->sbuf.head;
-	n = tail - curr;
-	if( (n < 1024) || (m > (prv->sbuf.max/2) ) ){
-		p = prv->sbuf.pool;
-		memcpy(p, curr, n);
-		prv->sbuf.head = p;
-		prv->sbuf.tail = p+n;
-	}else{
-		prv->sbuf.head = curr;
-	}
-
-	return r;
-}
-
-static int put_arib_std_b25(void *std_b25, ARIB_STD_B25_BUFFER *buf)
-{
-	int32_t n;
-	
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-
-	prv = private_data(std_b25);
-	if( (prv == NULL) || (buf == NULL) ){
-		return ARIB_STD_B25_ERROR_INVALID_PARAM;
-	}
-
-	if(!append_work_buffer(&(prv->sbuf), buf->data, buf->size)){
-		return ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-	}
-
-	if(prv->unit_size < 188){
-		n = select_unit_size(prv);
-		if(n < 0){
-			return n;
-		}
-		if(prv->unit_size < 188){
-			/* need more data */
-			return 0;
-		}
-	}
-
-	if(prv->p_count < 1){
-		n = find_pat(prv);
-		if(n < 0){
-			return n;
-		}
-		if(prv->p_count < 1){
-			if(prv->sbuf_offset < (16*1024*1024)){
-				/* need more data */
-				return 0;
-			}else{
-				/* exceed sbuf limit */
-				return ARIB_STD_B25_ERROR_NO_PAT_IN_HEAD_16M;
-			}
-		}
-		prv->sbuf_offset = 0;
-	}
-
-	if(!check_pmt_complete(prv)){
-		n = find_pmt(prv);
-		if(n < 0){
-			return n;
-		}
-		if(!check_pmt_complete(prv)){
-			if(prv->sbuf_offset < (32*1024*1024)){
-				/* need more data */
-				return 0;
-			}else{
-				/* exceed sbuf limit */
-				return ARIB_STD_B25_ERROR_NO_PMT_IN_HEAD_32M;
-			}
-		}
-		prv->sbuf_offset = 0;
-	}
-
-	if(!check_ecm_complete(prv)){
-		n = find_ecm(prv);
-		if(n < 0){
-			return n;
-		}
-		if(!check_ecm_complete(prv)){
-			if(prv->sbuf_offset < (32*1024*1024)){
-				/* need more data */
-				return 0;
-			}else{
-				/* exceed sbuf limit */
-				return ARIB_STD_B25_ERROR_NO_ECM_IN_HEAD_32M;
-			}
-		}
-		prv->sbuf_offset = 0;
-	}
-
-	return proc_arib_std_b25(prv);
-}
-
-static int get_arib_std_b25(void *std_b25, ARIB_STD_B25_BUFFER *buf)
-{
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-	prv = private_data(std_b25);
-	if( (prv == NULL) || (buf == NULL) ){
-		return ARIB_STD_B25_ERROR_INVALID_PARAM;
-	}
-
-	buf->data = prv->dbuf.head;
-	buf->size = prv->dbuf.tail - prv->dbuf.head;
-
-	reset_work_buffer(&(prv->dbuf));
-
-	return 0;
-}
-
-static int get_program_count_arib_std_b25(void *std_b25)
-{
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-	
-	prv = private_data(std_b25);
-	if(prv == NULL){
-		return ARIB_STD_B25_ERROR_INVALID_PARAM;
-	}
-
-	return prv->p_count;
-}
-
-static int get_program_info_arib_std_b25(void *std_b25, ARIB_STD_B25_PROGRAM_INFO *info, int idx)
-{
-	ARIB_STD_B25_PRIVATE_DATA *prv;
-
-	TS_PROGRAM *pgrm;
-	
-	TS_STREAM_ELEM *strm;
-	DECRYPTOR_ELEM *dec;
-
-	int32_t pid;
-	
-	prv = private_data(std_b25);
-	if( (prv == NULL) || (info == NULL) || (idx < 0) || (idx >= prv->p_count) ){
-		return ARIB_STD_B25_ERROR_INVALID_PARAM;
-	}
-
-	pgrm = prv->program + idx;
-
-	memset(info, 0, sizeof(ARIB_STD_B25_PROGRAM_INFO));
-
-	info->program_number = pgrm->program_number;
-	
-	pid = pgrm->pmt_pid;
-	info->total_packet_count += prv->map[pid].normal_packet;
-	info->total_packet_count += prv->map[pid].undecrypted;
-	info->undecrypted_packet_count += prv->map[pid].undecrypted;
-
-	pid = pgrm->pcr_pid;
-	if( (pid != 0) && (pid != 0x1fff) ){
-		info->total_packet_count += prv->map[pid].normal_packet;
-		info->total_packet_count += prv->map[pid].undecrypted;
-		info->undecrypted_packet_count += prv->map[pid].undecrypted;
-	}
-
-	strm = pgrm->streams.head;
-	while(strm != NULL){
-		pid = strm->pid;
-		if(prv->map[pid].type == PID_MAP_TYPE_ECM){
-			dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
-			info->ecm_unpurchased_count += dec->unpurchased;
-			info->last_ecm_error_code = dec->last_error;
-		}
-		info->total_packet_count += prv->map[pid].normal_packet;
-		info->total_packet_count += prv->map[pid].undecrypted;
-		info->undecrypted_packet_count += prv->map[pid].undecrypted;
-		strm = (TS_STREAM_ELEM *)(strm->next);
-	}
-
-	return 0;
-}
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- private method implementation
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static ARIB_STD_B25_PRIVATE_DATA *private_data(void *std_b25)
-{
-	ARIB_STD_B25 *p;
-	ARIB_STD_B25_PRIVATE_DATA *r;
-
-	p = (ARIB_STD_B25 *)std_b25;
-	if(p == NULL){
-		return NULL;
-	}
-
-	r = (ARIB_STD_B25_PRIVATE_DATA *)p->private_data;
-	if( ((void *)(r+1)) != ((void *)p) ){
-		return NULL;
-	}
-
-	return r; 
-}
-
-static void teardown(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int i;
-	
-	prv->unit_size = 0;
-	prv->sbuf_offset = 0;
-
-	if(prv->pat != NULL){
-		prv->pat->release(prv->pat);
-		prv->pat = NULL;
-	}
-	if(prv->cat != NULL){
-		prv->cat->release(prv->cat);
-		prv->cat = NULL;
-	}
-
-	if(prv->program != NULL){
-		for(i=0;i<prv->p_count;i++){
-			release_program(prv, prv->program+i);
-		}
-		free(prv->program);
-		prv->program = NULL;
-	}
-	prv->p_count = 0;
-
-	clear_stream_list(&(prv->strm_pool));
-
-	while(prv->decrypt.head != NULL){
-		remove_decryptor(prv, prv->decrypt.head);
-	}
-
-	memset(prv->map, 0, sizeof(prv->map));
-
-	prv->emm_pid = 0;
-	if(prv->emm != NULL){
-		prv->emm->release(prv->emm);
-		prv->emm = NULL;
-	}
-
-	release_work_buffer(&(prv->sbuf));
-	release_work_buffer(&(prv->dbuf));
-}
-
-static int select_unit_size(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int i;
-	int m,n,w;
-	int count[320];
-
-	unsigned char *head;
-	unsigned char *pre;
-	unsigned char *buf;
-	unsigned char *tail;
-
-	head = prv->sbuf.head;
-	tail = prv->sbuf.tail;
-	pre = NULL;
-	buf = head;
-	memset(count, 0, sizeof(count));
-
-	// 1st step, find head 0x47
-	while(buf < tail){
-		if(buf[0] == 0x47){
-			pre = buf;
-			break;
-		}
-		buf += 1;
-	}
-
-	if(pre == NULL){
-		return ARIB_STD_B25_ERROR_NON_TS_INPUT_STREAM;
-	}
-
-	// 2nd step, count up 0x47 interval
-	buf = pre + 1;
-	while( buf < tail ){
-		if(buf[0] == 0x47){
-			m = buf - pre;
-			if(m < 188){
-				n = check_unit_invert(head, buf);
-				if( (n >= 188) && (n < 320) ){
-					count[n] += 1;
-					pre = buf;
-				}
-			}else if(m < 320){
-				count[m] += 1;
-				pre = buf;
-			}else{
-				pre = buf;
-			}
-		}
-		buf += 1;
-	}
-
-	// 3rd step, select maximum appeared interval
-	m = 0;
-	n = 0;
-	for(i=188;i<320;i++){
-		if(m < count[i]){
-			m = count[i];
-			n = i;
-		}
-	}
-
-	// 4th step, verify unit_size
-	w = m*n;
-	if( (m < 8) || (w < ((tail-head) - (w/8))) ){
-		return ARIB_STD_B25_ERROR_NON_TS_INPUT_STREAM;
-	}
-
-	prv->unit_size = n;
-
-	return 0;
-}
-
-static int find_pat(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int r;
-	int n,size;
-	
-	int32_t unit;
-
-	uint8_t *p;
-	uint8_t *curr;
-	uint8_t *tail;
-
-	TS_HEADER hdr;
-
-	r = 0;
-	unit = prv->unit_size;
-	curr = prv->sbuf.head + prv->sbuf_offset;
-	tail = prv->sbuf.tail;
-
-	while( (curr+unit) < tail ){
-		if( (curr[0] != 0x47) || (curr[unit] != 0x47) ){
-			p = resync(curr, tail, unit);
-			if(p == NULL){
-				goto LAST;
-			}
-			curr = p;
-		}
-		extract_ts_header(&hdr, curr);
-		if(hdr.pid == 0x0000){
-			
-			p = curr+4;
-			if(hdr.adaptation_field_control & 0x02){
-				p += (p[0]+1);
-			}
-			size = 188 - (p-curr);
-			if(size < 1){
-				goto NEXT;
-			}
-			
-			if(prv->pat == NULL){
-				prv->pat = create_ts_section_parser();
-				if(prv->pat == NULL){
-					return ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-				}
-			}
-			
-			n = prv->pat->put(prv->pat, &hdr, p, size);
-			if(n < 0){
-				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
-				curr += unit;
-				goto LAST;
-			}
-			n = prv->pat->get_count(prv->pat);
-			if(n < 0){
-				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
-				curr += unit;
-				goto LAST;
-			}
-			if(n > 0){
-				curr += unit;
-				goto LAST;
-			}
-		}
-	NEXT:
-		curr += unit;
-	}
-
-LAST:
-	prv->sbuf_offset = curr - prv->sbuf.head;
-
-	if( (prv->pat != NULL) && (prv->pat->get_count(prv->pat) > 0) ){
-		r = proc_pat(prv);
-	}
-
-	return r;
-}
-
-static int proc_pat(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int r;
-	int i,n;
-	int len;
-	int count;
-	
-	int32_t program_number;
-	int32_t pid;
-
-	uint8_t *head;
-	uint8_t *tail;
-	
-	TS_PROGRAM *work;
-	TS_SECTION  sect;
-
-	r = 0;
-	memset(&sect, 0, sizeof(sect));
-
-	n = prv->pat->get(prv->pat, &sect);
-	if(n < 0){
-		r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
-		goto LAST;
-	}
-
-	if(sect.hdr.table_id != TS_SECTION_ID_PROGRAM_ASSOCIATION){
-		r = ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH;
-		goto LAST;
-	}
-
-	len = (sect.tail - sect.data) - 4;
-
-	count = len / 4;
-	work = (TS_PROGRAM *)calloc(count, sizeof(TS_PROGRAM));
-	if(work == NULL){
-		r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-		goto LAST;
-	}
-	
-	if(prv->program != NULL){
-		for(i=0;i<prv->p_count;i++){
-			release_program(prv, prv->program+i);
-		}
-		free(prv->program);
-		prv->program = NULL;
-	}
-	prv->p_count = 0;
-	memset(&(prv->map), 0, sizeof(prv->map));
-
-	head = sect.data;
-	tail = sect.tail-4;
-
-	i = 0;
-	while( (head+4) <= tail ){
-		program_number = ((head[0] << 8) | head[1]);
-		pid = ((head[2] << 8) | head[3]) & 0x1fff;
-		if(program_number != 0){
-			work[i].program_number = program_number;
-			work[i].pmt_pid = pid;
-			work[i].pmt = create_ts_section_parser();
-			if(work[i].pmt == NULL){
-				r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-				break;
-			}
-			prv->map[pid].type = PID_MAP_TYPE_PMT;
-			prv->map[pid].target = work+i;
-			i += 1;
-		}
-		head += 4;
-	}
-
-	prv->program = work;
-	prv->p_count = i;
-	
-	prv->map[0x0000].ref = 1;
-	prv->map[0x0000].type = PID_MAP_TYPE_PAT;
-	prv->map[0x0000].target = NULL;
-
-LAST:
-	if(sect.raw != NULL){
-		n = prv->pat->ret(prv->pat, &sect);
-		if( (n < 0) && (r == 0) ){
-			r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
-		}
-	}
-
-	return r;
-}
-
-static int check_pmt_complete(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int i,n;
-	int num[3];
-
-	memset(num, 0, sizeof(num));
-
-	for(i=0;i<prv->p_count;i++){
-		n = prv->program[i].phase;
-		if(n < 0){
-			n = 0;
-		}else if(n > 2){
-			n = 2;
-		}
-		num[n] += 1;
-	}
-
-	if(num[2] > 0){
-		return 1;
-	}
-
-	if(num[0] > 0){
-		return 0;
-	}
-
-	return 1;
-}
-
-static int find_pmt(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int r;
-	int n,size;
-	
-	int32_t unit;
-
-	uint8_t *p;
-	uint8_t *curr;
-	uint8_t *tail;
-
-	TS_HEADER hdr;
-	TS_PROGRAM *pgrm;
-
-	r = 0;
-	unit = prv->unit_size;
-	curr = prv->sbuf.head + prv->sbuf_offset;
-	tail = prv->sbuf.tail;
-
-	while( (curr+unit) < tail ){
-		
-		if( (curr[0] != 0x47) || (curr[unit] != 0x47) ){
-			p = resync(curr, tail, unit);
-			if(p == NULL){
-				goto LAST;
-			}
-			curr = p;
-		}
-		
-		extract_ts_header(&hdr, curr);
-		
-		if(prv->map[hdr.pid].type != PID_MAP_TYPE_PMT){
-			goto NEXT;
-		}
-		pgrm = (TS_PROGRAM *)(prv->map[hdr.pid].target);
-		if(pgrm == NULL){
-			goto NEXT;
-		}
-		
-		if(pgrm->phase == 0){
-			
-			p = curr + 4;
-			if(hdr.adaptation_field_control & 0x02){
-				p += (p[0]+1);
-			}
-			size = 188 - (p-curr);
-			if(size < 1){
-				goto NEXT;
-			}
-			
-			if(pgrm->pmt == NULL){
-				/* this code will never execute */
-				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-				curr += unit;
-				goto LAST;
-			}
-			
-			n = pgrm->pmt->put(pgrm->pmt, &hdr, p, size);
-			if(n < 0){
-				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-				curr += unit;
-				goto LAST;
-			}
-			n = pgrm->pmt->get_count(pgrm->pmt);
-			if(n < 0){
-				r =ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-				curr += unit;
-				goto LAST;
-			}
-			if(n == 0){
-				goto NEXT;
-			}
-			r = proc_pmt(prv, pgrm);
-			if(r < 0){
-				curr += unit;
-				goto LAST;
-			}
-			if(r > 0){
-				/* broken or unexpected section data */
-				goto NEXT;
-			}
-			pgrm->phase = 1;
-			if(check_pmt_complete(prv)){
-				curr += unit;
-				goto LAST;
-			}
-		}else{
-			pgrm->phase = 2;
-			curr += unit;
-			goto LAST;
-		}
-		
-	NEXT:
-		curr += unit;
-	}
-
-LAST:
-	prv->sbuf_offset = curr - prv->sbuf.head;
-
-	return r;
-}
-
-static int proc_pmt(ARIB_STD_B25_PRIVATE_DATA *prv, TS_PROGRAM *pgrm)
-{
-	int r;
-
-	int n;
-	int length;
-
-	uint8_t *head;
-	uint8_t *tail;
-
-	int32_t ecm_pid;
-	int32_t pid;
-	int32_t type;
-
-	TS_SECTION sect;
-	
-	DECRYPTOR_ELEM *dec[2];
-	DECRYPTOR_ELEM *dw;
-	
-	TS_STREAM_ELEM *strm;
-
-	r = 0;
-	dec[0] = NULL;
-	memset(&sect, 0, sizeof(sect));
-
-	n = pgrm->pmt->get(pgrm->pmt, &sect);
-	if(n < 0){
-		r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-		goto LAST;
-	}
-	if(sect.hdr.table_id != TS_SECTION_ID_PROGRAM_MAP){
-		r = ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH;
-		goto LAST;
-	}
-	
-	head = sect.data;
-	tail = sect.tail-4;
-
-	pgrm->pcr_pid = ((head[0] << 8) | head[1]) & 0x1fff;
-	length = ((head[2] << 8) | head[3]) & 0x0fff;
-	head += 4;
-	if(head+length > tail){
-		r = ARIB_STD_B25_WARN_BROKEN_TS_SECTION;
-		goto LAST;
-	}
-
-	/* find major ecm_pid and regist decryptor */
-	ecm_pid = find_ca_descriptor_pid(head, head+length);
-	if( (ecm_pid != 0) && (ecm_pid != 0x1fff) ){
-		dec[0] = set_decryptor(prv, ecm_pid);
-		if(dec[0] == NULL){
-			r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-			goto LAST;
-		}
-		dec[0]->ref += 1;
-	}
-	head += length;
-	
-	/* unref old stream entries */
-	while( (strm = get_stream_list_head(&(pgrm->old_strm))) != NULL ){
-		unref_stream(prv, strm->pid);
-		memset(strm, 0, sizeof(TS_STREAM_ELEM));
-		put_stream_list_tail(&(prv->strm_pool), strm);
-	}
-
-	/* save current streams */
-	memcpy(&(pgrm->old_strm), &(pgrm->streams), sizeof(TS_STREAM_LIST));
-	memset(&(pgrm->streams), 0, sizeof(TS_STREAM_LIST));
-
-	/* add current stream entries */
-	if( (ecm_pid != 0) && (ecm_pid != 0x1fff) ){
-		if(!add_ecm_stream(prv, &(pgrm->streams), ecm_pid)){
-			r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-			goto LAST;
-		}
-	}
-
-	while( head+4 < tail ){
-
-		type = head[0];
-		pid = ((head[1] << 8) | head[2]) & 0x1fff;
-		length = ((head[3] << 8) | head[4]) & 0x0fff;
-		head += 5;
-		ecm_pid = find_ca_descriptor_pid(head, head+length);
-		head += length;
-		
-		if( (ecm_pid != 0) && (ecm_pid != 0x1fff) ){
-			dec[1] = set_decryptor(prv, ecm_pid);
-			if(dec[1] == NULL){
-				r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-				goto LAST;
-			}
-			if(!add_ecm_stream(prv, &(pgrm->streams), ecm_pid)){
-				r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-				goto LAST;
-			}
-		}else{
-			dec[1] = NULL;
-		}
-
-		strm = get_stream_list_head(&(prv->strm_pool));
-		if( strm == NULL ){
-			strm = create_stream_elem(pid, type);
-			if(strm == NULL){
-				r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-				goto LAST;
-			}
-		}else{
-			strm->pid = pid;
-			strm->type = type;
-		}
-		
-		prv->map[pid].type = PID_MAP_TYPE_OTHER;
-		prv->map[pid].ref += 1;
-
-		dw = select_active_decryptor(dec[0], dec[1], ecm_pid);
-		bind_stream_decryptor(prv, pid, dw);
-		
-		put_stream_list_tail(&(pgrm->streams), strm);
-	}
-	
-LAST:
-	if( dec[0] != NULL ){
-		dec[0]->ref -= 1;
-		if( dec[0]->ref < 1 ){
-			remove_decryptor(prv, dec[0]);
-			dec[0] = NULL;
-		}
-	}
-
-	if(sect.raw != NULL){
-		n = pgrm->pmt->ret(pgrm->pmt, &sect);
-		if( (n < 0) && (r == 0) ){
-			return ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-		}
-	}
-
-	return 0;
-}
-		
-static int32_t find_ca_descriptor_pid(uint8_t *head, uint8_t *tail)
-{
-	uint32_t ca_pid;
-	uint32_t ca_sys_id;
-	
-	uint32_t tag;
-	uint32_t len;
-
-	while(head+1 < tail){
-		tag = head[0];
-		len = head[1];
-		head += 2;
-		if( (tag == 0x09) && /* CA_descriptor */
-		    (len >= 4) &&
-		    (head+len <= tail) ){
-			ca_sys_id = ((head[0] << 8) | head[1]);
-			ca_pid = ((head[2] << 8) | head[3]) & 0x1fff;
-			return ca_pid;
-		}
-		head += len;
-	}
-
-	return 0;
-}
-
-static int add_ecm_stream(ARIB_STD_B25_PRIVATE_DATA *prv, TS_STREAM_LIST *list, int32_t ecm_pid)
-{
-	TS_STREAM_ELEM *strm;
-
-	strm = find_stream_list_elem(list, ecm_pid);
-	if(strm != NULL){
-		// ECM is already registered
-		return 1;
-	}
-
-	strm = get_stream_list_head(&(prv->strm_pool));
-	if(strm == NULL){
-		strm = create_stream_elem(ecm_pid, PID_MAP_TYPE_ECM);
-		if(strm == NULL){
-			return 0;
-		}
-	}else{
-		strm->pid = ecm_pid;
-		strm->type = PID_MAP_TYPE_ECM;
-	}
-
-	put_stream_list_tail(list, strm);
-	prv->map[ecm_pid].ref += 1;
-
-	return 1;
-}
-
-static int check_ecm_complete(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int n,num[3];
-	DECRYPTOR_ELEM *e;
-
-	memset(num, 0, sizeof(num));
-
-	e = prv->decrypt.head;
-	while( e != NULL ){
-		n = e->phase;
-		if(n < 0){
-			n = 0;
-		}else if(n > 2){
-			n = 2;
-		}
-		num[n] += 1;
-		e = (DECRYPTOR_ELEM *)(e->next);
-	}
-
-	if(num[2] > 0){
-		return 1;
-	}
-
-	if(num[0] > 0){
-		return 0;
-	}
-
-	return 1;
-}
-
-static int find_ecm(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int r;
-	int n,size;
-
-	int32_t unit;
-
-	uint8_t *p;
-	uint8_t *curr;
-	uint8_t *tail;
-
-	TS_HEADER hdr;
-	DECRYPTOR_ELEM *dec;
-
-	r = 0;
-	unit = prv->unit_size;
-	curr = prv->sbuf.head + prv->sbuf_offset;
-	tail = prv->sbuf.tail;
-
-	while( (curr+unit) < tail ){
-		if( (curr[0] != 0x47) || (curr[unit] != 0x47) ){
-			p = resync(curr, tail, unit);
-			if(p == NULL){
-				goto LAST;
-			}
-			curr = p;
-		}
-		extract_ts_header(&hdr, curr);
-		if(prv->map[hdr.pid].type != PID_MAP_TYPE_ECM){
-			goto NEXT;
-		}
-		dec = (DECRYPTOR_ELEM *)(prv->map[hdr.pid].target);
-		if(dec == NULL){
-			goto NEXT;
-		}
-
-		if(dec->phase == 0){
-			
-			p = curr + 4;
-			if(hdr.adaptation_field_control & 0x02){
-				p += (p[0]+1);
-			}
-			size = 188 - (p-curr);
-			if(size < 1){
-				goto NEXT;
-			}
-			
-			if(dec->ecm == NULL){
-				/*  this code will never execute */
-				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-				curr += unit;
-				goto LAST;
-			}
-				
-			n = dec->ecm->put(dec->ecm, &hdr, p, size);
-			if(n < 0){
-				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-				curr += unit;
-				goto LAST;
-			}
-			n = dec->ecm->get_count(dec->ecm);
-			if(n < 0){
-				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-				curr += unit;
-				goto LAST;
-			}
-			if(n == 0){
-				goto NEXT;
-			}
-
-			r = proc_ecm(dec, prv->bcas, prv->multi2_round);
-			if(r < 0){
-				curr += unit;
-				goto LAST;
-			}
-			if( (r > 0) && (r != ARIB_STD_B25_WARN_UNPURCHASED_ECM) ){
-				/* broken or unexpected section data */
-				goto NEXT;
-			}
-			
-			dec->phase = 1;
-			if(check_ecm_complete(prv)){
-				curr += unit;
-				goto LAST;
-			}
-
-		}else{
-			dec->phase = 2;
-			curr += unit;
-			goto LAST;
-		}
-		
-	NEXT:
-		curr += unit;
-	}
-
-LAST:
-	prv->sbuf_offset = curr - prv->sbuf.head;
-
-	return r;
-}
-
-static int proc_ecm(DECRYPTOR_ELEM *dec, B_CAS_CARD *bcas, int32_t multi2_round)
-{
-	int r,n;
-	int length;
-
-	uint8_t *p;
-	
-	B_CAS_INIT_STATUS is;
-	B_CAS_ECM_RESULT res;
-
-	TS_SECTION sect;
-
-	r = 0;
-	memset(&sect, 0, sizeof(sect));
-	
-	if(bcas == NULL){
-		r = ARIB_STD_B25_ERROR_EMPTY_B_CAS_CARD;
-		goto LAST;
-	}
-
-	n = dec->ecm->get(dec->ecm, &sect);
-	if(n < 0){
-		r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-		goto LAST;
-	}
-	if(sect.hdr.table_id != TS_SECTION_ID_ECM_S){
-		r = ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH;
-		goto LAST;
-	}
-	
-	if(dec->locked){
-		/* previous ECM has returned unpurchased
-		   skip this pid for B-CAS card load reduction */
-		dec->unpurchased += 1;
-		r = ARIB_STD_B25_WARN_UNPURCHASED_ECM;
-		goto LAST;
-	}
-
-	length = (sect.tail - sect.data) - 4;
-	p = sect.data;
-
-	r = bcas->proc_ecm(bcas, &res, p, length);
-	if(r < 0){
-		if(dec->m2 != NULL){
-			dec->m2->clear_scramble_key(dec->m2);
-		}
-		r = ARIB_STD_B25_ERROR_ECM_PROC_FAILURE;
-		goto LAST;
-	}
-	
-	if( (res.return_code != 0x0800) &&
-	    (res.return_code != 0x0400) &&
-	    (res.return_code != 0x0200) ){
-		/* return_code is not equal "purchased" */
-		if(dec->m2 != NULL){
-			dec->m2->release(dec->m2);
-			dec->m2 = NULL;
-		}
-		dec->unpurchased += 1;
-		dec->last_error = res.return_code;
-		dec->locked += 1;
-		r = ARIB_STD_B25_WARN_UNPURCHASED_ECM;
-		goto LAST;
-	}
-
-	if(dec->m2 == NULL){
-		dec->m2 = create_multi2();
-		if(dec->m2 == NULL){
-			return ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-		}
-		r = bcas->get_init_status(bcas, &is);
-		if(r < 0){
-			return ARIB_STD_B25_ERROR_INVALID_B_CAS_STATUS;
-		}
-		dec->m2->set_system_key(dec->m2, is.system_key);
-		dec->m2->set_init_cbc(dec->m2, is.init_cbc);
-		dec->m2->set_round(dec->m2, multi2_round);
-	}
-
-	dec->m2->set_scramble_key(dec->m2, res.scramble_key);
-
-LAST:
-	if(sect.raw != NULL){
-		n = dec->ecm->ret(dec->ecm, &sect);
-		if( (n < 0) && (r == 0) ){
-			r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-		}
-	}
-	
-	return r;
-}
-
-static int proc_arib_std_b25(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int r;
-	int m,n;
-
-	int32_t crypt;
-	int32_t unit;
-	int32_t pid;
-
-	uint8_t *p;
-	uint8_t *curr;
-	uint8_t *tail;
-
-	TS_HEADER hdr;
-	DECRYPTOR_ELEM *dec;
-	TS_PROGRAM *pgrm;
-
-	unit = prv->unit_size;
-	curr = prv->sbuf.head;
-	tail = prv->sbuf.tail;
-
-	m = prv->dbuf.tail - prv->dbuf.head;
-	n = tail - curr;
-	if(!reserve_work_buffer(&(prv->dbuf), m+n)){
-		return ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-	}
-
-	r = 0;
-
-	while( (curr+unit) < tail ){
-		
-		if( (curr[0] != 0x47) || (curr[unit] != 0x47) ){
-			p = resync(curr, tail, unit);
-			if(p == NULL){
-				goto LAST;
-			}
-			curr = p;
-		}
-		
-		extract_ts_header(&hdr, curr);
-		crypt = hdr.transport_scrambling_control;
-		pid = hdr.pid;
-
-		if( (pid == 0x1fff) && (prv->strip) ){
-			/* strip null(padding) stream */
-			goto NEXT;
-		}
-
-		p = curr+4;
-		if(hdr.adaptation_field_control & 0x02){
-			p += (p[0]+1);
-		}
-		n = 188 - (p-curr);
-		if( (n < 1) && ((n < 0) || (hdr.adaptation_field_control & 0x01)) ){
-			/* broken packet */
-			curr += 1;
-			continue;
-		}
-
-		if( (crypt != 0) &&
-		    (hdr.adaptation_field_control & 0x01) ){
-			
-			if(prv->map[pid].type == PID_MAP_TYPE_OTHER){
-				dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
-			}else if( (prv->map[pid].type == 0) &&
-			          (prv->decrypt.count == 1) ){
-				dec = prv->decrypt.head;
-			}else{
-				dec = NULL;
-			}
-
-			if( (dec != NULL) && (dec->m2 != NULL) ){
-				m = dec->m2->decrypt(dec->m2, crypt, p, n);
-				if(m < 0){
-					r = ARIB_STD_B25_ERROR_DECRYPT_FAILURE;
-					goto LAST;
-				}
-				curr[3] &= 0x3f;
-				prv->map[pid].normal_packet += 1;
-			}else{
-				prv->map[pid].undecrypted += 1;
-			}
-		}else{
-			prv->map[pid].normal_packet += 1;
-		}
-
-		if(!append_work_buffer(&(prv->dbuf), curr, 188)){
-			r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-			goto LAST;
-		}
-
-		if(prv->map[pid].type == PID_MAP_TYPE_ECM){
-			dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
-			if( (dec == NULL) || (dec->ecm == NULL) ){
-				/* this code will never execute */
-				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = dec->ecm->put(dec->ecm, &hdr, p, n);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = dec->ecm->get_count(dec->ecm);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
-				goto LAST;
-			}
-			if(m == 0){
-				goto NEXT;
-			}
-			r = proc_ecm(dec, prv->bcas, prv->multi2_round);
-			if(r < 0){
-				goto LAST;
-			}
-		}else if(prv->map[pid].type == PID_MAP_TYPE_PMT){
-			pgrm = (TS_PROGRAM *)(prv->map[pid].target);
-			if( (pgrm == NULL) || (pgrm->pmt == NULL) ){
-				/* this code will never execute */
-				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = pgrm->pmt->put(pgrm->pmt, &hdr, p, n);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = pgrm->pmt->get_count(pgrm->pmt);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
-				goto LAST;
-			}
-			if(m == 0){
-				goto NEXT;
-			}
-			r = proc_pmt(prv, pgrm);
-			if(r < 0){
-				goto LAST;
-			}
-		}else if(prv->map[pid].type == PID_MAP_TYPE_EMM){
-			if( prv->emm_proc_on == 0){
-				goto NEXT;
-			}
-			if( prv->emm == NULL ){
-				prv->emm = create_ts_section_parser();
-				if(prv->emm == NULL){
-					r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
-					goto LAST;
-				}
-			}
-			m = prv->emm->put(prv->emm, &hdr, p, n);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = prv->emm->get_count(prv->emm);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
-				goto LAST;
-			}
-			if(m == 0){
-				goto NEXT;
-			}
-			r = proc_emm(prv);
-			if(r < 0){
-				goto LAST;
-			}
-		}else if(pid == 0x0001){
-			if( prv->cat == NULL ){
-				prv->cat = create_ts_section_parser();
-				if(prv->cat == NULL){
-					r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-					goto LAST;
-				}
-			}
-			m = prv->cat->put(prv->cat, &hdr, p, n);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = prv->cat->get_count(prv->cat);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
-				goto LAST;
-			}
-			if(m == 0){
-				goto NEXT;
-			}
-			r = proc_cat(prv);
-			if(r < 0){
-				goto LAST;
-			}
-		}else if(pid == 0x0000){
-			if( prv->pat == NULL ){
-				prv->pat = create_ts_section_parser();
-				if(prv->pat == NULL){
-					r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
-					goto LAST;
-				}
-			}
-			m = prv->pat->put(prv->pat, &hdr, p, n);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
-				goto LAST;
-			}
-			m = prv->pat->get_count(prv->pat);
-			if(m < 0){
-				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
-				goto LAST;
-			}
-			if(m == 0){
-				goto NEXT;
-			}
-			r = proc_pat(prv);
-			goto LAST;
-		}
-			
-	NEXT:
-		curr += unit;
-	}
-
-LAST:
-	m = curr - prv->sbuf.head;
-	n = tail - curr;
-	if( (n < 1024) || (m > (prv->sbuf.max/2) ) ){
-		p = prv->sbuf.pool;
-		memcpy(p, curr, n);
-		prv->sbuf.head = p;
-		prv->sbuf.tail = p+n;
-	}else{
-		prv->sbuf.head = curr;
-	}
-
-	return r;
-}
-
-static int proc_cat(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int r;
-	int n;
-	int emm_pid;
-
-	TS_SECTION sect;
-
-	r = 0;
-	memset(&sect, 0, sizeof(sect));
-
-	n = prv->cat->get(prv->cat, &sect);
-	if(n < 0){
-		r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
-		goto LAST;
-	}
-
-	if(sect.hdr.table_id != TS_SECTION_ID_CONDITIONAL_ACCESS){
-		r = ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH;
-		goto LAST;
-	}
-
-	emm_pid = find_ca_descriptor_pid(sect.data, sect.tail-4);
-	if( (emm_pid != 0x0000) && (emm_pid != 0x1fff) ){
-		if( (prv->map[emm_pid].target != NULL) &&
-		    (prv->map[emm_pid].type == PID_MAP_TYPE_OTHER) ){
-			DECRYPTOR_ELEM *dec;
-			dec = (DECRYPTOR_ELEM *)(prv->map[emm_pid].target);
-			dec->ref -= 1;
-			if(dec->ref < 1){
-				remove_decryptor(prv, dec);
-			}
-		}
-		prv->emm_pid = emm_pid;
-		prv->map[emm_pid].ref = 1;
-		prv->map[emm_pid].type = PID_MAP_TYPE_EMM;
-		prv->map[emm_pid].target = NULL;
-	}
-	
-	prv->map[0x0001].ref = 1;
-	prv->map[0x0001].type = PID_MAP_TYPE_CAT;
-	prv->map[0x0001].target = NULL;
-
-LAST:
-
-	if(sect.raw != NULL){
-		n = prv->cat->ret(prv->cat, &sect);
-		if( (n < 0) && (r == 0) ){
-			r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
-		}
-	}
-
-	return r;
-}
-
-static int proc_emm(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	int r;
-	int i,j,n;
-
-	int len;
-
-	uint8_t *head;
-	uint8_t *tail;
-
-	TS_SECTION sect;
-	EMM_FIXED_PART emm_hdr;
-
-	r = 0;
-	memset(&sect, 0, sizeof(sect));
-
-	if(prv->bcas == NULL){
-		r = ARIB_STD_B25_ERROR_EMPTY_B_CAS_CARD;
-		goto LAST;
-	}
-
-	while( (n = prv->emm->get_count(prv->emm)) > 0 ){
-
-		n = prv->emm->get(prv->emm, &sect);
-		if(n < 0){
-			r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
-			goto LAST;
-		}
-
-		if(sect.hdr.table_id == TS_SECTION_ID_EMM_MESSAGE){
-			/* EMM_MESSAGE is not supported */
-			goto NEXT;
-		}else if(sect.hdr.table_id != TS_SECTION_ID_EMM_S){
-			r = ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH;
-			goto LAST;
-		}
-
-		head = sect.data;
-		tail = sect.tail - 4;
-
-		i = 0;
-		while( (head+13) <= tail ){
-			
-			extract_emm_fixed_part(&emm_hdr, head);
-			len = emm_hdr.associated_information_length+7;
-			if( (head+len) > tail ){
-				/* broken EMM element */
-				goto NEXT;
-			}
-			
-			for(j=0;j<prv->casid.count;j++){
-				if(prv->casid.data[j] == emm_hdr.card_id){
-					n = prv->bcas->proc_emm(prv->bcas, head, len);
-					if(n < 0){
-						r = ARIB_STD_B25_ERROR_EMM_PROC_FAILURE;
-						goto LAST;
-					}
-					unlock_all_decryptor(prv);
-				}
-			}
-
-			head += len;
-		}
-
-	NEXT:
-		if(sect.raw != NULL){
-			n = prv->emm->ret(prv->emm, &sect);
-			if( (n < 0) && (r == 0) ){
-				r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
-				goto LAST;
-			}
-			memset(&sect, 0, sizeof(sect));
-		}
-	}
-
-LAST:
-	if(sect.raw != NULL){
-		n = prv->emm->ret(prv->emm, &sect);
-		if( (n < 0) && (r == 0) ){
-			r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
-		}
-	}
-
-	return r;
-}
-
-static void release_program(ARIB_STD_B25_PRIVATE_DATA *prv, TS_PROGRAM *pgrm)
-{
-	int32_t pid;
-	TS_STREAM_ELEM *strm;
-
-	pid = pgrm->pmt_pid;
-	
-	if(pgrm->pmt != NULL){
-		pgrm->pmt->release(pgrm->pmt);
-		pgrm->pmt = NULL;
-	}
-
-	while( (strm = get_stream_list_head(&(pgrm->old_strm))) != NULL ){
-		unref_stream(prv, strm->pid);
-		memset(strm, 0, sizeof(TS_STREAM_ELEM));
-		put_stream_list_tail(&(prv->strm_pool), strm);
-	}
-
-	while( (strm = get_stream_list_head(&(pgrm->streams))) != NULL ){
-		unref_stream(prv, strm->pid);
-		memset(strm, 0, sizeof(TS_STREAM_ELEM));
-		put_stream_list_tail(&(prv->strm_pool), strm);
-	}
-
-	prv->map[pid].type = PID_MAP_TYPE_UNKNOWN;
-	prv->map[pid].ref = 0;
-	prv->map[pid].target = NULL;
-}
-
-static void unref_stream(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid)
-{
-	DECRYPTOR_ELEM *dec;
-
-	prv->map[pid].ref -= 1;
-	if( prv->map[pid].ref < 1 ){
-		if( (prv->map[pid].target != NULL) &&
-		    (prv->map[pid].type == PID_MAP_TYPE_OTHER) ){
-			dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
-			dec->ref -= 1;
-			if(dec->ref < 1){
-				remove_decryptor(prv, dec);
-			}
-		}
-		prv->map[pid].type = PID_MAP_TYPE_UNKNOWN;
-		prv->map[pid].ref = 0;
-		prv->map[pid].target = NULL;
-	}
-}
-
-static DECRYPTOR_ELEM *set_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid)
-{
-	DECRYPTOR_ELEM *r;
-
-	r = NULL;
-	if(prv->map[pid].type == PID_MAP_TYPE_ECM){
-		r = (DECRYPTOR_ELEM *)(prv->map[pid].target);
-		if(r != NULL){
-			return r;
-		}
-	}
-	r = (DECRYPTOR_ELEM *)calloc(1, sizeof(DECRYPTOR_ELEM));
-	if(r == NULL){
-		return NULL;
-	}
-	r->ecm_pid = pid;
-	r->ecm = create_ts_section_parser();
-	if(r->ecm == NULL){
-		free(r);
-		return NULL;
-	}
-
-	if(prv->decrypt.tail != NULL){
-		r->prev = prv->decrypt.tail;
-		r->next = NULL;
-		prv->decrypt.tail->next = r;
-		prv->decrypt.tail = r;
-		prv->decrypt.count += 1;
-	}else{
-		r->prev = NULL;
-		r->next = NULL;
-		prv->decrypt.head = r;
-		prv->decrypt.tail = r;
-		prv->decrypt.count = 1;
-	}
-
-	if( (prv->map[pid].type == PID_MAP_TYPE_OTHER) &&
-	    (prv->map[pid].target != NULL) ){
-		DECRYPTOR_ELEM *dec;
-		dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
-		dec->ref -= 1;
-		if(dec->ref < 1){
-			remove_decryptor(prv, dec);
-		}
-	}
-
-	prv->map[pid].type = PID_MAP_TYPE_ECM;
-	prv->map[pid].target = r;
-
-	return r;
-}
-
-static void remove_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, DECRYPTOR_ELEM *dec)
-{
-	int32_t pid;
-
-	DECRYPTOR_ELEM *prev;
-	DECRYPTOR_ELEM *next;
-
-	pid = dec->ecm_pid;
-	if( (prv->map[pid].type == PID_MAP_TYPE_ECM) &&
-	    (prv->map[pid].target == ((void *)dec)) ){
-		prv->map[pid].type = PID_MAP_TYPE_UNKNOWN;
-		prv->map[pid].target = NULL;
-	}
-
-	prev = (DECRYPTOR_ELEM *)(dec->prev);
-	next = (DECRYPTOR_ELEM *)(dec->next);
-	if(prev != NULL){
-		prev->next = next;
-	}else{
-		prv->decrypt.head = next;
-	}
-	if(next != NULL){
-		next->prev = prev;
-	}else{
-		prv->decrypt.tail = prev;
-	}
-	prv->decrypt.count -= 1;
-
-	if(dec->ecm != NULL){
-		dec->ecm->release(dec->ecm);
-		dec->ecm = NULL;
-	}
-
-	if(dec->m2 != NULL){
-		dec->m2->release(dec->m2);
-		dec->m2 = NULL;
-	}
-
-	free(dec);
-}
-
-static DECRYPTOR_ELEM *select_active_decryptor(DECRYPTOR_ELEM *a, DECRYPTOR_ELEM *b, int32_t pid)
-{
-	if( b != NULL ){
-		return b;
-	}
-	if( pid == 0x1fff ){
-		return NULL;
-	}
-	return a;
-}
-
-static void bind_stream_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid, DECRYPTOR_ELEM *dec)
-{
-	DECRYPTOR_ELEM *old;
-
-	old = (DECRYPTOR_ELEM *)(prv->map[pid].target);
-	if(old == dec){
-		/* already binded - do nothing */
-		return;
-	}
-		 
-	if(old != NULL){
-		old->ref -= 1;
-		if(old->ref == 0){
-			remove_decryptor(prv, old);
-		}
-		prv->map[pid].target = NULL;
-	}
-
-	if(dec != NULL){
-		prv->map[pid].target = dec;
-		dec->ref += 1;
-	}
-}
-
-static void unlock_all_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv)
-{
-	DECRYPTOR_ELEM *e;
-
-	e = prv->decrypt.head;
-	while(e != NULL){
-		e->locked = 0;
-		e = (DECRYPTOR_ELEM *)(e->next);
-	}
-}
-
-static TS_STREAM_ELEM *get_stream_list_head(TS_STREAM_LIST *list)
-{
-	TS_STREAM_ELEM *r;
-
-	r = list->head;
-	if(r == NULL){
-		return NULL;
-	}
-
-	list->head = (TS_STREAM_ELEM *)(r->next);
-	if(list->head == NULL){
-		list->tail = NULL;
-		list->count = 0;
-	}else{
-		list->head->prev = NULL;
-		list->count -= 1;
-	}
-
-	r->prev = NULL;
-	r->next = NULL;
-
-	return r;
-}
-
-static TS_STREAM_ELEM *find_stream_list_elem(TS_STREAM_LIST *list, int32_t pid)
-{
-	TS_STREAM_ELEM *r;
-
-	r = list->head;
-	while(r != NULL){
-		if(r->pid == pid){
-			break;
-		}
-		r = (TS_STREAM_ELEM *)(r->next);
-	}
-
-	return r;
-}
-
-static TS_STREAM_ELEM *create_stream_elem(int32_t pid, int32_t type)
-{
-	TS_STREAM_ELEM *r;
-
-	r = (TS_STREAM_ELEM *)calloc(1, sizeof(TS_STREAM_ELEM));
-	if(r == NULL){
-		return NULL;
-	}
-
-	r->pid = pid;
-	r->type = type;
-
-	return r;
-}
-
-static void put_stream_list_tail(TS_STREAM_LIST *list, TS_STREAM_ELEM *elem)
-{
-	if(list->tail != NULL){
-		elem->prev = list->tail;
-		elem->next = NULL;
-		list->tail->next = elem;
-		list->tail = elem;
-		list->count += 1;
-	}else{
-		elem->prev = NULL;
-		elem->next = NULL;
-		list->head = elem;
-		list->tail = elem;
-		list->count = 1;
-	}
-}
-
-static void clear_stream_list(TS_STREAM_LIST *list)
-{
-	TS_STREAM_ELEM *p,*n;
-
-	p = list->head;
-	while(p != NULL){
-		n = (TS_STREAM_ELEM *)(p->next);
-		free(p);
-		p = n;
-	}
-
-	list->head = NULL;
-	list->tail = NULL;
-	list->count = 0;
-}
-
-static int reserve_work_buffer(TS_WORK_BUFFER *buf, int32_t size)
-{
-	int m,n;
-	uint8_t *p;
-	
-	if(buf->max >= size){
-		return 1;
-	}
-
-	if(buf->max < 512){
-		n = 512;
-	}else{
-		n = buf->max * 2;
-	}
-	
-	while(n < size){
-		n += n;
-	}
-
-	p = (uint8_t *)malloc(n);
-	if(p == NULL){
-		return 0;
-	}
-
-	m = 0;
-	if(buf->pool != NULL){
-		m = buf->tail - buf->head;
-		if(m > 0){
-			memcpy(p, buf->head, m);
-		}
-		free(buf->pool);
-		buf->pool = NULL;
-	}
-
-	buf->pool = p;
-	buf->head = p;
-	buf->tail = p+m;
-	buf->max = n;
-
-	return 1;
-}
-
-static int append_work_buffer(TS_WORK_BUFFER *buf, uint8_t *data, int32_t size)
-{
-	int m;
-
-	if(size < 1){
-		/* ignore - do nothing */
-		return 1;
-	}
-
-	m = buf->tail - buf->pool;
-
-	if( (m+size) > buf->max ){
-		if(!reserve_work_buffer(buf, m+size)){
-			return 0;
-		}
-	}
-
-	memcpy(buf->tail, data, size);
-	buf->tail += size;
-
-	return 1;
-}
-
-static void reset_work_buffer(TS_WORK_BUFFER *buf)
-{
-	buf->head = buf->pool;
-	buf->tail = buf->pool;
-}
-
-static void release_work_buffer(TS_WORK_BUFFER *buf)
-{
-	if(buf->pool != NULL){
-		free(buf->pool);
-	}
-	buf->pool = NULL;
-	buf->head = NULL;
-	buf->tail = NULL;
-	buf->max = 0;
-}
-
-static void extract_ts_header(TS_HEADER *dst, uint8_t *src)
-{
-	dst->sync                         =  src[0];
-	dst->transport_error_indicator    = (src[1] >> 7) & 0x01;
-	dst->payload_unit_start_indicator = (src[1] >> 6) & 0x01;
-	dst->transport_priority           = (src[1] >> 5) & 0x01;
-	dst->pid = ((src[1] & 0x1f) << 8) | src[2];
-	dst->transport_scrambling_control = (src[3] >> 6) & 0x03;
-	dst->adaptation_field_control     = (src[3] >> 4) & 0x03;
-	dst->continuity_counter           =  src[3]       & 0x0f;
-}
-
-static void extract_emm_fixed_part(EMM_FIXED_PART *dst, uint8_t *src)
-{
-	int i;
-
-	dst->card_id = 0;
-	for(i=0;i<6;i++){
-		dst->card_id = (dst->card_id << 8) | src[i];
-	}
-	
-	dst->associated_information_length = src[ 6];
-	dst->protocol_number               = src[ 7];
-	dst->broadcaster_group_id          = src[ 8];
-	dst->update_number                 = (src[ 9]<<8)|src[10];
-	dst->expiration_date               = (src[11]<<8)|src[12];
-}
-
-static int check_unit_invert(unsigned char *head, unsigned char *tail)
-{
-	unsigned char *buf;
-
-	buf = tail-188;
-
-	while(head <= buf){
-		if(buf[0] == 0x47){
-			return tail-buf;
-		}
-		buf -= 1;
-	}
-
-	return 0;
-}
-
-static uint8_t *resync(uint8_t *head, uint8_t *tail, int32_t unit_size)
-{
-	int i;
-	unsigned char *buf;
-
-	buf = head;
-	tail -= unit_size * 8;
-	while( buf <= tail ){
-		if(buf[0] == 0x47){
-			for(i=1;i<8;i++){
-				if(buf[unit_size*i] != 0x47){
-					break;
-				}
-			}
-			if(i == 8){
-				return buf;
-			}
-		}
-		buf += 1;
-	}
-
-	return NULL;
-}
-
-static uint8_t *resync_force(uint8_t *head, uint8_t *tail, int32_t unit_size)
-{
-	int i,n;
-	unsigned char *buf;
-
-	buf = head;
-	while( buf <= (tail-188) ){
-		if(buf[0] == 0x47){
-			n = (tail - buf) / unit_size;
-			if(n == 0){
-				return buf;
-			}
-			for(i=1;i<n;i++){
-				if(buf[unit_size*i] != 0x47){
-					break;
-				}
-			}
-			if(i == n){
-				return buf;
-			}
-		}
-		buf += 1;
-	}
-
-	return NULL;
-}
--- a/arib25v021/arib25/src/arib_std_b25.h	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-#ifndef ARIB_STD_B25_H
-#define ARIB_STD_B25_H
-
-#include "portable.h"
-#include "b_cas_card.h"
-
-typedef struct {
-	uint8_t *data;
-	int32_t  size;
-} ARIB_STD_B25_BUFFER;
-
-typedef struct {
-
-	int32_t  program_number; /* channel */
-	
-	int32_t  ecm_unpurchased_count;
-	int32_t  last_ecm_error_code;
-
-	int32_t  padding;
-
-	int64_t  total_packet_count;
-	int64_t  undecrypted_packet_count;
-	
-} ARIB_STD_B25_PROGRAM_INFO;
-
-typedef struct {
-
-	void *private_data;
-
-	void (* release)(void *std_b25);
-
-	int (* set_multi2_round)(void *std_b25, int32_t round);
-	int (* set_strip)(void *std_b25, int32_t strip);
-	int (* set_emm_proc)(void *std_b25, int32_t on);
-	
-	int (* set_b_cas_card)(void *std_b25, B_CAS_CARD *bcas);
-	
-	int (* reset)(void *std_b25);
-	int (* flush)(void *std_b25);
-
-	int (* put)(void *std_b25, ARIB_STD_B25_BUFFER *buf);
-	int (* get)(void *std_b25, ARIB_STD_B25_BUFFER *buf);
-
-	int (* get_program_count)(void *std_b25);
-	int (* get_program_info)(void *std_b25, ARIB_STD_B25_PROGRAM_INFO *info, int32_t idx);
-
-} ARIB_STD_B25;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern ARIB_STD_B25 *create_arib_std_b25();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ARIB_STD_B25_H */
-
--- a/arib25v021/arib25/src/arib_std_b25_error_code.h	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#ifndef ARIB_STD_B25_ERROR_CODE_H
-#define ARIB_STD_B25_ERROR_CODE_H
-
-#define ARIB_STD_B25_ERROR_INVALID_PARAM          -1
-#define ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY       -2
-#define ARIB_STD_B25_ERROR_NON_TS_INPUT_STREAM    -3
-#define ARIB_STD_B25_ERROR_NO_PAT_IN_HEAD_16M     -4
-#define ARIB_STD_B25_ERROR_NO_PMT_IN_HEAD_32M     -5
-#define ARIB_STD_B25_ERROR_NO_ECM_IN_HEAD_32M     -6
-#define ARIB_STD_B25_ERROR_EMPTY_B_CAS_CARD       -7
-#define ARIB_STD_B25_ERROR_INVALID_B_CAS_STATUS   -8
-#define ARIB_STD_B25_ERROR_ECM_PROC_FAILURE       -9
-#define ARIB_STD_B25_ERROR_DECRYPT_FAILURE       -10
-#define ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE     -11
-#define ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE     -12
-#define ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE     -13
-#define ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE     -14
-#define ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE     -15
-#define ARIB_STD_B25_ERROR_EMM_PROC_FAILURE      -16
-
-#define ARIB_STD_B25_WARN_UNPURCHASED_ECM          1
-#define ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH  2
-#define ARIB_STD_B25_WARN_BROKEN_TS_SECTION        3
-
-#endif /* ARIB_STD_B25_ERROR_CODE_H */
--- a/arib25v021/arib25/src/b_cas_card.c	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,729 +0,0 @@
-#include "b_cas_card.h"
-#include "b_cas_card_error_code.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <math.h>
-
-#if defined(WIN32)
-	#include <windows.h>
-#endif
-#include <winscard.h>
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- inner structures
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-typedef struct {
-	
-	SCARDCONTEXT       mng;
-	SCARDHANDLE        card;
-
-	uint8_t           *pool;
-	char              *reader;
-
-	uint8_t           *sbuf;
-	uint8_t           *rbuf;
-
-	B_CAS_INIT_STATUS  stat;
-	
-	B_CAS_ID           id;
-	int32_t            id_max;
-
-	B_CAS_PWR_ON_CTRL_INFO pwc;
-	int32_t            pwc_max;
-	
-} B_CAS_CARD_PRIVATE_DATA;
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- constant values
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static const uint8_t INITIAL_SETTING_CONDITIONS_CMD[] = {
-	0x90, 0x30, 0x00, 0x00, 0x00,
-};
-
-static const uint8_t CARD_ID_INFORMATION_ACQUIRE_CMD[] = {
-	0x90, 0x32, 0x00, 0x00, 0x00,
-};
-
-static const uint8_t POWER_ON_CONTROL_INFORMATION_REQUEST_CMD[] = {
-	0x90, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00,
-};
-
-static const uint8_t ECM_RECEIVE_CMD_HEADER[] = {
-	0x90, 0x34, 0x00, 0x00,
-};
-
-static const uint8_t EMM_RECEIVE_CMD_HEADER[] = {
-	0x90, 0x36, 0x00, 0x00,
-};
-
-#define B_CAS_BUFFER_MAX (4*1024)
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- function prottypes (interface method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static void release_b_cas_card(void *bcas);
-static int init_b_cas_card(void *bcas);
-static int get_init_status_b_cas_card(void *bcas, B_CAS_INIT_STATUS *stat);
-static int get_id_b_cas_card(void *bcas, B_CAS_ID *dst);
-static int get_pwr_on_ctrl_b_cas_card(void *bcas, B_CAS_PWR_ON_CTRL_INFO *dst);
-static int proc_ecm_b_cas_card(void *bcas, B_CAS_ECM_RESULT *dst, uint8_t *src, int len);
-static int proc_emm_b_cas_card(void *bcas, uint8_t *src, int len);
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- global function implementation
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-B_CAS_CARD *create_b_cas_card()
-{
-	int n;
-	
-	B_CAS_CARD *r;
-	B_CAS_CARD_PRIVATE_DATA *prv;
-
-	n = sizeof(B_CAS_CARD) + sizeof(B_CAS_CARD_PRIVATE_DATA);
-	prv = (B_CAS_CARD_PRIVATE_DATA *)calloc(1, n);
-	if(prv == NULL){
-		return NULL;
-	}
-
-	r = (B_CAS_CARD *)(prv+1);
-
-	r->private_data = prv;
-
-	r->release = release_b_cas_card;
-	r->init = init_b_cas_card;
-	r->get_init_status = get_init_status_b_cas_card;
-	r->get_id = get_id_b_cas_card;
-	r->get_pwr_on_ctrl = get_pwr_on_ctrl_b_cas_card;
-	r->proc_ecm = proc_ecm_b_cas_card;
-	r->proc_emm = proc_emm_b_cas_card;
-
-	return r;
-}
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- function prottypes (private method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static B_CAS_CARD_PRIVATE_DATA *private_data(void *bcas);
-static void teardown(B_CAS_CARD_PRIVATE_DATA *prv);
-static int change_id_max(B_CAS_CARD_PRIVATE_DATA *prv, int max);
-static int change_pwc_max(B_CAS_CARD_PRIVATE_DATA *prv, int max);
-static int connect_card(B_CAS_CARD_PRIVATE_DATA *prv, const char *reader_name);
-static void extract_power_on_ctrl_response(B_CAS_PWR_ON_CTRL *dst, uint8_t *src);
-static void extract_mjd(int *yy, int *mm, int *dd, int mjd);
-static int setup_ecm_receive_command(uint8_t *dst, uint8_t *src, int len);
-static int setup_emm_receive_command(uint8_t *dst, uint8_t *src, int len);
-static int32_t load_be_uint16(uint8_t *p);
-static int64_t load_be_uint48(uint8_t *p);
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- interface method implementation
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static void release_b_cas_card(void *bcas)
-{
-	B_CAS_CARD_PRIVATE_DATA *prv;
-
-	prv = private_data(bcas);
-	if(prv == NULL){
-		/* do nothing */
-		return;
-	}
-
-	teardown(prv);
-	free(prv);
-}
-
-static int init_b_cas_card(void *bcas)
-{
-	int m;
-	LONG ret;
-	DWORD len;
-	
-	B_CAS_CARD_PRIVATE_DATA *prv;
-
-	prv = private_data(bcas);
-	if(prv == NULL){
-		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
-	}
-
-	teardown(prv);
-
-	ret = SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &(prv->mng));
-	if(ret != SCARD_S_SUCCESS){
-		return B_CAS_CARD_ERROR_NO_SMART_CARD_READER;
-	}
-
-	ret = SCardListReaders(prv->mng, NULL, NULL, &len);
-	if(ret != SCARD_S_SUCCESS){
-		return B_CAS_CARD_ERROR_NO_SMART_CARD_READER;
-	}
-	len += 256;
-	
-	m = len + (2*B_CAS_BUFFER_MAX) + (sizeof(int64_t)*16) + (sizeof(B_CAS_PWR_ON_CTRL)*16);
-	prv->pool = (uint8_t *)malloc(m);
-	if(prv->pool == NULL){
-		return B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY;
-	}
-
-	prv->reader = (char *)(prv->pool);
-	prv->sbuf = prv->pool + len;
-	prv->rbuf = prv->sbuf + B_CAS_BUFFER_MAX;
-	prv->id.data = (int64_t *)(prv->rbuf + B_CAS_BUFFER_MAX);
-	prv->id_max = 16;
-	prv->pwc.data = (B_CAS_PWR_ON_CTRL *)(prv->id.data + prv->id_max);
-	prv->pwc_max = 16;
-
-	ret = SCardListReaders(prv->mng, NULL, prv->reader, &len);
-	if(ret != SCARD_S_SUCCESS){
-		return B_CAS_CARD_ERROR_NO_SMART_CARD_READER;
-	}
-
-	while( prv->reader[0] != 0 ){
-		if(connect_card(prv, prv->reader)){
-			break;
-		}
-		prv->reader += (strlen(prv->reader) + 1);
-	}
-
-	if(prv->card == 0){
-		return B_CAS_CARD_ERROR_ALL_READERS_CONNECTION_FAILED;
-	}
-
-	return 0;
-}
-
-static int get_init_status_b_cas_card(void *bcas, B_CAS_INIT_STATUS *stat)
-{
-	B_CAS_CARD_PRIVATE_DATA *prv;
-
-	prv = private_data(bcas);
-	if( (prv == NULL) || (stat == NULL) ){
-		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
-	}
-
-	if(prv->card == 0){
-		return B_CAS_CARD_ERROR_NOT_INITIALIZED;
-	}
-
-	memcpy(stat, &(prv->stat), sizeof(B_CAS_INIT_STATUS));
-
-	return 0;
-}
-
-static int get_id_b_cas_card(void *bcas, B_CAS_ID *dst)
-{
-	LONG ret;
-	
-	DWORD slen;
-	DWORD rlen;
-
-	int i,num;
-
-	uint8_t *p;
-	uint8_t *tail;
-	
-	B_CAS_CARD_PRIVATE_DATA *prv;
-	SCARD_IO_REQUEST sir;
-
-	prv = private_data(bcas);
-	if( (prv == NULL) || (dst == NULL) ){
-		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
-	}
-
-	if(prv->card == 0){
-		return B_CAS_CARD_ERROR_NOT_INITIALIZED;
-	}
-
-	slen = sizeof(CARD_ID_INFORMATION_ACQUIRE_CMD);
-	memcpy(prv->sbuf, CARD_ID_INFORMATION_ACQUIRE_CMD, slen);
-	memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
-	rlen = B_CAS_BUFFER_MAX;
-
-	ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
-	if( (ret != SCARD_S_SUCCESS) || (rlen < 19) ){
-		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
-	}
-
-	p = prv->rbuf + 6;
-	tail = prv->rbuf + rlen;
-	if( p+1 > tail ){
-		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
-	}
-
-	num = p[0];
-	if(num > prv->id_max){
-		if(change_id_max(prv, num+4) < 0){
-			return B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY;
-		}
-	}
-	
-	p += 1;
-	for(i=0;i<num;i++){
-		if( p+10 > tail ){
-			return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
-		}
-		
-		{
-			int maker_id;
-			int version;
-			int check_code;
-			
-			maker_id = p[0];
-			version = p[1];
-			prv->id.data[i] = load_be_uint48(p+2);
-			check_code = load_be_uint16(p+8);
-		}
-		
-		p += 10;
-	}
-
-	prv->id.count = num;
-
-	memcpy(dst, &(prv->id), sizeof(B_CAS_ID));
-
-	return 0;
-}
-
-static int get_pwr_on_ctrl_b_cas_card(void *bcas, B_CAS_PWR_ON_CTRL_INFO *dst)
-{
-	LONG ret;
-	
-	DWORD slen;
-	DWORD rlen;
-
-	int i,num,code;
-
-	B_CAS_CARD_PRIVATE_DATA *prv;
-	SCARD_IO_REQUEST sir;
-
-	memset(dst, 0, sizeof(B_CAS_PWR_ON_CTRL_INFO));
-
-	prv = private_data(bcas);
-	if( (prv == NULL) || (dst == NULL) ){
-		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
-	}
-
-	if(prv->card == 0){
-		return B_CAS_CARD_ERROR_NOT_INITIALIZED;
-	}
-
-	slen = sizeof(POWER_ON_CONTROL_INFORMATION_REQUEST_CMD);
-	memcpy(prv->sbuf, POWER_ON_CONTROL_INFORMATION_REQUEST_CMD, slen);
-	prv->sbuf[5] = 0;
-	memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
-	rlen = B_CAS_BUFFER_MAX;
-
-	ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
-	if( (ret != SCARD_S_SUCCESS) || (rlen < 18) || (prv->rbuf[6] != 0) ){
-		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
-	}
-
-	code = load_be_uint16(prv->rbuf+4);
-	if(code == 0xa101){
-		/* no data */
-		return 0;
-	}else if(code != 0x2100){
-		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
-	}
-
-	num = (prv->rbuf[7] + 1);
-	if(prv->pwc_max < num){
-		if(change_pwc_max(prv, num+4) < 0){
-			return B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY;
-		}
-	}
-
-	extract_power_on_ctrl_response(prv->pwc.data+0, prv->rbuf);
-
-	for(i=1;i<num;i++){
-		prv->sbuf[5] = i;
-		rlen = B_CAS_BUFFER_MAX;
-
-		ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
-		if( (ret != SCARD_S_SUCCESS) || (rlen < 18) || (prv->rbuf[6] != i) ){
-			return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
-		}
-
-		extract_power_on_ctrl_response(prv->pwc.data+i, prv->rbuf);
-	}
-
-	prv->pwc.count = num;
-
-	memcpy(dst, &(prv->pwc), sizeof(B_CAS_PWR_ON_CTRL_INFO));
-
-	return 0;
-}
-
-static int proc_ecm_b_cas_card(void *bcas, B_CAS_ECM_RESULT *dst, uint8_t *src, int len)
-{
-	int retry_count;
-	
-	LONG ret;
-	DWORD slen;
-	DWORD rlen;
-	
-	B_CAS_CARD_PRIVATE_DATA *prv;
-
-	SCARD_IO_REQUEST sir;
-
-	prv = private_data(bcas);
-	if( (prv == NULL) ||
-	    (dst == NULL) ||
-	    (src == NULL) ||
-	    (len < 1) ){
-		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
-	}
-
-	if(prv->card == 0){
-		return B_CAS_CARD_ERROR_NOT_INITIALIZED;
-	}
-
-	slen = setup_ecm_receive_command(prv->sbuf, src, len);
-	memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
-	rlen = B_CAS_BUFFER_MAX;
-
-	retry_count = 0;
-	ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
-	while( ((ret != SCARD_S_SUCCESS) || (rlen < 25)) && (retry_count < 10) ){
-		retry_count += 1;
-		if(!connect_card(prv, prv->reader)){
-			continue;
-		}
-		slen = setup_ecm_receive_command(prv->sbuf, src, len);
-		memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
-		rlen = B_CAS_BUFFER_MAX;
-
-		ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
-	}
-
-	if( (ret != SCARD_S_SUCCESS) || (rlen < 25) ){
-		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
-	}
-
-	memcpy(dst->scramble_key, prv->rbuf+6, 16);
-	dst->return_code = load_be_uint16(prv->rbuf+4);
-
-	return 0;
-}
-
-static int proc_emm_b_cas_card(void *bcas, uint8_t *src, int len)
-{
-	int retry_count;
-	
-	LONG ret;
-	DWORD slen;
-	DWORD rlen;
-	
-	B_CAS_CARD_PRIVATE_DATA *prv;
-
-	SCARD_IO_REQUEST sir;
-
-	prv = private_data(bcas);
-	if( (prv == NULL) ||
-	    (src == NULL) ||
-	    (len < 1) ){
-		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
-	}
-
-	if(prv->card == 0){
-		return B_CAS_CARD_ERROR_NOT_INITIALIZED;
-	}
-
-	slen = setup_emm_receive_command(prv->sbuf, src, len);
-	memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
-	rlen = B_CAS_BUFFER_MAX;
-
-	retry_count = 0;
-	ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
-	while( ((ret != SCARD_S_SUCCESS) || (rlen < 6)) && (retry_count < 2) ){
-		retry_count += 1;
-		if(!connect_card(prv, prv->reader)){
-			continue;
-		}
-		slen = setup_emm_receive_command(prv->sbuf, src, len);
-		memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
-		rlen = B_CAS_BUFFER_MAX;
-
-		ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
-	}
-
-	if( (ret != SCARD_S_SUCCESS) || (rlen < 6) ){
-		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
-	}
-
-	return 0;
-}
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- private method implementation
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static B_CAS_CARD_PRIVATE_DATA *private_data(void *bcas)
-{
-	B_CAS_CARD_PRIVATE_DATA *r;
-	B_CAS_CARD *p;
-
-	p = (B_CAS_CARD *)bcas;
-	if(p == NULL){
-		return NULL;
-	}
-
-	r = (B_CAS_CARD_PRIVATE_DATA *)(p->private_data);
-	if( ((void *)(r+1)) != ((void *)p) ){
-		return NULL;
-	}
-
-	return r;
-}
-
-static void teardown(B_CAS_CARD_PRIVATE_DATA *prv)
-{
-	if(prv->card != 0){
-		SCardDisconnect(prv->card, SCARD_LEAVE_CARD);
-		prv->card = 0;
-	}
-
-	if(prv->mng != 0){
-		SCardReleaseContext(prv->mng);
-		prv->mng = 0;
-	}
-
-	if(prv->pool != NULL){
-		free(prv->pool);
-		prv->pool = NULL;
-	}
-
-	prv->reader = NULL;
-	prv->sbuf = NULL;
-	prv->rbuf = NULL;
-	prv->id.data = NULL;
-	prv->id_max = 0;
-}
-
-static int change_id_max(B_CAS_CARD_PRIVATE_DATA *prv, int max)
-{
-	int m;
-	int reader_size;
-	int pwctrl_size;
-	
-	uint8_t *p;
-	uint8_t *old_reader;
-	uint8_t *old_pwctrl;
-
-	reader_size = prv->sbuf - prv->pool;
-	pwctrl_size = prv->pwc.count * sizeof(B_CAS_PWR_ON_CTRL);
-
-	m  = reader_size;
-	m += (2*B_CAS_BUFFER_MAX);
-	m += (max*sizeof(int64_t));
-	m += (prv->pwc_max*sizeof(B_CAS_PWR_ON_CTRL));
-	p = (uint8_t *)malloc(m);
-	if(p == NULL){
-		return B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY;
-	}
-
-	old_reader = (uint8_t *)(prv->reader);
-	old_pwctrl = (uint8_t *)(prv->pwc.data);
-
-	prv->reader = (char *)p;
-	prv->sbuf = prv->pool + reader_size;
-	prv->rbuf = prv->sbuf + B_CAS_BUFFER_MAX;
-	prv->id.data = (int64_t *)(prv->rbuf + B_CAS_BUFFER_MAX);
-	prv->id_max = max;
-	prv->pwc.data = (B_CAS_PWR_ON_CTRL *)(prv->id.data + prv->id_max);
-
-	memcpy(prv->reader, old_reader, reader_size);
-	memcpy(prv->pwc.data, old_pwctrl, pwctrl_size);
-	
-	free(prv->pool);
-	prv->pool = p;
-
-	return 0;
-}
-
-static int change_pwc_max(B_CAS_CARD_PRIVATE_DATA *prv, int max)
-{
-	int m;
-	int reader_size;
-	int cardid_size;
-	
-	uint8_t *p;
-	uint8_t *old_reader;
-	uint8_t *old_cardid;
-
-	reader_size = prv->sbuf - prv->pool;
-	cardid_size = prv->id.count * sizeof(int64_t);
-
-	m  = reader_size;
-	m += (2*B_CAS_BUFFER_MAX);
-	m += (prv->id_max*sizeof(int64_t));
-	m += (max*sizeof(B_CAS_PWR_ON_CTRL));
-	p = (uint8_t *)malloc(m);
-	if(p == NULL){
-		return B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY;
-	}
-
-	old_reader = (uint8_t *)(prv->reader);
-	old_cardid = (uint8_t *)(prv->id.data);
-
-	prv->reader = (char *)p;
-	prv->sbuf = prv->pool + reader_size;
-	prv->rbuf = prv->sbuf + B_CAS_BUFFER_MAX;
-	prv->id.data = (int64_t *)(prv->rbuf + B_CAS_BUFFER_MAX);
-	prv->pwc.data = (B_CAS_PWR_ON_CTRL *)(prv->id.data + prv->id_max);
-	prv->pwc_max = max;
-
-	memcpy(prv->reader, old_reader, reader_size);
-	memcpy(prv->id.data, old_cardid, cardid_size);
-	
-	free(prv->pool);
-	prv->pool = p;
-
-	return 0;
-}
-
-static int connect_card(B_CAS_CARD_PRIVATE_DATA *prv, const char *reader_name)
-{
-	int m,n;
-	
-	LONG ret;
-	DWORD rlen,protocol;
-
-	uint8_t *p;
-	
-	SCARD_IO_REQUEST sir;
-
-	if(prv->card != 0){
-		SCardDisconnect(prv->card, SCARD_RESET_CARD);
-		prv->card = 0;
-	}
-
-	ret = SCardConnect(prv->mng, reader_name, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T1, &(prv->card), &protocol);
-	if(ret != SCARD_S_SUCCESS){
-		return 0;
-	}
-
-	m = sizeof(INITIAL_SETTING_CONDITIONS_CMD);
-	memcpy(prv->sbuf, INITIAL_SETTING_CONDITIONS_CMD, m);
-	memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
-	rlen = B_CAS_BUFFER_MAX;
-	ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, m, &sir, prv->rbuf, &rlen);
-	if(ret != SCARD_S_SUCCESS){
-		return 0;
-	}
-
-	if(rlen < 57){
-		return 0;
-	}
-	
-	p = prv->rbuf;
-
-	n = load_be_uint16(p+4);
-	if(n != 0x2100){ // return code missmatch
-		return 0;
-	}
-
-	memcpy(prv->stat.system_key, p+16, 32);
-	memcpy(prv->stat.init_cbc, p+48, 8);
-	prv->stat.bcas_card_id = load_be_uint48(p+8);
-	prv->stat.card_status = load_be_uint16(p+2);
-
-	return 1;
-}
-
-static void extract_power_on_ctrl_response(B_CAS_PWR_ON_CTRL *dst, uint8_t *src)
-{
-	int referrence;
-	int start;
-	int limit;
-	
-	
-	dst->broadcaster_group_id = src[8];
-	referrence = (src[9]<<8)|src[10];
-	start = referrence - src[11];
-	limit = start + (src[12]-1);
-
-	extract_mjd(&(dst->s_yy), &(dst->s_mm), &(dst->s_dd), start);
-	extract_mjd(&(dst->l_yy), &(dst->l_mm), &(dst->l_dd), limit);
-
-	dst->hold_time = src[13];
-	dst->network_id = (src[14]<<8)|src[15];
-	dst->transport_id = (src[16]<<8)|src[17];
-	
-}
-
-static void extract_mjd(int *yy, int *mm, int *dd, int mjd)
-{
-	int yd;
-	int md;
-	int d;
-
-	yd = (int)floor( (mjd-15078.2) / 365.25 );
-	md = (int)floor( ((mjd-14956.1) - (yd*365.25)) / 30.6001 );
-	d = mjd - 14956 - (int)floor(yd*365.25) - (int)floor(md*30.6001);
-	if( md > 13 ){
-		*dd = d;
-		*mm = md-13;
-		*yy = 1900+yd+1;
-	}else{
-		*dd = d;
-		*mm = md-1;
-		*yy = 1900+yd;
-	}
-
-	if(*yy < 2000){ /* mjd bit overflow - retry */
-		extract_mjd(yy, mm, dd, mjd+0x10000);
-	}
-}
-
-static int setup_ecm_receive_command(uint8_t *dst, uint8_t *src, int len)
-{
-	int r;
-	
-	r  = sizeof(ECM_RECEIVE_CMD_HEADER);
-	memcpy(dst+0, ECM_RECEIVE_CMD_HEADER, r);
-	dst[r] = (uint8_t)(len & 0xff);
-	r += 1;
-	memcpy(dst+r, src, len);
-	r += len;
-	dst[r] = 0;
-	r += 1;
-
-	return r;
-}
-
-static int setup_emm_receive_command(uint8_t *dst, uint8_t *src, int len)
-{
-	int r;
-
-	r  = sizeof(EMM_RECEIVE_CMD_HEADER);
-	memcpy(dst+0, EMM_RECEIVE_CMD_HEADER, r);
-	dst[r] = (uint8_t)(len & 0xff);
-	r += 1;
-	memcpy(dst+r, src, len);
-	r += len;
-	dst[r] = 0;
-	r += 1;
-
-	return r;
-}
-
-static int32_t load_be_uint16(uint8_t *p)
-{
-	return ((p[0]<<8)|p[1]);
-}
-
-static int64_t load_be_uint48(uint8_t *p)
-{
-	int i;
-	int64_t r;
-
-	r = p[0];
-	for(i=1;i<6;i++){
-		r <<= 8;
-		r |= p[i];
-	}
-
-	return r;
-}
-
--- a/arib25v021/arib25/src/b_cas_card.h	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-#ifndef B_CAS_CARD_H
-#define B_CAS_CARD_H
-
-#include "portable.h"
-
-typedef struct {
-	uint8_t  system_key[32];
-	uint8_t  init_cbc[8];
-	int64_t  bcas_card_id;
-	int32_t  card_status;
-} B_CAS_INIT_STATUS;
-
-typedef struct {
-	int64_t *data;
-	int32_t  count;
-} B_CAS_ID;
-
-typedef struct {
-	
-	int32_t  s_yy; /* start date : year  */
-	int32_t  s_mm; /* start date : month */
-	int32_t  s_dd; /* start date : day   */
-	
-	int32_t  l_yy; /* limit date : year  */
-	int32_t  l_mm; /* limit date : month */
-	int32_t  l_dd; /* limit date : day   */
-
-	int32_t  hold_time; /* in hour unit  */
-
-	int32_t  broadcaster_group_id;
-	
-	int32_t  network_id;
-	int32_t  transport_id;
-	
-} B_CAS_PWR_ON_CTRL;
-
-typedef struct {
-	B_CAS_PWR_ON_CTRL *data;
-	int32_t  count;
-} B_CAS_PWR_ON_CTRL_INFO;
-
-typedef struct {
-	uint8_t  scramble_key[16];
-	uint32_t return_code;
-} B_CAS_ECM_RESULT;
-
-typedef struct {
-
-	void *private_data;
-
-	void (* release)(void *bcas);
-
-	int (* init)(void *bcas);
-
-	int (* get_init_status)(void *bcas, B_CAS_INIT_STATUS *stat);
-	int (* get_id)(void *bcas, B_CAS_ID *dst);
-	int (* get_pwr_on_ctrl)(void *bcas, B_CAS_PWR_ON_CTRL_INFO *dst);
-
-	int (* proc_ecm)(void *bcas, B_CAS_ECM_RESULT *dst, uint8_t *src, int len);
-	int (* proc_emm)(void *bcas, uint8_t *src, int len);
-	
-} B_CAS_CARD;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern B_CAS_CARD *create_b_cas_card();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* B_CAS_CARD_H */
--- a/arib25v021/arib25/src/b_cas_card_error_code.h	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#ifndef B_CAS_CARD_ERROR_CODE_H
-#define B_CAS_CARD_ERROR_CODE_H
-
-#define B_CAS_CARD_ERROR_INVALID_PARAMETER              -1
-#define B_CAS_CARD_ERROR_NOT_INITIALIZED                -2
-#define B_CAS_CARD_ERROR_NO_SMART_CARD_READER           -3
-#define B_CAS_CARD_ERROR_ALL_READERS_CONNECTION_FAILED  -4
-#define B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY               -5
-#define B_CAS_CARD_ERROR_TRANSMIT_FAILED                -6
-
-#endif /* B_CAS_CARD_ERROR_CODE_H */
--- a/arib25v021/arib25/src/makefile.win	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-CC = cl
-CFLAG = /c /MT /W4 /O2
-LINK = link
-LFLAG = /nologo
-LIBS = winscard.lib
-
-ALL: b25.exe
-
-arib_std_b25.obj: arib_std_b25.c arib_std_b25.h portable.h b_cas_card.h arib_std_b25_error_code.h multi2.h ts_section_parser.h ts_common_types.h 
-	$(CC) $(CFLAG) arib_std_b25.c
-
-b_cas_card.obj: b_cas_card.c b_cas_card.h portable.h b_cas_card_error_code.h 
-	$(CC) $(CFLAG) b_cas_card.c
-
-multi2.obj: multi2.c multi2.h portable.h multi2_error_code.h 
-	$(CC) $(CFLAG) multi2.c
-
-td.obj: td.c arib_std_b25.h portable.h b_cas_card.h 
-	$(CC) $(CFLAG) td.c
-
-ts_section_parser.obj: ts_section_parser.c ts_section_parser.h ts_common_types.h portable.h ts_section_parser_error_code.h 
-	$(CC) $(CFLAG) ts_section_parser.c
-
-OBJ = arib_std_b25.obj b_cas_card.obj multi2.obj td.obj ts_section_parser.obj 
-
-b25.exe: $(OBJ)
-	$(LINK) $(LFLAG) $(LIBS) /OUT:b25.exe $(OBJ)
-
-clean:
-	DEL *.obj
-	DEL *.exe
-
-
--- a/arib25v021/arib25/src/multi2.c	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,527 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-
-#include "multi2.h"
-#include "multi2_error_code.h"
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- inline functions
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static __inline uint8_t *load_be_uint32(uint32_t *dst, uint8_t *src)
-{
-	*dst = ((src[0]<<24)|(src[1]<<16)|(src[2]<<8)|src[3]);
-	return src+4;
-}
-
-static __inline uint8_t *save_be_uint32(uint8_t *dst, uint32_t src)
-{
-	dst[0] = (uint8_t)((src>>24) & 0xff);
-	dst[1] = (uint8_t)((src>>16) & 0xff);
-	dst[2] = (uint8_t)((src>> 8) & 0xff);
-	dst[3] = (uint8_t)( src      & 0xff);
-	return dst+4;
-}
-
-static __inline uint32_t left_rotate_uint32(uint32_t val, uint32_t count)
-{
-	return ((val << count) | (val >> (32-count)));
-}
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- inner structures
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-typedef struct {
-	uint32_t key[8];
-} CORE_PARAM;
-
-typedef struct {
-	uint32_t l;
-	uint32_t r;
-} CORE_DATA;
-
-typedef struct {
-
-	int32_t    ref_count;
-
-	CORE_DATA  cbc_init;
-	
-	CORE_PARAM sys;
-	CORE_DATA  scr[2]; /* 0: odd, 1: even */
-	CORE_PARAM wrk[2]; /* 0: odd, 1: even */
-
-	uint32_t   round;
-	uint32_t   state;
-	
-} MULTI2_PRIVATE_DATA;
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- constant values
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-#define MULTI2_STATE_CBC_INIT_SET     (0x0001)
-#define MULTI2_STATE_SYSTEM_KEY_SET   (0x0002)
-#define MULTI2_STATE_SCRAMBLE_KEY_SET (0x0004)
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- function prottypes (interface method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static void release_multi2(void *m2);
-static int add_ref_multi2(void *m2);
-static int set_round_multi2(void *m2, int32_t val);
-static int set_system_key_multi2(void *m2, uint8_t *val);
-static int set_init_cbc_multi2(void *m2, uint8_t *val);
-static int set_scramble_key_multi2(void *m2, uint8_t *val);
-static int clear_scramble_key_multi2(void *m2);
-static int encrypt_multi2(void *m2, int32_t type, uint8_t *buf, int32_t size);
-static int decrypt_multi2(void *m2, int32_t type, uint8_t *buf, int32_t size);
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- global function implementation
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-MULTI2 *create_multi2()
-{
-	int n;
-	
-	MULTI2 *r;
-	MULTI2_PRIVATE_DATA *prv;
-
-	n  = sizeof(MULTI2_PRIVATE_DATA);
-	n += sizeof(MULTI2);
-	
-	prv = (MULTI2_PRIVATE_DATA *)calloc(1, n);
-	if(prv == NULL){
-		return NULL;
-	}
-
-	r = (MULTI2 *)(prv+1);
-	r->private_data = prv;
-
-	prv->ref_count = 1;
-	prv->round = 4;
-
-	r->release = release_multi2;
-	r->add_ref = add_ref_multi2;
-	r->set_round = set_round_multi2;
-	r->set_system_key = set_system_key_multi2;
-	r->set_init_cbc = set_init_cbc_multi2;
-	r->set_scramble_key = set_scramble_key_multi2;
-	r->clear_scramble_key = clear_scramble_key_multi2;
-	r->encrypt = encrypt_multi2;
-	r->decrypt = decrypt_multi2;
-
-	return r;
-}
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- function prottypes (private method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static MULTI2_PRIVATE_DATA *private_data(void *m2);
-
-static void core_schedule(CORE_PARAM *work, CORE_PARAM *skey, CORE_DATA *dkey);
-
-static void core_encrypt(CORE_DATA *dst, CORE_DATA *src, CORE_PARAM *w, int32_t round);
-static void core_decrypt(CORE_DATA *dst, CORE_DATA *src, CORE_PARAM *w, int32_t round);
-
-static void core_pi1(CORE_DATA *dst, CORE_DATA *src);
-static void core_pi2(CORE_DATA *dst, CORE_DATA *src, uint32_t a);
-static void core_pi3(CORE_DATA *dst, CORE_DATA *src, uint32_t a, uint32_t b);
-static void core_pi4(CORE_DATA *dst, CORE_DATA *src, uint32_t a);
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- interface method implementation
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static void release_multi2(void *m2)
-{
-	MULTI2_PRIVATE_DATA *prv;
-
-	prv = private_data(m2);
-	if(prv == NULL){
-		/* do nothing */
-		return;
-	}
-
-	prv->ref_count -= 1;
-	if(prv->ref_count == 0){
-		free(prv);
-	}
-}
-
-static int add_ref_multi2(void *m2)
-{
-	MULTI2_PRIVATE_DATA *prv;
-
-	prv = private_data(m2);
-	if(prv == NULL){
-		return MULTI2_ERROR_INVALID_PARAMETER;
-	}
-
-	prv->ref_count += 1;
-
-	return 0;
-}
-
-static int set_round_multi2(void *m2, int32_t val)
-{
-	MULTI2_PRIVATE_DATA *prv;
-
-	prv = private_data(m2);
-	if(prv == NULL){
-		/* do nothing */
-		return MULTI2_ERROR_INVALID_PARAMETER;
-	}
-
-	prv->round = val;
-
-	return 0;
-}
-
-static int set_system_key_multi2(void *m2, uint8_t *val)
-{
-	int i;
-	uint8_t *p;
-	
-	MULTI2_PRIVATE_DATA *prv;
-
-	prv = private_data(m2);
-	if( (prv == NULL) || (val == NULL) ){
-		return MULTI2_ERROR_INVALID_PARAMETER;
-	}
-
-	p = val;
-	for(i=0;i<8;i++){
-		p = load_be_uint32(prv->sys.key+i, p);
-	}
-
-	prv->state |= MULTI2_STATE_SYSTEM_KEY_SET;
-
-	return 0;
-}
-
-static int set_init_cbc_multi2(void *m2, uint8_t *val)
-{
-	uint8_t *p;
-	
-	MULTI2_PRIVATE_DATA *prv;
-
-	prv = private_data(m2);
-	if( (prv == NULL) || (val == NULL) ){
-		return MULTI2_ERROR_INVALID_PARAMETER;
-	}
-
-	p = val;
-
-	p = load_be_uint32(&(prv->cbc_init.l), p);
-	p = load_be_uint32(&(prv->cbc_init.r), p);
-
-	prv->state |= MULTI2_STATE_CBC_INIT_SET;
-
-	return 0;
-}
-
-static int set_scramble_key_multi2(void *m2, uint8_t *val)
-{
-	uint8_t *p;
-	
-	MULTI2_PRIVATE_DATA *prv;
-
-	prv = private_data(m2);
-	if( (prv == NULL) || (val == NULL) ){
-		return MULTI2_ERROR_INVALID_PARAMETER;
-	}
-
-	p = val;
-
-	p = load_be_uint32(&(prv->scr[0].l), p);
-	p = load_be_uint32(&(prv->scr[0].r), p);
-	p = load_be_uint32(&(prv->scr[1].l), p);
-	p = load_be_uint32(&(prv->scr[1].r), p);
-	
-	core_schedule(prv->wrk+0, &(prv->sys), prv->scr+0);
-	core_schedule(prv->wrk+1, &(prv->sys), prv->scr+1);
-
-	prv->state |= MULTI2_STATE_SCRAMBLE_KEY_SET;
-
-	return 0;
-}
-
-static int clear_scramble_key_multi2(void *m2)
-{
-	MULTI2_PRIVATE_DATA *prv;
-
-	prv = private_data(m2);
-	if(prv == NULL){
-		return MULTI2_ERROR_INVALID_PARAMETER;
-	}
-
-	memset(prv->scr, 0, sizeof(prv->scr));
-	memset(prv->wrk, 0, sizeof(prv->wrk));
-
-	prv->state &= (~MULTI2_STATE_SCRAMBLE_KEY_SET);
-
-	return 0;
-}
-
-static int encrypt_multi2(void *m2, int32_t type, uint8_t *buf, int32_t size)
-{
-	CORE_DATA src,dst;
-	CORE_PARAM *prm;
-
-	uint8_t *p;
-
-	MULTI2_PRIVATE_DATA *prv;
-
-	prv = private_data(m2);
-	if( (prv == NULL) || (buf == NULL) || (size < 1) ){
-		return MULTI2_ERROR_INVALID_PARAMETER;
-	}
-
-	if(prv->state != (MULTI2_STATE_CBC_INIT_SET|MULTI2_STATE_SYSTEM_KEY_SET|MULTI2_STATE_SCRAMBLE_KEY_SET)){
-		if( (prv->state & MULTI2_STATE_CBC_INIT_SET) == 0 ){
-			return MULTI2_ERROR_UNSET_CBC_INIT;
-		}
-		if( (prv->state & MULTI2_STATE_SYSTEM_KEY_SET) == 0 ){
-			return MULTI2_ERROR_UNSET_SYSTEM_KEY;
-		}
-		if( (prv->state & MULTI2_STATE_SCRAMBLE_KEY_SET) == 0 ){
-			return MULTI2_ERROR_UNSET_SCRAMBLE_KEY;
-		}
-	}
-	
-	if(type == 0x02){
-		prm = prv->wrk+1;
-	}else{
-		prm = prv->wrk+0;
-	}
-
-	dst.l = prv->cbc_init.l;
-	dst.r = prv->cbc_init.r;
-
-	p = buf;
-	while(size >= 8){
-		load_be_uint32(&(src.l), p+0);
-		load_be_uint32(&(src.r), p+4);
-		src.l = src.l ^ dst.l;
-		src.r = src.r ^ dst.r;
-		core_encrypt(&dst, &src, prm, prv->round);
-		p = save_be_uint32(p, dst.l);
-		p = save_be_uint32(p, dst.r);
-		size -= 8;
-	}
-
-	if(size > 0){
-		int i;
-		uint8_t tmp[8];
-		
-		src.l = dst.l;
-		src.r = dst.r;
-		core_encrypt(&dst, &src, prm, prv->round);
-		save_be_uint32(tmp+0, dst.l);
-		save_be_uint32(tmp+4, dst.r);
-
-		for(i=0;i<size;i++){
-			p[i] = (uint8_t)(p[i] ^ tmp[i]);
-		}
-	}
-
-	return 0;
-}
-
-static int decrypt_multi2(void *m2, int32_t type, uint8_t *buf, int32_t size)
-{
-	CORE_DATA src,dst,cbc;
-	CORE_PARAM *prm;
-
-	uint8_t *p;
-
-	MULTI2_PRIVATE_DATA *prv;
-
-	prv = private_data(m2);
-	if( (prv == NULL) || (buf == NULL) || (size < 1) ){
-		return MULTI2_ERROR_INVALID_PARAMETER;
-	}
-
-	if(prv->state != (MULTI2_STATE_CBC_INIT_SET|MULTI2_STATE_SYSTEM_KEY_SET|MULTI2_STATE_SCRAMBLE_KEY_SET)){
-		if( (prv->state & MULTI2_STATE_CBC_INIT_SET) == 0 ){
-			return MULTI2_ERROR_UNSET_CBC_INIT;
-		}
-		if( (prv->state & MULTI2_STATE_SYSTEM_KEY_SET) == 0 ){
-			return MULTI2_ERROR_UNSET_SYSTEM_KEY;
-		}
-		if( (prv->state & MULTI2_STATE_SCRAMBLE_KEY_SET) == 0 ){
-			return MULTI2_ERROR_UNSET_SCRAMBLE_KEY;
-		}
-	}
-	
-	if(type == 0x02){
-		prm = prv->wrk+1;
-	}else{
-		prm = prv->wrk+0;
-	}
-
-	cbc.l = prv->cbc_init.l;
-	cbc.r = prv->cbc_init.r;
-
-	p = buf;
-	while(size >= 8){
-		load_be_uint32(&(src.l), p+0);
-		load_be_uint32(&(src.r), p+4);
-		core_decrypt(&dst, &src, prm, prv->round);
-		dst.l = dst.l ^ cbc.l;
-		dst.r = dst.r ^ cbc.r;
-		cbc.l = src.l;
-		cbc.r = src.r;
-		p = save_be_uint32(p, dst.l);
-		p = save_be_uint32(p, dst.r);
-		size -= 8;
-	}
-
-	if(size > 0){
-		int i;
-		uint8_t tmp[8];
-		
-		core_encrypt(&dst, &cbc, prm, prv->round);
-		save_be_uint32(tmp+0, dst.l);
-		save_be_uint32(tmp+4, dst.r);
-
-		for(i=0;i<size;i++){
-			p[i] = (uint8_t)(p[i] ^ tmp[i]);
-		}
-	}
-
-	return 0;
-}
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- private method implementation
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static MULTI2_PRIVATE_DATA *private_data(void *m2)
-{
-	MULTI2_PRIVATE_DATA *r;
-	MULTI2 *p;
-
-	p = (MULTI2 *)m2;
-	if(p == NULL){
-		return NULL;
-	}
-
-	r = (MULTI2_PRIVATE_DATA *)(p->private_data);
-	if( ((void *)(r+1)) != ((void *)p) ){
-		return NULL;
-	}
-
-	return r;
-}
-
-static void core_schedule(CORE_PARAM *work, CORE_PARAM *skey, CORE_DATA *dkey)
-{
-	CORE_DATA b1,b2,b3,b4,b5,b6,b7,b8,b9;
-
-	core_pi1(&b1, dkey);
-	
-	core_pi2(&b2, &b1, skey->key[0]);
-	work->key[0] = b2.l;
-	
-	core_pi3(&b3, &b2, skey->key[1], skey->key[2]);
-	work->key[1] = b3.r;
-	
-	core_pi4(&b4, &b3, skey->key[3]);
-	work->key[2] = b4.l;
-
-	core_pi1(&b5, &b4);
-	work->key[3] = b5.r;
-
-	core_pi2(&b6, &b5, skey->key[4]);
-	work->key[4] = b6.l;
-
-	core_pi3(&b7, &b6, skey->key[5], skey->key[6]);
-	work->key[5] = b7.r;
-
-	core_pi4(&b8, &b7, skey->key[7]);
-	work->key[6] = b8.l;
-
-	core_pi1(&b9, &b8);
-	work->key[7] = b9.r;
-}
-
-static void core_encrypt(CORE_DATA *dst, CORE_DATA *src, CORE_PARAM *w, int32_t round)
-{
-	int32_t i;
-	
-	CORE_DATA tmp;
-	
-	dst->l = src->l;
-	dst->r = src->r;
-	for(i=0;i<round;i++){
-		core_pi1(&tmp,  dst);
-		core_pi2( dst, &tmp, w->key[0]);
-		core_pi3(&tmp,  dst, w->key[1], w->key[2]);
-		core_pi4( dst, &tmp, w->key[3]);
-		core_pi1(&tmp,  dst);
-		core_pi2( dst, &tmp, w->key[4]);
-		core_pi3(&tmp,  dst, w->key[5], w->key[6]);
-		core_pi4( dst, &tmp, w->key[7]);
-	}
-}
-
-static void core_decrypt(CORE_DATA *dst, CORE_DATA *src, CORE_PARAM *w, int32_t round)
-{
-	int32_t i;
-	
-	CORE_DATA tmp;
-
-	dst->l = src->l;
-	dst->r = src->r;
-	for(i=0;i<round;i++){
-		core_pi4(&tmp,  dst, w->key[7]);
-		core_pi3( dst, &tmp, w->key[5], w->key[6]);
-		core_pi2(&tmp,  dst, w->key[4]);
-		core_pi1( dst, &tmp);
-		core_pi4(&tmp,  dst, w->key[3]);
-		core_pi3( dst, &tmp, w->key[1], w->key[2]);
-		core_pi2(&tmp,  dst, w->key[0]);
-		core_pi1( dst, &tmp);
-	}
-}
-
-static void core_pi1(CORE_DATA *dst, CORE_DATA *src)
-{
-	dst->l = src->l;
-	dst->r = src->r ^ src->l;
-}
-
-static void core_pi2(CORE_DATA *dst, CORE_DATA *src, uint32_t a)
-{
-	uint32_t t0,t1,t2;
-
-	t0 = src->r + a;
-	t1 = left_rotate_uint32(t0, 1) + t0 - 1;
-	t2 = left_rotate_uint32(t1, 4) ^ t1;
-
-	dst->l = src->l ^ t2;
-	dst->r = src->r;
-}
-
-static void core_pi3(CORE_DATA *dst, CORE_DATA *src, uint32_t a, uint32_t b)
-{
-	uint32_t t0,t1,t2,t3,t4,t5;
-
-	t0 = src->l + a;
-	t1 = left_rotate_uint32(t0, 2) + t0 + 1;
-	t2 = left_rotate_uint32(t1, 8) ^ t1;
-	t3 = t2 + b;
-	t4 = left_rotate_uint32(t3, 1) - t3;
-	t5 = left_rotate_uint32(t4, 16) ^ (t4 | src->l);
-
-	dst->l = src->l;
-	dst->r = src->r ^ t5;
-}
-
-static void core_pi4(CORE_DATA *dst, CORE_DATA *src, uint32_t a)
-{
-	uint32_t t0,t1;
-
-	t0 = src->r + a;
-	t1 = left_rotate_uint32(t0, 2) + t0 + 1;
-
-	dst->l = src->l ^ t1;
-	dst->r = src->r;
-}
--- a/arib25v021/arib25/src/multi2.h	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-#ifndef MULTI2_H
-#define MULTI2_H
-
-#include "portable.h"
-
-typedef struct {
-
-	void *private_data;
-
-	void (* release)(void *m2);
-	int (* add_ref)(void *m2);
-
-	int (* set_round)(void *m2, int32_t val);
-
-	int (* set_system_key)(void *m2, uint8_t *val);
-	int (* set_init_cbc)(void *m2, uint8_t *val);
-	int (* set_scramble_key)(void *m2, uint8_t *val);
-	int (* clear_scramble_key)(void *m2);
-
-	int (* encrypt)(void *m2, int32_t type, uint8_t *buf, int32_t size);
-	int (* decrypt)(void *m2, int32_t type, uint8_t *buf, int32_t size);
-
-} MULTI2;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern MULTI2 *create_multi2();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* MULTI2_H */
--- a/arib25v021/arib25/src/multi2_error_code.h	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#ifndef MULTI2_ERROR_CODE_H
-#define MULTI2_ERROR_CODE_H
-
-#define MULTI2_ERROR_INVALID_PARAMETER       -1
-#define MULTI2_ERROR_UNSET_SYSTEM_KEY        -2
-#define MULTI2_ERROR_UNSET_CBC_INIT          -3
-#define MULTI2_ERROR_UNSET_SCRAMBLE_KEY      -4
-
-#endif /* MULTI2_ERROR_CODE_H */
--- a/arib25v021/arib25/src/portable.h	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#ifndef PORTABLE_H
-#define PORTABLE_H
-
-#if (defined(WIN32) && MSC_VER < 1300) 
-
-typedef unsigned char     uint8_t;
-typedef   signed char      int8_t;
-typedef unsigned short   uint16_t;
-typedef   signed short    int16_t;
-typedef unsigned int     uint32_t;
-typedef   signed int      int32_t;
-typedef unsigned __int64 uint64_t;
-typedef   signed __int64  int64_t;
-
-#else
-
-#include <inttypes.h>
-
-#endif
-
-#if !defined(WIN32)
-	#define _open  open
-	#define _close close
-	#define _read  read
-	#define _write write
-	#define _lseeki64 lseek
-	#define _telli64(fd)  (lseek(fd,0,SEEK_CUR))
-	#define _O_BINARY     (0)
-	#define _O_RDONLY     (O_RDONLY)
-	#define _O_WRONLY     (O_WRONLY)
-	#define _O_SEQUENTIAL (0)
-	#define _O_CREAT      (O_CREAT)
-	#define _O_TRUNC      (O_TRUNC)
-	#define _S_IREAD      (S_IRUSR|S_IRGRP|S_IROTH)
-	#define _S_IWRITE     (S_IWUSR|S_IWGRP|S_IWOTH)
-#endif
-
-#endif /* PORTABLE_H */
--- a/arib25v021/arib25/src/td.c	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,385 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#if defined(WIN32)
-	#include <io.h>
-	#include <windows.h>
-	#include <crtdbg.h>
-#else
-	#define __STDC_FORMAT_MACROS
-	#include <inttypes.h>
-	#include <unistd.h>
-#endif
-
-#include "arib_std_b25.h"
-#include "b_cas_card.h"
-
-typedef struct {
-	int32_t round;
-	int32_t strip;
-	int32_t emm;
-	int32_t verbose;
-	int32_t power_ctrl;
-} OPTION;
-
-static void show_usage();
-static int parse_arg(OPTION *dst, int argc, char **argv);
-static void test_arib_std_b25(const char *src, const char *dst, OPTION *opt);
-static void show_bcas_power_on_control_info(B_CAS_CARD *bcas);
-
-int main(int argc, char **argv)
-{
-	int n;
-	OPTION opt;
-	
-	#if defined(WIN32)
-	_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
-	_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
-	_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
-	_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
-	_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
-	_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
-	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_DELAY_FREE_MEM_DF|_CRTDBG_CHECK_ALWAYS_DF|_CRTDBG_LEAK_CHECK_DF);
-	#endif
-
-	n = parse_arg(&opt, argc, argv);
-	if(n+2 > argc){
-		show_usage();
-		exit(EXIT_FAILURE);
-	}
-
-	test_arib_std_b25(argv[n+0], argv[n+1], &opt);
-
-	#if defined(WIN32)
-	_CrtDumpMemoryLeaks();
-	#endif
-
-	return EXIT_SUCCESS;
-}
-
-static void show_usage()
-{
-	fprintf(stderr, "b25 - ARIB STD-B25 test program ver. 0.2.1 (2008, 4/9)\n");
-	fprintf(stderr, "usage: b25 [options] src.m2t dst.m2t\n");
-	fprintf(stderr, "options:\n");
-	fprintf(stderr, "  -r round (integer, default=4)\n");
-	fprintf(stderr, "  -s strip\n");
-	fprintf(stderr, "     0: keep null(padding) stream (default)\n");
-	fprintf(stderr, "     1: strip null stream\n");
-	fprintf(stderr, "  -m EMM\n");
-	fprintf(stderr, "     0: ignore EMM (default)\n");
-	fprintf(stderr, "     1: send EMM to B-CAS card\n");
-	fprintf(stderr, "  -p power_on_control_info\n");
-	fprintf(stderr, "     0: do nothing additionaly\n");
-	fprintf(stderr, "     1: show B-CAS EMM receiving request (default)\n");
-	fprintf(stderr, "  -v verbose\n");
-	fprintf(stderr, "     0: silent\n");
-	fprintf(stderr, "     1: show processing status (default)\n");
-	fprintf(stderr, "\n");
-}
-
-static int parse_arg(OPTION *dst, int argc, char **argv)
-{
-	int i;
-	
-	dst->round = 4;
-	dst->strip = 0;
-	dst->emm = 0;
-	dst->power_ctrl = 1;
-	dst->verbose = 1;
-
-	for(i=1;i<argc;i++){
-		if(argv[i][0] != '-'){
-			break;
-		}
-		switch(argv[i][1]){
-		case 'm':
-			if(argv[i][2]){
-				dst->emm = atoi(argv[i]+2);
-			}else{
-				dst->emm = atoi(argv[i+1]);
-				i += 1;
-			}
-			break;
-		case 'p':
-			if(argv[i][2]){
-				dst->power_ctrl = atoi(argv[i]+2);
-			}else{
-				dst->power_ctrl = atoi(argv[i+1]);
-				i += 1;
-			}
-			break;
-		case 'r':
-			if(argv[i][2]){
-				dst->round = atoi(argv[i]+2);
-			}else{
-				dst->round = atoi(argv[i+1]);
-				i += 1;
-			}
-			break;
-		case 's':
-			if(argv[i][2]){
-				dst->strip = atoi(argv[i]+2);
-			}else{
-				dst->strip = atoi(argv[i+1]);
-				i += 1;
-			}
-			break;
-		case 'v':
-			if(argv[i][2]){
-				dst->verbose = atoi(argv[i]+2);
-			}else{
-				dst->verbose = atoi(argv[i+1]);
-				i += 1;
-			}
-			break;
-		default:
-			fprintf(stderr, "error - unknown option '-%c'\n", argv[i][1]);
-			return argc;
-		}
-	}
-
-	return i;
-}
-
-static void test_arib_std_b25(const char *src, const char *dst, OPTION *opt)
-{
-	int code,i,n,m;
-	int sfd,dfd;
-
-	int64_t total;
-	int64_t offset;
-
-	ARIB_STD_B25 *b25;
-	B_CAS_CARD   *bcas;
-
-	ARIB_STD_B25_PROGRAM_INFO pgrm;
-
-	uint8_t data[8*1024];
-
-	ARIB_STD_B25_BUFFER sbuf;
-	ARIB_STD_B25_BUFFER dbuf;
-
-	sfd = -1;
-	dfd = -1;
-	b25 = NULL;
-	bcas = NULL;
-
-	sfd = _open(src, _O_BINARY|_O_RDONLY|_O_SEQUENTIAL);
-	if(sfd < 0){
-		fprintf(stderr, "error - failed on _open(%s) [src]\n", src);
-		goto LAST;
-	}
-	
-	_lseeki64(sfd, 0, SEEK_END);
-	total = _telli64(sfd);
-	_lseeki64(sfd, 0, SEEK_SET);
-
-	b25 = create_arib_std_b25();
-	if(b25 == NULL){
-		fprintf(stderr, "error - failed on create_arib_std_b25()\n");
-		goto LAST;
-	}
-
-	code = b25->set_multi2_round(b25, opt->round);
-	if(code < 0){
-		fprintf(stderr, "error - failed on ARIB_STD_B25::set_multi2_round() : code=%d\n", code);
-		goto LAST;
-	}
-
-	code = b25->set_strip(b25, opt->strip);
-	if(code < 0){
-		fprintf(stderr, "error - failed on ARIB_STD_B25::set_strip() : code=%d\n", code);
-		goto LAST;
-	}
-
-	code = b25->set_emm_proc(b25, opt->emm);
-	if(code < 0){
-		fprintf(stderr, "error - failed on ARIB_STD_B25::set_emm_proc() : code=%d\n", code);
-		goto LAST;
-	}
-
-	bcas = create_b_cas_card();
-	if(bcas == NULL){
-		fprintf(stderr, "error - failed on create_b_cas_card()\n");
-		goto LAST;
-	}
-
-	code = bcas->init(bcas);
-	if(code < 0){
-		fprintf(stderr, "error - failed on B_CAS_CARD::init() : code=%d\n", code);
-		goto LAST;
-	}
-
-	code = b25->set_b_cas_card(b25, bcas);
-	if(code < 0){
-		fprintf(stderr, "error - failed on ARIB_STD_B25::set_b_cas_card() : code=%d\n", code);
-		goto LAST;
-	}
-
-	dfd = _open(dst, _O_BINARY|_O_WRONLY|_O_SEQUENTIAL|_O_CREAT|_O_TRUNC, _S_IREAD|_S_IWRITE);
-	if(dfd < 0){
-		fprintf(stderr, "error - failed on _open(%s) [dst]\n", dst);
-		goto LAST;
-	}
-
-	offset = 0;
-	while( (n = _read(sfd, data, sizeof(data))) > 0 ){
-		sbuf.data = data;
-		sbuf.size = n;
-
-		if(offset == 0x000000006dfd2000){
-			offset = 0x000000006dfd2000;
-		}
-
-		code = b25->put(b25, &sbuf);
-		if(code < 0){
-			fprintf(stderr, "error - failed on ARIB_STD_B25::put() : code=%d\n", code);
-			goto LAST;
-		}
-
-		code = b25->get(b25, &dbuf);
-		if(code < 0){
-			fprintf(stderr, "error - failed on ARIB_STD_B25::get() : code=%d\n", code);
-			goto LAST;
-		}
-
-		if(dbuf.size > 0){
-			n = _write(dfd, dbuf.data, dbuf.size);
-			if(n != dbuf.size){
-				fprintf(stderr, "error failed on _write(%d)\n", dbuf.size);
-				goto LAST;
-			}
-		}
-		
-		offset += sbuf.size;
-		if(opt->verbose != 0){
-			m = (int)(10000*offset/total);
-			fprintf(stderr, "\rprocessing: %2d.%02d%% ", m/100, m%100);
-		}
-	}
-
-	code = b25->flush(b25);
-	if(code < 0){
-		fprintf(stderr, "error - failed on ARIB_STD_B25::flush() : code=%d\n", code);
-		goto LAST;
-	}
-	
-	code = b25->get(b25, &dbuf);
-	if(code < 0){
-		fprintf(stderr, "error - failed on ARIB_STD_B25::get() : code=%d\n", code);
-		goto LAST;
-	}
-
-	if(dbuf.size > 0){
-		n = _write(dfd, dbuf.data, dbuf.size);
-		if(n != dbuf.size){
-			fprintf(stderr, "error - failed on _write(%d)\n", dbuf.size);
-			goto LAST;
-		}
-	}
-
-	if(opt->verbose != 0){
-		fprintf(stderr, "\rprocessing: finish  \n");
-		fflush(stderr);
-		fflush(stdout);
-	}
-
-	n = b25->get_program_count(b25);
-	if(n < 0){
-		fprintf(stderr, "error - failed on ARIB_STD_B25::get_program_count() : code=%d\n", code);
-		goto LAST;
-	}
-	for(i=0;i<n;i++){
-		code = b25->get_program_info(b25, &pgrm, i);
-		if(code < 0){
-			fprintf(stderr, "error - failed on ARIB_STD_B25::get_program_info(%d) : code=%d\n", i, code);
-			goto LAST;
-		}
-		if(pgrm.ecm_unpurchased_count > 0){
-			fprintf(stderr, "warning - unpurchased ECM is detected\n");
-			fprintf(stderr, "  channel:               %d\n", pgrm.program_number);
-			fprintf(stderr, "  unpurchased ECM count: %d\n", pgrm.ecm_unpurchased_count);
-			fprintf(stderr, "  last ECM error code:   %04x\n", pgrm.last_ecm_error_code);
-			#if defined(WIN32)
-			fprintf(stderr, "  undecrypted TS packet: %d\n", pgrm.undecrypted_packet_count);
-			fprintf(stderr, "  total TS packet:       %d\n", pgrm.total_packet_count);
-			#else
-			fprintf(stderr, "  undecrypted TS packet: %"PRId64"\n", pgrm.undecrypted_packet_count);
-			fprintf(stderr, "  total TS packet:       %"PRId64"\n", pgrm.total_packet_count);
-			#endif
-		}
-	}
-
-	if(opt->power_ctrl != 0){
-		show_bcas_power_on_control_info(bcas);
-	}
-
-LAST:
-
-	if(sfd >= 0){
-		_close(sfd);
-		sfd = -1;
-	}
-
-	if(dfd >= 0){
-		_close(dfd);
-		dfd = -1;
-	}
-
-	if(b25 != NULL){
-		b25->release(b25);
-		b25 = NULL;
-	}
-
-	if(bcas != NULL){
-		bcas->release(bcas);
-		bcas = NULL;
-	}
-}
-
-static void show_bcas_power_on_control_info(B_CAS_CARD *bcas)
-{
-	int code;
-	int i,w;
-	B_CAS_PWR_ON_CTRL_INFO pwc;
-
-	code = bcas->get_pwr_on_ctrl(bcas, &pwc);
-	if(code < 0){
-		fprintf(stderr, "error - failed on B_CAS_CARD::get_pwr_on_ctrl() : code=%d\n", code);
-		return;
-	}
-
-	if(pwc.count == 0){
-		fprintf(stdout, "no EMM receiving request\n");
-		return;
-	}
-
-	fprintf(stdout, "total %d EMM receiving request\n", pwc.count);
-	for(i=0;i<pwc.count;i++){
-		fprintf(stdout, "+ [%d] : tune ", i);
-		switch(pwc.data[i].network_id){
-		case 4:
-			w = pwc.data[i].transport_id;
-			fprintf(stdout, "BS-%d/TS-%d ", ((w >> 4) & 0x1f), (w & 7));
-			break;
-		case 6:
-		case 7:
-			w = pwc.data[i].transport_id;
-			fprintf(stdout, "ND-%d/TS-%d ", ((w >> 4) & 0x1f), (w & 7));
-			break;
-		default:
-			fprintf(stdout, "unknown(b:0x%02x,n:0x%04x,t:0x%04x) ", pwc.data[i].broadcaster_group_id, pwc.data[i].network_id, pwc.data[i].transport_id);
-			break;
-		}
-		fprintf(stdout, "between %04d %02d/%02d ", pwc.data[i].s_yy, pwc.data[i].s_mm, pwc.data[i].s_dd);
-		fprintf(stdout, "to %04d %02d/%02d ", pwc.data[i].l_yy, pwc.data[i].l_mm, pwc.data[i].l_dd);
-		fprintf(stdout, "least %d hours\n", pwc.data[i].hold_time);
-	}
-}
-
--- a/arib25v021/arib25/src/ts_common_types.h	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-#ifndef TS_COMMON_TYPES_H
-#define TS_COMMON_TYPES_H
-
-#include "portable.h"
-
-typedef struct {
-	int32_t           sync;                           /*  0- 7 :  8 bits */
-	int32_t           transport_error_indicator;      /*  8- 8 :  1 bit  */
-	int32_t           payload_unit_start_indicator;   /*  9- 9 :  1 bit  */
-	int32_t           transport_priority;             /* 10-10 :  1 bits */
-	int32_t           pid;                            /* 11-23 : 13 bits */
-	int32_t           transport_scrambling_control;   /* 24-25 :  2 bits */
-	int32_t           adaptation_field_control;       /* 26-27 :  2 bits */
-	int32_t           continuity_counter;             /* 28-31 :  4 bits */
-} TS_HEADER;
-
-typedef struct {
-	int32_t           table_id;                       /*  0- 7 :  8 bits */
-	int32_t           section_syntax_indicator;       /*  8- 8 :  1 bit  */
-	int32_t           private_indicator;              /*  9- 9 :  1 bit  */
-	int32_t           section_length;                 /* 12-23 : 12 bits */
-	int32_t           table_id_extension;             /* 24-39 : 16 bits */
-	int32_t           version_number;                 /* 42-46 :  5 bits */
-	int32_t           current_next_indicator;         /* 47-57 :  1 bit  */
-	int32_t           section_number;                 /* 48-55 :  8 bits */
-	int32_t           last_section_number;            /* 56-63 :  8 bits */
-} TS_SECTION_HEADER;
-
-typedef struct {
-	TS_SECTION_HEADER  hdr;
-	uint8_t           *raw;
-	uint8_t           *data;
-	uint8_t           *tail;
-} TS_SECTION;
-
-#endif /* TS_COMMON_TYPES_H */
--- a/arib25v021/arib25/src/ts_section_parser.c	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,802 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-
-#include "ts_section_parser.h"
-#include "ts_section_parser_error_code.h"
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- inner structures
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-typedef struct {
-	void                   *prev;
-	void                   *next;
-	TS_SECTION              sect;
-	int32_t                 ref;
-} TS_SECTION_ELEM;
-
-typedef struct {
-	TS_SECTION_ELEM        *head;
-	TS_SECTION_ELEM        *tail;
-	int32_t                 count;
-} TS_SECTION_LIST;
-
-typedef struct {
-
-	int32_t                 pid;
-
-	TS_SECTION_ELEM        *work;
-	TS_SECTION_ELEM        *last;
-
-	TS_SECTION_LIST         pool;
-	TS_SECTION_LIST         buff;
-
-	TS_SECTION_PARSER_STAT  stat;
-	
-} TS_SECTION_PARSER_PRIVATE_DATA;
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- constant values
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-#define MAX_RAW_SECTION_SIZE 4100
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- function prottypes (interface method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static void release_ts_section_parser(void *parser);
-static int reset_ts_section_parser(void *parser);
-static int put_ts_section_parser(void *parser, TS_HEADER *hdr, uint8_t *data, int size);
-static int get_ts_section_parser(void *parser, TS_SECTION *sect);
-static int ret_ts_section_parser(void *parser, TS_SECTION *sect);
-static int get_count_ts_section_parser(void *parser);
-static int get_stat_ts_section_parser(void *parser, TS_SECTION_PARSER_STAT *stat);
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- global function implementation (factory method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-TS_SECTION_PARSER *create_ts_section_parser()
-{
-	TS_SECTION_PARSER *r;
-	TS_SECTION_PARSER_PRIVATE_DATA *prv;
-
-	int n;
-
-	n  = sizeof(TS_SECTION_PARSER_PRIVATE_DATA);
-	n += sizeof(TS_SECTION_PARSER);
-	
-	prv = (TS_SECTION_PARSER_PRIVATE_DATA *)calloc(1, n);
-	if(prv == NULL){
-		/* failed on malloc() - no enough memory */
-		return NULL;
-	}
-
-	prv->pid = -1;
-
-	r = (TS_SECTION_PARSER *)(prv+1);
-	r->private_data = prv;
-
-	r->release = release_ts_section_parser;
-	r->reset = reset_ts_section_parser;
-	
-	r->put = put_ts_section_parser;
-	r->get = get_ts_section_parser;
-	r->ret = ret_ts_section_parser;
-	
-	r->get_count = get_count_ts_section_parser;
-
-	r->get_stat = get_stat_ts_section_parser;
-
-	return r;
-}
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- function prottypes (private method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static TS_SECTION_PARSER_PRIVATE_DATA *private_data(void *parser);
-static void teardown(TS_SECTION_PARSER_PRIVATE_DATA *prv);
-
-static int put_exclude_section_start(TS_SECTION_PARSER_PRIVATE_DATA *prv, uint8_t *data, int size);
-static int put_include_section_start(TS_SECTION_PARSER_PRIVATE_DATA *prv, uint8_t *data, int size);
-
-static void reset_section(TS_SECTION *sect);
-static void append_section_data(TS_SECTION *sect, uint8_t *data, int size);
-static int check_section_complete(TS_SECTION *sect);
-
-static int compare_elem_section(TS_SECTION_ELEM *a, TS_SECTION_ELEM *b);
-
-static void cancel_elem_empty(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem);
-static void cancel_elem_error(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem);
-static void cancel_elem_same(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem);
-static void commit_elem_updated(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem);
-
-static TS_SECTION_ELEM *query_work_elem(TS_SECTION_PARSER_PRIVATE_DATA *prv);
-
-static void extract_ts_section_header(TS_SECTION *sect);
-
-static TS_SECTION_ELEM *create_ts_section_elem();
-static TS_SECTION_ELEM *get_ts_section_list_head(TS_SECTION_LIST *list);
-static void put_ts_section_list_tail(TS_SECTION_LIST *list, TS_SECTION_ELEM *elem);
-static void unlink_ts_section_list(TS_SECTION_LIST *list, TS_SECTION_ELEM *elem);
-static void clear_ts_section_list(TS_SECTION_LIST *list);
-
-static uint32_t crc32(uint8_t *head, uint8_t *tail);
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- function implementation (interface method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static void release_ts_section_parser(void *parser)
-{
-	TS_SECTION_PARSER_PRIVATE_DATA *prv;
-
-	prv = private_data(parser);
-	if(prv == NULL){
-		return;
-	}
-
-	teardown(prv);
-	
-	memset(parser, 0, sizeof(TS_SECTION_PARSER));
-	free(prv);
-}
-
-static int reset_ts_section_parser(void *parser)
-{
-	TS_SECTION_PARSER_PRIVATE_DATA *prv;
-
-	prv = private_data(parser);
-	if(prv == NULL){
-		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
-	}
-
-	teardown(prv);
-
-	return 0;
-}
-
-static int put_ts_section_parser(void *parser, TS_HEADER *hdr, uint8_t *data, int size)
-{
-	TS_SECTION_PARSER_PRIVATE_DATA *prv;
-	
-	prv = private_data(parser);
-	if( (prv == NULL) || (hdr == NULL) || (data == NULL) || (size < 1) ){
-		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
-	}
-
-	if( (prv->pid >= 0) && (prv->pid != hdr->pid) ){
-		return TS_SECTION_PARSER_ERROR_INVALID_TS_PID;
-	}
-
-	prv->pid = hdr->pid;
-
-	if(hdr->payload_unit_start_indicator == 0){
-		/* exclude section start */
-		return put_exclude_section_start(prv, data, size);
-	}else{
-		/* include section start */
-		return put_include_section_start(prv, data, size);
-	}
-}
-
-static int get_ts_section_parser(void *parser, TS_SECTION *sect)
-{
-	TS_SECTION_PARSER_PRIVATE_DATA *prv;
-	TS_SECTION_ELEM *w;
-
-	prv = private_data(parser);
-	if( (prv == NULL) || (sect == NULL) ){
-		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
-	}
-
-	w = get_ts_section_list_head(&(prv->buff));
-	if(w == NULL){
-		memset(sect, 0, sizeof(TS_SECTION));
-		return TS_SECTION_PARSER_ERROR_NO_SECTION_DATA;
-	}
-
-	memcpy(sect, &(w->sect), sizeof(TS_SECTION));
-	put_ts_section_list_tail(&(prv->pool), w);
-
-	return 0;
-}
-
-static int ret_ts_section_parser(void *parser, TS_SECTION *sect)
-{
-	TS_SECTION_PARSER_PRIVATE_DATA *prv;
-	TS_SECTION_ELEM *w;
-
-	prv = private_data(parser);
-	if( (prv == NULL) || (sect == NULL) ){
-		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
-	}
-
-	w = prv->pool.tail;
-	while(w != NULL){
-		if(w->sect.data == sect->data){
-			break;
-		}
-		w = (TS_SECTION_ELEM *)(w->prev);
-	}
-
-	if( (w != NULL) && (w->ref > 0) ){
-		w->ref -= 1;
-	}
-
-	return 0;
-}
-
-static int get_count_ts_section_parser(void *parser)
-{
-	TS_SECTION_PARSER_PRIVATE_DATA *prv;
-	
-	prv = private_data(parser);
-	if(prv == NULL){
-		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
-	}
-
-	return prv->buff.count;
-}
-
-static int get_stat_ts_section_parser(void *parser, TS_SECTION_PARSER_STAT *stat)
-{
-	TS_SECTION_PARSER_PRIVATE_DATA *prv;
-
-	prv = private_data(parser);
-	if( (prv == NULL) || (stat == NULL) ){
-		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
-	}
-
-	memcpy(stat, &(prv->stat), sizeof(TS_SECTION_PARSER_STAT));
-
-	return 0;
-}
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- function implementation (private method)
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-static TS_SECTION_PARSER_PRIVATE_DATA *private_data(void *parser)
-{
-	TS_SECTION_PARSER_PRIVATE_DATA *r;
-	TS_SECTION_PARSER *p;
-
-	p = (TS_SECTION_PARSER *)parser;
-	if(p == NULL){
-		return NULL;
-	}
-
-	r = (TS_SECTION_PARSER_PRIVATE_DATA *)(p->private_data);
-	if( ((void *)(r+1)) != parser ){
-		return NULL;
-	}
-
-	return r;
-}
-
-static void teardown(TS_SECTION_PARSER_PRIVATE_DATA *prv)
-{
-	prv->pid = -1;
-
-	if(prv->work != NULL){
-		free(prv->work);
-		prv->work = NULL;
-	}
-
-	prv->last = NULL;
-	
-	clear_ts_section_list(&(prv->pool));
-	clear_ts_section_list(&(prv->buff));
-
-	memset(&(prv->stat), 0, sizeof(TS_SECTION_PARSER_STAT));
-}
-
-static int put_exclude_section_start(TS_SECTION_PARSER_PRIVATE_DATA *prv, uint8_t *data, int size)
-{
-	TS_SECTION_ELEM *w;
-
-	w = prv->work;
-	if( (w == NULL) || (w->sect.raw == w->sect.tail) ){
-		/* no previous data */
-		return 0;
-	}
-
-	append_section_data(&(w->sect), data, size);
-	if(check_section_complete(&(w->sect)) == 0){
-		/* need more data */
-		return 0;
-	}
-
-	prv->work = NULL;
-
-	if( (w->sect.hdr.section_syntax_indicator != 0) &&
-	    (crc32(w->sect.raw, w->sect.tail) != 0) ){
-		cancel_elem_error(prv, w);
-		return TS_SECTION_PARSER_WARN_CRC_MISSMATCH;
-	}
-
-	if(compare_elem_section(w, prv->last) == 0){
-		/* same section data */
-		cancel_elem_same(prv, w);
-		return 0;
-	}
-
-	commit_elem_updated(prv, w);
-	return 0;
-}
-
-static int put_include_section_start(TS_SECTION_PARSER_PRIVATE_DATA *prv, uint8_t *data, int size)
-{
-	TS_SECTION_ELEM *w;
-	
-	int pointer_field;
-
-	uint8_t *p;
-	uint8_t *tail;
-
-	int r;
-	int length;
-
-	p = data;
-	tail = p + size;
-
-	r = 0;
-
-	pointer_field = p[0];
-	p += 1;
-
-	if( (p+pointer_field) >= tail ){
-		/* input data is probably broken */
-		w = prv->work;
-		prv->work = NULL;
-		if(w != NULL) {
-			if(w->sect.raw != w->sect.tail){
-				cancel_elem_error(prv, w);
-				return TS_SECTION_PARSER_WARN_LENGTH_MISSMATCH;
-			}
-			cancel_elem_empty(prv, w);
-		}
-		return 0;
-	}
-
-	if(pointer_field > 0){
-		r = put_exclude_section_start(prv, p, pointer_field);
-		if(r < 0){
-			return r;
-		}
-		p += pointer_field;
-	}
-
-	w = prv->work;
-	prv->work = NULL;
-	
-	if(w != NULL){
-		if(w->sect.raw != w->sect.tail){
-			cancel_elem_error(prv, w);
-			r = TS_SECTION_PARSER_WARN_LENGTH_MISSMATCH;
-		}else{
-			cancel_elem_empty(prv, w);
-		}
-		w = NULL;
-	}
-
-	do {
-		
-		w = query_work_elem(prv);
-		if(w == NULL){
-			return TS_SECTION_PARSER_ERROR_NO_ENOUGH_MEMORY;
-		}
-		
-		append_section_data(&(w->sect), p, tail-p);
-		if(check_section_complete(&(w->sect)) == 0){
-			/* need more data */
-			prv->work = w;
-			return 0;
-		}
-		length = (w->sect.tail - w->sect.raw);
-
-		if( (w->sect.hdr.section_syntax_indicator != 0) &&
-		    (crc32(w->sect.raw, w->sect.tail) != 0) ){
-			cancel_elem_error(prv, w);
-			r = TS_SECTION_PARSER_WARN_CRC_MISSMATCH;
-		}else if(compare_elem_section(w, prv->last) == 0){
-			cancel_elem_same(prv, w);
-		}else{
-			commit_elem_updated(prv, w);
-		}
-
-		p += length;
-		
-	} while ( (p < tail) && (p[0] != 0xff) );
-
-	return r;
-}
-
-static void reset_section(TS_SECTION *sect)
-{
-	memset(&(sect->hdr), 0, sizeof(TS_SECTION_HEADER));
-	sect->tail = sect->raw;
-	sect->data = NULL;
-}
-
-static void append_section_data(TS_SECTION *sect, uint8_t *data, int size)
-{
-	int m,n;
-	
-	m = sect->tail - sect->raw;
-	n = MAX_RAW_SECTION_SIZE - m;
-
-	if(size < n){
-		n = size;
-	}
-	memcpy(sect->tail, data, n);
-	sect->tail += n;
-	m += n;
-
-	if(sect->data == NULL){
-		extract_ts_section_header(sect);
-	}
-
-	if(sect->data == NULL){
-		/* need more data */
-		return;
-	}
-
-	n = sect->hdr.section_length + 3;
-	if(m > n){
-		sect->tail = sect->raw + n;
-	}
-
-	return;
-}
-
-static int check_section_complete(TS_SECTION *sect)
-{
-	int m,n;
-	
-	if(sect->data == NULL){
-		return 0;
-	}
-
-	m = sect->tail - sect->raw;
-	n = sect->hdr.section_length + 3;
-
-	if(n > m){
-		return 0;
-	}
-
-	return 1;
-}
-
-static int compare_elem_section(TS_SECTION_ELEM *a, TS_SECTION_ELEM *b)
-{
-	int m,n;
-	
-	if( (a == NULL) || (b == NULL) ){
-		return 1;
-	}
-
-	m = a->sect.tail - a->sect.raw;
-	n = b->sect.tail - b->sect.raw;
-	if( m != n ){
-		return 1;
-	}
-
-	if(memcmp(a->sect.raw, b->sect.raw, m) != 0){
-		return 1;
-	}
-
-	return 0;
-}
-
-static void cancel_elem_empty(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem)
-{
-	reset_section(&(elem->sect));
-	elem->ref = 0;
-	put_ts_section_list_tail(&(prv->pool), elem);
-}
-
-static void cancel_elem_error(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem)
-{
-	reset_section(&(elem->sect));
-	elem->ref = 0;
-	put_ts_section_list_tail(&(prv->pool), elem);
-	prv->stat.total += 1;
-	prv->stat.error += 1;
-}
-
-static void cancel_elem_same(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem)
-{
-	reset_section(&(elem->sect));
-	elem->ref = 0;
-	put_ts_section_list_tail(&(prv->pool), elem);
-	prv->stat.total +=1;
-}
-
-static void commit_elem_updated(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem)
-{
-	if( (prv->last != NULL) && (prv->last->ref > 0) ){
-		prv->last->ref -= 1;
-	}
-
-	elem->ref = 2;
-	prv->last = elem;
-	put_ts_section_list_tail(&(prv->buff), elem);
-	prv->stat.total += 1;
-	prv->stat.unique += 1;
-}
-
-static TS_SECTION_ELEM *query_work_elem(TS_SECTION_PARSER_PRIVATE_DATA *prv)
-{
-	TS_SECTION_ELEM *r;
-
-	r = prv->pool.head;
-	while(r != NULL){
-		if(r->ref < 1){
-			break;
-		}
-		r = (TS_SECTION_ELEM *)(r->next);
-	}
-
-	if(r != NULL){
-		unlink_ts_section_list(&(prv->pool), r);
-		reset_section(&(r->sect));
-		r->ref = 0;
-		return r;
-	}
-
-	return create_ts_section_elem();
-}
-
-static void extract_ts_section_header(TS_SECTION *sect)
-{
-	int size;
-	uint8_t *p;
-	
-	sect->data = NULL;
-	
-	size = sect->tail - sect->raw;
-	if(size < 3){
-		/* need more data */
-		return;
-	}
-
-	p = sect->raw;
-	
-	sect->hdr.table_id                 =  p[0];
-	sect->hdr.section_syntax_indicator = (p[1] >> 7) & 0x01;
-	sect->hdr.private_indicator        = (p[1] >> 6) & 0x01;
-	sect->hdr.section_length           =((p[1] << 8) | p[2]) & 0x0fff;
-	
-	if(sect->hdr.section_syntax_indicator == 0){
-		/* short format section header */
-		sect->data = p+3;
-		return;
-	}
-
-	/* long format section header */
-
-	if(size < 8){
-		/* need more data */
-		return;
-	}
-
-	sect->hdr.table_id_extension       =((p[3] << 8) | p[4]);
-	sect->hdr.version_number           = (p[5] >> 1) & 0x1f;
-	sect->hdr.current_next_indicator   =  p[5]       & 0x01;
-	sect->hdr.section_number           =  p[6];
-	sect->hdr.last_section_number      =  p[7];
-
-	sect->data = p+8;
-
-	return;
-}
-
-static TS_SECTION_ELEM *create_ts_section_elem()
-{
-	TS_SECTION_ELEM *r;
-	int n;
-
-	n = sizeof(TS_SECTION_ELEM) + MAX_RAW_SECTION_SIZE;
-	r = (TS_SECTION_ELEM *)calloc(1, n);
-	if(r == NULL){
-		/* failed on malloc() */
-		return NULL;
-	}
-
-	r->sect.raw = (uint8_t *)(r+1);
-	r->sect.tail = r->sect.raw;
-
-	return r;
-}
-
-static TS_SECTION_ELEM *get_ts_section_list_head(TS_SECTION_LIST *list)
-{
-	TS_SECTION_ELEM *r;
-
-	if(list == NULL){/* invalid param */
-		return NULL;
-	}
-
-	r = list->head;
-	if(r == NULL){
-		return NULL;
-	}
-
-	list->head = (TS_SECTION_ELEM *)(r->next);
-	if(list->head != NULL){
-		list->head->prev = NULL;
-		list->count -= 1;
-	}else{
-		list->tail = NULL;
-		list->count = 0;
-	}
-
-	r->next = NULL;
-	
-	return r;
-}
-
-static void put_ts_section_list_tail(TS_SECTION_LIST *list, TS_SECTION_ELEM *elem)
-{
-	if( (list == NULL) || (elem == NULL) ){
-		/* invalid param */
-		return;
-	}
-
-	if(list->tail != NULL){
-		elem->prev = list->tail;
-		elem->next = NULL;
-		list->tail->next = elem;
-		list->tail = elem;
-		list->count += 1;
-	}else{
-		elem->prev = NULL;
-		elem->next = NULL;
-		list->head = elem;
-		list->tail = elem;
-		list->count = 1;
-	}
-}
-
-static void unlink_ts_section_list(TS_SECTION_LIST *list, TS_SECTION_ELEM *elem)
-{
-	TS_SECTION_ELEM *prev;
-	TS_SECTION_ELEM *next;
-
-	if( (list == NULL) || (elem == NULL) ){
-		/* invalid param */
-		return;
-	}
-
-	prev = (TS_SECTION_ELEM *)(elem->prev);
-	next = (TS_SECTION_ELEM *)(elem->next);
-
-	if(prev != NULL){
-		prev->next = next;
-	}else{
-		list->head = next;
-	}
-	if(next != NULL){
-		next->prev = prev;
-	}else{
-		list->tail = prev;
-	}
-	list->count -= 1;
-}
-
-static void clear_ts_section_list(TS_SECTION_LIST *list)
-{
-	TS_SECTION_ELEM *e;
-	TS_SECTION_ELEM *n;
-
-	if(list == NULL){ /* invalid param */
-		return;
-	}
-
-	e = list->head;
-	while(e != NULL){
-		n = (TS_SECTION_ELEM *)(e->next);
-		free(e);
-		e = n;
-	}
-	
-	list->head = NULL;
-	list->tail = NULL;
-	list->count = 0;
-}
-
-static uint32_t crc32(uint8_t *head, uint8_t *tail)
-{
-	uint32_t crc;
-	uint8_t *p;
-
-	static const uint32_t table[256] = {
-		0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9,
-		0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005,
-		0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, 0x2B4BCB61, 
-		0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD,
-		
-		0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9,
-		0x5F15ADAC, 0x5BD4B01B, 0x569796C2, 0x52568B75, 
-		0x6A1936C8, 0x6ED82B7F, 0x639B0DA6, 0x675A1011,
-		0x791D4014, 0x7DDC5DA3, 0x709F7B7A, 0x745E66CD,
-		
-		0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039,
-		0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5,
-		0xBE2B5B58, 0xBAEA46EF, 0xB7A96036, 0xB3687D81, 
-		0xAD2F2D84, 0xA9EE3033, 0xA4AD16EA, 0xA06C0B5D,
-		
-		0xD4326D90, 0xD0F37027, 0xDDB056FE, 0xD9714B49,
-		0xC7361B4C, 0xC3F706FB, 0xCEB42022, 0xCA753D95,
-		0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1, 
-		0xE13EF6F4, 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D,
-
-		0x34867077, 0x30476DC0, 0x3D044B19, 0x39C556AE,
-		0x278206AB, 0x23431B1C, 0x2E003DC5, 0x2AC12072, 
-		0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16,
-		0x018AEB13, 0x054BF6A4, 0x0808D07D, 0x0CC9CDCA,
-
-		0x7897AB07, 0x7C56B6B0, 0x71159069, 0x75D48DDE, 
-		0x6B93DDDB, 0x6F52C06C, 0x6211E6B5, 0x66D0FB02,
-		0x5E9F46BF, 0x5A5E5B08, 0x571D7DD1, 0x53DC6066,
-		0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA,
-		
-		0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E,
-		0xBFA1B04B, 0xBB60ADFC, 0xB6238B25, 0xB2E29692,
-		0x8AAD2B2F, 0x8E6C3698, 0x832F1041, 0x87EE0DF6, 
-		0x99A95DF3, 0x9D684044, 0x902B669D, 0x94EA7B2A,
-
-		0xE0B41DE7, 0xE4750050, 0xE9362689, 0xEDF73B3E,
-		0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2, 
-		0xC6BCF05F, 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686,
-		0xD5B88683, 0xD1799B34, 0xDC3ABDED, 0xD8FBA05A,
-
-		0x690CE0EE, 0x6DCDFD59, 0x608EDB80, 0x644FC637, 
-		0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB,
-		0x4F040D56, 0x4BC510E1, 0x46863638, 0x42472B8F,
-		0x5C007B8A, 0x58C1663D, 0x558240E4, 0x51435D53, 
-		
-		0x251D3B9E, 0x21DC2629, 0x2C9F00F0, 0x285E1D47,
-		0x36194D42, 0x32D850F5, 0x3F9B762C, 0x3B5A6B9B,
-		0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF,
-		0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623,
-
-		0xF12F560E, 0xF5EE4BB9, 0xF8AD6D60, 0xFC6C70D7,
-		0xE22B20D2, 0xE6EA3D65, 0xEBA91BBC, 0xEF68060B, 
-		0xD727BBB6, 0xD3E6A601, 0xDEA580D8, 0xDA649D6F,
-		0xC423CD6A, 0xC0E2D0DD, 0xCDA1F604, 0xC960EBB3,
-		
-		0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7, 
-		0xAE3AFBA2, 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B,
-		0x9B3660C6, 0x9FF77D71, 0x92B45BA8, 0x9675461F,
-		0x8832161A, 0x8CF30BAD, 0x81B02D74, 0x857130C3, 
-		
-		0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640,
-		0x4E8EE645, 0x4A4FFBF2, 0x470CDD2B, 0x43CDC09C,
-		0x7B827D21, 0x7F436096, 0x7200464F, 0x76C15BF8,
-		0x68860BFD, 0x6C47164A, 0x61043093, 0x65C52D24,
-
-		0x119B4BE9, 0x155A565E, 0x18197087, 0x1CD86D30,
-		0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC,
-		0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088,
-		0x2497D08D, 0x2056CD3A, 0x2D15EBE3, 0x29D4F654,
-
-		0xC5A92679, 0xC1683BCE, 0xCC2B1D17, 0xC8EA00A0,
-		0xD6AD50A5, 0xD26C4D12, 0xDF2F6BCB, 0xDBEE767C,
-		0xE3A1CBC1, 0xE760D676, 0xEA23F0AF, 0xEEE2ED18,
-		0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4, 
-
-		0x89B8FD09, 0x8D79E0BE, 0x803AC667, 0x84FBDBD0,
-		0x9ABC8BD5, 0x9E7D9662, 0x933EB0BB, 0x97FFAD0C,
-		0xAFB010B1, 0xAB710D06, 0xA6322BDF, 0xA2F33668, 
-		0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4,
-	};
-	
-	crc = 0xffffffff;
-
-	p = head;
-	while(p < tail){
-		crc = (crc << 8) ^ table[ ((crc >> 24) ^ p[0]) & 0xff ];
-		p += 1;
-	}
-
-	return crc;
-}
-
--- a/arib25v021/arib25/src/ts_section_parser.h	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#ifndef TS_SECTION_PARSER_H
-#define TS_SECTION_PARSER_H
-
-#include "ts_common_types.h"
-
-typedef struct {
-	int64_t total;      /* total received section count      */
-	int64_t unique;     /* unique section count              */
-	int64_t error;      /* crc and other error section count */
-} TS_SECTION_PARSER_STAT;
-
-typedef struct {
-
-	void *private_data;
-
-	void (* release)(void *parser);
-
-	int (* reset)(void *parser);
-
-	int (* put)(void *parser, TS_HEADER *hdr, uint8_t *data, int size);
-	int (* get)(void *parser, TS_SECTION *sect);
-	int (* ret)(void *parser, TS_SECTION *sect);
-
-	int (* get_count)(void *parser);
-	
-	int (* get_stat)(void *parser, TS_SECTION_PARSER_STAT *stat);
-	
-} TS_SECTION_PARSER;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern TS_SECTION_PARSER *create_ts_section_parser();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* TS_SECTION_PARSER_H */
--- a/arib25v021/arib25/src/ts_section_parser_error_code.h	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#ifndef TS_SECTION_PARSER_ERROR_CODE_H
-#define TS_SECTION_PARESR_ERROR_CODE_H
-
-#define TS_SECTION_PARSER_ERROR_INVALID_PARAM        -1
-#define TS_SECTION_PARSER_ERROR_NO_ENOUGH_MEMORY     -2
-#define TS_SECTION_PARSER_ERROR_INVALID_TS_PID       -3
-#define TS_SECTION_PARSER_ERROR_NO_SECTION_DATA      -4
-
-#define TS_SECTION_PARSER_WARN_CRC_MISSMATCH          1
-#define TS_SECTION_PARSER_WARN_LENGTH_MISSMATCH       2
-
-#endif /* TS_SECTION_PARSER_ERROR_CODE_H */
--- a/arib25v021/libccid_Info.plist	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundlePackageType</key>
-	<string>BNDL</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>0.0.1d1</string>
-	<key>ifdCapabilities</key>
-	<string>0x00000001</string>
-
-	<!-- Possible values for ifdCapabilities bits
-	1: IFD_GENERATE_HOTPLUG
-	   plugging the reader calls pcscd \-\-hotplug
-
-	Default value is 0x00000001
-	-->
-
-	<key>ifdProtocolSupport</key>
-	<string>0x00000001</string>
-	<key>ifdVersionNumber</key>
-	<string>0x00000001</string>
-
-	<key>ifdLogLevel</key>
-	<string>0x0003</string>
-
-	<!-- Possible values for ifdLogLevel
-	1: CRITICAL  important error messages
-	2: INFO      informative messages like what reader was detected
-	4: COMM      a dump of all the bytes exchanged between the host and
-	             the reader
-	8: PERIODIC  periodic info when pcscd test if a card is present
-	             (every 1/10 of a second)
-
-	The final value is a OR of these values
-
-	Default value: 3 (CRITICAL + INFO)
-	-->
-
-	<key>ifdDriverOptions</key>
-	<string>0x0000</string>
-
-	<!-- Possible values for ifdDriverOptions
-	1: DRIVER_OPTION_CCID_EXCHANGE_AUTHORIZED
-		the CCID Exchange command is allowed. You can use it through
-		SCardControl(hCard, IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE, ...) 
-
-	2: DRIVER_OPTION_GEMPC_TWIN_KEY_APDU
-		If set the GemPC Twin and GemPC Key readers with be configured
-		so that the T=1 TPDU protocol is done by the firmware instead of
-		the driver.
-		This switches the reader in APDU mode and also in EMV mode so
-		may not work with non EMV cards.
-
-	4: DRIVER_OPTION_USE_BOGUS_FIRMWARE
-		Some reader firmwares have bugs. By default the driver refuses
-		to work with such firmware versions. If your reader is rejected
-		because of the firmware (log message: "Firmware (x.y) is
-		bogus!") you can:
-		- upgrade your reader firmware (not all readers can do that)
-		or
-		- get another reader with a new/bugfree firmware
-		or
-		- activate this option but you will have problems depending on
-		  the bug
-
-	8: DRIVER_OPTION_RESET_ON_CLOSE
-		This option may be required on Linux 2.4 so that the
-		device reset if sequencial (bSeq) counter and can be
-		reused if pcscd restart. Otherwise the reader needs to
-		be unplugged/replugged.
-
-	bits 4 & 5: (values 0, 16, 32, 48)
-	  0: power on the card at 5V (default value)
-	 16: power on the card at 3V and then, it 3V fails use 5V
-	 32: power on the card at 1.8V, then 3V and then 5V
-	 48: let the reader decide
-
-	Default value: 0
-	-->
-
-	<key>CFBundleExecutable</key>
-	<string>libccid.so.1.3.1</string>
-
-	<key>ifdManufacturerString</key>
-	<string>Ludovic Rousseau (ludovic.rousseau@free.fr)</string>
-
-	<key>ifdProductString</key>
-	<string>Generic CCID driver v1.3.1</string>
-
-	<key>ifdVendorID</key>
-	<array>
-		<string>0x08E6</string>
-		<string>0x08E6</string>
-		<string>0x08E6</string>
-		<string>0x08E6</string>
-		<string>0x08E6</string>
-		<string>0x08E6</string>
-		<string>0x08E6</string>
-		<string>0x08E6</string>
-		<string>0x08E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x04E6</string>
-		<string>0x076B</string>
-		<string>0x076B</string>
-		<string>0x076B</string>
-		<string>0x076B</string>
-		<string>0x076B</string>
-		<string>0x076B</string>
-		<string>0x076B</string>
-		<string>0x076B</string>
-		<string>0x076B</string>
-		<string>0x076B</string>
-		<string>0x0783</string>
-		<string>0x0783</string>
-		<string>0x0783</string>
-		<string>0x0783</string>
-		<string>0x0783</string>
-		<string>0x0783</string>
-		<string>0x09C3</string>
-		<string>0x09C3</string>
-		<string>0x047B</string>
-		<string>0x413c</string>
-		<string>0x413c</string>
-		<string>0x046a</string>
-		<string>0x046a</string>
-		<string>0x046a</string>
-		<string>0x046a</string>
-		<string>0x072f</string>
-		<string>0x0b97</string>
-		<string>0x0b97</string>
-		<string>0x0D46</string>
-		<string>0x0D46</string>
-		<string>0x0d46</string>
-		<string>0x0d46</string>
-		<string>0x0d46</string>
-		<string>0x0d46</string>
-		<string>0x073D</string>
-		<string>0x073D</string>
-		<string>0x073D</string>
-		<string>0x073D</string>
-		<string>0x073D</string>
-		<string>0x0DC3</string>
-		<string>0x0DC3</string>
-		<string>0x09BE</string>
-		<string>0x0416</string>
-		<string>0x03F0</string>
-		<string>0x03F0</string>
-		<string>0x0B81</string>
-		<string>0x058F</string>
-		<string>0x058F</string>
-		<string>0x15E1</string>
-		<string>0x0BF8</string>
-		<string>0x0BF8</string>
-		<string>0x0DF6</string>
-		<string>0x0973</string>
-		<string>0x0471</string>
-		<string>0x04B9</string>
-		<string>0x1059</string>
-		<string>0x1059</string>
-		<string>0x17EF</string>
-		<string>0x19E7</string>
-		<string>0x09C3</string>
-		<string>0x0783</string>
-		<string>0x0C4B</string>
-	</array>
-
-	<key>ifdProductID</key>
-	<array>
-		<string>0x3437</string>
-		<string>0x3438</string>
-		<string>0x4433</string>
-		<string>0x3478</string>
-		<string>0x3479</string>
-		<string>0x3480</string>
-		<string>0x34EC</string>
-		<string>0xACE0</string>
-		<string>0x1359</string>
-		<string>0x5111</string>
-		<string>0x5113</string>
-		<string>0x5115</string>
-		<string>0x5116</string>
-		<string>0x5117</string>
-		<string>0x5119</string>
-		<string>0x511A</string>
-		<string>0x511C</string>
-		<string>0x511D</string>
-		<string>0x5120</string>
-		<string>0x5121</string>
-		<string>0xE001</string>
-		<string>0x5410</string>
-		<string>0xE003</string>
-		<string>0x1021</string>
-		<string>0x3021</string>
-		<string>0x3621</string>
-		<string>0x3821</string>
-		<string>0x4321</string>
-		<string>0x5121</string>
-		<string>0x5125</string>
-		<string>0x5321</string>
-		<string>0x6622</string>
-		<string>0xA022</string>
-		<string>0x0006</string>
-		<string>0x0007</string>
-		<string>0x0008</string>
-		<string>0x0009</string>
-		<string>0x0010</string>
-		<string>0x9002</string>
-		<string>0x0013</string>
-		<string>0x0014</string>
-		<string>0x020B</string>
-		<string>0x2100</string>
-		<string>0X2101</string>
-		<string>0x0005</string>
-		<string>0x0010</string>
-		<string>0x002D</string>
-		<string>0x003E</string>
-		<string>0x90cc</string>
-		<string>0x7762</string>
-		<string>0x7772</string>
-		<string>0x3001</string>
-		<string>0x3002</string>
-		<string>0x3003</string>
-		<string>0x3010</string>
-		<string>0x4000</string>
-		<string>0x4001</string>
-		<string>0x0B00</string>
-		<string>0x0C00</string>
-		<string>0x0C01</string>
-		<string>0x0007</string>
-		<string>0x0008</string>
-		<string>0x1004</string>
-		<string>0x1102</string>
-		<string>0x0002</string>
-		<string>0x3815</string>
-		<string>0x1024</string>
-		<string>0x0824</string>
-		<string>0x0200</string>
-		<string>0x9520</string>
-		<string>0x9522</string>
-		<string>0x2007</string>
-		<string>0x1005</string>
-		<string>0x1006</string>
-		<string>0x800A</string>
-		<string>0x0003</string>
-		<string>0x040F</string>
-		<string>0x1400</string>
-		<string>0x000C</string>
-		<string>0x000D</string>
-		<string>0x1003</string>
-		<string>0x0002</string>
-		<string>0x0008</string>
-		<string>0x0003</string>
-		<string>0x0300</string>
-	</array>
-
-	<key>ifdFriendlyName</key>
-	<array>
-		<string>Gemplus GemPC Twin</string>
-		<string>Gemplus GemPC Key</string>
-		<string>Gemplus GemPC433 SL</string>
-		<string>Gemplus GemPC Pinpad</string>
-		<string>Gemplus GemCore POS Pro</string>
-		<string>Gemplus GemCore SIM Pro</string>
-		<string>Gemplus GemPC Express</string>
-		<string>Verisign Secure Token</string>
-		<string>VeriSign Secure Storage Token</string>
-		<string>SCM SCR 331-DI</string>
-		<string>SCM SCR 333</string>
-		<string>SCM SCR 335</string>
-		<string>SCM SCR 3310</string>
-		<string>SCM SCR 3320</string>
-		<string>SCM SCR 3340 ExpressCard54</string>
-		<string>SCM SCR 3310 NTTCom</string>
-		<string>Axalto Reflex USB v3</string>
-		<string>SCM SCR 3311</string>
-		<string>SCM SCR 331-DI NTTCom</string>
-		<string>SCM SDI 010</string>
-		<string>SCM SCR 331</string>
-		<string>SCM SCR 355</string>
-		<string>SCM SPR 532</string>
-		<string>OmniKey CardMan 1021</string>
-		<string>OmniKey CardMan 3121</string>
-		<string>OmniKey CardMan 3621</string>
-		<string>OmniKey CardMan 3821</string>
-		<string>OmniKey CardMan 4321</string>
-		<string>OmniKey CardMan 5121</string>
-		<string>OmniKey CardMan 5125</string>
-		<string>OmniKey CardMan 5321</string>
-		<string>OmniKey CardMan 6121</string>
-		<string>Teo by Xiring</string>
-		<string>C3PO LTC31</string>
-		<string>C3PO TLTC2USB</string>
-		<string>C3PO LTC32 USBv2 with keyboard support</string>
-		<string>C3PO KBR36</string>
-		<string>C3PO LTC32</string>
-		<string>C3PO TLTC2USB</string>
-		<string>ActivCard USB Reader 3.0</string>
-		<string>Activkey Sim</string>
-		<string>Silitek SK-3105</string>
-		<string>Dell keyboard SK-3106</string>
-		<string>Dell smart card reader keyboard</string>
-		<string>Cherry XX33</string>
-		<string>Cherry XX44</string>
-		<string>Cherry ST1044U</string>
-		<string>Cherry SmartTerminal ST-2XXX</string>
-		<string>ACS ACR 38U-CCID</string>
-		<string>O2 Micro Oz776</string>
-		<string>O2 Micro Oz776</string>
-		<string>KOBIL KAAN Base</string>
-		<string>KOBIL KAAN Advanced</string>
-		<string>KOBIL KAAN SIM III</string>
-		<string>KOBIL EMV CAP - SecOVID Reader III</string>
-		<string>KOBIL mIDentity</string>
-		<string>KOBIL mIDentity</string>
-		<string>Eutron Digipass 860</string>
-		<string>Eutron SIM Pocket Combo</string>
-		<string>Eutron Smart Pocket</string>
-		<string>Eutron CryptoIdentity</string>
-		<string>Eutron CryptoIdentity</string>
-		<string>Athena ASE IIIe</string>
-		<string>Athena ASEDrive IIIe KB</string>
-		<string>SmartEpad</string>
-		<string>Winbond</string>
-		<string>HP USB Smart Card Keyboard</string>
-		<string>HP USB Smartcard Reader</string>
-		<string>id3 CL1356D</string>
-		<string>Alcor Micro AU9520</string>
-		<string>Alcor Micro AU9522</string>
-		<string>RSA SecurID</string>
-		<string>Fujitsu Siemens SmartCard Keyboard USB 2A</string>
-		<string>Fujitsu Siemens SmartCard USB 2A</string>
-		<string>Sitecom USB simcard reader MD-010</string>
-		<string>SchlumbergerSema Cyberflex Access</string>
-		<string>Philips JCOP41V221</string>
-		<string>SafeNet IKey4000</string>
-		<string>G&D CardToken 350</string>
-		<string>G&D CardToken 550</string>
-		<string>Lenovo Integrated Smart Card Reader</string>
-		<string>Charismathics token</string>
-		<string>ActivCard USB Reader 2.0</string>
-		<string>C3PO LTC31</string>
-		<string>Reiner-SCT cyberJack pinpad(a)</string>
-	</array>
-
-	<key>Copyright</key>
-	<string>This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.</string>
-
-</dict>
-</plist>
--- a/arib25v021/readme.txt	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-b25.exe ver.0.2.1 LinuxΉłłB
-arib25fBNgmakeƑłĂarib25/src/b25Ƀrh܂B
-gpCuPCSC-Lite(http://pcsclite.alioth.debian.org/)ŁAJ[h[_gp”\ȏԂɂȂĂ邱ƂKvłB
-Windowsł͓S‚HX-520UJJLinuxł͎gpłȂ̂ŒӂKvłB
-NTTComSCR3310-NTTComyathena-scs.hs.shopserve.jp/SHOP/RW001.htmlœ񍐂܂B
-B-CASJ[h̕\ɒӂĉB`bvʂłB
-ł̔}̃J[h[_gpꍇ́APCSC-Litẽy[WɂCCID drivergpA
-/etc/libccid_Info.plist
-====
-	<key>ifdVendorID</key>
-	<array>
-		<string>0xXXXX</string>
-		         
-	</array>
-
-	<key>ifdProductID</key>
-	<array>
-		<string>0xXXXX</string>
-		         
-	</array>
-
-	<key>ifdFriendlyName</key>
-	<array>
-		<string>XXXXXXXXXXXXXXXXXX</string>
-		               
-	</array>
-====
-zipɂ铯̃t@C̓ƓւĉB
-̃t@CʒuDebianˑ܂B
-  Gentooł/usr/lib/readers/usb/ifd-ccid.bundle/Contents/Info.plistɂƂ񍐂܂B
-}yэŋ߂̔}ł̓J[h[_ςĂׁA/etc/libccid_Info.plist̕ύX͕svłB
-
-smartcard_list.txtPCSC-LiteɊ܂܂pcsc_scanpłB
-PCSC-Litẽt@CƒuB-CASB-CASƂĔF܂B
-
-PCSC-LiteAPIWindowsX}[gJ[hANZXpAPIƌ݊łׁA
-قLinuxŃRpCG[ɂȂ镔̑Ώ݂̂łB
-ver.0.2.032bit‹2Gbytet@C̖肪ȂȂ͂łB64bit‹ł2Gbyteȏ̃t@Co邱ƂmFĂ܂B
-
-PCSC-LiteɊ܂܂DWORD̒`͔32bit‹̏ꍇɖ肪܂A֌WȂ܂B
-
-ύX_:
-ver.0.1.2ɑ΂pb`open̈Ă܂Ăӏɖ߂܂B
-ver.0.1.5ŏo̓t@C̃p[~bVK̂𒼂܂Bumaskɏ]悤ɂȂĂ͂łB
-ver.0.2.0ŁA32bitLinux2GByteȏ̃t@CłȂoOC͂łB
-
-extrecdgpĂւ̒ӓ_:
-b25̌Ăяo-p 0 -v 0IvVtKv܂(b25牽o͂΃G[Ƃ݂ȂĂ)Bȉ̏CsȂĉB
-430s
-my @b25_cmd    = (@b25_prefix, $path_b25, $target_encts, $target_ts);
-
-my @b25_cmd    = (@b25_prefix, $path_b25, "-p", "0", "-v", "0", $target_encts, $target_ts);
-
-CZX:
-̃\[X͂܂쐬b25قڂ̂܂܂Ȃ̂ŁA܂̔fɏ]܂B
-arib25/readme.txtɂIWib25ɓYtĂreadme.txtɏĂA
->@E\[XR[h𗘗pƂɂāÃguĂ
->@@Ζ am͐ӔC𕉂Ȃ
->@E\[XR[h𗘗pƂɂāAvOɖ肪Ă
->@@Ζ am͐ӔC𕉂Ȃ
->
->@L 2 ɓӂč쐬ꂽ񎟓I앨ɑ΂āAΖ am
->@҂ɗ^鏔sgȂ
-Kp܂B
-
-̑:
-̃vOAS-ISŒ񋟂܂BȂɂ肪NĂӔC͎Ă܂B
-
-mF‹:
-  Debian GNU/Linux lenny(testing)
-  Linux 2.6.22.6 SMP PREEMPT x86_64
-
-N/E9PqspSk
--- a/arib25v021/smartcard_list.txt	Mon Feb 16 21:40:16 2009 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1874 +0,0 @@
-#
-#    smartcard_list.txt
-#    Copyright (C) 2002-2006  Ludovic Rousseau
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with this program; if not, write to the Free Software
-#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-#    02111-1307  USA
-
-#
-# This list contains a match between an ATR and a card type
-# The list is sorted for edition purposes
-#
-# You can get the latest version of this file from:
-# http://ludovic.rousseau.free.fr/softwares/pcsc-tools/smartcard_list.txt
-#
-# $Id: smartcard_list.txt,v 1.290 2007-10-30 21:12:54 rousseau Exp $
-#
-
-# syntax:
-# ATR in regular expression form
-# \t descriptive text
-# \t descriptive text
-# \t descriptive text
-# empty line
-
-3B F0 12 00 FF 91 81 B1 7C 45 1F 03 99
-	B-CAS
-
-3B 02 14 50
-	Schlumberger Multiflex 3k
-
-3B 02 53 01
-	Gemplus GemClub Memo
-
-3B 04 41 11 77 81
-	Sample Mifare DESFire contactless smartcard from Phillips
-
-3B 04 41 11 77 B1
-	IBM JCOP 30 contactless
-
-3B 04 49 32 43 2E
-	German Health Insurance Card
-	"LogCard" from concept2.com (a indoor rower manufacturer)
-	I2C card
-
-3B 04 92 23 10 91
-	Siemens SLE 4432/42 card
-
-3B 04 A2 13 10 91
-	PM2P Chipkarte SLE 4442, Code FFFFFF
-	Bahn BKK (Deutsche Bahn AG - Insurance Company)
-
-3B 05 68 01 01 02 05
-	Certinomis card (electronic certificates)
-
-3B 06 A2 13 10 91 90 00
-	C3P2K SAMPLE CARD (C3PO, S.L)
-
-3B 09 41 04 11 DD 82 2F 00 00 88
-	1k contactless Mifare
-
-3B 0A 20 62 0C 01 4F 53 45 99 14 AA
-	GSM-SIM BEN (1800MHz)
-
-3B 0F 80 6A 16 32 46 49 53 45 53 8C E0 FF 07 90 00
-	GSM-SIM Sonera (from 1998)
-
-3B 0F FF C1 B5 CC 72 CA 00 00 ??
-	Mifare Std 1K
-
-3B 15 13 80 53 41 52 03
-	Eutron CryptoIdentity (ATMEL AT903232C - 6464C Cryptographic
-	processors, 64KB EEPROM, RSA 2048)
-
-3B 15 94 C3 02 08 16 01
-	GSM-SIM EMT (Estonia)
-
-3B 16 94 71 01 01 00 27 00
-	Cingular GSM SIM Card
-
-3B 16 94 71 01 01 05 02 00
-	GSM SIM Bouygues Telecom
-
-3B 16 94 81 10 06 01 81 2F
-	Schlumberger Cyberflex Access Augmented Crypto
-
-3B 16 94 81 10 06 01 81 3F
-	Schlumberger Cyberflex Access Crypto
-
-3B 16 96 41 73 74 72 69 64
-	Gemalto .NET v2.0
-
-3B 17 13 9C 12 02 01 01 07 40
-	Schlumberger Cyberflex Access Developer 32k
-
-3B 17 94 18 01 01 02 01 41 49
-	white SFR SIM card
-
-3B 17 94 18 02 01 25 01 41 93
-	AT&T Wireless GSM SIM Card
-
-3B 17 94 89 01 02 01 02 41 87
-	Vodafone/Omnitel 16K GSM SIM
-
-3B 19 14 55 90 01 01 01 00 05 08 B0
-	Schlumberger Multiflex 8k
-
-3B 19 14 55 90 01 02 01 00 05 04 B0
-	Schlumberger Multiflex 4k
-
-3B 19 14 59 01 01 0F 01 00 05 08 B0
-	Schlumberger Multiflex 8k
-
-3B 19 94 31 02 05 10 45 98 01 02 4E
-	GSM-SIM EMT (Estonia)
-
-3B 1F 11 00 67 42 41 46 49 53 45 53 52 66 FF 81 90 00
-	Finnish student id card
-
-3B 1F 11 00 67 80 42 46 49 53 45 10 52 66 FF 81 90 00
-	Nokia branded SC (Setec)
-
-3B 1F 11 00 6A 01 38 46 49 53 45 10 8C 02 FF 07 90 00
-	GSM-SIM Saunalahti (from 2004)
-	Finnish cell phone operator "Sonera" SIM card (from 2002)
-
-3B 1F 11 00 6A 31 36 46 49 53 45 13 8C 02 FF 07 90 00
-	GSM-SIM card - Telenor Mobil - http://www.telenor.com/
-
-3B 1F 11 80 6A 16 32 46 49 53 45 15 8C E6 FF 07 90 00
-	GSM SIM card - Tele2 Estonia - http://www.tele2.ee
-
-3B 1F 11 80 6A 32 37 46 49 53 45 12 8C 00 FF 07 90 00
-	Setec Test card, SetCOS 3.7.2, rel 1.3
-
-3B 1F 11 80 6A 32 37 46 49 53 45 12 8C 02 FF 07 90 00
-	GSM-SIM DNA Finland (from 2001)
-
-3B 1F 11 80 6A 80 34 46 49 53 45 53 94 36 FF 07 90 00
-	SetCOS 3.4.0c
-	RSA SecurID 3100
-
-3B 1F 94 00 6A 01 38 46 49 53 45 10 8C 02 FF 07 90 00
-	GSM-SIM Saunalahti (from 2004)
-
-3B 1F 94 80 6A 16 32 46 49 53 45 15 8C E6 FF 07 90 00
-	GSM-SIM Sonera (from 2002)
-
-3B 23 00 00 36 41 81
-	Schlumberger Payflex 4k SAM
-
-3B 23 00 35 11 80
-	Schlumberger Payflex 1k User
-
-3B 23 00 35 11 81
-	Schlumberger Payflex 1k SAM
-
-3B 23 00 35 13 80
-	Schlumberger Cyberflex Access Campus
-
-3B 23 00 35 13 FF
-	Schlumberger MicroPayflex
-
-3B 23 00 35 41 80
-	PayflexHID (idenfitied by Sun Ray Services)
-
-3B 24 00 .. .. .. 45
-	Conax
-
-3B 24 00 30 42 30 30
-	ComHem Digital-TV smartcard (Sweden)
-
-3B 24 00 80 72 94 43
-	MPCOS-3DES 64K \ EMV Filter (Gemplus)
-
-3B 26 00 00 26 40 00 90 00
-	Schlumberger, purse?
-
-3B 26 00 11 04 5C 03 90 00
-	Caixa Abierta (Barcelona, Spain) Cash/Visa Electron
-
-3B 26 00 11 06 23 03 90 00
-	Tarjeta de la Seguridad Social (Spanish Social Insurance Card)
-
-3B 27 00 80 65 A2 .. 01 01 37
-	Gemplus GemSAFE Smart Card (4K)
-
-3B 27 00 80 65 A2 00 01 01 37
-	Gemplus GemSAFE Card CSP v1.0
-
-3B 27 00 80 65 A2 02 02 82 37
-	Gemplus GPK2000s
-
-3B 27 00 80 65 A2 02 03 82 37
-	Gemplus GPK2000sp
-
-3B 27 00 80 65 A2 04 01 01 37
-	Gemplus GPK4000s
-
-3B 27 00 80 65 A2 05 01 01 37
-	Gemplus GPK4000sp
-
-3B 27 00 80 65 A2 06 01 01 37
-	GPK 4000, RSA 512 bits Sign, Unwrap 40 bits
-
-3B 27 00 80 65 A2 0C 01 01 37
-	Gemplus GPK4000
-
-3B 27 00 80 65 A2 8C 3B 27 00
-	GPK 4000, RSA 1024 bits Sign, Unwrap 256 bits
-
-3B 29 00 24 93 01 00 00 00 00 01 A9
-	Telephone chipcard for the Vienna University of Technology
-	http://nic.tuwien.ac.at/telefonie/chipkarte/
-
-3B 29 00 80 72 A4 45 64 00 00 D0 15
-	Moeda Electronica Bradesco (Gemplus MPCOS?) (Brasilia)
-
-3B 29 00 80 72 A4 45 64 00 FF 00 10
-	MPCOS-3DES 8K (Gemplus)
-	MBNA Europe Platinum Plus Mastercard
-	MasterCard Card - Worldcard - Yapıkredi / Turkey
-
-3B 2A 00 80 65 A0 58 04 01 62 72 D6 43
-	Gemplus GemCombiXplore MPCOS Pro
-
-3B 2A 00 80 65 A2 01 00 00 00 72 D6 41
-	MPCOS_EMV_1B
-
-3B 2A 00 80 65 A2 01 00 00 00 72 D6 43
-	MPCOS_EMV_4B
-
-3B 2A 00 80 65 A2 01 .. .. .. 72 D6 41
-	Gemplus MPCOS EMV 1 Byte sectors
-
-3B 2A 00 80 65 A2 01 02 01 31 72 D6 43
-	MPCOS-EMV 64K Functional Sample
-
-3B 2A 00 80 65 A2 01 .. .. .. 72 D6 43
-	Gemplus MPCOS EMV 4 Byte sectors
-
-3B 2F 00 80 69 10 80 00 01 A1 0A 01 01 59 83 0E 90 00
-	Belgium Dexia (Axion) Bank Card
-	Proton/Bancontact Mister Cash/Maestro
-
-3B 32 15 00 06 80
-	Schlumberger Multiflex 8k
-
-3B 32 15 00 06 95
-	Schlumberger Multiflex 8k DES
-
-3B 37 11 00 46 4C 4F 4D 41 90 00
-	SLE 4428
-
-3B 3B .. 00 80 6. A[F,E] 03 0[C,D] .. .. 83 .. 90 00
-	GemXplore Xpresso V3
-
-3B 3B 11 00 80 65 AF 03 0C 01 6F 83 0F 90 00
-	Gemplus GemX{plore,presso} V3-B1
-
-3B 3B 11 00 80 69 AF 03 0C 01 6F 83 0[0,1] 90 00
-	GemXplore'Xpresso V3 64K
-
-3B 3B 94 00 4F 34 10 20 01 04 C0 33 33 90 00
-	SIM card from the italian operator WIND
-
-3B 3B 94 00 67 37 10 00 00 39 60 33 33 90 00
-	Avea GSM / Turkey
-
-3B 3B 94 00 80 65 AF 03 0D 01 74 83 0F 90 00
-	Gemplus GemXplore Xpresso V3 B1P
-	Mobistar SIM - Belgium (Gemplus)
-
-3B 3C 94 00 4B 31 25 A2 10 13 14 47 83 83 90 00
-	GSM SFR
-
-3B 3C 94 00 4C 31 25 A7 20 1B 00 15 83 83 90 00
-	GSM-SIM (900MHz) card of the carrier vodafone for their cellular
-	network (phase 2+ with 3V)
-
-3B 3D 94 00 01 0F 00 36 00 00 86 60 18 04 00 01 07
-	Vodafone GSM / Turkey
-
-3B 3F 11 00 6F AF 65 03 12 01 80 73 32 21 1B 83 0F 90 00
-	GSM SIM card Orange J2RE postpaid
-
-3B 3F 94 00 80 65 AF 03 12 01 79 73 32 21 1B 83 0F 90 00
-	UK O2 GSM SIM (2G Online Prepay Maldives)
-
-3F 3F 94 00 80 69 AF 03 07 01 59 00 00 0A 0E 83 3E 9F 16
-	Finnish SIM card from "Radiolinja" now "Elisa"
-
-3B 3F 94 00 80 69 AF 03 07 06 67 00 00 0A 0E 83 3E 9F 16
-	SFR SIM card (red Gemplus Répertoire)
-
-3B 3F 94 00 80 69 AF 03 07 06 67 09 97 0A 0E 83 3E 9F 16
-	BASE SIM - Belgium (Gemplus)
-
-3B 3F 94 00 80 69 AF 03 0F 02 80 FF FF 06 0E 83 3E 9F 16
-	GSM-SIM Telefonica Movistar, prepaid (Spain)
-
-3B 3F 95 00 80 65 AF 03 12 01 6F 73 32 21 1B 83 00 90 00
-	Gemplus GemXpresso PRO 64 PK SIM
-
-3B 3F 95 00 80 65 AF 03 14 01 8A 73 32 21 1B 83 0F 90 00
-	SIM Vodafone 64k
-
-3F 96 18 80 01 80 51 00 61 10 30 9F
-	Atmel/Athena T0 Inverse Convention PC/SC Compliance Test Card No. 2
-
-3B 3F 95 00 80 69 AF 03 0F 02 80 FF FF 06 0E 83 3E 9F 16
-	AT&T Wireless GSM SIM Card
-
-3B 57 18 02 93 02 01 01 01 90 00
-	Easyflex FastOS 2.0 / Schlumberger
-
-3B 63 00 00 36 41 80
-	Schlumberger Payflex 4k User
-
-3B 64 00 00 80 62 0. 51
-	Setec SetCOS 5.1.0 EMV
-
-3B 64 00 FF 80 62 02 A2
-	VISA credit card (Nordea bank)
-
-3B 64 .. FF 80 62 .. A2
-	JCOP20
-
-3B 65 00 00 29 05 01 02 01
-	ActivCard (Schlumberger) CyberFlex 64K V1 SM 2.1
-
-3B 65 00 00 58 01 01 00 80
-	RBS Advanta Platinum Reserve Master Card
-
-3B 65 00 00 9C 02 02 07 02
-	US Department of Defense, TEST Common Access Card (CAC)
-	Schlumberger Cyberflex Access #2
-	Axalto Cyberflex Access 32K V2
-
-3B 65 00 00 9C 1[0,1] 01 01 03
-	Schlumberger Cyberflex Palmera
-
-3B 66 00 00 00 9C 11 01 01 03
-	Axalto Cyberflex Access 32K V4 SM 1.3
-
-3B 66 00 00 00 9C 11 01 03 01
-	Axalto Cyberflex Access 64K V1 Bio SM 3.1
-
-3B 66 00 00 31 4B 01 01 00 80
-	VISA credit card (Skandiabanken)
-
-3B 66 00 FF 4A 43 4F 50 33 30
-	JCOP30 "OP-DI 16k VISA v2 (JCOP30) ORGA"
-
-3B 66 00 FF 4A 43 4F 50 30 33
-	IBM JCOP 30
-
-3B 67 00 00 00 00 00 00 00 90 00
-	Axa Bank (Belgium) Mastercard Gold / Axa Bank Belgium
-	MisterCash & Proton card
-	VISA Card (emitted by Bank Card Company - Belgium)
-
-3B 67 00 00 00 00 20 00 00 90 00
-	BankID card from Sparebank1
-
-3B 67 00 00 00 31 80 71 86 90 00
-	Swiss ZKB-Bancomat-Card
-
-3B 67 00 00 29 20 00 6F 78 90 00
-	Postbank Chippas (chipknip) Netherlands
-
-3B 67 00 00 2D 20 36 00 78 90 00
-	Swedish cashcard, http://www.ida.liu.se/~TDDB31/Cashcard.pdf
-	Bank Card (ING - Belgium)
-
-3B 67 00 00 7D 20 40 34 3B 90 00
-	Nordea Visa Sweden
-
-3B 67 00 00 85 20 36 30 78 90 00
-	Belgium Fortis Bank
-	Belgium Keytrade Bank
-	Belgium Post Bank
-
-3B 67 00 00 9C 10 01 01 03 FF 07
-	Schlumberger Cyberflex Palmera Protect
-
-3B 67 00 00 A5 20 40 10 1F 90 00
-	Swedish eLegitimation (eID) from Nordea Bank http://www.elegitimation.se/
-
-3B 67 25 00 2A 20 00 4[0,5] 68 90 00
-	Swedish cashcard (proton)
-
-3B 67 25 00 62 24 33 03 ..
-	Bull TB1000 ? (SAM for ATM in Luxemburg)
-
-3B 68 00 00 56 53 44 43 4C 43 31 30
-	VISA (Estonian), made by www.trueb.ch
-
-3B 68 00 00 80 66 A2 06 02 01 32 0E
-	Gemplus GemClub 1K
-
-3B 68 00 00 9D 08 01 02 01 56 49 53
-	Visa Card - bonus - DenizBank / Turkey
-
-3B 68 00 00 9D 08 01 03 01 4F 54 53
-	MasterCard Card - bonus - Garanti Bank / Turkey
-
-3B 68 00 00 9D 08 01 03 01 56 49 53
-	MasterCard Card - bonus - Garanti Bank / Turkey
-	MasterCard Card - bonus plus (paypass) - Garanti Bank / Turkey
-
-3B 68 00 00 9D 08 01 05 01 56 49 53
-	MasterCard Card - CartaSi (Italian Credit Card)
-
-3B 68 00 00 A1 02 02 01 01 56 49 53
-	UK NatWest Business MasterCard
-	UK Barclaycard VISA
-	UK NatWest Platinum MasterCard
-	Visa Card - DenizBank / Turkey
-
-3B 69 00 00 24 94 01 02 01 00 01 01 A9
-	Chipcard from SUN to be used in SunRay's
-	370-4328-01 (31091)
-
-3B 69 00 00 24 94 01 03 01 00 01 00 A9
-	Schlumberger MicroPayflex S card
-
-3B 69 00 00 4A 43 4F 50 33 31 56 32 32
-	Visa Europe Sample Card / Axalto
-
-3B 69 00 00 50 01 01 04 01 00 01 01 A9
-	Sample card given to all attendees of the CTST 2004 SmartCard Conference
-
-3B 69 00 FF 53 6D 40 72 74 43 61 66 65
-	G&D (Giesecke&Devrient) Sm@rtCafé
-
-3B 6A 00 00 80 31 C0 A1 02 03 01 32 81 16
-	Lloyds TSB Visa Credit/Debit Card
-
-3B 6A 00 00 80 65 A2 01 01 01 3D 72 D6 43
-	GemSafe Xpresso 16k
-
-3B 6A 00 00 80 66 A1 09 02 01 63 0E 90 00
-	Danish Visa/Dankort
-	UK MBNA MasterCard
-	Visa Card - Worldcard - YapıKredi / Turkey
-
-3B 6B 00 00 00 31 80 64 2D A0 02 0C 8C 61 27
-	SmartEMV prototype
-
-3B 6B 00 00 00 31 80 64 43 B0 02 00 8C 61 27
-	Bull Odyssey 1.2 (Javacard 2.0)
-
-3B 6B 00 00 80 65 A1 09 03 01 97 83 0E 90 00
-	Visa Card - Worldcard - YapıKredi / Turkey
-
-3B 6B 00 00 80 65 B0 83 01 01 74 83 00 90 00
-	GemXpresso Pro R3 with 64K EEPROM
-
-3B 6B 00 00 80 65 B0 83 01 03 74 83 00 90 00
-	Gemplus GemXpresso PRO 64K R3 v1
-
-3B 6B 00 00 80 65 B0 83 01 04 74 83 00 90 00
-	Gemplus GXP3 64V2N
-	U.S. Department of Defense Common Access Card (DoD CAC)
-
-3B 6B 00 FF 33 00 00 09 FA 10 00 80 01 FF FF
-	Atmel 6464C PRO 64K
-
-3B 6B .. FF 80 62 .. A2 56 46 69 6E 45 49 44
-	JCOP20 v2.x
-
-3B 6C 00 00 10 10 10 30 00 00 00 00 00 00 00 00
-	Datacard Group Aptura Development Card V1.1b
-
-3B 6D 00 00 00 31 C0 71 D6 64 11 22 33 01 83 90 00
-	UK Barclaycard VISA
-	UK Halifax Platinum VISA
-
-3B 6D 00 00 00 31 C0 71 D6 64 34 C7 01 00 84 90 00
-	DeLaRue ProlifIC
-
-3B 6D 00 00 00 31 C0 71 D6 64 34 C7 02 00 84 90 00
-	Cybelys card (Thalys fidelity card)
-
-3B 6D 00 00 00 31 C0 71 D6 64 38 D0 02 00 84 90 00
-	EMV Visa Electron (Oberthur)
-
-3B 6D 00 00 00 31 C0 71 D6 64 38 D0 03 00 84 90 00
-	HSBC Visa/MasterCard credit card
-	Barclay Card MasterCard
-
-3B 6D 00 00 00 31 C0 71 D6 64 4E D8 01 01 84 90 00
-	UK Capital One Platinum MasterCard
-
-3B 6D 00 00 00 31 C0 71 D6 64 58 D7 01 00 84 90 00
-	UK Nationwide Bank Visa Delta
-	UK First Direct Maestro
-	UK Halifax Platinum Visa
-
-3B 6D 00 00 80 31 80 65 B0 06 01 01 77 83 00 90 00
-	GemXpresso Lite: with EMV application
-
-3B 6D 00 00 80 31 80 65 B0 43 01 00 77 83 00 90 00
-	Gemplus GemXpresso Lite
-
-3B 6D 00 00 80 31 80 65 B0 83 01 02 90 83 00 90 00
-	DeutscheBank Identification card
-
-3B 6D 00 FF 00 31 80 71 8E 64 48 D5 02 00 82 90 00
-	Blue for Business, American Express@Business
-
-3B 6E 00 00 00 31 80 71 86 65 01 64 02 22 32 80 90 00
-	MasterCard Card - bonus plus (paypass) - Garanti Bank / Turkey
-
-3B 6E 00 00 00 31 80 71 86 65 01 64 02 22 32 83 90 00
-	MasterCard Card - bonus YKM - Garanti Bank / Turkey
-
-3B 6E 00 00 00 31 80 71 86 65 01 67 02 A0 0A 83 90 00
-	Australian ANZ First Visa Card from the ANZ
-	(Australia and New Zealand) Bank
-
-3B 6E 00 00 00 31 80 71 86 65 47 44 23 01 02 83 90 00
-	Nat West Master Card
-
-3B 6E 00 00 00 31 80 71 86 65 47 44 24 01 81 83 90 00
-	MasterCard Card - Maximum - IS Bank / Turkey
-	Visa Card - Axess - Akbank / Turkey
-
-3B 6E 00 00 00 31 C0 71 86 65 01 64 02 22 33 83 90 00
-	UK NatWest ServiceCard 100 Maestro
-	Visa Card - bonus - Garanti Bank / Turkey
-
-3B 6E 00 00 00 31 C0 71 86 65 01 78 01 27 34 83 90 00
-	UK NatWest ServiceCard 100 Maestro
-	Visa Card - Gold - CARDFINANS  / Turkey
-
-3B 6E 00 00 00 31 C0 71 C6 65 01 B0 01 03 37 83 90 00
-	UK NatWest Business MasterCard
-
-3B 6E 00 00 00 31 C0 71 D6 65 7D E4 01 10 A0 83 90 00
-	VISA card, issued by the ANWB, the Dutch national Automobile club
-	Visa Card - Maximum - Oyak Bank / Turkey
-
-3B 6E 00 00 00 31 C0 71 D6 65 7D E4 01 11 A0 83 90 00
-	UK CapitalOne Platinum Mastercard
-
-3B 6E 00 00 00 31 C0 71 D6 65 A3 03 01 80 00 83 90 00
-	UK First Direct (HSBC) Maestro / Cirrus
-
-3B 6E 00 00 00 62 .. 43 57 41 56 41 4E 54 10 81 90 00
-	Setec SetCOS 4.3.0
-
-3B 6E 00 00 00 62 00 00 57 41 56 41 4E 54 10 81 90 00
-	Setec SetCOS 5.1.0 EMV + AVANT
-
-3B 6E 00 00 45 73 74 45 49 44 20 76 65 72 20 31 2E 30
-	Estonian Identity Card (EstEID v1.5 multos)
-
-3B 6E 00 00 80 31 80 65 B0 03 01 01 5E 83 00 00 90 00
-	FirstUSA Visa
-
-3B 6E 00 00 80 31 80 65 B0 03 02 01 5E 83 00 00 90 00
-	Gemplus GemXpresso 211is
-
-3B 6E 00 FF 00 62 00 00 57 41 56 41 4E 54 10 81 90 00
-	debit card (Visa Electron) issued by Nordea bank
-
-3B 6E 00 FF 45 73 74 45 49 44 20 76 65 72 20 31 2E 30
-	Estonian Identity Card (EstEID v1.0 warm)
-
-3B 6F 00 00 00 67 2. 43 46 49 53 45 12 52 66 FF 81 90 00
-	Setec SetCOS 4.3.2
-
-3B 6F 00 00 80 31 C0 52 00 83 64 02 19 08 32 83 83 90 00
-	Bancomer Mexican Bank
-
-3B 6F 00 00 80 31 C0 52 16 B9 64 05 66 80 32 83 83 90 00
-	Banorte Mexican Bank
-
-3B 6F 00 00 80 31 E0 5B 4E 4F 4B 00 00 00 00 00 00 02 00
-	Norsk-Tipping (Buypass) Monodex card
-
-3B 6F 00 00 80 31 E0 6B 04 06 03 04 40 55 55 55 55 55 55
-	Blue American Express Card
-
-3B 6F 00 00 80 31 E0 6B 04 06 05 02 17 55 55 55 55 55 55
-	Marx Software Security - Cryptoken M2048, MULTOS, Infineon SLE66CX, 64kByte
-	http://www.marx.com/en/
-
-3B 6F 00 00 80 31 E0 6B 04 20 05 02 30 55 55 55 55 55 55
-	Buypass card for Norsk Tipping (http://norsk-tipping.no)
-
-3B 6F 00 00 80 31 E0 6B 84 06 03 04 31 55 55 55 55 55 55
-	Multos Developer Sample
-
-3B 6F 00 00 80 31 E0 6B 84 06 0E 02 02 55 55 55 55 55 55
-	Multos Developer Sample
-
-3B 6F 00 00 80 31 E0 6B 84 20 05 02 39 55 55 55 55 55 55
-	Multos 14D (2-0-10) 64K Developer Card
-
-3B 6F 00 00 80 31 E0 6B 84 20 05 02 42 55 55 55 55 55 55
-	Multos 14Dc(6-0-13) 64K Dual-Interface Developer Card
-
-3B 6F 00 00 80 5A .. 0[1-5] .. .. .. .. .. .. .. .. 82 90 00
-	Card supporting a Calypso application Rev 1
-	Typically: French "Navigo" transport card
-
-3B 6F 00 00 80 66 45 46 01 38 18 03 53 02 31 10 82 90 00
-	Fábrica Nacional de Moneda y Timbre FNMT WG10
-	http://www.fnmt.es/es/html/tage/fichaTarjeta/fp1_ta_01.asp
-
-3B 6F 00 FF 52 53 41 53 65 63 75 72 49 44 28 52 29 31 30
-	RSA SecurID SID800 token
-
-3B 6F 00 FF 53 46 53 45 2D 43 58 33 32 32 2D 56 18 02 02
-	Giesecke & Devrient SmartCafe Expert 2.0
-
-3B 75 12 00 00 29 05 01 04 01
-	CAC Cryptographic Service Provider
-	Axalto Cyberflex Access 64K V1 SM 4.1
-
-3B 75 13 00 00 9C 02 02 01 02
-	Cyberflex Access 32k v2
-
-3B 75 94 00 00 62 02 02 0[1-3] 01
-	Schlumberger Cyberflex 32K e-gate
-
-3B 76 11 00 00 00 9C 11 01 02 02
-	Schlumberger Cyberflex Access 32K
-
-3B 76 11 00 00 00 9C 11 01 02 03
-	RSA SecureID 5100
-
-3B 76 12 00 00 00 9C 11 01 03 03
-	Precise BioMatch (TM) JavaCard (Schlumberger)
-	www.precisebiometrics.com
-
-3B 76 98 00 00 00 9C 11 01 01 02
-	CyberFlex Access 32
-
-3B 7A 11 00 02 48 4F 53 54 06 03 19 02 90 00
-	Swedish bankcard with Mastercard from ICA-banken
-
-3B 7A 13 00 00 00 09 A5 05 01 00 B7 01 A6 01
-	"cleyris" authentication card. monpass.santé from Mutuelle Générale
-
-3B 7A 94 00 00 80 65 A2 01 01 01 3D 72 D6 43
-	Gemplus GemXpresso Pro R3 E32 PK
-
-3B 7B .. 00 00 80 62 0. 51 56 46 69 6E 45 49 44
-	Setec SetCOS 5.1.0
-
-3B 7B 18 00 00 00 31 C0 64 77 E3 03 00 82 90 00
-	Oberthur Cosmopolic 64K v5.2 D
-
-3B 7B 94 00 00 80 62 11 51 56 46 69 6E 45 49 44
-	Finnish Electronic ID card (fineid card www.fineid.fi)
-
-3B 7B 94 00 00 80 65 B0 83 01 0[1,3] 74 83 00 90 00
-	Gemplus GemXpresso Pro R3 (E64 PK)
-
-3B 7B 95 00 00 80 65 B0 83 01 04 74 83 00 90 00
-	Gemplus GemXpresso Pro 64K R3 FIPS v2
-
-3B 7D 11 00 00 00 31 80 71 8E 64 52 D9 01 00 82 90 00
-	Oberthur Galactic V2
-
-3B 7D 11 00 00 00 31 80 71 8E 64 77 E3 01 00 82 90 00
-	Oberthur Cosmo 64k RSA v5
-
-3B 7D 11 00 00 00 31 80 71 8E 64 77 E3 02 00 82 90 00
-	Oberthur 64k v5/2.2.0
-
-3B 7D 11 00 00 00 31 80 71 8E 64 86 D6 01 00 81 90 00
-	DOD-CAC
-
-3B 7D 18 00 00 00 31 80 71 8E 64 77 E3 01 00 82 90 00
-	Oberthur 64k v4/2.1.1
-
-3B 7D 94 00 00 80 31 80 65 B0 83 01 02 90 83 00 90 00
-	Gem e-Seal
-	(GemSafeXpresso 16k R3.2?)
-
-3B 7D 94 00 00 80 31 80 65 B0 83 01 01 90 83 00 90 00
-	GemSafeXpresso 16k R3.2
-
-3B 7D 94 00 00 80 31 80 65 B0 83 02 04 7E 83 00 90 00
-	GXP Pro R3.2 64K, GemSafe applet MPCOS v1.11
-
-3B 7D 96 00 00 80 31 80 65 B0 83 11 40 AC 83 00 90 00
-	GemXpresso R4 64k
-
-3B 7D 96 00 00 80 31 80 65 B0 83 11 C0 A9 83 00 90 00
-	Gemplus X-Presso Pro 64k
-
-3B 7E 11 00 00 00 6A 11 63 54 08 30 24 01 .. .. 21 90 01
-	Sagem Windows for smart cards
-
-3B 7F 11 00 00 00 6A 43 45 52 45 53 02 2C 34 02 00 03 90 00
-	FNMT-CERES ST (Fábrica Nacional de Moneda y Timbre)
-
-3B 7F 11 00 00 80 31 C0 52 21 57 64 02 18 19 53 83 83 90 00
-	banking card (www.caixacatalunya.com)
-	student id of Universitat  Autonoma de Barcelona
-
-3B 7E 13 00 00 00 6A 11 63 54 05 48 .. .. .. 01 22 90 00
-	Sagem Windows for smart cards
-
-3B 7F 13 00 FF 45 43 4F 53 76 31 31 30 28 63 29 50 46 42 4D
-	ECOS-Card [Experimental Card Operating System V.1.1] by Philipp Maier
-	http://www.runningserver.com/?page=runningserver.content.download.ecos
-
-3B 7F 11 00 00 00 31 C0 53 CA C4 01 64 52 D9 04 00 82 90 00
-	DoD CAC, Oberthur CosmopolIC 32K V4
-
-3B 7F 18 00 00 00 31 C0 73 9E 01 0B 64 52 D9 03 00 82 90 00
-	Oberthur Galactic V3 (32k)
-
-3B 7F 18 00 00 00 31 C0 73 9E 01 0B 64 52 D9 04 00 82 90 00
-	Oberthur CosmopolIC 32K v4 Fast ATR
-	Oberthur Authentic
-
-3B 7F 18 00 00 00 31 C0 73 9E 01 0B 64 52 D9 05 00 82 90 00
-	Oberthur 32k BIO
-
-3B 7F 38 00 00 00 6A 43 45 52 45 53 02 2C 34 02 02 03 90 00
-	WG10
-
-3B 7F 38 00 00 00 6A 44 4E 49 65 20 02 4C 34 01 13 03 90 00
-	DNI electronico (Spanish electronic ID card)
-	http://www.dnielectronico.es
-
-3B 81 1F 00 CC 52
-	eToken R2 2242
-
-3B 81 80 01 80 80
-	Mifare DESFire
-
-3B 82 00 55 22
-	GSM-SIM TELE2 Smart (Estonia, prepaid)
-
-3B 82 81 31 76 43 C0 02 C5
-	CardOS/M2 V2.01(SLE44CxxS)
-
-3B 82 81 31 76 43 C1 03 C5
-	i.ti (ticket card for Collogne/Bonn)
-	CardOS M2 Combi V2.02 (SLE44R42S)
-
-3B 83 00 12 10 96
-	GSM-SIM T-Mobil D1 (900MHz)
-
-3B 85 00 12 02 01 00 96
-	GSM-SIM Victorvox D1 (900MHz)
-
-3B 85 00 87 25 01 38 02
-	GSM-SIM Viag Interkom E2 Loop GSM (1800MHz)
-
-3B 85 00 87 25 01 39 00
-	GSM-SIM Telfort (Netherlands) 900 MHz
-
-3B 85 40 20 68 01 01 .. ..
-	Schlumberger Cryptoflex 8k
-
-3B 85 40 20 68 01 01 03 05
-	Schlumberger Cryptoflex Key Generation
-
-3B 85 40 20 68 01 01 05 01
-	Schlumberger Cryptoflex 8k
-
-3B 86 40 20 68 01 01 02 04 AC
-	Activcard Gold, SchlumbergerSema Cryptoflex 8k
-
-3B 85 40 FF 63 01 01 03 01
-	Axalto Cryptoflex 16K
-
-3B 85 40 FE 68 01 01 02 04
-	Axalto CryptoFlex 8K
-
-3B 86 80 01 4A 43 4F 50 33 30 12
-	Mifare ProX T=CL
-
-3B 86 80 01 4A 43 4F 50 33 31 13
-	JCOP BIO 31 Contactless Card
-
-3B 87 81 31 40 43 4D 46 43 20 31 33 31 6F
-	Telekom Paycard
-
-3B 88 81 31 20 55 00 57 69 6E 43 61 72 64 29
-	SmartCard for Windows 1.0
-
-3B 89 00 91 26 91 06 00 01 22 01 00
-	BT Cellnet SIM
-
-3B 8B 80 01 00 64 04 11 01 01 31 80 00 90 00 5A
-	German Passport (issued Nov 2006)
-	United Kingdom e-Passport
-
-3B 89 40 14 47 47 32 36 4D 35 32 38 30
-	GSM-SIM e-plus (1800MHz)
-
-3B 89 80 01 00 64 04 15 01 02 00 90 00 EE
-	German Passport (issued Apr 2007)
-
-3B 89 80 01 4A 43 4F 50 34 31 56 32 32 4D
-	New Zealand e-Passport
-
-3B 89 80 01 4D 54 43 4F 53 73 01 02 01 3F
-	Contactless MTCOS
-	http://www.masktech.de/
-
-3B 89 80 01 53 50 4B 32 35 44 49 90 00 DA
-	SPK 2.5 D1
-
-3B 8A 80 01 00 64 05 5C 02 03 31 80 90 00 16
-	T-System Contactless Netkey Card
-
-3B 8A 80 01 00 64 05 76 02 03 31 80 90 00 3C
-	T-System Contactless TCOS Min
-
-3B 8A 00 91 01 00 16 00 01 16 01 00 96
-	GSM-SIM T-Mobil D1 (900MHz)
-
-3B 8A 00 91 01 00 16 00 01 20 01 00 96
-	GSM-SIM T-D1 prepaid (Xtra)
-
-3B 8A 00 91 01 00 16 00 01 20 02 00 96
-	GSM-SIM (900MHz) card of the carrier t-mobile for their cellular
-	network (phase 2+ with 3V)
-
-3B 8A 00 91 91 00 17 00 01 07 03 00 96
-	T-Mobile prepaid 2G SIM
-
-3B 8E 80 01 80 31 80 66 40 90 89 12 08 02 83 01 90 00 0B
-	ISO 14443B Type T = CL Infineon Card
-
-3B 8E 80 01 80 91 91 31 C0 64 77 E3 03 00 83 82 90 00 1C
-	Belgian Passport
-
-3B 8F 01 80 25 A0 00 00 00 56 57 44 4B 34 30 30 06 00 B7
-	SafeNet IKey4000
-
-3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A
-	Philips MIFARE Standard (1 Kbytes EEPROM)
-	http://www.nxp.com/products/identification/mifare/classic/
-	RFID - ISO 14443 Type A - Transport for London Oyster
-
-3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 02 00 00 00 00 69
-	Mifare card with 4k EEPROM
-
-3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68
-	Contactless Mifare Ultralight
-
-3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 00 00 00 00 00 63
-	RFID - ISO 15693 - EM Microelectronic-Marin SA
-
-3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 12 00 00 00 00 71
-	RFID - ISO 15693 - Texas Instrument
-
-3B 8F 80 01 80 4F 0C A0 00 00 03 06 0A 00 1C 00 00 00 00 7E
-	RFID - HID iCLASS 16K CL
-
-3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77
-	Philips ICode
-	RFID - ISO 15693 - Philips Semiconductors
-
-3B 90 95 80 1F C3 59
-	Dai Nippon Printing Co., DNP Standard-J T3.1
-
-3B 95 15 40 .. 68 01 02 .. ..
-	Schlumberger CryptoFlex 8k v2
-
-3B 95 18 40 FF 62 01 02 01 04
-	Schlumberger Cryptoflex 32K e-gate
-
-3B 95 18 40 FF 62 04 01 01 05
-	Schlumberger CryptoFlex 32Ko V1
-
-3B 95 18 40 FF 64 02 01 01 02
-	Schlumberger CryptoFlex 32Ko
-
-3B 95 94 40 FF 63 01 01 02 01
-	Schlumberger Cryptoflex 16Ko
-
-3B 95 95 40 FF AE 01 01 02 03
-	Axalto Cyberflex Access 64K v2a SM 2.3
-
-3B 95 95 40 FF AE 01 03 00 00
-	Axalto - Cyberflex 64K
-
-3B 95 95 40 FF D0 00 1A 01 01
-	Cyberflex Access 64k (v3)
-
-3B 98 13 40 0A A5 03 01 01 01 AD 13 11
-	Belgium Electronic ID card
-
-3B 98 94 40 0A A5 03 01 01 01 AD 13 10
-	Belgium Electronic ID card
-
-3B 99 94 00 91 08 91 06 00 01 06 06 00
-	GSM-SIM Orange-UK (1800)
-
-3B 9A 94 00 91 01 00 17 00 01 23 10 00 96
-	GSM-SIM Victorvox D1 (900MHz)
-
-3B 9A 94 00 91 01 00 17 00 01 23 11 00 96
-	GSM-SIM Card T-D1 (900MHz)
-
-3B 99 94 00 91 99 93 12 00 01 16 02 00
-	ORGA test systems - GSM Phase 2+ Test SIM
-
-3B 9A 96 00 92 03 49 93 16 00 01 21 01 00
-	GSM-SIM card of the Austrian provider Yesss! (http://www.yesss.at)
-
-3B 9B 95 80 1F 47 80 31 A0 73 BE 21 00 53 34 99 05 D0
-	GSM-SIM EMT "Diil", prepaid (Estonia)
-
-3B 9C 13 11 81 64 72 65 61 6D 63 72 79 70 74 00 04 08
-	XPlusTV & INXCT Access Card-9 (FIRECrypt)
-
-3B 9D 11 40 23 00 68 10 11 4D 69 6F 43 4F 53 00 90 00
-	MioCOS 1.0
-
-3B 9D 94 40 23 00 68 20 01 4D 69 6F 43 4F 53 00 90 00
-	Miotec (http://www.miotec.fi) smartcard running Miocos 2.0 on an Atmel AT90SC646
-
-3B 9E 95 80 1F C3 80 31 A0 73 BE 21 13 67 29 02 01 04 04 CD 39
-	Hutchison/3 3G USIM
-	J+ SWIM WIB UMTS SIM Test card
-	http://www.exceldata.es/microprocess/j%2Bswinwibusim.html
-
-3B 9D 95 80 1F C3 80 31 E0 52 4B 54 62 11 03 73 FE 21 1B 8F
-	KT WiBro UICC (2.3 GHz mobile WiMAX in South Korea)
-
-3B 9F 21 0E 49 52 44 45 54 4F 20 41 43 53 20 56 34 2E 31 9D
-	Foxtel paytv decoder in Australia acs 4.1 Irdeto2
-
-3B 9F .. 80 1F C3 00 68 1. 44 05 01 46 49 53 45 31 C8 .. 90 00 ..
-	Setec SetCOS 4.4.1
-
-3B 9F 94 40 1E 00 67 11 43 46 49 53 45 10 52 66 FF 81 90 00
-	Setec / FINEID
-	SETEC Instant EID
-
-3B 9F 94 40 1E 00 67 16 43 46 49 53 45 10 52 66 FF 81 90 00
-	RSA SecurID 3100 or Utimaco Safeware Smartcard
-	SetCOS 4.3.1 Revision Unknown
-
-3B 9F 94 40 1E 00 67 .. 43 46 49 53 45 10 52 66 FF 81 90 00
-	SLE66CX160S running SETCOS 4.3.1 Revision A
-
-3B 9F 94 80 1F C3 00 68 10 44 05 01 46 49 53 45 31 C8 07 90 00 18
-	SetCOS 4.3.0 32K RSA
-	Instant EID IP2
-	SETEC SetCard 32K PKI Evaluated SetCOS 4.4.1a2
-
-3B 9F 95 80 1F C3 80 31 E0 73 FE 21 1B 63 E2 09 A9 83 0F 90 00 8D
-	GSM-SIM EMT (Estonia, WPKI eID support)
-
-3B 9F 95 80 1F C3 80 31 E0 73 FE 21 1B B3 E2 01 74 83 0F 90 00 88
-	Gemplus GemXplore 3G USIM
-
-3B 9F 95 80 1F C7 80 31 E0 73 FE 21 1B 63 E2 04 A5 83 0F 90 00 88
-	Cingular "64Ksmartchip" GSM SIM
-
-3B 9F 96 80 1F C3 00 68 10 44 05 01 46 49 53 45 31 C8 07 90 00 1A
-	SETEC SetCard 32K PKI Evaluated SetCOS 4.4.1
-
-3B 9F 96 80 1F C3 80 31 E0 73 FE 21 1B B3 E2 02 7E 83 0F 90 00 82
-	Vodafone SIM Card (D2, 1800Mhz, Germany, Twincard, possibly others too?), manufactured by Gemplus (See stamp on the chip)
-
-3B A7 00 40 .. 80 65 A2 08 .. .. ..
-	Gemplus GemSAFE Smart Card (8K)
-
-3B A7 00 40 14 80 65 A2 14 01 01 37
-	Gemplus GPK4000sdo
-
-3B A7 00 40 18 80 65 A2 08 01 01 52
-	Gemplus GPK8000
-	GemSAFE Smart Card (8K)
-
-3B A7 00 40 18 80 65 A2 09 01 01 52
-	Gemplus GPK16000
-
-3B A7 00 40 18 80 65 A2 09 01 02 52
-	Gemplus GPK16000
-
-3B A7 00 40 18 80 65 A2 09 01 03 52
-	Gemplus GemSAFE std (GPK16000?)
-
-3B A8 00 81 71 46 5D 00 54 43 4F 53 31 2E 32 00 65
-	Telesec TCOS 1.2
-
-3B A8 00 81 71 46 5D 00 54 43 4F 53 31 2E 32 4B 2E
-	CeloCom Card with TCOS 1.2
-
-3B AA 00 40 14 47 47 32 47 54 35 53 34 38 30
-	GSM-SIM Libertel (900MHz)
-
-3B AA 00 40 80 53 4F 80 53 45 03 04 11 AA A3
-	"open platform" ATMEGA "new Generation"
-	http://www.masterixweb-italy.com/new/images/articoli/atmega.jpg
-
-3B AB 00 81 31 40 45 80 31 C0 65 08 06 80 00 00 00 00 84
-	Reloadable Visa Cash card (Schlumberger), Bank of America
-
-3B AD 00 40 FF 80 31 80 65 B0 05 01 01 5E 83 00 90 00
-	Dallas Semiconductor iButton
-	JIB
-
-3B B0 11 00 81 31 90 73 F2
-	SamOS 2.7
-
-3B B2 11 00 10 80 00 01
-	Atmel memory card AT88SC0104C
-	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
-
-3B B2 11 00 10 80 00 02
-	Atmel memory card AT88SC0204C (Atmel memory card)
-	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
-
-3B B2 11 00 10 80 00 04
-	Atmel memory card AT88SC0404C
-	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
-
-3B B2 11 00 10 80 00 08
-	Atmel memory card AT88SC0808C
-	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
-
-3B B2 11 00 10 80 00 16
-	Atmel memory card AT88SC1616C
-	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
-
-3B B3 11 00 00 00 00 32
-	Atmel memory card AT88SC3216C
-	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
-
-3B B3 11 00 00 00 00 64
-	Atmel memory card AT88SC6416C
-	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
-
-3B B3 11 00 00 00 01 28
-	Atmel memory card AT88SC12816C
-	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
-
-3B B3 11 00 00 00 02 56
-	Atmel memory card AT88SC25616C
-	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
-
-3B B2 11 00 10 80 00 08
-	Smart VR Card - GD Burti
-
-3B B7 11 00 81 31 90 43 A5 .. .. .. .. .. .. ..
-	Siemens CardOS/M V1.4 (SLE44C80S)
-
-3B B7 11 00 81 31 90 53 B5 .. .. .. .. .. .. ..
-	CardOS EM/V1.4 (SLE44CR80S)
-
-3B B7 18 00 81 31 FE 65 53 50 4B 32 34 90 00 5A
-	Giesecke & Devrient Starcos 2.4
-
-3B B7 18 00 C0 3E 31 FE 65 53 50 4B 32 34 90 00 25
-	G&D STARCOS SPK 2.4
-
-3B B7 94 00 81 31 FE 65 53 50 4B 32 32 90 00 D0
-	Giesecke & Devrient STARCOS SPK2.2
-
-3B B7 94 00 81 31 FE 65 53 50 4B 32 33 90 00 D1
-	Giesecke & Devrient Starcos 2.3
-	Deutsche Bank WebSign (RSA-Card)
-	G&D StarSign Token
-
-3B B8 13 00 81 31 20 5D 00 57 69 6E 43 61 72 64 02
-	SmartCard for Windows 1.1
-
-3B B9 94 00 40 14 47 47 33 4E 48 38 36 34 30
-	GSM-SIM card of the Austrian mobile phone provider One, http://www.one.at
-	Proximus SIM - Belgium (SetCOS?)
-
-3B BA 11 00 81 31 FE 4D 55 45 4B 41 45 20 56 31 2E 30 AE
-	AKİS v1.0
-
-3B BA 13 00 81 31 86 5D 00 64 05 0A 02 01 31 80 90 00 8B
-	Telesec TCOS 2 (SLE44)
-	TCOS 2.0 (on CR80S)
-	Cryptokarte with RSA-Controller, T=1 Protocol
-
-3B BA 14 00 81 31 86 5D 00 64 05 14 02 02 31 80 90 00 91
-	TCOS 2.0 (on CX160S)
-	Telesec TCOS 2 (SLE66)
-
-3B BA 94 00 40 14
-	GG3RS732S0 ?
-
-3B BA 94 00 40 14 47 47 33 52 53 37 31 36 53 30
-	GSM-SIM Viag Interkom E2 Loop (1800MHz)
-	GSM-SIM card of the Austrian A1, http://www.a1.net/privat/home
-
-3B BA 96 00 81 31 86 5D 00 64 05 60 02 03 31 80 90 00 66
-	Telesec TCOS 2 (SLE66P)
-	TCOS 2.0 (on CX320P)
-	TeleSec Netkey Card
-
-3B BA 96 00 81 31 86 5D 00 64 05 7B 02 03 31 80 90 00 7D
-	TeleSec NetKey Card
-	Deutsche Post card (tcos)
-
-3B BC 94 00 40 14 47 47 33 48 33 35 58 53 32 30 30 30
-	GSM-SIM Era-PL
-	T-Mobile GSM SIM Card
-
-3B BC 94 00 40 14 47 47 33 48 33 35 58 56 32 30 30 30
-	GSM SIM CARD 32K, Vodafone
-
-3B BC 94 00 40 14 47 47 33 49 35 43 41 43 31 30 30 30
-	Siemens SIM card
-
-3B BC 94 00 40 14 47 47 33 53 30 35 31 53 31 30 31 30
-	GSM SIM (Tele2, Estonia)
-
-3B BE 11 00 00 41 01 38 00 00 00 00 00 00 00 00 01 90 00
-	ACS (Advanced Card System) ACOS-1
-
-3B BE 11 00 00 41 01 38 00 00 00 00 00 00 00 00 02 90 00
-	ACS (Advanced Card System) ACOS-1 8K
-
-3B BE 11 00 00 41 01 38 01 00 03 00 00 00 00 00 02 90 00
-	ACOS2 test card from ACS reading off a ACR38U
-
-3B BF 11 00 81 31 FE 45 45 50 41 00 00 00 00 21 00 93 42 00 00 00 00 01
-	Austrian BankCard (Old Version - ca. 2004)
-
-3B BF 11 00 81 31 FE 45 45 50 41 00 00 00 00 26 24 68 30 00 00 00 00 AB
-	Austrian BankCard  (Maestro + Quick) (New Version, since 02/2005,
-	with Digital-Signature etc.)
-
-3B BF 11 00 81 31 FE 45 45 50 41 00 00 00 00 28 93 66 23 00 00 03 E8 E4
-	Austrian Maestro BankCard +Quick Buergerkarte
-
-3B BF 11 00 81 31 .. 45 45 50 41 00 00 00 00 .. .. .. .. 00 00 .. .. ..
-	Austrian Quick E-purse
-
-3B BE 18 00 00 41 05 .. 00 00 00 00 00 00 00 00 00 90 00
-	Advanced Card Systems (ACS) ACOS5 Cryptographic Smart Card
-
-3B BE 18 00 00 41 05 10 00 00 00 00 00 00 00 00 00 90 00
-	ACS ACOS5 "ACOS5-32-G" http://www.acs.com.hk/acos5.asp
-
-3B BD 18 00 81 31 FE 45 80 51 02 67 04 14 B1 01 01 02 00 81 05 3D
-	Austrian "e-Card" (=Health Card), BRANDNEW (since 06/2005)
-	special Version of Starcos 3.1
-
-3B BF 11 00 C0 10 31 FE 44 53 4D 40 52 54 20 43 41 46 45 20 31 2E 31 43 C1
-	Giesecke&Devrient SmartCafe 1.1
-
-3B BF 18 00 80 31 70 35 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00 9B
-	Giesecke & Devrient STARCOS S2.1
-
-3B BF 18 00 81 31 70 55 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00 FA
-	Giesecke & Devrient STARCOS S2.1
-
-3B BF 18 00 C0 20 31 70 52 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00 9C
-	Giesecke & Devrient SPK 2.1 C
-
-3B BF 94 00 81 31 FE 65 45 4C 55 20 41 75 73 74 72 69 61 20 31 2E 32 38
-	A-Trust: trust-sign (Old Version, ca. 2002) for Digital Signature etc.
-	A-Trust: a-sign-premium (ca. 2004) "Bürgerkarte" ("Citizen-Card")
-	for Identifikation, Digital Signature etc.
-	("should be" Starcos 2.3)
-
-3B BF 94 00 81 31 FE 65 45 4C 55 20 41 75 73 74 72 69 61 20 31 2E 32 38
-
-3B BF 96 00 81 31 FE 5D 00 64 .. .. .. .. 31 C0 73 F7 01 D0 00 90 00 ..
-	TCOS 3.0 / NetKey 3.0
-
-3B D0 A8 FF 81 F1 FB 24 00 1F C3 F4
-	Philips DESFire SAM
-
-3B D5 95 04 00 AE 01 02 01 01
-	Axalto Cyberflex Access 64K v2b SM 1.1
-
-3B D6 18 00 80 B1 80 6D 1F 03 80 51 00 61 10 30 9E
-	Atmel/Athena T0 PC/SC Compliance Test Card No. 1
-
-3B D6 18 00 81 B1 80 7D 1F 03 80 51 00 61 10 30 8F
-	ASECard Crypto, http://www.athena-scs.com/product.asp?pid=8
-
-3B DB 11 FF 50 00 FF 00 00 00 00 00 00 00 07 92 16 03
-	NEC V-WAY64 v2.1
-
-3B DB 96 00 80 1F 03 00 31 C0 64 77 E3 03 00 82 90 00 C1
-	CAC (Common Access Card)
-
-3B DB 96 00 81 B1 FE 45 1F 03 80 F9 A0 00 00 03 08 00 00 10 00 18
-	Oberthur CS PIV End Point v1.08 FIPS201 Certified
-
-3B DE 18 FF 81 F1 FB 34 00 1F 07 44 45 53 46 69 72 65 53 41 4D 56 31 2E 30 D2
-	Mifare Desfire SAM Module
-
-3B DE 18 FF C0 80 B1 FE 45 1F 03 45 73 74 45 49 44 20 76 65 72 20 31 2E 30 2B
-	Estonian Identity Card (EstEID v1.0 2006 cold)
-
-3B DF 18 00 81 31 FE 67 00 5C 49 43 4D D4 91 47 D2 76 00 00 38 33 00 58
-	Infineon SICRYPT Card Module D4 PC/SC Compliance Test Card
-
-3B E0 00 00 81 31 20 40 30
-	SmarTEC
-
-3B E2 00 00 40 20 49 ..
-	Schlumberger Cryptoflex 4k
-
-3B E2 00 00 40 20 49 05
-	Schlumberger Cryptoflex DES
-
-3B E2 00 00 40 20 49 06
-	Schlumberger Cryptoflex
-
-3B E2 00 00 40 20 49 07
-	Schlumberger Cryptoflex Key Generation
-
-3B E2 00 FF C1 10 31 FE 55 C8 02 9C
-	Aladdin eToken PRO (USB token)
-	Siemens CardOS M4.0
-
-3B E3 00 FF 91 81 71 26 44 00 01 13 20 2D
-	Metrebus Card
-	(used in Rome to store personal information and Atac subscription.
-	Atac is the public transport company of the city of Rome.)
-	http://www.atac.roma.it/smart/smart.asp?A=2&S=22&PR=4&LNG=2
-
-3B E6 00 FF 81 31 FE 45 4A 43 4F 50 30 33 07
-	IBM JCOP 30/16
-
-3B E6 00 FF 81 31 FE 45 4A 43 4F 50 31 30 05
-	IBM JCOP 10/16
-
-3B E6 00 FF 81 31 FE 45 4A 43 4F 50 32 30 06
-	IBM JCOP 20/16
-	IBM JCOP20 with MIFARE
-	or Datakey Smart Card Model 330J
-	(http://www.datakey.com/products/smart_cards/products_sc_330j.shtml)
-
-3B E6 00 FF 81 31 FE 45 4A 43 4F 50 32 31 07
-	IBM JCOP ID21
-
-3B E6 00 FF 81 31 FE 45 4A 43 4F 50 33 30 07
-	Mifare ProX T=1
-
-3B E6 00 FF 81 31 FE 45 4A 43 4F 50 33 31 06
-	IBM JCOP 30/31bio (contact interface)
-
-3B E7 00 00 91 81 31 FE 41 01 10 30 01 00 90 80 49
-	"FirmenTicket" from the "Rheinbahn" for the "VRR"
-	its a ticket corporates can buy for their employees. so its called
-	"FirmenTicket". "Rheinbahn" is the local service operator for the
-	mass traffic in and around duesseldorf/germany. "VRR" is traffic
-	network spanning over at least a big part of north rhine westphalia
-	(Verkehrsverbund Rhein-Ruhr)
-	(http://www.vrr.de/de/tickets_und_tarife/vielfahrer/firmenticket/index.php)
-
-3B E9 00 00 81 21 45 45 4D 56 5F 41 54 52 20 06 6C
-	VISA card, issued by HVB Bank Czech Republic (http://www.hvb.cz)
-
-3B E9 00 00 81 21 45 56 49 53 5F 49 4E 46 20 06 78
-	VISA card, issued by the Austrian "Raiffeisen" bank (http://www.raiffeisen.at/
-	Visa Card - Maximum - Oyak Bank / Turkey
-
-3B E9 00 00 81 31 FE 45 4A 43 4F 50 34 31 56 32 32 A7
-	IBM JCOP v2.2 41
-
-3B E9 00 FF C1 10 31 FE 55 C8 01 20 50 4E 34 30 31 32 AD
-	Siemens CardOS/M 3.0 (SLE66CX160S)
-
-3B EA 00 FF 81 31 20 75 00 64 05 14 01 02 31 00 90 00 27
-	GCOS-MDK
-
-3B EA 00 FF 81 31 FE 45 54 55 42 2D 43 4B 01 03 01 00 7B
-	Technische Universität Berlin - Campus Karte
-	Maybe Sm@rtCafé Expert 2.0 (Giesecke & Devrient)
-	or GemXpresso 211 PK (Gemplus)
-	Includes a Mifare-Chip (1 KB - Memory-Chip)
-
-3B EB 00 00 81 31 42 45 4E 4C 43 68 53 43 4B 30 34 30 31 2B
-	Dutch University accesscard & Electronic purse & telphone card
-
-3B EB 00 00 81 31 42 45 4E 4C 43 68 69 70 70 65 72 30 31 0A
-	Dutch Post (Chipper)
-
-3B EC 00 FF 81 31 FE 45 A0 00 00 00 56 33 33 30 4A 33 06 00 A1
-	Datakey model 330J card, www.datakey.com
-	http://www.hmk.de/downloads/datakey/Model_330J_Smart_Card.pdf
-	Model 330J JavaCard v2.1.1
-	Global Platform v2.0.1 specifications.
-	JCCOS operating system applet (Java-based Cryptographic Card
-	Operating System)
-
-3B EF 00 00 40 14 80 25 43 45 52 45 53 57 01 16 01 01 03 90 00
-	Electronic Identification Card from the FNMT, the Spanish Official
-	Certification Authority (Fábrica Nacional de Moneda y Timbre)
-	FNMT-Ceres Siemens Infineon SLE 19
-
-3B EF 00 00 40 14 80 25 43 45 52 45 53 57 05 60 01 02 03 90 00
-	FNMT-Ceres Siemens Infineon SLE 20
-	Fábrica Nacional de Moneda y Timbre
-
-3B EF 00 00 81 31 20 49 00 5C 50 43 54 10 27 F8 D2 76 00 00 38 33 00 4D
-	Infineon Technologies PC/SC Compliance Test Card V1.0
-
-3B EF 00 00 81 31 FC 45 80 31 80 65 11 01 13 00 01 53 41 43 45 81 04 21
-	Slovenska sporitelna (SLSP) Bank card, Maestro Card with chip
-
-3B EF 00 FF 81 31 20 45 42 61 73 69 63 43 61 72 64 20 5A 43 32 2E 33 BD
-	ZeitControl BasicCard Enhanced 2.3
-
-3B EF 00 FF 81 31 20 45 42 61 73 69 63 43 61 72 64 20 5A 43 33 2E 33 BC
-	Electronic Purse (Elton Senegal)
-
-3B EF 00 FF 81 31 50 45 65 63 0D 24 20 02 80 00 05 08 33 56 10 01 02 43
-	German ec card
-
-3B EF 00 FF 81 31 20 75 42 61 73 69 63 43 61 72 64 20 5A 43 33 2E 33 8C
-	ZeitControl BasicCard Enhanced 3.3
-
-3B EF 00 FF 81 31 20 75 42 61 73 69 63 43 61 72 64 20 5A 43 33 2E 37 88
-	ZeitControl BasicCard Enhanced 3.7
-
-3B EF 00 FF 81 31 20 75 42 61 73 69 63 43 61 72 64 20 5A 43 33 2E 39 86
-	ZeitControl BasicCard Enhanced 3.9
-
-3B EF 00 FF 81 31 42 45 .* 38
-	UNI-Card
-
-3B EF 00 FF 81 31 42 45 65 63 03 02 03 02 80 00 22 40 48 95 96 00 20 28
-	Scard Sparkasse Detmold, Deutschland BLZ 47650130
-
-3B EF 00 FF 81 31 50 45 42 61 73 69 63 43 61 72 64 20 5A 43 31 2E 31 CC
-	ZeitControl BasicCard Compact 1.1
-
-3B EF 00 FF 81 31 50 45 65 63 .. .. .. .. .. .. .. .. .. .. .. .. .. ..
-	GeldKarte v2 (Germany)
-
-3B EF 00 FF 81 31 50 45 65 63 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-	Geldkarte v2
-
-3B EF 00 FF 81 31 50 45 65 63 08 0B 40 02 80 00 08 15 20 03 36 04 00 7E
-	old banking card (electronic-card / Maestro / Geldkarte) of the
-	Stadt-Sparkasse Duesseldorf (like the above, but old - around 2002).
-
-3B EF 00 FF 81 31 52 45 4D 46 43 20 49 42 4D 20 34 30 48 39 36 30 31 FB
-	IBM MFC 3.5 file system smart card
-	(Card from the book "Smart Card Application Development Using Java")
-
-3B EF 00 FF 81 31 60 45 65 63 04 02 11 00 00 00 00 00 A5 32 A5 01 11 B6
-	GledKarte
-	Siemens M3-Module with a Motorola SC-28.
-	G&D (Giesecke&Devrient) Geldkarten-OS mit der Version 11
-
-3B EF 00 FF 81 31 60 45 65 63 06 03 14 02 50 00 06 51 08 11 5E 01 41 90
-	Geldkarte from Deutsche Bank, Thomson-Chip
-
-3B EF 00 FF 81 31 66 45 49 42 4D 20 4D 46 43 34 30 30 32 30 38 33 31 A1
-	IBM MFC 4.1 file system smart card
-	Card from the book "Smart Card Application Development Using Java"
-	authors: Uwe Hansmann, Martin. S. Nicklous, Thomas Schäck, Achim Schneider, Frank Seliger
-
-3B EF 00 FF 81 31 66 45 65 63 20 20 49 42 4D 20 33 2E 31 20 20 20 20
-	IBM eCash
-
-3B EF 00 FF 81 31 66 45 65 63 20 20 49 42 4D 20 33 2E 31 20 20 20 20 CF
-	IBM eCash
-
-3B EF 00 FF 81 31 86 45 49 42 4D 20 4D 46 43 34 30 30 30 30 38 33 31 43
-	ComCard MFC 4.1
-
-3B EF 00 FF 81 31 FE 45 65 63 11 04 01 02 80 00 0F 27 40 00 03 01 00 E1
-	Postbank Geldkarte
-
-3B EF 00 FF 81 31 FE 45 65 63 11 04 01 02 80 00 0F 46 20 04 23 01 00 C4
-	Postbank ec/Maestro (Germany)
-
-3B EF 00 FF 81 31 FE 45 80 31 C0 6B 49 42 4D 20 4A 65 74 5A 20 4D 32 39
-	UBS Internet Card (IBM JetZ M2)
-
-3B F2 18 00 02 C1 0A 31 FE 55 C8 07 76
-	Siemens CardOS V4.3
-
-3B F2 18 00 02 C1 0A 31 FE 58 C8 08 74
-	Siemens CardOS V4.3B
-
-3B F2 18 00 02 C1 0A 31 FE 58 C8 09 75
-	Siemens CardOS V4.2B
-
-3B F2 18 00 FF C1 0A 31 FE 55 C8 06 8A
-	Siemens CardOS M 4.2 (SLE66CX642P)
-
-3B F2 98 00 FF C1 10 31 FE 55 C8 03 15
-	Siemens CardOS M 4.01 (SLE66CX320P)
-
-3B F2 98 00 FF C1 10 31 FE 55 C8 04 12
-	CardOS M4.01a (SLE66CX322P)
-
-3B F4 18 00 02 C1 0A 31 FE 58 56 34 63 76 C5
-	Eutron CryptoIdentity (reader + card token)
-
-3B F4 18 00 FF 81 31 80 55 00 31 80 00 C7
-	Identity card of Italian Republic
-
-3B F4 98 00 FF C1 10 31 FE 55 4D 34 63 76 B4
-	Eutron Digipass 860 (reader + card token)
-
-3B F5 91 00 FF 91 81 71 FE 40 00 41 00 00 00 00 05
-	Contactless Mifare Ultralight
-
-3B F5 91 00 FF 91 81 71 FE 40 00 41 08 00 00 00 0D
-	Contactless Mifare
-
-3B F5 91 00 FF 91 81 71 FE 40 00 41 18 00 00 00 1D
-	Contactless Mifare 4k
-
-3B F5 91 00 FF 91 81 71 FE 40 00 41 88 00 00 00 8D
-	Contactless Mifare 1k or 4k
-
-3B F6 18 00 FF 81 31 FE 45 4A 43 4F 50 32 30 0E
-	IBM JCOP20
-
-3B F6 18 00 FF 81 31 FE 45 4A 43 4F 50 33 30 0F
-	Philips P8RF5016 running IBM JCOP 30 (contact interface)
-
-3B F6 18 00 FF 81 31 FE 45 4A 43 4F 50 33 31 0E
-	IBM JCOP BIO31
-	IBM JCOP BIO31 Java card
-
-3B F7 11 00 01 40 96 54 30 04 0E 6C B6 D6 90 00
-	PIC16F876-04/SP (PICCard2) or
-	PIC16F84A-04/P + 24LC16B (PICCard1) or
-	Canal + Canal Digital Spain year 2000/2001 or
-	PIC Silver Card 2 (PIC16F876/7 + 24C64)
-
-3B F7 11 00 01 40 96 58 42 14 0E 6C B6 D6
-	UK on digital (terrestrial digital TV card)
-
-3B F7 11 00 01 40 96 70 70 07 0E 6C B6 D6 90 00
-	M-II (a.k.a. M-2, a.k.a. Platinum Card), AT90SC6464C based
-	KnotCard II
-	TitaniumElite
-
-3B F7 11 00 01 40 96 70 70 17 0E 6C B6 D6
-	Canal Satellite card (VERSION 7.1  SYSTEM / SECA2)
-
-3B F7 91 00 FF 91 81 71 FE 40 00 41 20 00 11 77 81 80 40
-	Contactless Mifare DESFire
-
-3B F8 18 00 00 81 31 FE 45 00 73 C8 40 13 00 90 00 93
-	Giesecke & Devrient Sm@rtCafé Expert 3.0
-
-3B F9 94 00 00 81 31 FE 65 46 54 20 56 31 30 30 90 00 83
-	ePass 2000
-
-3B FA 11 00 02 40 60 43 C6 02 F8 03 03 00 00 90 00
-	DeLaRue DX(?)
-
-3B FA 13 00 00 81 31 FE 45 4A 43 4F 50 34 31 56
-	JCOP41 V221
-
-3B FA 13 00 FF 81 31 80 45 00 31 C1 73 C0 01 00 00 90 00 B1
-	OpenPGP
-
-3B FA 94 00 00 81 31 20 43 80 65 A2 01 01 01 3D 72 D6 43 21
-	GemXpresso Pro R3 32PK (MPCOS, T=1)
-
-3B FA 98 00 FF C1 10 31 FE 55 C8 03 53 41 47 5F 50 4B 49 32 77
-	Siemens corporate ID card (access to the building / rooms etc,
-	stores PKI private keys/certificates)
-
-3B FA 98 00 FF C1 10 31 FE 55 C8 04 53 41 47 5F 50 4B 49 32 70
-	Siemens Belgium Corporate Card
-
-3B FB 13 00 FF 81 31 80 75 5A 43 36 2E 35 20 52 45 56 20 43 64
-	ZeitControl BasicCard 6.5, multiapplication with 30 kByte EEPROM
-
-3B FB 13 00 FF 81 31 80 75 5A 43 35 2E 35 20 52 45 56 20 47 63
-	ZeitControl BasicCard 5.5
-
-3B FB 13 00 FF C0 80 31 80 75 5A 43 35 2E 34 20 52 45 56 20 41 A5
-	ZeitControl BasicCard Professional 5.4 Revision A
-
-3B FB 96 00 00 80 31 FE 45 00 31 C0 64 77 E3 02 00 82 90 00 76
-	Oberthur ID-One Cosmo
-
-3B FB 98 00 FF C1 10 31 FE 55 00 64 05 20 47 03 31 80 00 90 00 F3
-	Gemplus GemGate 32K
-	distributed by Postecert (www.postecert.it) to legally sign documents
-
-3B FC 98 00 FF C1 10 31 FE 55 C8 03 49 6E 66 6F 63 61 6D 65 72 65 28
-	New Card Infocamere (Italy) series 1402...
-	 http://www.card.infocamere.it/
-	 Siemens Informatica - Siemens M4.01a
-	 chip Infineon SLE66CX322P (CC EAL5)
-	 Memory EEPROM: 32KB
-	 Operating system CARDOS
-	 Max numero dei tentativi PIN: 3
-	 Pin: da 5 a 8 digit
-	 Unblocked by tool CARDOS API 2.2
-
-3B FD 18 00 00 80 31 FE 45 00 31 80 71 8E 64 52 D9 04 00 81 90 00 5B
-	Oberthur Card Systems, authentIC
-
-3B FD 94 00 00 81 31 20 43 80 31 80 65 B0 83 02 04 7E 83 00 90 00 B6
-	GXPPRo-R3.x STD PTS T=1
-
-3B FD 94 00 00 81 31 60 65 80 31 C0 69 4D 54 43 4F 53 73 01 01 11 E0
-	MTCOS Light, http://www.masktech.de/products/mtcoslight/index.html
-
-3B FE 91 00 FF 91 81 71 FE 40 00 41 28 00 01 80 81 00 73 C8 40 00 00 90 00 4D
-	Philips SmartMX chip (IBMs JCOP OS)
-
-3B FE 94 00 FF 80 B1 FA 45 1F 03 45 73 74 45 49 44 20 76 65 72 20 31 2E 30 43
-	Estonian Identity Card (EstEID v1.0 cold)
-
-3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0
-	Datakey 32K PKI Smart Card Model 330
-	(http://www.datakey.com/products/smart_cards/products_sc_330.shtml)
-
-3B FF 11 00 00 81 71 40 42 00 00 21 01 31 42 52 00 0[0,5] 63 .. .. .. .. 90 00.*
-	Smart Card "The Smart Way to Login"
-	Used on Acer TravelMate to secure boot
-
-3B FF 11 00 02 40 64 80 69 A2 07 01 03 57 00 00 FF 00 83 00 90 00
-	Gemplus GemXpresso
-
-3B FF 13 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D2
-	Datakey DCOS model 330 (DKCCOS 6.0 token)
-
-3B FF 13 00 FF 80 31 FE 45 53 46 53 45 2D 43 58 33 32 32 2D 56 18 02 08 76
-	SmartCafe Expert Java
-
-3B FF 13 00 FF 80 31 FE 45 53 46 53 45 2D 43 58 33 32 32 2D 56 18 03 08 77
-	Giesecke & Devrient SmartCafe Expert 32K v2.0 #2
-
-3B FF 13 00 FF 81 31 FE 45 65 63 11 04 50 02 80 00 08 39 00 04 02 05 02 E9
-	German "Geldkarte" supplied by the Deutsche Bank in Karlsruhe,
-	Baden-Württemberg, Germany.
-
-3B FF 13 00 FF 81 31 FE 45 65 63 11 04 50 02 80 00 08 54 00 04 23 05 02 A5
-	Maestrocard/Geldkarte (Stadtsparkasse Haltern, Germany)
-
-3B FF 13 00 FF 81 31 FE 5D 80 25 A0 00 00 00 56 57 44 4B 33 32 30 05 00 3F
-	Datakey DCOS model 320
-
-3B FF 18 00 00 81 31 FE 45 00 6B 04 05 01 00 01 11 01 43 4E 53 10 31 80 69
-	Sanitary Card of "Friuli Venezia Giulia" region (Italian Republic)
-	Carta Nazionale dei Servizi (Italia) http://cartaservizi.regione.fvg.it/
-
-3B FF 18 00 FF 80 31 FE 45 53 46 53 45 2D 43 58 33 32 32 2D 56 18 03 08 7C
-	Giesecke & Devrient Sm@rtCafé Expert 2.0
-
-3B FF 18 00 FF 80 31 FE 45 53 6D 40 72 74 43 61 66 65 45 78 70 65 72 74 65
-	Giesecke & Devrient SmartCafe 32K v1
-
-3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 00 26 00 04 10 09
-	Maestrocard/Geldkarte (Postbank, Germany)
-
-3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 01 55 00 04 10 7B
-	Volksbank VR-BankCard (GeldKarte)
-
-3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 07 88 00 04 10 A0
-	HBCI-Karte (Berliner Sparkasse, Germany)
-
-3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 05 29 00 04 10 03
-	Geldkarte/HBCI(DDV-1) (Stadtsparkasse Vorpommern, Germany)
-
-3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 13 82 00 04 10 BE
-	Bremer Karte ("Geldkarte und BSAG-Kundenkarte in einem.")
-	http://www.bsag.de/4911.php
-
-3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 14 06 00 04 10 3D
-	Geldkarte/HBCI(DDV-1) (Staedtische Sparkasse Offenbach, Germany)
-
-3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 55 70 00 04 10 0A
-	EC-Card from DKB (Deutsche Kreditbank AG)
-
-3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 80 00 12 24 30 00 20 04 10 59
-	Geldkarte (Germany)
-
-3B FF 18 00 FF 81 31 50 45 65 63 .. .. .. .. .. .. .. .. .. .. .. .. .. ..
-	GeldKarte v3 (Germany)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 0D 08 65 07 64 00 0D 91 04 90 00 06 16 0E
-	German Railway's (Deutsche Bahn AG) "Konzernausweis"
-
-3B FF 18 00 FF 81 31 FE 45 65 63 0D 04 50 02 80 00 08 90 09 70 00 05 00 2A
-	Landesbank baden-Württemberg Geldkarte
-
-3B FF 18 00 FF 81 31 FE 45 65 63 0D 07 63 05 28 00 0D 90 81 06 00 06 15 58
-	Geldkarte/HBCI (Frankfurter Sparkasse, Germany)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 0D 07 63 07 64 00 0D 90 58 45 00 06 15 8C
-	Stadtsparkasse München electronic cash card / Geldkarte
-
-3B FF 18 00 FF 81 31 FE 45 65 63 0D 07 63 07 64 00 0D 90 73 07 00 06 15 E5
-	Sparkasse Acchen HBCI Geld Karte
-
-3B FF 18 00 FF 81 31 FE 45 65 63 0D 07 63 07 64 00 0D 90 74 32 00 06 15 D7
-	German HBCI-Banking Card with 'Geldkarte' from the bank "Sparkasse Marburg-Biedenkopf"
-
-3B FF 18 00 FF 81 31 FE 45 65 63 0D 07 63 07 64 00 0D 90 92 61 00 06 15 62
-	Geldkarte (Frankfurter Sparkasse, Germany)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 03 50 02 80 00 08 27 70 02 06 05 01 8A
-	old banking card (electronic-card / Maestro / Geldkarte) of the
-	"Volksbank Gelderland eG" (around 2003)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 05 40 02 50 00 10 55 10 03 03 05 00 43
-	belongs to a banking card (electronic-card / Maestro / Geldkarte).
-	the bank calls it "VR-BankCard". the banks name is "Volksbank
-	Gelderland eG" and is part of the "Volksbanken und Raiffeisenbanken"
-	(http://www.vb-gelderland.de/html/5/2394/rubrik/1282.html)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 05 50 03 10 05 00 43
-	HBCI-Karte (Bordesholmer Sparkasse, Germany)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 19 10 04 20 05 00 28
-	Stadtsparkasse München HBCI card / Geldkarte
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 25 60 05 12 05 00 57
-	Geldkarte/HBCI(DDV-1) (Stadtsparkasse Vorpommern, Germany)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 27 30 02 16 05 00 06
-	GeldKarte from Sparkasse bank
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 27 80 03 25 05 00 84
-	Volksbank VR-BankCard (GeldKarte)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 28 50 01 11 05 00 6D
-	HBCI Bancing Card of Sparkasse Pforzheim
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 06 62 02 80 00 11 06 60 03 04 06 13 87
-	Geldkarte (Volksbank Offenburg, Germany)
-
-3B FF 18 00 FF 81 31 .. 45 65 63 .. .. .. .. .. .. .. .. .. .. .. .. .. ..
-	Geldkarte (generic ATR)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 06 62 02 80 00 11 20 90 03 09 06 13 5C
-	Geldkarte [ec, Maestro] (1822 direkt Frankfurter Sparkasse, Germany)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 06 62 02 80 00 11 43 50 01 17 06 13 E3
-	EC-Card of Sparkasse Pforzheim Calw
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 06 62 02 80 00 11 16 50 05 17 06 13 B2
-	FinTS (BBBank Karlsruhe, Germany)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 08 43 02 50 00 10 46 50 01 08 05 30 27
-	HBCI-Karte (Sparkasse Altmark-West, Salzwedel, Germany)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 08 66 02 80 00 11 40 50 03 18 06 20 D4
-	banking card (electronic-card / Maestro / Geldkarte). the bank+calls
-	it "S-Card" or "Sparkassen-Card". the banks name is "Stadtsparkasse
-	Duesseldorf" and is part of the "Sparkassen-Finanzgruppe" (a finance
-	group, network of local banks).
-
-3B FF 18 00 FF 81 31 FE 45 65 63 11 08 66 02 80 00 11 56 00 03 18 06 20 92
-	Geldkarte [ec, Maestro] (Sparkasse Langen-Seligenstadt, Germany)
-
-3B FF 18 00 FF 81 31 FE 45 65 63 1A 01 41 02 50 00 10 52 09 05 67 05 10 21
-	Maestro/Geldkarte (BBBank Karlsruhe, Germany)
-
-3B FF 18 00 FF 81 31 FE 55 00 6B 02 09 02 00 01 01 01 43 4E 53 10 31 80 9F
-	Carta Nazionale dei Servizi - InfoCamere
-
-3B FF 18 00 FF 81 31 FE 55 00 6B 02 09 02 00 01 11 01 43 4E 53 10 31 80 8F
-	Carta Regionale dei Servizi - Regione Lombardia
-
-3B FF 18 00 FF 81 31 FE 55 00 6B 02 09 02 00 01 11 01 43 4E 53 11 31 80 8E
-	Infocamere CNS
-
-3B FF 18 00 FF C1 0A 31 FE 55 00 6B 05 08 C8 05 01 11 01 43 4E 53 10 31 80 0C
-	Carta Regionale dei Servizi - Regione Lombardia
-
-3B FF 32 00 00 10 80 80 31 E0 5B 47 42 50 00 00 00 00 00 00 02 55
-	UK NatWest BT PayToView Mondex
-
-3B FF 94 00 00 40 0A 80 31 00 73 12 21 13 57 4A 33 0E 02 32 41 00
-	Turkcell SIMPlus64 / Turkey
-
-3B FF 94 00 FF 80 B1 FE 45 1F 03 00 68 D2 76 00 00 28 FF 05 1E 31 80 00 90 00 23
-	D-Trust Signature Card (www.d-trust.net):
-	- Citizencard of the People of Ulm in Germany (Bürgerkarte)
-	- Qualified Electronic Signature Card (Qualifizierte Signaturkarte)
-
-3B FF 94 00 FF C0 0A 1F 43 80 31 E0 73 36 21 13 57 4A 43 49 1C 31 30 32 1C
-	Giesecke & Devrient - UniverSIM Pegasus
-
-3B FF 95 00 FF 40 0A 80 31 00 73 1A 21 13 57 4A 50 48 60 31 41 47
-	Vodafone 64 KB SIM with Javacard
-
-3B FF 95 00 FF 40 0A 80 31 E8 73 F6 21 13 67 4A 47 48 60 31 42 00
-	Giesecke & Devrient STARSIM
-
-3B FF 96 00 FF C0 0A 1F 43 80 31 E0 73 36 21 13 57 4A 43 49 1C 31 30 32 1E
-	Giesecke & Devrient - UniverSIM Pegasus
-
-3B FF 95 00 FF C0 0A 1F 43 80 31 E0 73 F6 21 13 57 4A 33 48 61 32 41 47 D6
-	GSM SIM (issued by e-plus, Germany)
-
-3F 05 DC 20 FC 00 01
-	DigiCash Facility Card
-
-3F 28 00 00 11 14 00 03 68 90 00
-	SIMEMU - a DIY GSM SIM card - http://simemu.cjb.net/
-
-3F 2D 00 27 A0 51 82 7D 00 00 00 52 00 0C 90 00
-	Porta Moedas Multibanco (Portugeese electronic purse)
-
-3F 2F 00 80 59 AF 02 01 01 30 00 00 0A 0E 83 06 9F 12
-	Gemplus GemXplore
-
-3F 2F 00 80 59 AF 02 01 02 30 00 0C 0A 0E 83 1E 9F 16
-	GSM-SIM (900MHz) card of the carrier "Mannesmann Mobilfunk" for
-	their network "D2-Privat" - now known as Vodafone Mobilfunk
-	(http://www.vodafone.de/).
-
-3F 2F 00 80 69 AE 02 02 01 36 00 00 0A 0E 83 3E 9F 16
-	GSM-SIM e-plus (1800MHz)
-
-3F 2F 00 80 69 AF 02 04 01 36 00 02 0A 0E 83 3E 9F 16
-	GSM-SIM D2 CallYa (900MHz)
-
-3F 2F 00 80 69 AF 03 07 03 52 00 00 0A 0E 83 3E 9F 16
-	GemXplore 98 V1 16K
-
-3F 2F 00 80 69 AF 03 07 03 52 00 0D 0A 0E 83 3E 9F 16
-	GSM-SIM Debitel D2 (900MHz)
-
-3F 2F 00 80 69 AF 03 07 03 5A 00 15 0A 0E 83 3E 9F 16
-	Virgin Mobile SIM (Gemplus)
-
-3F 67 25 00 21 20 00 0F 78 90 00
-	Bank Nederlandse Gemeenten, BNG Data Services
-
-3F 65 25 .. .. 04 6C 90 .0
-	Carte Bancaire (French banking card)
-
-3F 65 25 00 2[2,C] 09 [F,6]9 90 00
-	Sesam Vitale (French health card)
-
-3F 65 25 00 2B 09 62 90 00
-	Coinamatic SmartyCity smartcard
-
-3F 65 25 00 2B 09 EB 90 00
-	Bull Scot 5
-
-3F 65 25 00 52 09 6A 90 00
-	French carte Vitale
-
-3F 65 25 08 22 04 68 90 00
-	France Telecom card (ex Pastel card)
-
-3F 65 25 08 33 04 20 90 00
-	D-Trust card
-
-3F 65 35 10 02 04 6C 90 00
-	Postcard (Switzerland)
-
-3F 65 35 64 02 04 6C 90 40
-	Postcard (Switzerland)
-
-3F 67 25 00 26 14 00 20 68 90 00
-	Pay-TV card from Casema Cable Television, Netherland
-
-3F 67 25 00 2A 20 00 0F 68 90 00
-	Carte Grand Voyageur (SNCF: French train company)
-
-3F 67 25 00 2A 20 00 40 68 9F 00
-	Swiss Cash card
-
-3F 67 25 00 2A 20 00 4[0,1] 68 90 00
-	Dutch ChipKnip, Proton
-	(chip Bull CC 60 V1, Bull CC 60 V2 or Bull CC 1000)
-
-3F 67 25 04 21 20 00 07 68 90 00
-	Philips TB100 (C-MOS chip)
-
-3F 67 2F 04 11 20 00 00 68 90 00
-	BULL HN ITALIA 06/92 - 100.000 - 64MP
-	La Sapienza - Universita' di Roma
-
-3F 69 00 00 24 AF 01 70 01 01 FF 90 00
-	French GSM SIM card (900MHz)
-
-3F 6C 00 00 24 A0 30 00 FF 00 00 01 00 04 90 00
-	Gemplus MCOS 16K DES Sample Card
-
-3F 6C 00 00 25 A0 30 89 76 00 00 04 01 0C 90 00
-	MCOS 24k EEPROM
-
-3F 6C 00 00 3C A0 30 9E 61 00 00 01 00 04 90 00
-	Gemplus - British Gas - Gascard
-
-3F 6C 00 00 3C A0 30 A7 58 00 00 01 01 8C 90 00
-	Rendezvous Series 7 (D2-Mac satellite TV card)
-
-3F 6D 00 00 80 31 80 65 B0 05 01 02 5E 83 00 90 00
-	Gemplus GemXpresso 211PK or 211PK-IS
-
-3F 6D 00 00 80 31 80 65 B0 05 01 02 5E 92 00 90 00
-	Gemplus GemXpresso 32K
-
-3F 77 18 25 00 29 14 00 62 68 90 00
-	Viaccess card
-
-3F 78 12 25 01 40 B0 03 4A 50 20 48 55
-	DSS/DTV H
-
-3F 7E 11 25 05 40 B0 08 00 00 4D 59 00 00 00 53 4B 0B 07
-	BSkyB Series 11 (DSS satellite TV card)
-
-3F 7F 11 25 05 40 B0 0F 69 FF 4D 59 00 00 00 53 4B 0C 06 00
-	Sky Series 12 (DSS satellite TV card)
-
-3F 7E 11 25 09 40 B0 01 00 00 4D 59 00 00 03 53 4B 0A 01
-	Sky Series 10 (DSS satellite TV card)
-
-3F 7E 11 25 05 40 B0 08 00 00 4D 59 00 00 00 53 4B 0B 08
-	Sky Series 11 (DSS satellite TV card)
-
-3F 7F 13 25 03 33 B0 06 69 FF 4A 50 D0 00 00 53 59 00 00 00
-	Sky 2005/6 (DSS satellite TV card)
-
-3F 7F 13 25 03 38 B0 04 FF FF 4A 50 00 00 29 48 55 .. .. ..
-	DSS/DTV HU
-
-3F 7F 13 25 03 40 B0 0B 69 4C 4A 50 C0 00 00 53 59 00 00 00
-	Sky Digital (DSS satellite TV card)
-
-3F 78 13 25 03 40 B0 20 FF FF 4A 50 00
-	DSS/DTV P4
-
-3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 30 20 52 65 76 41 32 30 48
-	DSS/DISH ROM10
-
-3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 30 20 52 65 76 41 32 31 49
-	PayTV card for DishNetwork Sat receiver http://www.dishnetwork.com/
-
-3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 31 20 52 65 76 42
-	NTL digial TV card (Nagravision)
-
-3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 31 20 52 65 76 42 30 36 4E
-	Telewest Broadband (Nagravision)
-
-3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 31 20 52 65 76 42 30 42 3A
-	NagraVision card for StarHub Digital Cable DVB-C Singapore
-
-3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 31 20 52 65 76 42 30 44 3C
-	NagraVision card for Virgin Media in the UK
-
-3F FF 95 00 FF 91 81 71 FE 47 00 44 4E 41 53 50 31 31 30 20 52 65 76 41 30 31 14
-	TVA Digital - Nagra Vision ID TV-01
-
-3F FF 95 00 FF 91 81 71 FE 47 00 44 4E 41 53 50 31 31 30 20 52 65 76 41 43 33 65
-	Brazilian NET Digital (Cable TV provider) - Nagra Vision "NASP110 RevA01"
-
-# do not delete
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/.cproject	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="0.2092644647">
+<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.2092644647" moduleId="org.eclipse.cdt.core.settings" name="デフォルト">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<configuration artifactName="arib25" buildProperties="" description="" id="0.2092644647" name="デフォルト" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+<folderInfo id="0.2092644647." name="/" resourcePath="">
+<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.688074301" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
+<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.688074301.278752691" name=""/>
+<builder autoBuildTarget="all" buildPath="${workspace_loc:/arib25}" cleanBuildTarget="clean" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.700134985" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+<tool id="org.eclipse.cdt.build.core.settings.holder.libs.310034476" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
+<tool id="org.eclipse.cdt.build.core.settings.holder.763264754" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
+<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1029322776" name="インクルード・パス" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
+<listOptionValue builtIn="false" value="/usr/include/PCSC"/>
+</option>
+<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1774263112" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+</tool>
+<tool id="org.eclipse.cdt.build.core.settings.holder.1843852156" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
+<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1633338499" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
+<listOptionValue builtIn="false" value="/usr/include/PCSC"/>
+</option>
+<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.68868800" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+</tool>
+<tool id="org.eclipse.cdt.build.core.settings.holder.1110713882" name="アセンブリー" superClass="org.eclipse.cdt.build.core.settings.holder">
+<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1161623323" languageId="org.eclipse.cdt.core.assembly" languageName="アセンブリー" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+</tool>
+</toolChain>
+</folderInfo>
+</configuration>
+</storageModule>
+
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
+<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
+<storageModule moduleId="scannerConfiguration">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<scannerConfigBuildInfo instanceId="0.2092644647">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+</storageModule>
+</cconfiguration>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<project id="arib25.null.793956085" name="arib25"/>
+</storageModule>
+</cproject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/.project	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>arib25</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+			<triggers>clean,full,incremental,</triggers>
+			<arguments>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+					<value>all</value>
+				</dictionary>
+				<dictionary>
+					<key>?name?</key>
+					<value></value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+					<value>false</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.buildLocation</key>
+					<value>${workspace_loc:/arib25}</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.enableFullBuild</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+					<value>clean</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.append_environment</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.contents</key>
+					<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.buildArguments</key>
+					<value></value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.buildCommand</key>
+					<value>make</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+					<value>all</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.stopOnError</key>
+					<value>true</value>
+				</dictionary>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+		<nature>org.eclipse.cdt.core.ccnature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+	</natures>
+</projectDescription>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/.settings/org.eclipse.core.resources.prefs	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,3 @@
+#Wed Jan 23 22:50:22 JST 2008
+eclipse.preferences.version=1
+encoding/<project>=Windows-31J
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/Makefile	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,6 @@
+all:
+	cd src; make all
+
+clean:
+	cd src; make clean
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/arib_std_b25.sln	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "arib_std_b25", "arib_std_b25.vcproj", "{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}.Debug|Win32.Build.0 = Debug|Win32
+		{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}.Release|Win32.ActiveCfg = Release|Win32
+		{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/arib_std_b25.vcproj	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,259 @@
+<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="arib_std_b25"
+	ProjectGUID="{6E77C1AC-A31A-49B9-9A52-9FE1E03B8FEC}"
+	RootNamespace="arib_std_b25"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UseUnicodeResponseFiles="false"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winscard.lib"
+				OutputFile="$(OutDir)\b25.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UseUnicodeResponseFiles="false"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winscard.lib"
+				OutputFile="$(OutDir)\b25.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="\[X t@C"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\src\arib_std_b25.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\b_cas_card.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\multi2.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\td.c"
+				>
+			</File>
+			<File
+				RelativePath=".\src\ts_section_parser.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="wb_[ t@C"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\src\arib_std_b25.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\arib_std_b25_error_code.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\b_cas_card.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\b_cas_card_error_code.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\multi2.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\multi2_error_code.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\portable.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\ts_common_types.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\ts_section_parser.h"
+				>
+			</File>
+			<File
+				RelativePath=".\src\ts_section_parser_error_code.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="\[X t@C"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/readme.txt	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,351 @@
+ýz
+
+@ARIB STD-B25 dlmFeXgvO\[XR[h
+
+yo[Wz
+
+@0.2.3
+
+yҁz
+
+@Ζ am (MOGI, Kazuhiro) 
+@kazhiro@marumo.ne.jp
+
+yꎟzzz
+
+@http://www.marumo.ne.jp/db2008_c.htm#30
+
+@邢
+
+@http://www.marumo.ne.jp/junk/arib_std_b25-0.2.3.lzh
+
+yړIz
+
+@ARIB STD-B25 ̎dl𗝉ׂ́AQlp̎ƂČJ
+
+ywiz
+
+@2011 N 7 ̒nAiOgTAȒnfW^
+@M@̔̔҂Ă
+
+@AARIB ̕W͂킴ƔɂĊJ܂
+@悤ƂĂƂvȂقǂɈӖsĂȋLqɂȂĂ
+@̂܂܂ł͒ቿiM@̊JȂǕs”\Ɏv
+
+@ŁAȂ ARIB Wǂ݁A͈͂\[X
+@R[ȟ`ɂ܂Ƃ߂ČJ邱Ƃɂ
+
+@̃R[hȎM@̊J̈ꏕƂȂ邱Ƃ҂
+
+@ȂA܂łdlړIƂ̂ł邽߁Arhς
+@oCit@C͔zzȂ
+
+ý͈z
+
+@CA VXe (B-CAS J[h֘A) 𒆐S ECM(table_id=0x82) ̏
+@Xg[Í̕AEMM(table_id=0x84) ̏܂ł
+
+@EMM bZ[W (table_id=0x85) ֘A͖ƂȂĂ
+
+yvO̓‹z
+
+@ISO 7816 Ή IC J[h[_CXg[ꂽ Windows PC 
+@z蓮‹Ƃ
+
+@ISO 7816 ΉX}[gJ[h[_[͈ʂ
+@uZJ[hΉ IC J[h[_vue-Tax Ή IC J[h[_v
+@ȂǂƂ 4000 ~xŔ̔Ă̂p”\ł
+
+@}NZ HX-520UJJ Őɓ삷邱ƂmFĂ
+
+y\[XR[h̃CZXɂ‚āz
+
+@E\[XR[h𗘗pƂɂāÃguĂ
+@@Ζ am͐ӔC𕉂Ȃ
+@E\[XR[h𗘗pƂɂāAvOɖ肪Ă
+@@Ζ am͐ӔC𕉂Ȃ
+
+@L 2 ɓӂč쐬ꂽ񎟓I앨ɑ΂āAΖ am
+@҂ɗ^鏔sgȂ
+
+yvO̍\z
+
+@Earib_std_b25.h/c
+
+@@ARIB STD-B25 Lڂ̏s߂̃W[
+@@MPEG-2 TS ̕ACA VXe (B-CAS J[h) @\̌ĂяoA
+@@MULTI2 @\̌ĂяoS
+
+@Ets_section_parser.h/c
+
+@@MPEG-2 TS ̃ZNV`f[^̕S
+
+@Eb_cas_card.h/c
+
+@@CA VXe (B-CAS J[h) ̃\[XǗђڂ̐
+@@S
+
+@Emulti2.h/c
+
+@@MULTI2 Í̕ƕS
+
+@Etd.c
+
+@@eXghCo
+@@PAT/PMT/ECM ܂ MPEG-2 TS t@Cǂݍ݁A
+@@MPEG-2 TS t@Co͂
+
+@@R}hCIvV MULTI2 Í̃Ehw”\
+@@Ehw肵Ȃꍇ̏l 4
+
+@@̃Eh 4  MULTI2 pł 32 ɑ
+
+@@ARIB STD-B25 ł MULTI2 ̃Eh͔Jp[^
+@@Ŏۂ̃Eh͐”\ł
+
+y̗z
+
+@EN
+
+@@1 AvP[V B_CAS_CARD W[̃CX^X
+@@@쐬AB_CAS_CARD W[ɁA˗
+
+@@1.a B_CAS_CARD W[ WIN32 API ̃X}[gJ[h֘A
+@@@@API ĂяoACA VXeɐڑ
+@@1.b B_CAS_CARD W[ ARIB STD-B25 Lڂ́u
+@@@@ݒR}h CA VXeɔsAVXe (64 byte)
+@@@@ CBC  (8 byte) 󂯎 
+
+@@2 AvP[V ARIB_STD_B25 W[̃CX^X
+@@@쐬AB_CAS_CARD W[ ARIB_STD_B25 W[
+@@@o^
+
+@Ef[^
+
+@@1 AvP[V ARIB_STD_B25 W[ɏf[^
+@@@񋟂AARIB_STD_B25 W[珈f[^
+@@@ăt@Cɏo͂Ă
+
+@@EARIB_STD_B25 W[
+
+@@@1 TS pPbg̃jbgTCY (188/192/204 ȂǂʓI) 
+@@@@肳ĂȂꍇ 8K ܂œ̓f[^obt@ĂA
+@@@@jbgTCY肷
+@@@@jbgTCYłȂꍇ́AG[I
+
+@@@2 PAT ĂȂꍇAPAT ł܂œ
+@@@@f[^obt@
+@@@@PAT łɃobt@TCY 16M 𒴉߂ꍇ
+@@@@G[I
+@@@@PAT łꍇAvOz쐬 PID }bv
+@@@@zɓo^
+
+@@@3 PAT ɓo^Ă PMT ׂĂ邩Aǂꂩ
+@@@@ЂƂ‚ PMT  2 –ڂ̃ZNV܂œ
+@@@@f[^obt@
+@@@@L𖞂Ƀobt@TCY 32M 𒴉߂ꍇ
+@@@@G[I
+@@@@PMT 閈 ECM ̗LmFAECM ݂
+@@@@ꍇ̓fNv^쐬ăvOɏXg[
+@@@@ PID }bvŊ֘At
+
+@@@4 PMT ɓo^Ă ECM ׂĂ邩Aǂꂩ
+@@@@ЂƂ‚ ECM  2 –ڂ̃ZNV܂œ
+@@@@f[^obt@
+@@@@L𖞂Ƀobt@TCY 32M 𒴉߂ꍇ
+@@@@G[I
+@@@@e ECM ɑ΂āAŏ̃ZNVf[^_
+@@@@MULTI2 W[̃CX^XfNv^ɍ쐬
+@@@@ECM ZNVf[^ B_CAS_CARD W[ɒ񋟂
+@@@@XNu󂯎AMULTI2 W[ɃVXeA
+@@@@ CBC ԁAXNunAMULTI2 ̏
+@@@@s
+
+@@@5.a ÍĂ TS pPbgł΁APID Ή
+@@@@@ECM Xg[肵AfNv^ MULTI2 W[
+@@@@@ɕďo̓obt@ɐς
+@@@@
+@@@5.b ÍĂȂ TS pPbgł΁Â܂܏o
+@@@@@obt@ɐς
+
+@@@5.c CAT oꍇAEMM  PID 擾 EMM ̏
+@@@@@s
+
+@@@5.d EMM 󂯎ꍇAB-CAS J[h ID ƔrA
+@@@@@Ă EMM ł B-CAS J[hɈnď
+@@@@@# EMM IvVw肳Ăꍇ
+
+@@@6 ECM XVꂽꍇAB_CAS_CARD W[ɏ
+@@@@˗Ao͂ꂽXNu MULTI2 W[
+@@@@o^
+
+@@@7 PMT XVꂽꍇAECM PID ωĂΐV
+@@@@fNv^쐬 4 ɖ߂
+
+@@@8 PAT XVꂽꍇAvOzj
+@@@@3 ɖ߂
+
+@EI
+
+@@1 eW[mۂ\[X
+
+yXVz
+
+@E2008, 12/30 - ver. 0.2.3
+
+@@CA_descriptor ̉߂sۂ CA_system_id  B-CAS J[h
+@@擾̂ƈv邩mFs悤ɕύX
+
+@@http://www.marumo.ne.jp/db2008_c.htm#30 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.2.3.lzh
+
+@E2008, 11/10 - ver. 0.2.2
+
+@@CEXNւ̕ϊ萳mȂ̂֕ύX
+
+@@TS pPbgTCY̓@ύX
+
+@@http://www.marumo.ne.jp/db2008_b.htm#10 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.2.2.lzh
+
+@E2008, 4/9 - ver. 0.2.1
+
+@@PAT XVɕRꂪĂoOC
+@@(ver. 0.2.0 ł̃GoO)
+
+@@ PID (PMT ɋLڂĂȂXg[) ݂ꍇ
+@@TS  ECM ЂƂ‚Ȃ΁A ECM ŕ`ɕύX
+
+@@EMM  B-CAS J[hւ̑MIvVőI”\ɕύX (-m)
+@@i󋵂̕\IvVőI”\ɕύX (-v)
+@@ʓd (EMMMp) \IvVlj (-p)
+
+@@http://www.marumo.ne.jp/db2008_4.htm#9 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.2.1.lzh
+
+@E2008, 4/6 - ver. 0.2.0
+
+@@EMM Ή
+@@p B-CAS J[h ID  EMM oꍇAEMM 
+@@B-CAS J[hɓnlj
+
+@@ECM ̍ۂɖ_񉞓ԂꂽꍇA׌ÿׁA
+@@ȍ~A PID  ECM  B-CAS J[hŏȂ悤ɕ
+@@X (EMM ꍇ͍Ă ECM 悤ɖ߂)
+
+@@i nn.nn% ̏ŕWG[o͂ɕ\悤ɕύX
+@@
+@@http://www.marumo.ne.jp/db2008_4.htm#6 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.2.0.lzh
+
+@E2008, 3/31 - ver. 0.1.9
+
+@@MULTI2 W[̃CX^X쐻̏󋵂ŁAMULTI2 
+@@@\ĂяoėO𔭐邱ƂoOC
+
+@@# pb`񋟂ĂꂽɊ
+
+@@http://www.marumo.ne.jp/db2008_3.htm#31 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.9.lzh
+
+@E2008, 3/24 - ver. 0.1.8
+
+@@-s IvV (NULL pPbg̍폜) lj
+@@-s 1  NULL pPbgo̓t@Cɂ͕ۑȂȂ
+@@ftHg -s 0  NULL pPbgێ
+
+@@http://www.marumo.ne.jp/db2008_3.htm#24 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.8.lzh
+
+@E2008, 3/17 - ver. 0.1.7
+
+@@arib_std_b25.h Ɂuextern "C" {v‚R[hȂ 
+@@(C++ R[h痘pꍇɃRpCG[𔭐) 
+@@C
+
+@@TS pPbg̒rŃXg[؂ւP[XŖ肪
+@@ɂȂ悤ɁAarib_std_b25.c ̃R[hC
+
+@@http://www.marumo.ne.jp/db2008_3.htm#17 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.7.lzh
+
+@E2008, 3/16 - ver. 0.1.6
+
+@@PMT XV̍ہAECM ֘Ȁ󋵂ύX (XNu - mXN
+@@u̐؂ւAECM PID ̕ύX) sĂAꂪ
+@@fĂȂC
+
+@@http://www.marumo.ne.jp/db2008_3.htm#16 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.6.lzh
+
+@E2008, 2/14
+
+@@readme.txt (̃t@C) C
+@@\[XR[h̃CZXɂ‚Ă̋Lqlj
+
+@E2008, 2/12 - ver. 0.1.5
+
+@@PMT ̍XVɔAǂ̃vOɂȂȂ PID (Xg
+@@[) ŃpPbgMꑱꍇÃpPbg̕
+@@łȂȂĂC
+
+@@http://www.marumo.ne.jp/db2008_2.htm#12 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.5.lzh
+
+@E2008, 2/2 - ver. 0.1.4
+
+@@ver. 0.1.3 ł PMT @ύXɖ肪APMT XVꂽ
+@@ꍇAȍ~ŐȏsȂȂĂoOC
+
+@@B-CAS J[hƂ̒ʐMŃG[ꍇ̃gC@\
+@@ĂȂoOC
+
+@@http://www.marumo.ne.jp/db2008_2.htm#2 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.4.lzh
+
+@E2008, 2/1 - ver. 0.1.3
+
+@@LŖ_Ԃ B-CAS J[hgۂɁA擾
+@@ĂȂɂ炸AԈŕĂɑΏ
+
+@@擾łȂ ECM Ɋ֘AtꂽXg[ł͕
+@@s킸AXNutOc܂ܓ͂fʂ`ɕύX
+@@擾łȂ ECM ݂ꍇAIɃ`lԍ
+@@B-CAS J[h擾łG[ԍxbZ[WƂĕ\
+@@`ɕύX
+
+@@ÍĂȂvOŗO𔭐ĂoOC
+
+@@http://www.marumo.ne.jp/db2008_2.htm#1 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.3.lzh
+
+@E2008, 1/11 - ver. 0.1.2
+
+@@fW^ BS ŁAPAT ɓo^Ă̂ɁAXg[
+@@PMT ؏oȂƂꍇɑΉ
+
+@@PMT ̋Lqq̈ 2  CA_descriptor ݂ꍇɑΉ
+@@ arib_std_b25.c ł̏\ύX
+
+@@ʃvOƓs邽߂ɃX}[gJ[h̔rw
+@@ύX
+
+@@http://www.marumo.ne.jp/db2008_1.htm#11 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.2.lzh
+
+@E2008, 1/7 - ver. 0.1.1
+
+@@ZNV (PAT/PMT/ECM )  TS pPbgɕĂ
+@@ꍇɁAɏłȂAO𔭐邱Ƃ
+@@oOC
+
+@@http://www.marumo.ne.jp/db2008_1.htm#7 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.1.lzh
+
+@E2007, 11/25 - ver. 0.1.0
+
+@@J
+
+@@http://www.marumo.ne.jp/db2007_b.htm#25 
+@@http://www.marumo.ne.jp/junk/arib_std_b25-0.1.0.lzh
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/Makefile	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,25 @@
+# PC/SC Lite libraries and headers.
+PCSC_CFLAGS ?= `pkg-config libpcsclite --cflags`
+PCSC_LDLIBS ?= `pkg-config libpcsclite --libs`
+
+CC     = gcc
+CFLAGS = -Wall -O2 -g $(PCSC_CFLAGS) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+LDLIBS = $(PCSC_LDLIBS) -lm
+ 
+TARGET = b25
+OBJS   = arib_std_b25.o b_cas_card.o multi2.o td.o ts_section_parser.o
+
+all: $(TARGET)
+
+arib_std_b25.o: arib_std_b25.c arib_std_b25.h portable.h b_cas_card.h arib_std_b25_error_code.h multi2.h ts_section_parser.h ts_common_types.h
+b_cas_card.o: b_cas_card.c b_cas_card.h portable.h b_cas_card_error_code.h 
+multi2.o: multi2.c multi2.h portable.h multi2_error_code.h 
+td.o: td.c arib_std_b25.h portable.h b_cas_card.h 
+ts_section_parser.o: ts_section_parser.c ts_section_parser.h ts_common_types.h portable.h ts_section_parser_error_code.h
+
+$(TARGET): $(OBJS)
+	$(CC) $(LDLIBS) -o $(TARGET) $(OBJS)
+
+clean:
+	rm -f *.o
+	rm -f $(TARGET)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/arib_std_b25.c	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,2566 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "arib_std_b25.h"
+#include "arib_std_b25_error_code.h"
+#include "multi2.h"
+#include "ts_common_types.h"
+#include "ts_section_parser.h"
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ inner structures
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+typedef struct {
+	int32_t           pid;
+	int32_t           type;
+	void             *prev;
+	void             *next;
+} TS_STREAM_ELEM;
+
+typedef struct {
+	TS_STREAM_ELEM   *head;
+	TS_STREAM_ELEM   *tail;
+	int32_t           count;
+} TS_STREAM_LIST;
+
+typedef struct {
+	
+	uint8_t          *pool;
+	uint8_t          *head;
+	uint8_t          *tail;
+	int32_t           max;
+	
+} TS_WORK_BUFFER;
+
+typedef struct {
+
+	int32_t            phase;
+
+	int32_t            program_number;
+
+	int32_t            pmt_pid;
+	TS_SECTION_PARSER *pmt;
+
+	int32_t            pcr_pid;
+
+	TS_STREAM_LIST     streams;
+	TS_STREAM_LIST     old_strm;
+
+} TS_PROGRAM;
+
+typedef struct {
+
+	int32_t            ref;
+	int32_t            phase;
+
+	int32_t            locked;
+
+	int32_t            ecm_pid;
+	TS_SECTION_PARSER *ecm;
+
+	MULTI2            *m2;
+
+	int32_t            unpurchased;
+	int32_t            last_error;
+
+	void              *prev;
+	void              *next;
+
+} DECRYPTOR_ELEM;
+
+typedef struct {
+	DECRYPTOR_ELEM    *head;
+	DECRYPTOR_ELEM    *tail;
+	int32_t            count;
+} DECRYPTOR_LIST;
+
+typedef struct {
+	uint32_t           ref;
+	uint32_t           type;
+	int64_t            normal_packet;
+	int64_t            undecrypted;
+	void              *target;
+} PID_MAP;
+
+typedef struct {
+
+	int32_t            multi2_round;
+	int32_t            strip;
+	int32_t            emm_proc_on;
+	
+	int32_t            unit_size;
+
+	int32_t            sbuf_offset;
+
+	TS_SECTION_PARSER *pat;
+	TS_SECTION_PARSER *cat;
+
+	TS_STREAM_LIST     strm_pool;
+	
+	int32_t            p_count;
+	TS_PROGRAM        *program;
+
+	DECRYPTOR_LIST     decrypt;
+
+	PID_MAP            map[0x2000];
+
+	B_CAS_CARD        *bcas;
+	B_CAS_ID           casid;
+	int32_t            ca_system_id;
+
+	int32_t            emm_pid;
+	TS_SECTION_PARSER *emm;
+
+	TS_WORK_BUFFER     sbuf;
+	TS_WORK_BUFFER     dbuf;
+	
+} ARIB_STD_B25_PRIVATE_DATA;
+
+typedef struct {
+	int64_t            card_id;
+	int32_t            associated_information_length;
+	int32_t            protocol_number;
+	int32_t            broadcaster_group_id;
+	int32_t            update_number;
+	int32_t            expiration_date;
+} EMM_FIXED_PART;
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ constant values
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+enum TS_STREAM_TYPE {
+	TS_STREAM_TYPE_11172_2_VIDEO                = 0x01,
+	TS_STREAM_TYPE_13818_2_VIDEO                = 0x02,
+	TS_STREAM_TYPE_11172_3_AUDIO                = 0x03,
+	TS_STREAM_TYPE_13818_3_AUDIO                = 0x04,
+	TS_STREAM_TYPE_13818_1_PRIVATE_SECTIONS     = 0x05,
+	TS_STREAM_TYPE_13818_1_PES_PRIVATE_DATA     = 0x06,
+	TS_STREAM_TYPE_13522_MHEG                   = 0x07,
+	TS_STREAM_TYPE_13818_1_DSM_CC               = 0x08,
+	TS_STREAM_TYPE_H_222_1                      = 0x09,
+	TS_STREAM_TYPE_13818_6_TYPE_A               = 0x0a,
+	TS_STREAM_TYPE_13818_6_TYPE_B               = 0x0b,
+	TS_STREAM_TYPE_13818_6_TYPE_C               = 0x0c,
+	TS_STREAM_TYPE_13818_6_TYPE_D               = 0x0d,
+	TS_STREAM_TYPE_13818_1_AUX                  = 0x0e,
+	TS_STREAM_TYPE_13818_7_AUDIO_ADTS           = 0x0f,
+	TS_STREAM_TYPE_14496_2_VISUAL               = 0x10,
+	TS_STREAM_TYPE_14496_3_AUDIO_LATM           = 0x11,
+	TS_STREAM_TYPE_14496_1_PES_SL_PACKET        = 0x12,
+	TS_STREAM_TYPE_14496_1_SECTIONS_SL_PACKET   = 0x13,
+	TS_STREAM_TYPE_13818_6_SYNC_DWLOAD_PROTCOL  = 0x14,
+};
+
+enum TS_SECTION_ID {
+	TS_SECTION_ID_PROGRAM_ASSOCIATION           = 0x00,
+	TS_SECTION_ID_CONDITIONAL_ACCESS            = 0x01,
+	TS_SECTION_ID_PROGRAM_MAP                   = 0x02,
+	TS_SECTION_ID_DESCRIPTION                   = 0x03,
+	TS_SECTION_ID_14496_SCENE_DESCRIPTION       = 0x04,
+	TS_SECTION_ID_14496_OBJECT_DESCRIPTION      = 0x05,
+
+	/* ARIB STD-B10 stuff */
+	TS_SECTION_ID_DSM_CC_HEAD                   = 0x3a,
+	TS_SECTION_ID_DSM_CC_TAIL                   = 0x3f,
+	TS_SECTION_ID_NIT_ACTUAL                    = 0x40,
+	TS_SECTION_ID_NIT_OTHER                     = 0x41,
+	TS_SECTION_ID_SDT_ACTUAL                    = 0x42,
+	TS_SECTION_ID_SDT_OTHER                     = 0x46,
+	TS_SECTION_ID_BAT                           = 0x4a,
+	TS_SECTION_ID_EIT_ACTUAL_CURRENT            = 0x4e,
+	TS_SECTION_ID_EIT_OTHER_CURRENT             = 0x4f,
+	TS_SECTION_ID_EIT_ACTUAL_SCHEDULE_HEAD      = 0x50,
+	TS_SECTION_ID_EIT_ACTUAL_SCHEDULE_TAIL      = 0x5f,
+	TS_SECTION_ID_EIT_OTHER_SCHEDULE_HEAD       = 0x60,
+	TS_SECTION_ID_EIT_OTHER_SCHEDULE_TAIL       = 0x6f,
+	TS_SECTION_ID_TDT                           = 0x70,
+	TS_SECTION_ID_RST                           = 0x71,
+	TS_SECTION_ID_ST                            = 0x72,
+	TS_SECTION_ID_TOT                           = 0x73,
+	TS_SECTION_ID_AIT                           = 0x74,
+	TS_SECTION_ID_DIT                           = 0x7e,
+	TS_SECTION_ID_SIT                           = 0x7f,
+	TS_SECTION_ID_ECM_S                         = 0x82,
+	TS_SECTION_ID_ECM                           = 0x83,
+	TS_SECTION_ID_EMM_S                         = 0x84,
+	TS_SECTION_ID_EMM_MESSAGE                   = 0x85,
+	TS_SECTION_ID_DCT                           = 0xc0,
+	TS_SECTION_ID_DLT                           = 0xc1,
+	TS_SECTION_ID_PCAT                          = 0xc2,
+	TS_SECTION_ID_SDTT                          = 0xc3,
+	TS_SECTION_ID_BIT                           = 0xc4,
+	TS_SECTION_ID_NBIT_BODY                     = 0xc5,
+	TS_SECTION_ID_NBIT_REFERENCE                = 0xc6,
+	TS_SECTION_ID_LDT                           = 0xc7,
+	TS_SECTION_ID_CDT                           = 0xc8,
+	TS_SECTION_ID_LIT                           = 0xd0,
+	TS_SECTION_ID_ERT                           = 0xd1,
+	TS_SECTION_ID_ITT                           = 0xd2,
+};
+
+enum TS_DESCRIPTOR_TAG {
+	TS_DESCRIPTOR_TAG_VIDEO_STREAM              = 0x02,
+	TS_DESCRIPTOR_TAG_AUDIO_STREAM              = 0x03,
+	TS_DESCRIPTOR_TAG_HIERARCHY                 = 0x04,
+	TS_DESCRIPTOR_TAG_REGISTRATION              = 0x05,
+	TS_DESCRIPTOR_TAG_DATA_STREAM_ALIGNMENT     = 0x06,
+	TS_DESCRIPTOR_TAG_TARGET_BACKGROUND_GRID    = 0x07,
+	TS_DESCRIPTOR_TAG_VIDEO_WINDOW              = 0x08,
+	TS_DESCRIPTOR_TAG_CA                        = 0x09,
+	TS_DESCRIPTOR_TAG_ISO_639_LANGUAGE          = 0x0a,
+	TS_DESCRIPTOR_TAG_SYSTEM_CLOCK              = 0x0b,
+	TS_DESCRIPTOR_TAG_MULTIPLEX_BUF_UTILIZ      = 0x0c,
+	TS_DESCRIPTOR_TAG_COPYRIGHT                 = 0x0d,
+	TS_DESCRIPTOR_TAG_MAXIMUM_BITRATE           = 0x0e,
+	TS_DESCRIPTOR_TAG_PRIVATE_DATA_INDICATOR    = 0x0f,
+	TS_DESCRIPTOR_TAG_SMOOTHING_BUFFER          = 0x10,
+	TS_DESCRIPTOR_TAG_STD                       = 0x11,
+	TS_DESCRIPTOR_TAG_IBP                       = 0x12,
+	TS_DESCRIPTOR_TAG_MPEG4_VIDEO               = 0x1b,
+	TS_DESCRIPTOR_TAG_MPEG4_AUDIO               = 0x1c,
+	TS_DESCRIPTOR_TAG_IOD                       = 0x1d,
+	TS_DESCRIPTOR_TAG_SL                        = 0x1e,
+	TS_DESCRIPTOR_TAG_FMC                       = 0x1f,
+	TS_DESCRIPTOR_TAG_EXTERNAL_ES_ID            = 0x20,
+	TS_DESCRIPTOR_TAG_MUXCODE                   = 0x21,
+	TS_DESCRIPTOR_TAG_FMX_BUFFER_SIZE           = 0x22,
+	TS_DESCRIPTOR_TAG_MULTIPLEX_BUFFER          = 0x23,
+	TS_DESCRIPTOR_TAG_AVC_VIDEO                 = 0x28,
+	TS_DESCRIPTOR_TAG_AVC_TIMING_HRD            = 0x2a,
+
+	/* ARIB STD-B10 stuff */
+	TS_DESCRIPTOR_TAG_NETWORK_NAME              = 0x40,
+	TS_DESCRIPTOR_TAG_SERVICE_LIST              = 0x41,
+	TS_DESCRIPTOR_TAG_STUFFING                  = 0x42,
+	TS_DESCRIPTOR_TAG_SATELLITE_DELIVERY_SYS    = 0x43,
+	TS_DESCRIPTOR_TAG_CABLE_DISTRIBUTION        = 0x44,
+	TS_DESCRIPTOR_TAG_BOUNQUET_NAME             = 0x47,
+	TS_DESCRIPTOR_TAG_SERVICE                   = 0x48,
+	TS_DESCRIPTOR_TAG_COUNTRY_AVAILABILITY      = 0x49,
+	TS_DESCRIPTOR_TAG_LINKAGE                   = 0x4a,
+	TS_DESCRIPTOR_TAG_NVOD_REFERENCE            = 0x4b,
+	TS_DESCRIPTOR_TAG_TIME_SHIFTED_SERVICE      = 0x4c,
+	TS_DESCRIPTOR_TAG_SHORT_EVENT               = 0x4d,
+	TS_DESCRIPTOR_TAG_EXTENDED_EVENT            = 0x4e,
+	TS_DESCRIPTOR_TAG_TIME_SHIFTED_EVENT        = 0x4f,
+	TS_DESCRIPTOR_TAG_COMPONENT                 = 0x50,
+	TS_DESCRIPTOR_TAG_MOSAIC                    = 0x51,
+	TS_DESCRIPTOR_TAG_STREAM_IDENTIFIER         = 0x52,
+	TS_DESCRIPTOR_TAG_CA_IDENTIFIER             = 0x53,
+	TS_DESCRIPTOR_TAG_CONTENT                   = 0x54,
+	TS_DESCRIPTOR_TAG_PARENTAL_RATING           = 0x55,
+	TS_DESCRIPTOR_TAG_LOCAL_TIME_OFFSET         = 0x58,
+	TS_DESCRIPTOR_TAG_PARTIAL_TRANSPORT_STREAM  = 0x63,
+	TS_DESCRIPTOR_TAG_HIERARCHICAL_TRANSMISSION = 0xc0,
+	TS_DESCRIPTOR_TAG_DIGITAL_COPY_CONTROL      = 0xc1,
+	TS_DESCRIPTOR_TAG_NETWORK_IDENTIFICATION    = 0xc2,
+	TS_DESCRIPTOR_TAG_PARTIAL_TRANSPORT_TIME    = 0xc3,
+	TS_DESCRIPTOR_TAG_AUDIO_COMPONENT           = 0xc4,
+	TS_DESCRIPTOR_TAG_HYPERLINK                 = 0xc5,
+	TS_DESCRIPTOR_TAG_TARGET_REGION             = 0xc6,
+	TS_DESCRIPTOR_TAG_DATA_COTENT               = 0xc7,
+	TS_DESCRIPTOR_TAG_VIDEO_DECODE_CONTROL      = 0xc8,
+	TS_DESCRIPTOR_TAG_DOWNLOAD_CONTENT          = 0xc9,
+	TS_DESCRIPTOR_TAG_CA_EMM_TS                 = 0xca,
+	TS_DESCRIPTOR_TAG_CA_CONTRACT_INFORMATION   = 0xcb,
+	TS_DESCRIPTOR_TAG_CA_SERVICE                = 0xcc,
+	TS_DESCRIPTOR_TAG_TS_INFORMATION            = 0xcd,
+	TS_DESCRIPTOR_TAG_EXTENDED_BROADCASTER      = 0xce,
+	TS_DESCRIPTOR_TAG_LOGO_TRANSMISSION         = 0xcf,
+	TS_DESCRIPTOR_TAG_BASIC_LOCAL_EVENT         = 0xd0,
+	TS_DESCRIPTOR_TAG_REFERENCE                 = 0xd1,
+	TS_DESCRIPTOR_TAG_NODE_RELATION             = 0xd2,
+	TS_DESCRIPTOR_TAG_SHORT_NODE_INFORMATION    = 0xd3,
+	TS_DESCRIPTOR_TAG_STC_REFERENCE             = 0xd4,
+	TS_DESCRIPTOR_TAG_SERIES                    = 0xd5,
+	TS_DESCRIPTOR_TAG_EVENT_GROUP               = 0xd6,
+	TS_DESCRIPTOR_TAG_SI_PARAMETER              = 0xd7,
+	TS_DESCRIPTOR_TAG_BROADCASTER_NAME          = 0xd8,
+	TS_DESCRIPTOR_TAG_COMPONENT_GROUP           = 0xd9,
+	TS_DESCRIPTOR_TAG_SI_PRIME_TS               = 0xda,
+	TS_DESCRIPTOR_TAG_BOARD_INFORMATION         = 0xdb,
+	TS_DESCRIPTOR_TAG_LDT_LINKAGE               = 0xdc,
+	TS_DESCRIPTOR_TAG_CONNECTED_TRANSMISSION    = 0xdd,
+	TS_DESCRIPTOR_TAG_CONTENT_AVAILABILITY      = 0xde,
+	TS_DESCRIPTOR_TAG_VALUE_EXTENSION           = 0xdf,
+	TS_DESCRIPTOR_TAG_SERVICE_GROUP             = 0xe0,
+	TS_DESCRIPTOR_TAG_CARUSEL_COMPOSITE         = 0xf7,
+	TS_DESCRIPTOR_TAG_CONDITIONAL_PLAYBACK      = 0xf8,
+	TS_DESCRIPTOR_TAG_CABLE_TS_DIVISSION        = 0xf9,
+	TS_DESCRIPTOR_TAG_TERRESTRIAL_DELIVERY_SYS  = 0xfa,
+	TS_DESCRIPTOR_TAG_PARTIAL_RECEPTION         = 0xfb,
+	TS_DESCRIPTOR_TAG_EMERGENCY_INFOMATION      = 0xfc,
+	TS_DESCRIPTOR_TAG_DATA_COMPONENT            = 0xfd,
+	TS_DESCRIPTOR_TAG_SYSTEM_MANAGEMENT         = 0xfe,
+};
+
+enum PID_MAP_TYPE {
+	PID_MAP_TYPE_UNKNOWN                        = 0x0000,
+	PID_MAP_TYPE_PAT                            = 0x0100,
+	PID_MAP_TYPE_PMT                            = 0x0200,
+	PID_MAP_TYPE_NIT                            = 0x0300,
+	PID_MAP_TYPE_PCR                            = 0x0400,
+	PID_MAP_TYPE_ECM                            = 0x0500,
+	PID_MAP_TYPE_EMM                            = 0x0600,
+	PID_MAP_TYPE_EIT                            = 0x0700,
+	PID_MAP_TYPE_CAT                            = 0x0800,
+	PID_MAP_TYPE_OTHER                          = 0xff00,
+};
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ function prottypes (interface method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static void release_arib_std_b25(void *std_b25);
+static int set_multi2_round_arib_std_b25(void *std_b25, int32_t round);
+static int set_strip_arib_std_b25(void *std_b25, int32_t strip);
+static int set_emm_proc_arib_std_b25(void *std_b25, int32_t on);
+static int set_b_cas_card_arib_std_b25(void *std_b25, B_CAS_CARD *bcas);
+static int reset_arib_std_b25(void *std_b25);
+static int flush_arib_std_b25(void *std_b25);
+static int put_arib_std_b25(void *std_b25, ARIB_STD_B25_BUFFER *buf);
+static int get_arib_std_b25(void *std_b25, ARIB_STD_B25_BUFFER *buf);
+static int get_program_count_arib_std_b25(void *std_b25);
+static int get_program_info_arib_std_b25(void *std_b25, ARIB_STD_B25_PROGRAM_INFO *info, int idx);
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ global function implementation
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+ARIB_STD_B25 *create_arib_std_b25()
+{
+	int n;
+	
+	ARIB_STD_B25 *r;
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+
+	n  = sizeof(ARIB_STD_B25_PRIVATE_DATA);
+	n += sizeof(ARIB_STD_B25);
+	
+	prv = (ARIB_STD_B25_PRIVATE_DATA *)calloc(1, n);
+	if(prv == NULL){
+		return NULL;
+	}
+
+	prv->multi2_round = 4;
+
+	r = (ARIB_STD_B25 *)(prv+1);
+	r->private_data = prv;
+
+	r->release = release_arib_std_b25;
+	r->set_multi2_round = set_multi2_round_arib_std_b25;
+	r->set_strip = set_strip_arib_std_b25;
+	r->set_emm_proc = set_emm_proc_arib_std_b25;
+	r->set_b_cas_card = set_b_cas_card_arib_std_b25;
+	r->reset = reset_arib_std_b25;
+	r->flush = flush_arib_std_b25;
+	r->put = put_arib_std_b25;
+	r->get = get_arib_std_b25;
+	r->get_program_count = get_program_count_arib_std_b25;
+	r->get_program_info = get_program_info_arib_std_b25;
+
+	return r;
+}
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ function prottypes (private method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static ARIB_STD_B25_PRIVATE_DATA *private_data(void *std_b25);
+static void teardown(ARIB_STD_B25_PRIVATE_DATA *prv);
+static int select_unit_size(ARIB_STD_B25_PRIVATE_DATA *prv);
+static int find_pat(ARIB_STD_B25_PRIVATE_DATA *prv);
+static int proc_pat(ARIB_STD_B25_PRIVATE_DATA *prv);
+static int check_pmt_complete(ARIB_STD_B25_PRIVATE_DATA *prv);
+static int find_pmt(ARIB_STD_B25_PRIVATE_DATA *prv);
+static int proc_pmt(ARIB_STD_B25_PRIVATE_DATA *prv, TS_PROGRAM *pgrm);
+static int32_t find_ca_descriptor_pid(uint8_t *head, uint8_t *tail, int32_t ca_system_id);
+static int32_t add_ecm_stream(ARIB_STD_B25_PRIVATE_DATA *prv, TS_STREAM_LIST *list, int32_t ecm_pid);
+static int check_ecm_complete(ARIB_STD_B25_PRIVATE_DATA *prv);
+static int find_ecm(ARIB_STD_B25_PRIVATE_DATA *prv);
+static int proc_ecm(DECRYPTOR_ELEM *dec, B_CAS_CARD *bcas, int32_t multi2_round);
+static int proc_arib_std_b25(ARIB_STD_B25_PRIVATE_DATA *prv);
+
+static int proc_cat(ARIB_STD_B25_PRIVATE_DATA *prv);
+static int proc_emm(ARIB_STD_B25_PRIVATE_DATA *prv);
+
+static void release_program(ARIB_STD_B25_PRIVATE_DATA *prv, TS_PROGRAM *pgrm);
+
+static void unref_stream(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid);
+
+static DECRYPTOR_ELEM *set_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid);
+static void remove_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, DECRYPTOR_ELEM *dec);
+static DECRYPTOR_ELEM *select_active_decryptor(DECRYPTOR_ELEM *a, DECRYPTOR_ELEM *b, int32_t pid);
+static void bind_stream_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid, DECRYPTOR_ELEM *dec);
+static void unlock_all_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv);
+
+static TS_STREAM_ELEM *get_stream_list_head(TS_STREAM_LIST *list);
+static TS_STREAM_ELEM *find_stream_list_elem(TS_STREAM_LIST *list, int32_t pid);
+static TS_STREAM_ELEM *create_stream_elem(int32_t pid, int32_t type);
+static void put_stream_list_tail(TS_STREAM_LIST *list, TS_STREAM_ELEM *elem);
+static void clear_stream_list(TS_STREAM_LIST *list);
+
+static int reserve_work_buffer(TS_WORK_BUFFER *buf, int32_t size);
+static int append_work_buffer(TS_WORK_BUFFER *buf, uint8_t *data, int32_t size);
+static void reset_work_buffer(TS_WORK_BUFFER *buf);
+static void release_work_buffer(TS_WORK_BUFFER *buf);
+
+static void extract_ts_header(TS_HEADER *dst, uint8_t *src);
+static void extract_emm_fixed_part(EMM_FIXED_PART *dst, uint8_t *src);
+
+static uint8_t *resync(uint8_t *head, uint8_t *tail, int32_t unit);
+static uint8_t *resync_force(uint8_t *head, uint8_t *tail, int32_t unit);
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ interface method implementation
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static void release_arib_std_b25(void *std_b25)
+{
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+
+	prv = private_data(std_b25);
+	if(prv == NULL){
+		return;
+	}
+
+	teardown(prv);
+	free(prv);
+}
+
+static int set_multi2_round_arib_std_b25(void *std_b25, int32_t round)
+{
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+
+	prv = private_data(std_b25);
+	if(prv == NULL){
+		return ARIB_STD_B25_ERROR_INVALID_PARAM;
+	}
+
+	prv->multi2_round = round;
+
+	return 0;
+}
+
+static int set_strip_arib_std_b25(void *std_b25, int32_t strip)
+{
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+
+	prv = private_data(std_b25);
+	if(prv == NULL){
+		return ARIB_STD_B25_ERROR_INVALID_PARAM;
+	}
+
+	prv->strip = strip;
+
+	return 0;
+}
+
+static int set_emm_proc_arib_std_b25(void *std_b25, int32_t on)
+{
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+
+	prv = private_data(std_b25);
+	if(prv == NULL){
+		return ARIB_STD_B25_ERROR_INVALID_PARAM;
+	}
+
+	prv->emm_proc_on = on;
+
+	return 0;
+}
+
+static int set_b_cas_card_arib_std_b25(void *std_b25, B_CAS_CARD *bcas)
+{
+	int n;
+	B_CAS_INIT_STATUS is;
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+
+	prv = private_data(std_b25);
+	if(prv == NULL){
+		return ARIB_STD_B25_ERROR_INVALID_PARAM;
+	}
+
+	prv->bcas = bcas;
+	if(prv->bcas != NULL){
+		n = prv->bcas->get_init_status(bcas, &is);
+		if(n < 0){
+			return ARIB_STD_B25_ERROR_INVALID_B_CAS_STATUS;
+		}
+		prv->ca_system_id = is.ca_system_id;
+		n = prv->bcas->get_id(prv->bcas, &(prv->casid));
+		if(n < 0){
+			return ARIB_STD_B25_ERROR_INVALID_B_CAS_STATUS;
+		}
+	}
+
+	return 0;
+}
+
+static int reset_arib_std_b25(void *std_b25)
+{
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+
+	prv = private_data(std_b25);
+	if(prv == NULL){
+		return ARIB_STD_B25_ERROR_INVALID_PARAM;
+	}
+
+	teardown(prv);
+
+	return 0;
+}
+
+static int flush_arib_std_b25(void *std_b25)
+{
+	int r;
+	int m,n;
+
+	int32_t crypt;
+	int32_t unit;
+	int32_t pid;
+
+	uint8_t *p;
+	uint8_t *curr;
+	uint8_t *tail;
+
+	TS_HEADER hdr;
+	DECRYPTOR_ELEM *dec;
+	TS_PROGRAM *pgrm;
+
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+
+	prv = private_data(std_b25);
+	if(prv == NULL){
+		return ARIB_STD_B25_ERROR_INVALID_PARAM;
+	}
+
+	if(prv->unit_size < 188){
+		r = select_unit_size(prv);
+		if(r < 0){
+			return r;
+		}
+	}
+
+	r = proc_arib_std_b25(prv);
+	if(r < 0){
+		return r;
+	}
+
+	unit = prv->unit_size;
+	curr = prv->sbuf.head;
+	tail = prv->sbuf.tail;
+
+	m = prv->dbuf.tail - prv->dbuf.head;
+	n = tail - curr;
+	if(!reserve_work_buffer(&(prv->dbuf), m+n)){
+		return ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+	}
+
+	r = 0;
+
+	while( (curr+188) <= tail ){
+		
+		if(curr[0] != 0x47){
+			p = resync_force(curr, tail, unit);
+			if(p == NULL){
+				goto LAST;
+			}
+			curr = p;
+		}
+		
+		extract_ts_header(&hdr, curr);
+		crypt = hdr.transport_scrambling_control;
+		pid = hdr.pid;
+		
+		if( (pid == 0x1fff) && (prv->strip) ){
+			goto NEXT;
+		}
+		
+		p = curr+4;
+		if(hdr.adaptation_field_control & 0x02){
+			p += (p[0]+1);
+		}
+		n = 188 - (p-curr);
+		if( (n < 1) && ((n < 0) || (hdr.adaptation_field_control & 0x01)) ){
+			/* broken packet */
+			curr += 1;
+			continue;
+		}
+
+		if( (crypt != 0) &&
+		    (hdr.adaptation_field_control & 0x01) ){
+			
+			if(prv->map[pid].type == PID_MAP_TYPE_OTHER){
+				dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
+			}else{
+				dec = NULL;
+			}
+
+			if( (dec != NULL) && (dec->m2 != NULL) ){
+				m = dec->m2->decrypt(dec->m2, crypt, p, n);
+				if(m < 0){
+					r = ARIB_STD_B25_ERROR_DECRYPT_FAILURE;
+					goto LAST;
+				}
+				curr[3] &= 0x3f;
+				prv->map[pid].normal_packet += 1;
+			}else{
+				prv->map[pid].undecrypted += 1;
+			}
+		}else{
+			prv->map[pid].normal_packet += 1;
+		}
+
+		if(!append_work_buffer(&(prv->dbuf), curr, 188)){
+			r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+			goto LAST;
+		}
+
+		if(prv->map[pid].type == PID_MAP_TYPE_ECM){
+			dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
+			if( (dec == NULL) || (dec->ecm == NULL) ){
+				/* this code will never execute */
+				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = dec->ecm->put(dec->ecm, &hdr, p, n);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = dec->ecm->get_count(dec->ecm);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+				goto LAST;
+			}
+			if(m == 0){
+				goto NEXT;
+			}
+			r = proc_ecm(dec, prv->bcas, prv->multi2_round);
+			if(r < 0){
+				goto LAST;
+			}
+		}else if(prv->map[pid].type == PID_MAP_TYPE_PMT){
+			pgrm = (TS_PROGRAM *)(prv->map[pid].target);
+			if( (pgrm == NULL) || (pgrm->pmt == NULL) ){
+				/* this code will never execute */
+				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = pgrm->pmt->put(pgrm->pmt, &hdr, p, n);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = pgrm->pmt->get_count(pgrm->pmt);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+				goto LAST;
+			}
+			if(m == 0){
+				goto NEXT;
+			}
+			r = proc_pmt(prv, pgrm);
+			if(r < 0){
+				goto LAST;
+			}
+		}else if(prv->map[pid].type == PID_MAP_TYPE_EMM){
+			if( prv->emm_proc_on == 0){
+				goto NEXT;
+			}
+			if( prv->emm == NULL ){
+				prv->emm = create_ts_section_parser();
+				if(prv->emm == NULL){
+					r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
+					goto LAST;
+				}
+			}
+			m = prv->emm->put(prv->emm, &hdr, p, n);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = prv->emm->get_count(prv->emm);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
+				goto LAST;
+			}
+			if(m == 0){
+				goto NEXT;
+			}
+			r = proc_emm(prv);
+			if(r < 0){
+				goto LAST;
+			}
+		}else if(pid == 0x0001){
+			if( prv->cat == NULL ){
+				prv->cat = create_ts_section_parser();
+				if(prv->cat == NULL){
+					r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+					goto LAST;
+				}
+			}
+			m = prv->cat->put(prv->cat, &hdr, p, n);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = prv->cat->get_count(prv->cat);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
+				goto LAST;
+			}
+			if(m == 0){
+				goto NEXT;
+			}
+			r = proc_cat(prv);
+			if(r < 0){
+				goto LAST;
+			}
+		}else if(pid == 0x0000){
+			if( prv->pat == NULL ){
+				prv->pat = create_ts_section_parser();
+				if(prv->pat == NULL){
+					r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+					goto LAST;
+				}
+			}
+			m = prv->pat->put(prv->pat, &hdr, p, n);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = prv->pat->get_count(prv->pat);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
+				goto LAST;
+			}
+			if(m == 0){
+				goto NEXT;
+			}
+			r = proc_pat(prv);
+			if(r < 0){
+				goto LAST;
+			}
+		}
+			
+	NEXT:
+		curr += unit;
+	}
+
+LAST:
+	
+	m = curr - prv->sbuf.head;
+	n = tail - curr;
+	if( (n < 1024) || (m > (prv->sbuf.max/2) ) ){
+		p = prv->sbuf.pool;
+		memcpy(p, curr, n);
+		prv->sbuf.head = p;
+		prv->sbuf.tail = p+n;
+	}else{
+		prv->sbuf.head = curr;
+	}
+
+	return r;
+}
+
+static int put_arib_std_b25(void *std_b25, ARIB_STD_B25_BUFFER *buf)
+{
+	int32_t n;
+	
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+
+	prv = private_data(std_b25);
+	if( (prv == NULL) || (buf == NULL) ){
+		return ARIB_STD_B25_ERROR_INVALID_PARAM;
+	}
+
+	if(!append_work_buffer(&(prv->sbuf), buf->data, buf->size)){
+		return ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+	}
+
+	if(prv->unit_size < 188){
+		n = select_unit_size(prv);
+		if(n < 0){
+			return n;
+		}
+		if(prv->unit_size < 188){
+			/* need more data */
+			return 0;
+		}
+	}
+
+	if(prv->p_count < 1){
+		n = find_pat(prv);
+		if(n < 0){
+			return n;
+		}
+		if(prv->p_count < 1){
+			if(prv->sbuf_offset < (16*1024*1024)){
+				/* need more data */
+				return 0;
+			}else{
+				/* exceed sbuf limit */
+				return ARIB_STD_B25_ERROR_NO_PAT_IN_HEAD_16M;
+			}
+		}
+		prv->sbuf_offset = 0;
+	}
+
+	if(!check_pmt_complete(prv)){
+		n = find_pmt(prv);
+		if(n < 0){
+			return n;
+		}
+		if(!check_pmt_complete(prv)){
+			if(prv->sbuf_offset < (32*1024*1024)){
+				/* need more data */
+				return 0;
+			}else{
+				/* exceed sbuf limit */
+				return ARIB_STD_B25_ERROR_NO_PMT_IN_HEAD_32M;
+			}
+		}
+		prv->sbuf_offset = 0;
+	}
+
+	if(!check_ecm_complete(prv)){
+		n = find_ecm(prv);
+		if(n < 0){
+			return n;
+		}
+		if(!check_ecm_complete(prv)){
+			if(prv->sbuf_offset < (32*1024*1024)){
+				/* need more data */
+				return 0;
+			}else{
+				/* exceed sbuf limit */
+				return ARIB_STD_B25_ERROR_NO_ECM_IN_HEAD_32M;
+			}
+		}
+		prv->sbuf_offset = 0;
+	}
+
+	return proc_arib_std_b25(prv);
+}
+
+static int get_arib_std_b25(void *std_b25, ARIB_STD_B25_BUFFER *buf)
+{
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+	prv = private_data(std_b25);
+	if( (prv == NULL) || (buf == NULL) ){
+		return ARIB_STD_B25_ERROR_INVALID_PARAM;
+	}
+
+	buf->data = prv->dbuf.head;
+	buf->size = prv->dbuf.tail - prv->dbuf.head;
+
+	reset_work_buffer(&(prv->dbuf));
+
+	return 0;
+}
+
+static int get_program_count_arib_std_b25(void *std_b25)
+{
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+	
+	prv = private_data(std_b25);
+	if(prv == NULL){
+		return ARIB_STD_B25_ERROR_INVALID_PARAM;
+	}
+
+	return prv->p_count;
+}
+
+static int get_program_info_arib_std_b25(void *std_b25, ARIB_STD_B25_PROGRAM_INFO *info, int idx)
+{
+	ARIB_STD_B25_PRIVATE_DATA *prv;
+
+	TS_PROGRAM *pgrm;
+	
+	TS_STREAM_ELEM *strm;
+	DECRYPTOR_ELEM *dec;
+
+	int32_t pid;
+	
+	prv = private_data(std_b25);
+	if( (prv == NULL) || (info == NULL) || (idx < 0) || (idx >= prv->p_count) ){
+		return ARIB_STD_B25_ERROR_INVALID_PARAM;
+	}
+
+	pgrm = prv->program + idx;
+
+	memset(info, 0, sizeof(ARIB_STD_B25_PROGRAM_INFO));
+
+	info->program_number = pgrm->program_number;
+	
+	pid = pgrm->pmt_pid;
+	info->total_packet_count += prv->map[pid].normal_packet;
+	info->total_packet_count += prv->map[pid].undecrypted;
+	info->undecrypted_packet_count += prv->map[pid].undecrypted;
+
+	pid = pgrm->pcr_pid;
+	if( (pid != 0) && (pid != 0x1fff) ){
+		info->total_packet_count += prv->map[pid].normal_packet;
+		info->total_packet_count += prv->map[pid].undecrypted;
+		info->undecrypted_packet_count += prv->map[pid].undecrypted;
+	}
+
+	strm = pgrm->streams.head;
+	while(strm != NULL){
+		pid = strm->pid;
+		if(prv->map[pid].type == PID_MAP_TYPE_ECM){
+			dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
+			info->ecm_unpurchased_count += dec->unpurchased;
+			info->last_ecm_error_code = dec->last_error;
+		}
+		info->total_packet_count += prv->map[pid].normal_packet;
+		info->total_packet_count += prv->map[pid].undecrypted;
+		info->undecrypted_packet_count += prv->map[pid].undecrypted;
+		strm = (TS_STREAM_ELEM *)(strm->next);
+	}
+
+	return 0;
+}
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ private method implementation
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static ARIB_STD_B25_PRIVATE_DATA *private_data(void *std_b25)
+{
+	ARIB_STD_B25 *p;
+	ARIB_STD_B25_PRIVATE_DATA *r;
+
+	p = (ARIB_STD_B25 *)std_b25;
+	if(p == NULL){
+		return NULL;
+	}
+
+	r = (ARIB_STD_B25_PRIVATE_DATA *)p->private_data;
+	if( ((void *)(r+1)) != ((void *)p) ){
+		return NULL;
+	}
+
+	return r; 
+}
+
+static void teardown(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int i;
+	
+	prv->unit_size = 0;
+	prv->sbuf_offset = 0;
+
+	if(prv->pat != NULL){
+		prv->pat->release(prv->pat);
+		prv->pat = NULL;
+	}
+	if(prv->cat != NULL){
+		prv->cat->release(prv->cat);
+		prv->cat = NULL;
+	}
+
+	if(prv->program != NULL){
+		for(i=0;i<prv->p_count;i++){
+			release_program(prv, prv->program+i);
+		}
+		free(prv->program);
+		prv->program = NULL;
+	}
+	prv->p_count = 0;
+
+	clear_stream_list(&(prv->strm_pool));
+
+	while(prv->decrypt.head != NULL){
+		remove_decryptor(prv, prv->decrypt.head);
+	}
+
+	memset(prv->map, 0, sizeof(prv->map));
+
+	prv->emm_pid = 0;
+	if(prv->emm != NULL){
+		prv->emm->release(prv->emm);
+		prv->emm = NULL;
+	}
+
+	release_work_buffer(&(prv->sbuf));
+	release_work_buffer(&(prv->dbuf));
+}
+
+static int select_unit_size(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int i;
+	int m,n,w;
+	int count[320-188];
+
+	unsigned char *head;
+	unsigned char *buf;
+	unsigned char *tail;
+
+	head = prv->sbuf.head;
+	tail = prv->sbuf.tail;
+
+	buf = head;
+	memset(count, 0, sizeof(count));
+
+	// 1st step, count up 0x47 interval
+	while( (buf+188) < tail ){
+		if(buf[0] != 0x47){
+			buf += 1;
+			continue;
+		}
+		m = 320;
+		if( buf+m > tail ){
+			m = tail-buf;
+		}
+		for(i=188;i<m;i++){
+			if(buf[i] == 0x47){
+				count[i-188] += 1;
+			}
+		}
+		buf += 1;
+	}
+
+	// 2nd step, select maximum appeared interval
+	m = 0;
+	n = 0;
+	for(i=188;i<320;i++){
+		if(m < count[i-188]){
+			m = count[i-188];
+			n = i;
+		}
+	}
+
+	// 3rd step, verify unit_size
+	w = m*n;
+	if( (m < 8) || ((w+3*n) < (tail-head)) ){
+		return ARIB_STD_B25_ERROR_NON_TS_INPUT_STREAM;
+	}
+
+	prv->unit_size = n;
+
+	return 0;
+}
+
+static int find_pat(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int r;
+	int n,size;
+	
+	int32_t unit;
+
+	uint8_t *p;
+	uint8_t *curr;
+	uint8_t *tail;
+
+	TS_HEADER hdr;
+
+	r = 0;
+	unit = prv->unit_size;
+	curr = prv->sbuf.head + prv->sbuf_offset;
+	tail = prv->sbuf.tail;
+
+	while( (curr+unit) < tail ){
+		if( (curr[0] != 0x47) || (curr[unit] != 0x47) ){
+			p = resync(curr, tail, unit);
+			if(p == NULL){
+				goto LAST;
+			}
+			curr = p;
+		}
+		extract_ts_header(&hdr, curr);
+		if(hdr.pid == 0x0000){
+			
+			p = curr+4;
+			if(hdr.adaptation_field_control & 0x02){
+				p += (p[0]+1);
+			}
+			size = 188 - (p-curr);
+			if(size < 1){
+				goto NEXT;
+			}
+			
+			if(prv->pat == NULL){
+				prv->pat = create_ts_section_parser();
+				if(prv->pat == NULL){
+					return ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+				}
+			}
+			
+			n = prv->pat->put(prv->pat, &hdr, p, size);
+			if(n < 0){
+				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
+				curr += unit;
+				goto LAST;
+			}
+			n = prv->pat->get_count(prv->pat);
+			if(n < 0){
+				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
+				curr += unit;
+				goto LAST;
+			}
+			if(n > 0){
+				curr += unit;
+				goto LAST;
+			}
+		}
+	NEXT:
+		curr += unit;
+	}
+
+LAST:
+	prv->sbuf_offset = curr - prv->sbuf.head;
+
+	if( (prv->pat != NULL) && (prv->pat->get_count(prv->pat) > 0) ){
+		r = proc_pat(prv);
+	}
+
+	return r;
+}
+
+static int proc_pat(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int r;
+	int i,n;
+	int len;
+	int count;
+	
+	int32_t program_number;
+	int32_t pid;
+
+	uint8_t *head;
+	uint8_t *tail;
+	
+	TS_PROGRAM *work;
+	TS_SECTION  sect;
+
+	r = 0;
+	memset(&sect, 0, sizeof(sect));
+
+	n = prv->pat->get(prv->pat, &sect);
+	if(n < 0){
+		r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
+		goto LAST;
+	}
+
+	if(sect.hdr.table_id != TS_SECTION_ID_PROGRAM_ASSOCIATION){
+		r = ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH;
+		goto LAST;
+	}
+
+	len = (sect.tail - sect.data) - 4;
+
+	count = len / 4;
+	work = (TS_PROGRAM *)calloc(count, sizeof(TS_PROGRAM));
+	if(work == NULL){
+		r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+		goto LAST;
+	}
+	
+	if(prv->program != NULL){
+		for(i=0;i<prv->p_count;i++){
+			release_program(prv, prv->program+i);
+		}
+		free(prv->program);
+		prv->program = NULL;
+	}
+	prv->p_count = 0;
+	memset(&(prv->map), 0, sizeof(prv->map));
+
+	head = sect.data;
+	tail = sect.tail-4;
+
+	i = 0;
+	while( (head+4) <= tail ){
+		program_number = ((head[0] << 8) | head[1]);
+		pid = ((head[2] << 8) | head[3]) & 0x1fff;
+		if(program_number != 0){
+			work[i].program_number = program_number;
+			work[i].pmt_pid = pid;
+			work[i].pmt = create_ts_section_parser();
+			if(work[i].pmt == NULL){
+				r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+				break;
+			}
+			prv->map[pid].type = PID_MAP_TYPE_PMT;
+			prv->map[pid].target = work+i;
+			i += 1;
+		}
+		head += 4;
+	}
+
+	prv->program = work;
+	prv->p_count = i;
+	
+	prv->map[0x0000].ref = 1;
+	prv->map[0x0000].type = PID_MAP_TYPE_PAT;
+	prv->map[0x0000].target = NULL;
+
+LAST:
+	if(sect.raw != NULL){
+		n = prv->pat->ret(prv->pat, &sect);
+		if( (n < 0) && (r == 0) ){
+			r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
+		}
+	}
+
+	return r;
+}
+
+static int check_pmt_complete(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int i,n;
+	int num[3];
+
+	memset(num, 0, sizeof(num));
+
+	for(i=0;i<prv->p_count;i++){
+		n = prv->program[i].phase;
+		if(n < 0){
+			n = 0;
+		}else if(n > 2){
+			n = 2;
+		}
+		num[n] += 1;
+	}
+
+	if(num[2] > 0){
+		return 1;
+	}
+
+	if(num[0] > 0){
+		return 0;
+	}
+
+	return 1;
+}
+
+static int find_pmt(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int r;
+	int n,size;
+	
+	int32_t unit;
+
+	uint8_t *p;
+	uint8_t *curr;
+	uint8_t *tail;
+
+	TS_HEADER hdr;
+	TS_PROGRAM *pgrm;
+
+	r = 0;
+	unit = prv->unit_size;
+	curr = prv->sbuf.head + prv->sbuf_offset;
+	tail = prv->sbuf.tail;
+
+	while( (curr+unit) < tail ){
+		
+		if( (curr[0] != 0x47) || (curr[unit] != 0x47) ){
+			p = resync(curr, tail, unit);
+			if(p == NULL){
+				goto LAST;
+			}
+			curr = p;
+		}
+		
+		extract_ts_header(&hdr, curr);
+		
+		if(prv->map[hdr.pid].type != PID_MAP_TYPE_PMT){
+			goto NEXT;
+		}
+		pgrm = (TS_PROGRAM *)(prv->map[hdr.pid].target);
+		if(pgrm == NULL){
+			goto NEXT;
+		}
+		
+		if(pgrm->phase == 0){
+			
+			p = curr + 4;
+			if(hdr.adaptation_field_control & 0x02){
+				p += (p[0]+1);
+			}
+			size = 188 - (p-curr);
+			if(size < 1){
+				goto NEXT;
+			}
+			
+			if(pgrm->pmt == NULL){
+				/* this code will never execute */
+				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+				curr += unit;
+				goto LAST;
+			}
+			
+			n = pgrm->pmt->put(pgrm->pmt, &hdr, p, size);
+			if(n < 0){
+				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+				curr += unit;
+				goto LAST;
+			}
+			n = pgrm->pmt->get_count(pgrm->pmt);
+			if(n < 0){
+				r =ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+				curr += unit;
+				goto LAST;
+			}
+			if(n == 0){
+				goto NEXT;
+			}
+			r = proc_pmt(prv, pgrm);
+			if(r < 0){
+				curr += unit;
+				goto LAST;
+			}
+			if(r > 0){
+				/* broken or unexpected section data */
+				goto NEXT;
+			}
+			pgrm->phase = 1;
+			if(check_pmt_complete(prv)){
+				curr += unit;
+				goto LAST;
+			}
+		}else{
+			pgrm->phase = 2;
+			curr += unit;
+			goto LAST;
+		}
+		
+	NEXT:
+		curr += unit;
+	}
+
+LAST:
+	prv->sbuf_offset = curr - prv->sbuf.head;
+
+	return r;
+}
+
+static int proc_pmt(ARIB_STD_B25_PRIVATE_DATA *prv, TS_PROGRAM *pgrm)
+{
+	int r;
+
+	int n;
+	int length;
+
+	uint8_t *head;
+	uint8_t *tail;
+
+	int32_t ecm_pid;
+	int32_t pid;
+	int32_t type;
+
+	TS_SECTION sect;
+	
+	DECRYPTOR_ELEM *dec[2];
+	DECRYPTOR_ELEM *dw;
+	
+	TS_STREAM_ELEM *strm;
+
+	r = 0;
+	dec[0] = NULL;
+	memset(&sect, 0, sizeof(sect));
+
+	n = pgrm->pmt->get(pgrm->pmt, &sect);
+	if(n < 0){
+		r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+		goto LAST;
+	}
+	if(sect.hdr.table_id != TS_SECTION_ID_PROGRAM_MAP){
+		r = ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH;
+		goto LAST;
+	}
+	
+	head = sect.data;
+	tail = sect.tail-4;
+
+	pgrm->pcr_pid = ((head[0] << 8) | head[1]) & 0x1fff;
+	length = ((head[2] << 8) | head[3]) & 0x0fff;
+	head += 4;
+	if(head+length > tail){
+		r = ARIB_STD_B25_WARN_BROKEN_TS_SECTION;
+		goto LAST;
+	}
+
+	/* find major ecm_pid and regist decryptor */
+	ecm_pid = find_ca_descriptor_pid(head, head+length, prv->ca_system_id);
+	if( (ecm_pid != 0) && (ecm_pid != 0x1fff) ){
+		dec[0] = set_decryptor(prv, ecm_pid);
+		if(dec[0] == NULL){
+			r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+			goto LAST;
+		}
+		dec[0]->ref += 1;
+	}
+	head += length;
+	
+	/* unref old stream entries */
+	while( (strm = get_stream_list_head(&(pgrm->old_strm))) != NULL ){
+		unref_stream(prv, strm->pid);
+		memset(strm, 0, sizeof(TS_STREAM_ELEM));
+		put_stream_list_tail(&(prv->strm_pool), strm);
+	}
+
+	/* save current streams */
+	memcpy(&(pgrm->old_strm), &(pgrm->streams), sizeof(TS_STREAM_LIST));
+	memset(&(pgrm->streams), 0, sizeof(TS_STREAM_LIST));
+
+	/* add current stream entries */
+	if( (ecm_pid != 0) && (ecm_pid != 0x1fff) ){
+		if(!add_ecm_stream(prv, &(pgrm->streams), ecm_pid)){
+			r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+			goto LAST;
+		}
+	}
+
+	while( head+4 < tail ){
+
+		type = head[0];
+		pid = ((head[1] << 8) | head[2]) & 0x1fff;
+		length = ((head[3] << 8) | head[4]) & 0x0fff;
+		head += 5;
+		ecm_pid = find_ca_descriptor_pid(head, head+length, prv->ca_system_id);
+		head += length;
+		
+		if( (ecm_pid != 0) && (ecm_pid != 0x1fff) ){
+			dec[1] = set_decryptor(prv, ecm_pid);
+			if(dec[1] == NULL){
+				r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+				goto LAST;
+			}
+			if(!add_ecm_stream(prv, &(pgrm->streams), ecm_pid)){
+				r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+				goto LAST;
+			}
+		}else{
+			dec[1] = NULL;
+		}
+
+		strm = get_stream_list_head(&(prv->strm_pool));
+		if( strm == NULL ){
+			strm = create_stream_elem(pid, type);
+			if(strm == NULL){
+				r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+				goto LAST;
+			}
+		}else{
+			strm->pid = pid;
+			strm->type = type;
+		}
+		
+		prv->map[pid].type = PID_MAP_TYPE_OTHER;
+		prv->map[pid].ref += 1;
+
+		dw = select_active_decryptor(dec[0], dec[1], ecm_pid);
+		bind_stream_decryptor(prv, pid, dw);
+		
+		put_stream_list_tail(&(pgrm->streams), strm);
+	}
+	
+LAST:
+	if( dec[0] != NULL ){
+		dec[0]->ref -= 1;
+		if( dec[0]->ref < 1 ){
+			remove_decryptor(prv, dec[0]);
+			dec[0] = NULL;
+		}
+	}
+
+	if(sect.raw != NULL){
+		n = pgrm->pmt->ret(pgrm->pmt, &sect);
+		if( (n < 0) && (r == 0) ){
+			return ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+		}
+	}
+
+	return 0;
+}
+		
+static int32_t find_ca_descriptor_pid(uint8_t *head, uint8_t *tail, int32_t ca_system_id)
+{
+	uint32_t ca_pid;
+	uint32_t ca_sys_id;
+	
+	uint32_t tag;
+	uint32_t len;
+
+	while(head+1 < tail){
+		tag = head[0];
+		len = head[1];
+		head += 2;
+		if( (tag == 0x09) && /* CA_descriptor */
+		    (len >= 4) &&
+		    (head+len <= tail) ){
+			ca_sys_id = ((head[0] << 8) | head[1]);
+			ca_pid = ((head[2] << 8) | head[3]) & 0x1fff;
+			if(ca_sys_id == ca_system_id){
+				return ca_pid;
+			}
+		}
+		head += len;
+	}
+
+	return 0;
+}
+
+static int add_ecm_stream(ARIB_STD_B25_PRIVATE_DATA *prv, TS_STREAM_LIST *list, int32_t ecm_pid)
+{
+	TS_STREAM_ELEM *strm;
+
+	strm = find_stream_list_elem(list, ecm_pid);
+	if(strm != NULL){
+		// ECM is already registered
+		return 1;
+	}
+
+	strm = get_stream_list_head(&(prv->strm_pool));
+	if(strm == NULL){
+		strm = create_stream_elem(ecm_pid, PID_MAP_TYPE_ECM);
+		if(strm == NULL){
+			return 0;
+		}
+	}else{
+		strm->pid = ecm_pid;
+		strm->type = PID_MAP_TYPE_ECM;
+	}
+
+	put_stream_list_tail(list, strm);
+	prv->map[ecm_pid].ref += 1;
+
+	return 1;
+}
+
+static int check_ecm_complete(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int n,num[3];
+	DECRYPTOR_ELEM *e;
+
+	memset(num, 0, sizeof(num));
+
+	e = prv->decrypt.head;
+	while( e != NULL ){
+		n = e->phase;
+		if(n < 0){
+			n = 0;
+		}else if(n > 2){
+			n = 2;
+		}
+		num[n] += 1;
+		e = (DECRYPTOR_ELEM *)(e->next);
+	}
+
+	if(num[2] > 0){
+		return 1;
+	}
+
+	if(num[0] > 0){
+		return 0;
+	}
+
+	return 1;
+}
+
+static int find_ecm(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int r;
+	int n,size;
+
+	int32_t unit;
+
+	uint8_t *p;
+	uint8_t *curr;
+	uint8_t *tail;
+
+	TS_HEADER hdr;
+	DECRYPTOR_ELEM *dec;
+
+	r = 0;
+	unit = prv->unit_size;
+	curr = prv->sbuf.head + prv->sbuf_offset;
+	tail = prv->sbuf.tail;
+
+	while( (curr+unit) < tail ){
+		if( (curr[0] != 0x47) || (curr[unit] != 0x47) ){
+			p = resync(curr, tail, unit);
+			if(p == NULL){
+				goto LAST;
+			}
+			curr = p;
+		}
+		extract_ts_header(&hdr, curr);
+		if(prv->map[hdr.pid].type != PID_MAP_TYPE_ECM){
+			goto NEXT;
+		}
+		dec = (DECRYPTOR_ELEM *)(prv->map[hdr.pid].target);
+		if(dec == NULL){
+			goto NEXT;
+		}
+
+		if(dec->phase == 0){
+			
+			p = curr + 4;
+			if(hdr.adaptation_field_control & 0x02){
+				p += (p[0]+1);
+			}
+			size = 188 - (p-curr);
+			if(size < 1){
+				goto NEXT;
+			}
+			
+			if(dec->ecm == NULL){
+				/*  this code will never execute */
+				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+				curr += unit;
+				goto LAST;
+			}
+				
+			n = dec->ecm->put(dec->ecm, &hdr, p, size);
+			if(n < 0){
+				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+				curr += unit;
+				goto LAST;
+			}
+			n = dec->ecm->get_count(dec->ecm);
+			if(n < 0){
+				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+				curr += unit;
+				goto LAST;
+			}
+			if(n == 0){
+				goto NEXT;
+			}
+
+			r = proc_ecm(dec, prv->bcas, prv->multi2_round);
+			if(r < 0){
+				curr += unit;
+				goto LAST;
+			}
+			if( (r > 0) && (r != ARIB_STD_B25_WARN_UNPURCHASED_ECM) ){
+				/* broken or unexpected section data */
+				goto NEXT;
+			}
+			
+			dec->phase = 1;
+			if(check_ecm_complete(prv)){
+				curr += unit;
+				goto LAST;
+			}
+
+		}else{
+			dec->phase = 2;
+			curr += unit;
+			goto LAST;
+		}
+		
+	NEXT:
+		curr += unit;
+	}
+
+LAST:
+	prv->sbuf_offset = curr - prv->sbuf.head;
+
+	return r;
+}
+
+static int proc_ecm(DECRYPTOR_ELEM *dec, B_CAS_CARD *bcas, int32_t multi2_round)
+{
+	int r,n;
+	int length;
+
+	uint8_t *p;
+	
+	B_CAS_INIT_STATUS is;
+	B_CAS_ECM_RESULT res;
+
+	TS_SECTION sect;
+
+	r = 0;
+	memset(&sect, 0, sizeof(sect));
+	
+	if(bcas == NULL){
+		r = ARIB_STD_B25_ERROR_EMPTY_B_CAS_CARD;
+		goto LAST;
+	}
+
+	n = dec->ecm->get(dec->ecm, &sect);
+	if(n < 0){
+		r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+		goto LAST;
+	}
+	if(sect.hdr.table_id != TS_SECTION_ID_ECM_S){
+		r = ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH;
+		goto LAST;
+	}
+	
+	if(dec->locked){
+		/* previous ECM has returned unpurchased
+		   skip this pid for B-CAS card load reduction */
+		dec->unpurchased += 1;
+		r = ARIB_STD_B25_WARN_UNPURCHASED_ECM;
+		goto LAST;
+	}
+
+	length = (sect.tail - sect.data) - 4;
+	p = sect.data;
+
+	r = bcas->proc_ecm(bcas, &res, p, length);
+	if(r < 0){
+		if(dec->m2 != NULL){
+			dec->m2->clear_scramble_key(dec->m2);
+		}
+		r = ARIB_STD_B25_ERROR_ECM_PROC_FAILURE;
+		goto LAST;
+	}
+	
+	if( (res.return_code != 0x0800) &&
+	    (res.return_code != 0x0400) &&
+	    (res.return_code != 0x0200) ){
+		/* return_code is not equal "purchased" */
+		if(dec->m2 != NULL){
+			dec->m2->release(dec->m2);
+			dec->m2 = NULL;
+		}
+		dec->unpurchased += 1;
+		dec->last_error = res.return_code;
+		dec->locked += 1;
+		r = ARIB_STD_B25_WARN_UNPURCHASED_ECM;
+		goto LAST;
+	}
+
+	if(dec->m2 == NULL){
+		dec->m2 = create_multi2();
+		if(dec->m2 == NULL){
+			return ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+		}
+		r = bcas->get_init_status(bcas, &is);
+		if(r < 0){
+			return ARIB_STD_B25_ERROR_INVALID_B_CAS_STATUS;
+		}
+		dec->m2->set_system_key(dec->m2, is.system_key);
+		dec->m2->set_init_cbc(dec->m2, is.init_cbc);
+		dec->m2->set_round(dec->m2, multi2_round);
+	}
+
+	dec->m2->set_scramble_key(dec->m2, res.scramble_key);
+
+LAST:
+	if(sect.raw != NULL){
+		n = dec->ecm->ret(dec->ecm, &sect);
+		if( (n < 0) && (r == 0) ){
+			r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+		}
+	}
+	
+	return r;
+}
+
+static int proc_arib_std_b25(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int r;
+	int m,n;
+
+	int32_t crypt;
+	int32_t unit;
+	int32_t pid;
+
+	uint8_t *p;
+	uint8_t *curr;
+	uint8_t *tail;
+
+	TS_HEADER hdr;
+	DECRYPTOR_ELEM *dec;
+	TS_PROGRAM *pgrm;
+
+	unit = prv->unit_size;
+	curr = prv->sbuf.head;
+	tail = prv->sbuf.tail;
+
+	m = prv->dbuf.tail - prv->dbuf.head;
+	n = tail - curr;
+	if(!reserve_work_buffer(&(prv->dbuf), m+n)){
+		return ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+	}
+
+	r = 0;
+
+	while( (curr+unit) < tail ){
+		
+		if( (curr[0] != 0x47) || (curr[unit] != 0x47) ){
+			p = resync(curr, tail, unit);
+			if(p == NULL){
+				goto LAST;
+			}
+			curr = p;
+		}
+		
+		extract_ts_header(&hdr, curr);
+		crypt = hdr.transport_scrambling_control;
+		pid = hdr.pid;
+
+		if( (pid == 0x1fff) && (prv->strip) ){
+			/* strip null(padding) stream */
+			goto NEXT;
+		}
+
+		p = curr+4;
+		if(hdr.adaptation_field_control & 0x02){
+			p += (p[0]+1);
+		}
+		n = 188 - (p-curr);
+		if( (n < 1) && ((n < 0) || (hdr.adaptation_field_control & 0x01)) ){
+			/* broken packet */
+			curr += 1;
+			continue;
+		}
+
+		if( (crypt != 0) &&
+		    (hdr.adaptation_field_control & 0x01) ){
+			
+			if(prv->map[pid].type == PID_MAP_TYPE_OTHER){
+				dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
+			}else if( (prv->map[pid].type == 0) &&
+			          (prv->decrypt.count == 1) ){
+				dec = prv->decrypt.head;
+			}else{
+				dec = NULL;
+			}
+
+			if( (dec != NULL) && (dec->m2 != NULL) ){
+				m = dec->m2->decrypt(dec->m2, crypt, p, n);
+				if(m < 0){
+					r = ARIB_STD_B25_ERROR_DECRYPT_FAILURE;
+					goto LAST;
+				}
+				curr[3] &= 0x3f;
+				prv->map[pid].normal_packet += 1;
+			}else{
+				prv->map[pid].undecrypted += 1;
+			}
+		}else{
+			prv->map[pid].normal_packet += 1;
+		}
+
+		if(!append_work_buffer(&(prv->dbuf), curr, 188)){
+			r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+			goto LAST;
+		}
+
+		if(prv->map[pid].type == PID_MAP_TYPE_ECM){
+			dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
+			if( (dec == NULL) || (dec->ecm == NULL) ){
+				/* this code will never execute */
+				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = dec->ecm->put(dec->ecm, &hdr, p, n);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = dec->ecm->get_count(dec->ecm);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE;
+				goto LAST;
+			}
+			if(m == 0){
+				goto NEXT;
+			}
+			r = proc_ecm(dec, prv->bcas, prv->multi2_round);
+			if(r < 0){
+				goto LAST;
+			}
+		}else if(prv->map[pid].type == PID_MAP_TYPE_PMT){
+			pgrm = (TS_PROGRAM *)(prv->map[pid].target);
+			if( (pgrm == NULL) || (pgrm->pmt == NULL) ){
+				/* this code will never execute */
+				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = pgrm->pmt->put(pgrm->pmt, &hdr, p, n);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = pgrm->pmt->get_count(pgrm->pmt);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE;
+				goto LAST;
+			}
+			if(m == 0){
+				goto NEXT;
+			}
+			r = proc_pmt(prv, pgrm);
+			if(r < 0){
+				goto LAST;
+			}
+		}else if(prv->map[pid].type == PID_MAP_TYPE_EMM){
+			if( prv->emm_proc_on == 0){
+				goto NEXT;
+			}
+			if( prv->emm == NULL ){
+				prv->emm = create_ts_section_parser();
+				if(prv->emm == NULL){
+					r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
+					goto LAST;
+				}
+			}
+			m = prv->emm->put(prv->emm, &hdr, p, n);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = prv->emm->get_count(prv->emm);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
+				goto LAST;
+			}
+			if(m == 0){
+				goto NEXT;
+			}
+			r = proc_emm(prv);
+			if(r < 0){
+				goto LAST;
+			}
+		}else if(pid == 0x0001){
+			if( prv->cat == NULL ){
+				prv->cat = create_ts_section_parser();
+				if(prv->cat == NULL){
+					r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+					goto LAST;
+				}
+			}
+			m = prv->cat->put(prv->cat, &hdr, p, n);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = prv->cat->get_count(prv->cat);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
+				goto LAST;
+			}
+			if(m == 0){
+				goto NEXT;
+			}
+			r = proc_cat(prv);
+			if(r < 0){
+				goto LAST;
+			}
+		}else if(pid == 0x0000){
+			if( prv->pat == NULL ){
+				prv->pat = create_ts_section_parser();
+				if(prv->pat == NULL){
+					r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
+					goto LAST;
+				}
+			}
+			m = prv->pat->put(prv->pat, &hdr, p, n);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
+				goto LAST;
+			}
+			m = prv->pat->get_count(prv->pat);
+			if(m < 0){
+				r = ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE;
+				goto LAST;
+			}
+			if(m == 0){
+				goto NEXT;
+			}
+			r = proc_pat(prv);
+			goto LAST;
+		}
+			
+	NEXT:
+		curr += unit;
+	}
+
+LAST:
+	m = curr - prv->sbuf.head;
+	n = tail - curr;
+	if( (n < 1024) || (m > (prv->sbuf.max/2) ) ){
+		p = prv->sbuf.pool;
+		memcpy(p, curr, n);
+		prv->sbuf.head = p;
+		prv->sbuf.tail = p+n;
+	}else{
+		prv->sbuf.head = curr;
+	}
+
+	return r;
+}
+
+static int proc_cat(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int r;
+	int n;
+	int emm_pid;
+
+	TS_SECTION sect;
+
+	r = 0;
+	memset(&sect, 0, sizeof(sect));
+
+	n = prv->cat->get(prv->cat, &sect);
+	if(n < 0){
+		r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
+		goto LAST;
+	}
+
+	if(sect.hdr.table_id != TS_SECTION_ID_CONDITIONAL_ACCESS){
+		r = ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH;
+		goto LAST;
+	}
+
+	emm_pid = find_ca_descriptor_pid(sect.data, sect.tail-4, prv->ca_system_id);
+	if( (emm_pid != 0x0000) && (emm_pid != 0x1fff) ){
+		if( (prv->map[emm_pid].target != NULL) &&
+		    (prv->map[emm_pid].type == PID_MAP_TYPE_OTHER) ){
+			DECRYPTOR_ELEM *dec;
+			dec = (DECRYPTOR_ELEM *)(prv->map[emm_pid].target);
+			dec->ref -= 1;
+			if(dec->ref < 1){
+				remove_decryptor(prv, dec);
+			}
+		}
+		prv->emm_pid = emm_pid;
+		prv->map[emm_pid].ref = 1;
+		prv->map[emm_pid].type = PID_MAP_TYPE_EMM;
+		prv->map[emm_pid].target = NULL;
+	}
+	
+	prv->map[0x0001].ref = 1;
+	prv->map[0x0001].type = PID_MAP_TYPE_CAT;
+	prv->map[0x0001].target = NULL;
+
+LAST:
+
+	if(sect.raw != NULL){
+		n = prv->cat->ret(prv->cat, &sect);
+		if( (n < 0) && (r == 0) ){
+			r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
+		}
+	}
+
+	return r;
+}
+
+static int proc_emm(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	int r;
+	int i,j,n;
+
+	int len;
+
+	uint8_t *head;
+	uint8_t *tail;
+
+	TS_SECTION sect;
+	EMM_FIXED_PART emm_hdr;
+
+	r = 0;
+	memset(&sect, 0, sizeof(sect));
+
+	if(prv->bcas == NULL){
+		r = ARIB_STD_B25_ERROR_EMPTY_B_CAS_CARD;
+		goto LAST;
+	}
+
+	while( (n = prv->emm->get_count(prv->emm)) > 0 ){
+
+		n = prv->emm->get(prv->emm, &sect);
+		if(n < 0){
+			r = ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE;
+			goto LAST;
+		}
+
+		if(sect.hdr.table_id == TS_SECTION_ID_EMM_MESSAGE){
+			/* EMM_MESSAGE is not supported */
+			goto NEXT;
+		}else if(sect.hdr.table_id != TS_SECTION_ID_EMM_S){
+			r = ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH;
+			goto LAST;
+		}
+
+		head = sect.data;
+		tail = sect.tail - 4;
+
+		i = 0;
+		while( (head+13) <= tail ){
+			
+			extract_emm_fixed_part(&emm_hdr, head);
+			len = emm_hdr.associated_information_length+7;
+			if( (head+len) > tail ){
+				/* broken EMM element */
+				goto NEXT;
+			}
+			
+			for(j=0;j<prv->casid.count;j++){
+				if(prv->casid.data[j] == emm_hdr.card_id){
+					n = prv->bcas->proc_emm(prv->bcas, head, len);
+					if(n < 0){
+						r = ARIB_STD_B25_ERROR_EMM_PROC_FAILURE;
+						goto LAST;
+					}
+					unlock_all_decryptor(prv);
+				}
+			}
+
+			head += len;
+		}
+
+	NEXT:
+		if(sect.raw != NULL){
+			n = prv->emm->ret(prv->emm, &sect);
+			if( (n < 0) && (r == 0) ){
+				r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
+				goto LAST;
+			}
+			memset(&sect, 0, sizeof(sect));
+		}
+	}
+
+LAST:
+	if(sect.raw != NULL){
+		n = prv->emm->ret(prv->emm, &sect);
+		if( (n < 0) && (r == 0) ){
+			r = ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE;
+		}
+	}
+
+	return r;
+}
+
+static void release_program(ARIB_STD_B25_PRIVATE_DATA *prv, TS_PROGRAM *pgrm)
+{
+	int32_t pid;
+	TS_STREAM_ELEM *strm;
+
+	pid = pgrm->pmt_pid;
+	
+	if(pgrm->pmt != NULL){
+		pgrm->pmt->release(pgrm->pmt);
+		pgrm->pmt = NULL;
+	}
+
+	while( (strm = get_stream_list_head(&(pgrm->old_strm))) != NULL ){
+		unref_stream(prv, strm->pid);
+		memset(strm, 0, sizeof(TS_STREAM_ELEM));
+		put_stream_list_tail(&(prv->strm_pool), strm);
+	}
+
+	while( (strm = get_stream_list_head(&(pgrm->streams))) != NULL ){
+		unref_stream(prv, strm->pid);
+		memset(strm, 0, sizeof(TS_STREAM_ELEM));
+		put_stream_list_tail(&(prv->strm_pool), strm);
+	}
+
+	prv->map[pid].type = PID_MAP_TYPE_UNKNOWN;
+	prv->map[pid].ref = 0;
+	prv->map[pid].target = NULL;
+}
+
+static void unref_stream(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid)
+{
+	DECRYPTOR_ELEM *dec;
+
+	prv->map[pid].ref -= 1;
+	if( prv->map[pid].ref < 1 ){
+		if( (prv->map[pid].target != NULL) &&
+		    (prv->map[pid].type == PID_MAP_TYPE_OTHER) ){
+			dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
+			dec->ref -= 1;
+			if(dec->ref < 1){
+				remove_decryptor(prv, dec);
+			}
+		}
+		prv->map[pid].type = PID_MAP_TYPE_UNKNOWN;
+		prv->map[pid].ref = 0;
+		prv->map[pid].target = NULL;
+	}
+}
+
+static DECRYPTOR_ELEM *set_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid)
+{
+	DECRYPTOR_ELEM *r;
+
+	r = NULL;
+	if(prv->map[pid].type == PID_MAP_TYPE_ECM){
+		r = (DECRYPTOR_ELEM *)(prv->map[pid].target);
+		if(r != NULL){
+			return r;
+		}
+	}
+	r = (DECRYPTOR_ELEM *)calloc(1, sizeof(DECRYPTOR_ELEM));
+	if(r == NULL){
+		return NULL;
+	}
+	r->ecm_pid = pid;
+	r->ecm = create_ts_section_parser();
+	if(r->ecm == NULL){
+		free(r);
+		return NULL;
+	}
+
+	if(prv->decrypt.tail != NULL){
+		r->prev = prv->decrypt.tail;
+		r->next = NULL;
+		prv->decrypt.tail->next = r;
+		prv->decrypt.tail = r;
+		prv->decrypt.count += 1;
+	}else{
+		r->prev = NULL;
+		r->next = NULL;
+		prv->decrypt.head = r;
+		prv->decrypt.tail = r;
+		prv->decrypt.count = 1;
+	}
+
+	if( (prv->map[pid].type == PID_MAP_TYPE_OTHER) &&
+	    (prv->map[pid].target != NULL) ){
+		DECRYPTOR_ELEM *dec;
+		dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
+		dec->ref -= 1;
+		if(dec->ref < 1){
+			remove_decryptor(prv, dec);
+		}
+	}
+
+	prv->map[pid].type = PID_MAP_TYPE_ECM;
+	prv->map[pid].target = r;
+
+	return r;
+}
+
+static void remove_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, DECRYPTOR_ELEM *dec)
+{
+	int32_t pid;
+
+	DECRYPTOR_ELEM *prev;
+	DECRYPTOR_ELEM *next;
+
+	pid = dec->ecm_pid;
+	if( (prv->map[pid].type == PID_MAP_TYPE_ECM) &&
+	    (prv->map[pid].target == ((void *)dec)) ){
+		prv->map[pid].type = PID_MAP_TYPE_UNKNOWN;
+		prv->map[pid].target = NULL;
+	}
+
+	prev = (DECRYPTOR_ELEM *)(dec->prev);
+	next = (DECRYPTOR_ELEM *)(dec->next);
+	if(prev != NULL){
+		prev->next = next;
+	}else{
+		prv->decrypt.head = next;
+	}
+	if(next != NULL){
+		next->prev = prev;
+	}else{
+		prv->decrypt.tail = prev;
+	}
+	prv->decrypt.count -= 1;
+
+	if(dec->ecm != NULL){
+		dec->ecm->release(dec->ecm);
+		dec->ecm = NULL;
+	}
+
+	if(dec->m2 != NULL){
+		dec->m2->release(dec->m2);
+		dec->m2 = NULL;
+	}
+
+	free(dec);
+}
+
+static DECRYPTOR_ELEM *select_active_decryptor(DECRYPTOR_ELEM *a, DECRYPTOR_ELEM *b, int32_t pid)
+{
+	if( b != NULL ){
+		return b;
+	}
+	if( pid == 0x1fff ){
+		return NULL;
+	}
+	return a;
+}
+
+static void bind_stream_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv, int32_t pid, DECRYPTOR_ELEM *dec)
+{
+	DECRYPTOR_ELEM *old;
+
+	old = (DECRYPTOR_ELEM *)(prv->map[pid].target);
+	if(old == dec){
+		/* already binded - do nothing */
+		return;
+	}
+		 
+	if(old != NULL){
+		old->ref -= 1;
+		if(old->ref == 0){
+			remove_decryptor(prv, old);
+		}
+		prv->map[pid].target = NULL;
+	}
+
+	if(dec != NULL){
+		prv->map[pid].target = dec;
+		dec->ref += 1;
+	}
+}
+
+static void unlock_all_decryptor(ARIB_STD_B25_PRIVATE_DATA *prv)
+{
+	DECRYPTOR_ELEM *e;
+
+	e = prv->decrypt.head;
+	while(e != NULL){
+		e->locked = 0;
+		e = (DECRYPTOR_ELEM *)(e->next);
+	}
+}
+
+static TS_STREAM_ELEM *get_stream_list_head(TS_STREAM_LIST *list)
+{
+	TS_STREAM_ELEM *r;
+
+	r = list->head;
+	if(r == NULL){
+		return NULL;
+	}
+
+	list->head = (TS_STREAM_ELEM *)(r->next);
+	if(list->head == NULL){
+		list->tail = NULL;
+		list->count = 0;
+	}else{
+		list->head->prev = NULL;
+		list->count -= 1;
+	}
+
+	r->prev = NULL;
+	r->next = NULL;
+
+	return r;
+}
+
+static TS_STREAM_ELEM *find_stream_list_elem(TS_STREAM_LIST *list, int32_t pid)
+{
+	TS_STREAM_ELEM *r;
+
+	r = list->head;
+	while(r != NULL){
+		if(r->pid == pid){
+			break;
+		}
+		r = (TS_STREAM_ELEM *)(r->next);
+	}
+
+	return r;
+}
+
+static TS_STREAM_ELEM *create_stream_elem(int32_t pid, int32_t type)
+{
+	TS_STREAM_ELEM *r;
+
+	r = (TS_STREAM_ELEM *)calloc(1, sizeof(TS_STREAM_ELEM));
+	if(r == NULL){
+		return NULL;
+	}
+
+	r->pid = pid;
+	r->type = type;
+
+	return r;
+}
+
+static void put_stream_list_tail(TS_STREAM_LIST *list, TS_STREAM_ELEM *elem)
+{
+	if(list->tail != NULL){
+		elem->prev = list->tail;
+		elem->next = NULL;
+		list->tail->next = elem;
+		list->tail = elem;
+		list->count += 1;
+	}else{
+		elem->prev = NULL;
+		elem->next = NULL;
+		list->head = elem;
+		list->tail = elem;
+		list->count = 1;
+	}
+}
+
+static void clear_stream_list(TS_STREAM_LIST *list)
+{
+	TS_STREAM_ELEM *p,*n;
+
+	p = list->head;
+	while(p != NULL){
+		n = (TS_STREAM_ELEM *)(p->next);
+		free(p);
+		p = n;
+	}
+
+	list->head = NULL;
+	list->tail = NULL;
+	list->count = 0;
+}
+
+static int reserve_work_buffer(TS_WORK_BUFFER *buf, int32_t size)
+{
+	int m,n;
+	uint8_t *p;
+	
+	if(buf->max >= size){
+		return 1;
+	}
+
+	if(buf->max < 512){
+		n = 512;
+	}else{
+		n = buf->max * 2;
+	}
+	
+	while(n < size){
+		n += n;
+	}
+
+	p = (uint8_t *)malloc(n);
+	if(p == NULL){
+		return 0;
+	}
+
+	m = 0;
+	if(buf->pool != NULL){
+		m = buf->tail - buf->head;
+		if(m > 0){
+			memcpy(p, buf->head, m);
+		}
+		free(buf->pool);
+		buf->pool = NULL;
+	}
+
+	buf->pool = p;
+	buf->head = p;
+	buf->tail = p+m;
+	buf->max = n;
+
+	return 1;
+}
+
+static int append_work_buffer(TS_WORK_BUFFER *buf, uint8_t *data, int32_t size)
+{
+	int m;
+
+	if(size < 1){
+		/* ignore - do nothing */
+		return 1;
+	}
+
+	m = buf->tail - buf->pool;
+
+	if( (m+size) > buf->max ){
+		if(!reserve_work_buffer(buf, m+size)){
+			return 0;
+		}
+	}
+
+	memcpy(buf->tail, data, size);
+	buf->tail += size;
+
+	return 1;
+}
+
+static void reset_work_buffer(TS_WORK_BUFFER *buf)
+{
+	buf->head = buf->pool;
+	buf->tail = buf->pool;
+}
+
+static void release_work_buffer(TS_WORK_BUFFER *buf)
+{
+	if(buf->pool != NULL){
+		free(buf->pool);
+	}
+	buf->pool = NULL;
+	buf->head = NULL;
+	buf->tail = NULL;
+	buf->max = 0;
+}
+
+static void extract_ts_header(TS_HEADER *dst, uint8_t *src)
+{
+	dst->sync                         =  src[0];
+	dst->transport_error_indicator    = (src[1] >> 7) & 0x01;
+	dst->payload_unit_start_indicator = (src[1] >> 6) & 0x01;
+	dst->transport_priority           = (src[1] >> 5) & 0x01;
+	dst->pid = ((src[1] & 0x1f) << 8) | src[2];
+	dst->transport_scrambling_control = (src[3] >> 6) & 0x03;
+	dst->adaptation_field_control     = (src[3] >> 4) & 0x03;
+	dst->continuity_counter           =  src[3]       & 0x0f;
+}
+
+static void extract_emm_fixed_part(EMM_FIXED_PART *dst, uint8_t *src)
+{
+	int i;
+
+	dst->card_id = 0;
+	for(i=0;i<6;i++){
+		dst->card_id = (dst->card_id << 8) | src[i];
+	}
+	
+	dst->associated_information_length = src[ 6];
+	dst->protocol_number               = src[ 7];
+	dst->broadcaster_group_id          = src[ 8];
+	dst->update_number                 = (src[ 9]<<8)|src[10];
+	dst->expiration_date               = (src[11]<<8)|src[12];
+}
+
+static uint8_t *resync(uint8_t *head, uint8_t *tail, int32_t unit_size)
+{
+	int i;
+	unsigned char *buf;
+
+	buf = head;
+	tail -= unit_size * 8;
+	while( buf <= tail ){
+		if(buf[0] == 0x47){
+			for(i=1;i<8;i++){
+				if(buf[unit_size*i] != 0x47){
+					break;
+				}
+			}
+			if(i == 8){
+				return buf;
+			}
+		}
+		buf += 1;
+	}
+
+	return NULL;
+}
+
+static uint8_t *resync_force(uint8_t *head, uint8_t *tail, int32_t unit_size)
+{
+	int i,n;
+	unsigned char *buf;
+
+	buf = head;
+	while( buf <= (tail-188) ){
+		if(buf[0] == 0x47){
+			n = (tail - buf) / unit_size;
+			if(n == 0){
+				return buf;
+			}
+			for(i=1;i<n;i++){
+				if(buf[unit_size*i] != 0x47){
+					break;
+				}
+			}
+			if(i == n){
+				return buf;
+			}
+		}
+		buf += 1;
+	}
+
+	return NULL;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/arib_std_b25.h	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,60 @@
+#ifndef ARIB_STD_B25_H
+#define ARIB_STD_B25_H
+
+#include "portable.h"
+#include "b_cas_card.h"
+
+typedef struct {
+	uint8_t *data;
+	int32_t  size;
+} ARIB_STD_B25_BUFFER;
+
+typedef struct {
+
+	int32_t  program_number; /* channel */
+	
+	int32_t  ecm_unpurchased_count;
+	int32_t  last_ecm_error_code;
+
+	int32_t  padding;
+
+	int64_t  total_packet_count;
+	int64_t  undecrypted_packet_count;
+	
+} ARIB_STD_B25_PROGRAM_INFO;
+
+typedef struct {
+
+	void *private_data;
+
+	void (* release)(void *std_b25);
+
+	int (* set_multi2_round)(void *std_b25, int32_t round);
+	int (* set_strip)(void *std_b25, int32_t strip);
+	int (* set_emm_proc)(void *std_b25, int32_t on);
+	
+	int (* set_b_cas_card)(void *std_b25, B_CAS_CARD *bcas);
+	
+	int (* reset)(void *std_b25);
+	int (* flush)(void *std_b25);
+
+	int (* put)(void *std_b25, ARIB_STD_B25_BUFFER *buf);
+	int (* get)(void *std_b25, ARIB_STD_B25_BUFFER *buf);
+
+	int (* get_program_count)(void *std_b25);
+	int (* get_program_info)(void *std_b25, ARIB_STD_B25_PROGRAM_INFO *info, int32_t idx);
+
+} ARIB_STD_B25;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern ARIB_STD_B25 *create_arib_std_b25();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ARIB_STD_B25_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/arib_std_b25_error_code.h	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,25 @@
+#ifndef ARIB_STD_B25_ERROR_CODE_H
+#define ARIB_STD_B25_ERROR_CODE_H
+
+#define ARIB_STD_B25_ERROR_INVALID_PARAM          -1
+#define ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY       -2
+#define ARIB_STD_B25_ERROR_NON_TS_INPUT_STREAM    -3
+#define ARIB_STD_B25_ERROR_NO_PAT_IN_HEAD_16M     -4
+#define ARIB_STD_B25_ERROR_NO_PMT_IN_HEAD_32M     -5
+#define ARIB_STD_B25_ERROR_NO_ECM_IN_HEAD_32M     -6
+#define ARIB_STD_B25_ERROR_EMPTY_B_CAS_CARD       -7
+#define ARIB_STD_B25_ERROR_INVALID_B_CAS_STATUS   -8
+#define ARIB_STD_B25_ERROR_ECM_PROC_FAILURE       -9
+#define ARIB_STD_B25_ERROR_DECRYPT_FAILURE       -10
+#define ARIB_STD_B25_ERROR_PAT_PARSE_FAILURE     -11
+#define ARIB_STD_B25_ERROR_PMT_PARSE_FAILURE     -12
+#define ARIB_STD_B25_ERROR_ECM_PARSE_FAILURE     -13
+#define ARIB_STD_B25_ERROR_CAT_PARSE_FAILURE     -14
+#define ARIB_STD_B25_ERROR_EMM_PARSE_FAILURE     -15
+#define ARIB_STD_B25_ERROR_EMM_PROC_FAILURE      -16
+
+#define ARIB_STD_B25_WARN_UNPURCHASED_ECM          1
+#define ARIB_STD_B25_WARN_TS_SECTION_ID_MISSMATCH  2
+#define ARIB_STD_B25_WARN_BROKEN_TS_SECTION        3
+
+#endif /* ARIB_STD_B25_ERROR_CODE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/b_cas_card.c	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,749 @@
+#include "b_cas_card.h"
+#include "b_cas_card_error_code.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <math.h>
+
+#if defined(WIN32)
+	#include <windows.h>
+#endif
+#include <winscard.h>
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ inner structures
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+typedef struct {
+	
+	SCARDCONTEXT       mng;
+	SCARDHANDLE        card;
+
+	uint8_t           *pool;
+	char              *reader;
+
+	uint8_t           *sbuf;
+	uint8_t           *rbuf;
+
+	B_CAS_INIT_STATUS  stat;
+	
+	B_CAS_ID           id;
+	int32_t            id_max;
+
+	B_CAS_PWR_ON_CTRL_INFO pwc;
+	int32_t            pwc_max;
+	
+} B_CAS_CARD_PRIVATE_DATA;
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ constant values
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static const uint8_t INITIAL_SETTING_CONDITIONS_CMD[] = {
+	0x90, 0x30, 0x00, 0x00, 0x00,
+};
+
+static const uint8_t CARD_ID_INFORMATION_ACQUIRE_CMD[] = {
+	0x90, 0x32, 0x00, 0x00, 0x00,
+};
+
+static const uint8_t POWER_ON_CONTROL_INFORMATION_REQUEST_CMD[] = {
+	0x90, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00,
+};
+
+static const uint8_t ECM_RECEIVE_CMD_HEADER[] = {
+	0x90, 0x34, 0x00, 0x00,
+};
+
+static const uint8_t EMM_RECEIVE_CMD_HEADER[] = {
+	0x90, 0x36, 0x00, 0x00,
+};
+
+#define B_CAS_BUFFER_MAX (4*1024)
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ function prottypes (interface method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static void release_b_cas_card(void *bcas);
+static int init_b_cas_card(void *bcas);
+static int get_init_status_b_cas_card(void *bcas, B_CAS_INIT_STATUS *stat);
+static int get_id_b_cas_card(void *bcas, B_CAS_ID *dst);
+static int get_pwr_on_ctrl_b_cas_card(void *bcas, B_CAS_PWR_ON_CTRL_INFO *dst);
+static int proc_ecm_b_cas_card(void *bcas, B_CAS_ECM_RESULT *dst, uint8_t *src, int len);
+static int proc_emm_b_cas_card(void *bcas, uint8_t *src, int len);
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ global function implementation
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+B_CAS_CARD *create_b_cas_card()
+{
+	int n;
+	
+	B_CAS_CARD *r;
+	B_CAS_CARD_PRIVATE_DATA *prv;
+
+	n = sizeof(B_CAS_CARD) + sizeof(B_CAS_CARD_PRIVATE_DATA);
+	prv = (B_CAS_CARD_PRIVATE_DATA *)calloc(1, n);
+	if(prv == NULL){
+		return NULL;
+	}
+
+	r = (B_CAS_CARD *)(prv+1);
+
+	r->private_data = prv;
+
+	r->release = release_b_cas_card;
+	r->init = init_b_cas_card;
+	r->get_init_status = get_init_status_b_cas_card;
+	r->get_id = get_id_b_cas_card;
+	r->get_pwr_on_ctrl = get_pwr_on_ctrl_b_cas_card;
+	r->proc_ecm = proc_ecm_b_cas_card;
+	r->proc_emm = proc_emm_b_cas_card;
+
+	return r;
+}
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ function prottypes (private method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static B_CAS_CARD_PRIVATE_DATA *private_data(void *bcas);
+static void teardown(B_CAS_CARD_PRIVATE_DATA *prv);
+static int change_id_max(B_CAS_CARD_PRIVATE_DATA *prv, int max);
+static int change_pwc_max(B_CAS_CARD_PRIVATE_DATA *prv, int max);
+static int connect_card(B_CAS_CARD_PRIVATE_DATA *prv, const char *reader_name);
+static void extract_power_on_ctrl_response(B_CAS_PWR_ON_CTRL *dst, uint8_t *src);
+static void extract_mjd(int *yy, int *mm, int *dd, int mjd);
+static int setup_ecm_receive_command(uint8_t *dst, uint8_t *src, int len);
+static int setup_emm_receive_command(uint8_t *dst, uint8_t *src, int len);
+static int32_t load_be_uint16(uint8_t *p);
+static int64_t load_be_uint48(uint8_t *p);
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ interface method implementation
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static void release_b_cas_card(void *bcas)
+{
+	B_CAS_CARD_PRIVATE_DATA *prv;
+
+	prv = private_data(bcas);
+	if(prv == NULL){
+		/* do nothing */
+		return;
+	}
+
+	teardown(prv);
+	free(prv);
+}
+
+static int init_b_cas_card(void *bcas)
+{
+	int m;
+	LONG ret;
+	DWORD len;
+	
+	B_CAS_CARD_PRIVATE_DATA *prv;
+
+	prv = private_data(bcas);
+	if(prv == NULL){
+		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
+	}
+
+	teardown(prv);
+
+	ret = SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &(prv->mng));
+	if(ret != SCARD_S_SUCCESS){
+		return B_CAS_CARD_ERROR_NO_SMART_CARD_READER;
+	}
+
+	ret = SCardListReaders(prv->mng, NULL, NULL, &len);
+	if(ret != SCARD_S_SUCCESS){
+		return B_CAS_CARD_ERROR_NO_SMART_CARD_READER;
+	}
+	len += 256;
+	
+	m = len + (2*B_CAS_BUFFER_MAX) + (sizeof(int64_t)*16) + (sizeof(B_CAS_PWR_ON_CTRL)*16);
+	prv->pool = (uint8_t *)malloc(m);
+	if(prv->pool == NULL){
+		return B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY;
+	}
+
+	prv->reader = (char *)(prv->pool);
+	prv->sbuf = prv->pool + len;
+	prv->rbuf = prv->sbuf + B_CAS_BUFFER_MAX;
+	prv->id.data = (int64_t *)(prv->rbuf + B_CAS_BUFFER_MAX);
+	prv->id_max = 16;
+	prv->pwc.data = (B_CAS_PWR_ON_CTRL *)(prv->id.data + prv->id_max);
+	prv->pwc_max = 16;
+
+	ret = SCardListReaders(prv->mng, NULL, prv->reader, &len);
+	if(ret != SCARD_S_SUCCESS){
+		return B_CAS_CARD_ERROR_NO_SMART_CARD_READER;
+	}
+
+	while( prv->reader[0] != 0 ){
+		if(connect_card(prv, prv->reader)){
+			break;
+		}
+		prv->reader += (strlen(prv->reader) + 1);
+	}
+
+	if(prv->card == 0){
+		return B_CAS_CARD_ERROR_ALL_READERS_CONNECTION_FAILED;
+	}
+
+	return 0;
+}
+
+static int get_init_status_b_cas_card(void *bcas, B_CAS_INIT_STATUS *stat)
+{
+	B_CAS_CARD_PRIVATE_DATA *prv;
+
+	prv = private_data(bcas);
+	if( (prv == NULL) || (stat == NULL) ){
+		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
+	}
+
+	if(prv->card == 0){
+		return B_CAS_CARD_ERROR_NOT_INITIALIZED;
+	}
+
+	memcpy(stat, &(prv->stat), sizeof(B_CAS_INIT_STATUS));
+
+	return 0;
+}
+
+static int get_id_b_cas_card(void *bcas, B_CAS_ID *dst)
+{
+	LONG ret;
+	
+	DWORD slen;
+	DWORD rlen;
+
+	int i,num;
+
+	uint8_t *p;
+	uint8_t *tail;
+	
+	B_CAS_CARD_PRIVATE_DATA *prv;
+	SCARD_IO_REQUEST sir;
+
+	prv = private_data(bcas);
+	if( (prv == NULL) || (dst == NULL) ){
+		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
+	}
+
+	if(prv->card == 0){
+		return B_CAS_CARD_ERROR_NOT_INITIALIZED;
+	}
+
+	slen = sizeof(CARD_ID_INFORMATION_ACQUIRE_CMD);
+	memcpy(prv->sbuf, CARD_ID_INFORMATION_ACQUIRE_CMD, slen);
+	memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
+	rlen = B_CAS_BUFFER_MAX;
+
+	ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
+	if( (ret != SCARD_S_SUCCESS) || (rlen < 19) ){
+		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
+	}
+
+	p = prv->rbuf + 6;
+	tail = prv->rbuf + rlen;
+	if( p+1 > tail ){
+		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
+	}
+
+	num = p[0];
+	if(num > prv->id_max){
+		if(change_id_max(prv, num+4) < 0){
+			return B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY;
+		}
+	}
+	
+	p += 1;
+	for(i=0;i<num;i++){
+		if( p+10 > tail ){
+			return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
+		}
+		
+		{
+			int maker_id;
+			int version;
+			int check_code;
+			
+			maker_id = p[0];
+			version = p[1];
+			prv->id.data[i] = load_be_uint48(p+2);
+			check_code = load_be_uint16(p+8);
+		}
+		
+		p += 10;
+	}
+
+	prv->id.count = num;
+
+	memcpy(dst, &(prv->id), sizeof(B_CAS_ID));
+
+	return 0;
+}
+
+static int get_pwr_on_ctrl_b_cas_card(void *bcas, B_CAS_PWR_ON_CTRL_INFO *dst)
+{
+	LONG ret;
+	
+	DWORD slen;
+	DWORD rlen;
+
+	int i,num,code;
+
+	B_CAS_CARD_PRIVATE_DATA *prv;
+	SCARD_IO_REQUEST sir;
+
+	memset(dst, 0, sizeof(B_CAS_PWR_ON_CTRL_INFO));
+
+	prv = private_data(bcas);
+	if( (prv == NULL) || (dst == NULL) ){
+		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
+	}
+
+	if(prv->card == 0){
+		return B_CAS_CARD_ERROR_NOT_INITIALIZED;
+	}
+
+	slen = sizeof(POWER_ON_CONTROL_INFORMATION_REQUEST_CMD);
+	memcpy(prv->sbuf, POWER_ON_CONTROL_INFORMATION_REQUEST_CMD, slen);
+	prv->sbuf[5] = 0;
+	memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
+	rlen = B_CAS_BUFFER_MAX;
+
+	ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
+	if( (ret != SCARD_S_SUCCESS) || (rlen < 18) || (prv->rbuf[6] != 0) ){
+		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
+	}
+
+	code = load_be_uint16(prv->rbuf+4);
+	if(code == 0xa101){
+		/* no data */
+		return 0;
+	}else if(code != 0x2100){
+		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
+	}
+
+	num = (prv->rbuf[7] + 1);
+	if(prv->pwc_max < num){
+		if(change_pwc_max(prv, num+4) < 0){
+			return B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY;
+		}
+	}
+
+	extract_power_on_ctrl_response(prv->pwc.data+0, prv->rbuf);
+
+	for(i=1;i<num;i++){
+		prv->sbuf[5] = i;
+		rlen = B_CAS_BUFFER_MAX;
+
+		ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
+		if( (ret != SCARD_S_SUCCESS) || (rlen < 18) || (prv->rbuf[6] != i) ){
+			return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
+		}
+
+		extract_power_on_ctrl_response(prv->pwc.data+i, prv->rbuf);
+	}
+
+	prv->pwc.count = num;
+
+	memcpy(dst, &(prv->pwc), sizeof(B_CAS_PWR_ON_CTRL_INFO));
+
+	return 0;
+}
+
+static int proc_ecm_b_cas_card(void *bcas, B_CAS_ECM_RESULT *dst, uint8_t *src, int len)
+{
+	int retry_count;
+	
+	LONG ret;
+	DWORD slen;
+	DWORD rlen;
+	
+	B_CAS_CARD_PRIVATE_DATA *prv;
+
+	SCARD_IO_REQUEST sir;
+
+	prv = private_data(bcas);
+	if( (prv == NULL) ||
+	    (dst == NULL) ||
+	    (src == NULL) ||
+	    (len < 1) ){
+		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
+	}
+
+	if(prv->card == 0){
+		return B_CAS_CARD_ERROR_NOT_INITIALIZED;
+	}
+
+	slen = setup_ecm_receive_command(prv->sbuf, src, len);
+	memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
+	rlen = B_CAS_BUFFER_MAX;
+
+	retry_count = 0;
+	ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
+	while( ((ret != SCARD_S_SUCCESS) || (rlen < 25)) && (retry_count < 10) ){
+		retry_count += 1;
+		if(!connect_card(prv, prv->reader)){
+			continue;
+		}
+		slen = setup_ecm_receive_command(prv->sbuf, src, len);
+		memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
+		rlen = B_CAS_BUFFER_MAX;
+
+		ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
+	}
+
+	if( (ret != SCARD_S_SUCCESS) || (rlen < 25) ){
+		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
+	}
+
+	memcpy(dst->scramble_key, prv->rbuf+6, 16);
+	dst->return_code = load_be_uint16(prv->rbuf+4);
+
+	return 0;
+}
+
+static int proc_emm_b_cas_card(void *bcas, uint8_t *src, int len)
+{
+	int retry_count;
+	
+	LONG ret;
+	DWORD slen;
+	DWORD rlen;
+	
+	B_CAS_CARD_PRIVATE_DATA *prv;
+
+	SCARD_IO_REQUEST sir;
+
+	prv = private_data(bcas);
+	if( (prv == NULL) ||
+	    (src == NULL) ||
+	    (len < 1) ){
+		return B_CAS_CARD_ERROR_INVALID_PARAMETER;
+	}
+
+	if(prv->card == 0){
+		return B_CAS_CARD_ERROR_NOT_INITIALIZED;
+	}
+
+	slen = setup_emm_receive_command(prv->sbuf, src, len);
+	memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
+	rlen = B_CAS_BUFFER_MAX;
+
+	retry_count = 0;
+	ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
+	while( ((ret != SCARD_S_SUCCESS) || (rlen < 6)) && (retry_count < 2) ){
+		retry_count += 1;
+		if(!connect_card(prv, prv->reader)){
+			continue;
+		}
+		slen = setup_emm_receive_command(prv->sbuf, src, len);
+		memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
+		rlen = B_CAS_BUFFER_MAX;
+
+		ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, slen, &sir, prv->rbuf, &rlen);
+	}
+
+	if( (ret != SCARD_S_SUCCESS) || (rlen < 6) ){
+		return B_CAS_CARD_ERROR_TRANSMIT_FAILED;
+	}
+
+	return 0;
+}
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ private method implementation
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static B_CAS_CARD_PRIVATE_DATA *private_data(void *bcas)
+{
+	B_CAS_CARD_PRIVATE_DATA *r;
+	B_CAS_CARD *p;
+
+	p = (B_CAS_CARD *)bcas;
+	if(p == NULL){
+		return NULL;
+	}
+
+	r = (B_CAS_CARD_PRIVATE_DATA *)(p->private_data);
+	if( ((void *)(r+1)) != ((void *)p) ){
+		return NULL;
+	}
+
+	return r;
+}
+
+static void teardown(B_CAS_CARD_PRIVATE_DATA *prv)
+{
+	if(prv->card != 0){
+		SCardDisconnect(prv->card, SCARD_LEAVE_CARD);
+		prv->card = 0;
+	}
+
+	if(prv->mng != 0){
+		SCardReleaseContext(prv->mng);
+		prv->mng = 0;
+	}
+
+	if(prv->pool != NULL){
+		free(prv->pool);
+		prv->pool = NULL;
+	}
+
+	prv->reader = NULL;
+	prv->sbuf = NULL;
+	prv->rbuf = NULL;
+	prv->id.data = NULL;
+	prv->id_max = 0;
+}
+
+static int change_id_max(B_CAS_CARD_PRIVATE_DATA *prv, int max)
+{
+	int m;
+	int reader_size;
+	int pwctrl_size;
+	
+	uint8_t *p;
+	uint8_t *old_reader;
+	uint8_t *old_pwctrl;
+
+	reader_size = prv->sbuf - prv->pool;
+	pwctrl_size = prv->pwc.count * sizeof(B_CAS_PWR_ON_CTRL);
+
+	m  = reader_size;
+	m += (2*B_CAS_BUFFER_MAX);
+	m += (max*sizeof(int64_t));
+	m += (prv->pwc_max*sizeof(B_CAS_PWR_ON_CTRL));
+	p = (uint8_t *)malloc(m);
+	if(p == NULL){
+		return B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY;
+	}
+
+	old_reader = (uint8_t *)(prv->reader);
+	old_pwctrl = (uint8_t *)(prv->pwc.data);
+
+	prv->reader = (char *)p;
+	prv->sbuf = prv->pool + reader_size;
+	prv->rbuf = prv->sbuf + B_CAS_BUFFER_MAX;
+	prv->id.data = (int64_t *)(prv->rbuf + B_CAS_BUFFER_MAX);
+	prv->id_max = max;
+	prv->pwc.data = (B_CAS_PWR_ON_CTRL *)(prv->id.data + prv->id_max);
+
+	memcpy(prv->reader, old_reader, reader_size);
+	memcpy(prv->pwc.data, old_pwctrl, pwctrl_size);
+	
+	free(prv->pool);
+	prv->pool = p;
+
+	return 0;
+}
+
+static int change_pwc_max(B_CAS_CARD_PRIVATE_DATA *prv, int max)
+{
+	int m;
+	int reader_size;
+	int cardid_size;
+	
+	uint8_t *p;
+	uint8_t *old_reader;
+	uint8_t *old_cardid;
+
+	reader_size = prv->sbuf - prv->pool;
+	cardid_size = prv->id.count * sizeof(int64_t);
+
+	m  = reader_size;
+	m += (2*B_CAS_BUFFER_MAX);
+	m += (prv->id_max*sizeof(int64_t));
+	m += (max*sizeof(B_CAS_PWR_ON_CTRL));
+	p = (uint8_t *)malloc(m);
+	if(p == NULL){
+		return B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY;
+	}
+
+	old_reader = (uint8_t *)(prv->reader);
+	old_cardid = (uint8_t *)(prv->id.data);
+
+	prv->reader = (char *)p;
+	prv->sbuf = prv->pool + reader_size;
+	prv->rbuf = prv->sbuf + B_CAS_BUFFER_MAX;
+	prv->id.data = (int64_t *)(prv->rbuf + B_CAS_BUFFER_MAX);
+	prv->pwc.data = (B_CAS_PWR_ON_CTRL *)(prv->id.data + prv->id_max);
+	prv->pwc_max = max;
+
+	memcpy(prv->reader, old_reader, reader_size);
+	memcpy(prv->id.data, old_cardid, cardid_size);
+	
+	free(prv->pool);
+	prv->pool = p;
+
+	return 0;
+}
+
+static int connect_card(B_CAS_CARD_PRIVATE_DATA *prv, const char *reader_name)
+{
+	int m,n;
+	
+	LONG ret;
+	DWORD rlen,protocol;
+
+	uint8_t *p;
+	
+	SCARD_IO_REQUEST sir;
+
+	if(prv->card != 0){
+		SCardDisconnect(prv->card, SCARD_RESET_CARD);
+		prv->card = 0;
+	}
+
+	ret = SCardConnect(prv->mng, reader_name, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T1, &(prv->card), &protocol);
+	if(ret != SCARD_S_SUCCESS){
+		return 0;
+	}
+
+	m = sizeof(INITIAL_SETTING_CONDITIONS_CMD);
+	memcpy(prv->sbuf, INITIAL_SETTING_CONDITIONS_CMD, m);
+	memcpy(&sir, SCARD_PCI_T1, sizeof(sir));
+	rlen = B_CAS_BUFFER_MAX;
+	ret = SCardTransmit(prv->card, SCARD_PCI_T1, prv->sbuf, m, &sir, prv->rbuf, &rlen);
+	if(ret != SCARD_S_SUCCESS){
+		return 0;
+	}
+
+	if(rlen < 57){
+		return 0;
+	}
+	
+	p = prv->rbuf;
+
+	n = load_be_uint16(p+4);
+	if(n != 0x2100){ // return code missmatch
+		return 0;
+	}
+
+	memcpy(prv->stat.system_key, p+16, 32);
+	memcpy(prv->stat.init_cbc, p+48, 8);
+	prv->stat.bcas_card_id = load_be_uint48(p+8);
+	prv->stat.card_status = load_be_uint16(p+2);
+	prv->stat.ca_system_id = load_be_uint16(p+6);
+
+	return 1;
+}
+
+static void extract_power_on_ctrl_response(B_CAS_PWR_ON_CTRL *dst, uint8_t *src)
+{
+	int referrence;
+	int start;
+	int limit;
+	
+	
+	dst->broadcaster_group_id = src[8];
+	referrence = (src[9]<<8)|src[10];
+	start = referrence - src[11];
+	limit = start + (src[12]-1);
+
+	extract_mjd(&(dst->s_yy), &(dst->s_mm), &(dst->s_dd), start);
+	extract_mjd(&(dst->l_yy), &(dst->l_mm), &(dst->l_dd), limit);
+
+	dst->hold_time = src[13];
+	dst->network_id = (src[14]<<8)|src[15];
+	dst->transport_id = (src[16]<<8)|src[17];
+	
+}
+
+static void extract_mjd(int *yy, int *mm, int *dd, int mjd)
+{
+	int a1,m1;
+	int a2,m2;
+	int a3,m3;
+	int a4,m4;
+	int mw;
+	int dw;
+	int yw;
+
+	mjd -= 51604; // 2000,3/1
+	if(mjd < 0){
+		mjd += 0x10000;
+	}
+
+	a1 = mjd / 146097;
+	m1 = mjd % 146097;
+	a2 = m1 / 36524;
+	m2 = m1 - (a2 * 36524);
+	a3 = m2 / 1461;
+	m3 = m2 - (a3 * 1461);
+	a4 = m3 / 365;
+	if(a4 > 3){
+		a4 = 3;
+	}
+	m4 = m3 - (a4 * 365);
+
+	mw = (1071*m4+450) >> 15;
+	dw = m4 - ((979*mw+16) >> 5);
+
+	yw = a1*400 + a2*100 + a3*4 + a4 + 2000;
+	mw += 3;
+	if(mw > 12){
+		mw -= 12;
+		yw += 1;
+	}
+	dw += 1;
+
+	*yy = yw;
+	*mm = mw;
+	*dd = dw;
+}
+
+static int setup_ecm_receive_command(uint8_t *dst, uint8_t *src, int len)
+{
+	int r;
+	
+	r  = sizeof(ECM_RECEIVE_CMD_HEADER);
+	memcpy(dst+0, ECM_RECEIVE_CMD_HEADER, r);
+	dst[r] = (uint8_t)(len & 0xff);
+	r += 1;
+	memcpy(dst+r, src, len);
+	r += len;
+	dst[r] = 0;
+	r += 1;
+
+	return r;
+}
+
+static int setup_emm_receive_command(uint8_t *dst, uint8_t *src, int len)
+{
+	int r;
+
+	r  = sizeof(EMM_RECEIVE_CMD_HEADER);
+	memcpy(dst+0, EMM_RECEIVE_CMD_HEADER, r);
+	dst[r] = (uint8_t)(len & 0xff);
+	r += 1;
+	memcpy(dst+r, src, len);
+	r += len;
+	dst[r] = 0;
+	r += 1;
+
+	return r;
+}
+
+static int32_t load_be_uint16(uint8_t *p)
+{
+	return ((p[0]<<8)|p[1]);
+}
+
+static int64_t load_be_uint48(uint8_t *p)
+{
+	int i;
+	int64_t r;
+
+	r = p[0];
+	for(i=1;i<6;i++){
+		r <<= 8;
+		r |= p[i];
+	}
+
+	return r;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/b_cas_card.h	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,75 @@
+#ifndef B_CAS_CARD_H
+#define B_CAS_CARD_H
+
+#include "portable.h"
+
+typedef struct {
+	uint8_t  system_key[32];
+	uint8_t  init_cbc[8];
+	int64_t  bcas_card_id;
+	int32_t  card_status;
+	int32_t  ca_system_id;
+} B_CAS_INIT_STATUS;
+
+typedef struct {
+	int64_t *data;
+	int32_t  count;
+} B_CAS_ID;
+
+typedef struct {
+	
+	int32_t  s_yy; /* start date : year  */
+	int32_t  s_mm; /* start date : month */
+	int32_t  s_dd; /* start date : day   */
+	
+	int32_t  l_yy; /* limit date : year  */
+	int32_t  l_mm; /* limit date : month */
+	int32_t  l_dd; /* limit date : day   */
+
+	int32_t  hold_time; /* in hour unit  */
+
+	int32_t  broadcaster_group_id;
+	
+	int32_t  network_id;
+	int32_t  transport_id;
+	
+} B_CAS_PWR_ON_CTRL;
+
+typedef struct {
+	B_CAS_PWR_ON_CTRL *data;
+	int32_t  count;
+} B_CAS_PWR_ON_CTRL_INFO;
+
+typedef struct {
+	uint8_t  scramble_key[16];
+	uint32_t return_code;
+} B_CAS_ECM_RESULT;
+
+typedef struct {
+
+	void *private_data;
+
+	void (* release)(void *bcas);
+
+	int (* init)(void *bcas);
+
+	int (* get_init_status)(void *bcas, B_CAS_INIT_STATUS *stat);
+	int (* get_id)(void *bcas, B_CAS_ID *dst);
+	int (* get_pwr_on_ctrl)(void *bcas, B_CAS_PWR_ON_CTRL_INFO *dst);
+
+	int (* proc_ecm)(void *bcas, B_CAS_ECM_RESULT *dst, uint8_t *src, int len);
+	int (* proc_emm)(void *bcas, uint8_t *src, int len);
+	
+} B_CAS_CARD;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern B_CAS_CARD *create_b_cas_card();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* B_CAS_CARD_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/b_cas_card_error_code.h	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,11 @@
+#ifndef B_CAS_CARD_ERROR_CODE_H
+#define B_CAS_CARD_ERROR_CODE_H
+
+#define B_CAS_CARD_ERROR_INVALID_PARAMETER              -1
+#define B_CAS_CARD_ERROR_NOT_INITIALIZED                -2
+#define B_CAS_CARD_ERROR_NO_SMART_CARD_READER           -3
+#define B_CAS_CARD_ERROR_ALL_READERS_CONNECTION_FAILED  -4
+#define B_CAS_CARD_ERROR_NO_ENOUGH_MEMORY               -5
+#define B_CAS_CARD_ERROR_TRANSMIT_FAILED                -6
+
+#endif /* B_CAS_CARD_ERROR_CODE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/makefile.win	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,33 @@
+CC = cl
+CFLAG = /c /MT /W4 /O2
+LINK = link
+LFLAG = /nologo
+LIBS = winscard.lib
+
+ALL: b25.exe
+
+arib_std_b25.obj: arib_std_b25.c arib_std_b25.h portable.h b_cas_card.h arib_std_b25_error_code.h multi2.h ts_section_parser.h ts_common_types.h 
+	$(CC) $(CFLAG) arib_std_b25.c
+
+b_cas_card.obj: b_cas_card.c b_cas_card.h portable.h b_cas_card_error_code.h 
+	$(CC) $(CFLAG) b_cas_card.c
+
+multi2.obj: multi2.c multi2.h portable.h multi2_error_code.h 
+	$(CC) $(CFLAG) multi2.c
+
+td.obj: td.c arib_std_b25.h portable.h b_cas_card.h 
+	$(CC) $(CFLAG) td.c
+
+ts_section_parser.obj: ts_section_parser.c ts_section_parser.h ts_common_types.h portable.h ts_section_parser_error_code.h 
+	$(CC) $(CFLAG) ts_section_parser.c
+
+OBJ = arib_std_b25.obj b_cas_card.obj multi2.obj td.obj ts_section_parser.obj 
+
+b25.exe: $(OBJ)
+	$(LINK) $(LFLAG) $(LIBS) /OUT:b25.exe $(OBJ)
+
+clean:
+	DEL *.obj
+	DEL *.exe
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/multi2.c	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,527 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "multi2.h"
+#include "multi2_error_code.h"
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ inline functions
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static __inline uint8_t *load_be_uint32(uint32_t *dst, uint8_t *src)
+{
+	*dst = ((src[0]<<24)|(src[1]<<16)|(src[2]<<8)|src[3]);
+	return src+4;
+}
+
+static __inline uint8_t *save_be_uint32(uint8_t *dst, uint32_t src)
+{
+	dst[0] = (uint8_t)((src>>24) & 0xff);
+	dst[1] = (uint8_t)((src>>16) & 0xff);
+	dst[2] = (uint8_t)((src>> 8) & 0xff);
+	dst[3] = (uint8_t)( src      & 0xff);
+	return dst+4;
+}
+
+static __inline uint32_t left_rotate_uint32(uint32_t val, uint32_t count)
+{
+	return ((val << count) | (val >> (32-count)));
+}
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ inner structures
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+typedef struct {
+	uint32_t key[8];
+} CORE_PARAM;
+
+typedef struct {
+	uint32_t l;
+	uint32_t r;
+} CORE_DATA;
+
+typedef struct {
+
+	int32_t    ref_count;
+
+	CORE_DATA  cbc_init;
+	
+	CORE_PARAM sys;
+	CORE_DATA  scr[2]; /* 0: odd, 1: even */
+	CORE_PARAM wrk[2]; /* 0: odd, 1: even */
+
+	uint32_t   round;
+	uint32_t   state;
+	
+} MULTI2_PRIVATE_DATA;
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ constant values
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+#define MULTI2_STATE_CBC_INIT_SET     (0x0001)
+#define MULTI2_STATE_SYSTEM_KEY_SET   (0x0002)
+#define MULTI2_STATE_SCRAMBLE_KEY_SET (0x0004)
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ function prottypes (interface method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static void release_multi2(void *m2);
+static int add_ref_multi2(void *m2);
+static int set_round_multi2(void *m2, int32_t val);
+static int set_system_key_multi2(void *m2, uint8_t *val);
+static int set_init_cbc_multi2(void *m2, uint8_t *val);
+static int set_scramble_key_multi2(void *m2, uint8_t *val);
+static int clear_scramble_key_multi2(void *m2);
+static int encrypt_multi2(void *m2, int32_t type, uint8_t *buf, int32_t size);
+static int decrypt_multi2(void *m2, int32_t type, uint8_t *buf, int32_t size);
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ global function implementation
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+MULTI2 *create_multi2()
+{
+	int n;
+	
+	MULTI2 *r;
+	MULTI2_PRIVATE_DATA *prv;
+
+	n  = sizeof(MULTI2_PRIVATE_DATA);
+	n += sizeof(MULTI2);
+	
+	prv = (MULTI2_PRIVATE_DATA *)calloc(1, n);
+	if(prv == NULL){
+		return NULL;
+	}
+
+	r = (MULTI2 *)(prv+1);
+	r->private_data = prv;
+
+	prv->ref_count = 1;
+	prv->round = 4;
+
+	r->release = release_multi2;
+	r->add_ref = add_ref_multi2;
+	r->set_round = set_round_multi2;
+	r->set_system_key = set_system_key_multi2;
+	r->set_init_cbc = set_init_cbc_multi2;
+	r->set_scramble_key = set_scramble_key_multi2;
+	r->clear_scramble_key = clear_scramble_key_multi2;
+	r->encrypt = encrypt_multi2;
+	r->decrypt = decrypt_multi2;
+
+	return r;
+}
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ function prottypes (private method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static MULTI2_PRIVATE_DATA *private_data(void *m2);
+
+static void core_schedule(CORE_PARAM *work, CORE_PARAM *skey, CORE_DATA *dkey);
+
+static void core_encrypt(CORE_DATA *dst, CORE_DATA *src, CORE_PARAM *w, int32_t round);
+static void core_decrypt(CORE_DATA *dst, CORE_DATA *src, CORE_PARAM *w, int32_t round);
+
+static void core_pi1(CORE_DATA *dst, CORE_DATA *src);
+static void core_pi2(CORE_DATA *dst, CORE_DATA *src, uint32_t a);
+static void core_pi3(CORE_DATA *dst, CORE_DATA *src, uint32_t a, uint32_t b);
+static void core_pi4(CORE_DATA *dst, CORE_DATA *src, uint32_t a);
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ interface method implementation
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static void release_multi2(void *m2)
+{
+	MULTI2_PRIVATE_DATA *prv;
+
+	prv = private_data(m2);
+	if(prv == NULL){
+		/* do nothing */
+		return;
+	}
+
+	prv->ref_count -= 1;
+	if(prv->ref_count == 0){
+		free(prv);
+	}
+}
+
+static int add_ref_multi2(void *m2)
+{
+	MULTI2_PRIVATE_DATA *prv;
+
+	prv = private_data(m2);
+	if(prv == NULL){
+		return MULTI2_ERROR_INVALID_PARAMETER;
+	}
+
+	prv->ref_count += 1;
+
+	return 0;
+}
+
+static int set_round_multi2(void *m2, int32_t val)
+{
+	MULTI2_PRIVATE_DATA *prv;
+
+	prv = private_data(m2);
+	if(prv == NULL){
+		/* do nothing */
+		return MULTI2_ERROR_INVALID_PARAMETER;
+	}
+
+	prv->round = val;
+
+	return 0;
+}
+
+static int set_system_key_multi2(void *m2, uint8_t *val)
+{
+	int i;
+	uint8_t *p;
+	
+	MULTI2_PRIVATE_DATA *prv;
+
+	prv = private_data(m2);
+	if( (prv == NULL) || (val == NULL) ){
+		return MULTI2_ERROR_INVALID_PARAMETER;
+	}
+
+	p = val;
+	for(i=0;i<8;i++){
+		p = load_be_uint32(prv->sys.key+i, p);
+	}
+
+	prv->state |= MULTI2_STATE_SYSTEM_KEY_SET;
+
+	return 0;
+}
+
+static int set_init_cbc_multi2(void *m2, uint8_t *val)
+{
+	uint8_t *p;
+	
+	MULTI2_PRIVATE_DATA *prv;
+
+	prv = private_data(m2);
+	if( (prv == NULL) || (val == NULL) ){
+		return MULTI2_ERROR_INVALID_PARAMETER;
+	}
+
+	p = val;
+
+	p = load_be_uint32(&(prv->cbc_init.l), p);
+	p = load_be_uint32(&(prv->cbc_init.r), p);
+
+	prv->state |= MULTI2_STATE_CBC_INIT_SET;
+
+	return 0;
+}
+
+static int set_scramble_key_multi2(void *m2, uint8_t *val)
+{
+	uint8_t *p;
+	
+	MULTI2_PRIVATE_DATA *prv;
+
+	prv = private_data(m2);
+	if( (prv == NULL) || (val == NULL) ){
+		return MULTI2_ERROR_INVALID_PARAMETER;
+	}
+
+	p = val;
+
+	p = load_be_uint32(&(prv->scr[0].l), p);
+	p = load_be_uint32(&(prv->scr[0].r), p);
+	p = load_be_uint32(&(prv->scr[1].l), p);
+	p = load_be_uint32(&(prv->scr[1].r), p);
+	
+	core_schedule(prv->wrk+0, &(prv->sys), prv->scr+0);
+	core_schedule(prv->wrk+1, &(prv->sys), prv->scr+1);
+
+	prv->state |= MULTI2_STATE_SCRAMBLE_KEY_SET;
+
+	return 0;
+}
+
+static int clear_scramble_key_multi2(void *m2)
+{
+	MULTI2_PRIVATE_DATA *prv;
+
+	prv = private_data(m2);
+	if(prv == NULL){
+		return MULTI2_ERROR_INVALID_PARAMETER;
+	}
+
+	memset(prv->scr, 0, sizeof(prv->scr));
+	memset(prv->wrk, 0, sizeof(prv->wrk));
+
+	prv->state &= (~MULTI2_STATE_SCRAMBLE_KEY_SET);
+
+	return 0;
+}
+
+static int encrypt_multi2(void *m2, int32_t type, uint8_t *buf, int32_t size)
+{
+	CORE_DATA src,dst;
+	CORE_PARAM *prm;
+
+	uint8_t *p;
+
+	MULTI2_PRIVATE_DATA *prv;
+
+	prv = private_data(m2);
+	if( (prv == NULL) || (buf == NULL) || (size < 1) ){
+		return MULTI2_ERROR_INVALID_PARAMETER;
+	}
+
+	if(prv->state != (MULTI2_STATE_CBC_INIT_SET|MULTI2_STATE_SYSTEM_KEY_SET|MULTI2_STATE_SCRAMBLE_KEY_SET)){
+		if( (prv->state & MULTI2_STATE_CBC_INIT_SET) == 0 ){
+			return MULTI2_ERROR_UNSET_CBC_INIT;
+		}
+		if( (prv->state & MULTI2_STATE_SYSTEM_KEY_SET) == 0 ){
+			return MULTI2_ERROR_UNSET_SYSTEM_KEY;
+		}
+		if( (prv->state & MULTI2_STATE_SCRAMBLE_KEY_SET) == 0 ){
+			return MULTI2_ERROR_UNSET_SCRAMBLE_KEY;
+		}
+	}
+	
+	if(type == 0x02){
+		prm = prv->wrk+1;
+	}else{
+		prm = prv->wrk+0;
+	}
+
+	dst.l = prv->cbc_init.l;
+	dst.r = prv->cbc_init.r;
+
+	p = buf;
+	while(size >= 8){
+		load_be_uint32(&(src.l), p+0);
+		load_be_uint32(&(src.r), p+4);
+		src.l = src.l ^ dst.l;
+		src.r = src.r ^ dst.r;
+		core_encrypt(&dst, &src, prm, prv->round);
+		p = save_be_uint32(p, dst.l);
+		p = save_be_uint32(p, dst.r);
+		size -= 8;
+	}
+
+	if(size > 0){
+		int i;
+		uint8_t tmp[8];
+		
+		src.l = dst.l;
+		src.r = dst.r;
+		core_encrypt(&dst, &src, prm, prv->round);
+		save_be_uint32(tmp+0, dst.l);
+		save_be_uint32(tmp+4, dst.r);
+
+		for(i=0;i<size;i++){
+			p[i] = (uint8_t)(p[i] ^ tmp[i]);
+		}
+	}
+
+	return 0;
+}
+
+static int decrypt_multi2(void *m2, int32_t type, uint8_t *buf, int32_t size)
+{
+	CORE_DATA src,dst,cbc;
+	CORE_PARAM *prm;
+
+	uint8_t *p;
+
+	MULTI2_PRIVATE_DATA *prv;
+
+	prv = private_data(m2);
+	if( (prv == NULL) || (buf == NULL) || (size < 1) ){
+		return MULTI2_ERROR_INVALID_PARAMETER;
+	}
+
+	if(prv->state != (MULTI2_STATE_CBC_INIT_SET|MULTI2_STATE_SYSTEM_KEY_SET|MULTI2_STATE_SCRAMBLE_KEY_SET)){
+		if( (prv->state & MULTI2_STATE_CBC_INIT_SET) == 0 ){
+			return MULTI2_ERROR_UNSET_CBC_INIT;
+		}
+		if( (prv->state & MULTI2_STATE_SYSTEM_KEY_SET) == 0 ){
+			return MULTI2_ERROR_UNSET_SYSTEM_KEY;
+		}
+		if( (prv->state & MULTI2_STATE_SCRAMBLE_KEY_SET) == 0 ){
+			return MULTI2_ERROR_UNSET_SCRAMBLE_KEY;
+		}
+	}
+	
+	if(type == 0x02){
+		prm = prv->wrk+1;
+	}else{
+		prm = prv->wrk+0;
+	}
+
+	cbc.l = prv->cbc_init.l;
+	cbc.r = prv->cbc_init.r;
+
+	p = buf;
+	while(size >= 8){
+		load_be_uint32(&(src.l), p+0);
+		load_be_uint32(&(src.r), p+4);
+		core_decrypt(&dst, &src, prm, prv->round);
+		dst.l = dst.l ^ cbc.l;
+		dst.r = dst.r ^ cbc.r;
+		cbc.l = src.l;
+		cbc.r = src.r;
+		p = save_be_uint32(p, dst.l);
+		p = save_be_uint32(p, dst.r);
+		size -= 8;
+	}
+
+	if(size > 0){
+		int i;
+		uint8_t tmp[8];
+		
+		core_encrypt(&dst, &cbc, prm, prv->round);
+		save_be_uint32(tmp+0, dst.l);
+		save_be_uint32(tmp+4, dst.r);
+
+		for(i=0;i<size;i++){
+			p[i] = (uint8_t)(p[i] ^ tmp[i]);
+		}
+	}
+
+	return 0;
+}
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ private method implementation
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static MULTI2_PRIVATE_DATA *private_data(void *m2)
+{
+	MULTI2_PRIVATE_DATA *r;
+	MULTI2 *p;
+
+	p = (MULTI2 *)m2;
+	if(p == NULL){
+		return NULL;
+	}
+
+	r = (MULTI2_PRIVATE_DATA *)(p->private_data);
+	if( ((void *)(r+1)) != ((void *)p) ){
+		return NULL;
+	}
+
+	return r;
+}
+
+static void core_schedule(CORE_PARAM *work, CORE_PARAM *skey, CORE_DATA *dkey)
+{
+	CORE_DATA b1,b2,b3,b4,b5,b6,b7,b8,b9;
+
+	core_pi1(&b1, dkey);
+	
+	core_pi2(&b2, &b1, skey->key[0]);
+	work->key[0] = b2.l;
+	
+	core_pi3(&b3, &b2, skey->key[1], skey->key[2]);
+	work->key[1] = b3.r;
+	
+	core_pi4(&b4, &b3, skey->key[3]);
+	work->key[2] = b4.l;
+
+	core_pi1(&b5, &b4);
+	work->key[3] = b5.r;
+
+	core_pi2(&b6, &b5, skey->key[4]);
+	work->key[4] = b6.l;
+
+	core_pi3(&b7, &b6, skey->key[5], skey->key[6]);
+	work->key[5] = b7.r;
+
+	core_pi4(&b8, &b7, skey->key[7]);
+	work->key[6] = b8.l;
+
+	core_pi1(&b9, &b8);
+	work->key[7] = b9.r;
+}
+
+static void core_encrypt(CORE_DATA *dst, CORE_DATA *src, CORE_PARAM *w, int32_t round)
+{
+	int32_t i;
+	
+	CORE_DATA tmp;
+	
+	dst->l = src->l;
+	dst->r = src->r;
+	for(i=0;i<round;i++){
+		core_pi1(&tmp,  dst);
+		core_pi2( dst, &tmp, w->key[0]);
+		core_pi3(&tmp,  dst, w->key[1], w->key[2]);
+		core_pi4( dst, &tmp, w->key[3]);
+		core_pi1(&tmp,  dst);
+		core_pi2( dst, &tmp, w->key[4]);
+		core_pi3(&tmp,  dst, w->key[5], w->key[6]);
+		core_pi4( dst, &tmp, w->key[7]);
+	}
+}
+
+static void core_decrypt(CORE_DATA *dst, CORE_DATA *src, CORE_PARAM *w, int32_t round)
+{
+	int32_t i;
+	
+	CORE_DATA tmp;
+
+	dst->l = src->l;
+	dst->r = src->r;
+	for(i=0;i<round;i++){
+		core_pi4(&tmp,  dst, w->key[7]);
+		core_pi3( dst, &tmp, w->key[5], w->key[6]);
+		core_pi2(&tmp,  dst, w->key[4]);
+		core_pi1( dst, &tmp);
+		core_pi4(&tmp,  dst, w->key[3]);
+		core_pi3( dst, &tmp, w->key[1], w->key[2]);
+		core_pi2(&tmp,  dst, w->key[0]);
+		core_pi1( dst, &tmp);
+	}
+}
+
+static void core_pi1(CORE_DATA *dst, CORE_DATA *src)
+{
+	dst->l = src->l;
+	dst->r = src->r ^ src->l;
+}
+
+static void core_pi2(CORE_DATA *dst, CORE_DATA *src, uint32_t a)
+{
+	uint32_t t0,t1,t2;
+
+	t0 = src->r + a;
+	t1 = left_rotate_uint32(t0, 1) + t0 - 1;
+	t2 = left_rotate_uint32(t1, 4) ^ t1;
+
+	dst->l = src->l ^ t2;
+	dst->r = src->r;
+}
+
+static void core_pi3(CORE_DATA *dst, CORE_DATA *src, uint32_t a, uint32_t b)
+{
+	uint32_t t0,t1,t2,t3,t4,t5;
+
+	t0 = src->l + a;
+	t1 = left_rotate_uint32(t0, 2) + t0 + 1;
+	t2 = left_rotate_uint32(t1, 8) ^ t1;
+	t3 = t2 + b;
+	t4 = left_rotate_uint32(t3, 1) - t3;
+	t5 = left_rotate_uint32(t4, 16) ^ (t4 | src->l);
+
+	dst->l = src->l;
+	dst->r = src->r ^ t5;
+}
+
+static void core_pi4(CORE_DATA *dst, CORE_DATA *src, uint32_t a)
+{
+	uint32_t t0,t1;
+
+	t0 = src->r + a;
+	t1 = left_rotate_uint32(t0, 2) + t0 + 1;
+
+	dst->l = src->l ^ t1;
+	dst->r = src->r;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/multi2.h	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,35 @@
+#ifndef MULTI2_H
+#define MULTI2_H
+
+#include "portable.h"
+
+typedef struct {
+
+	void *private_data;
+
+	void (* release)(void *m2);
+	int (* add_ref)(void *m2);
+
+	int (* set_round)(void *m2, int32_t val);
+
+	int (* set_system_key)(void *m2, uint8_t *val);
+	int (* set_init_cbc)(void *m2, uint8_t *val);
+	int (* set_scramble_key)(void *m2, uint8_t *val);
+	int (* clear_scramble_key)(void *m2);
+
+	int (* encrypt)(void *m2, int32_t type, uint8_t *buf, int32_t size);
+	int (* decrypt)(void *m2, int32_t type, uint8_t *buf, int32_t size);
+
+} MULTI2;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern MULTI2 *create_multi2();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTI2_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/multi2_error_code.h	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,9 @@
+#ifndef MULTI2_ERROR_CODE_H
+#define MULTI2_ERROR_CODE_H
+
+#define MULTI2_ERROR_INVALID_PARAMETER       -1
+#define MULTI2_ERROR_UNSET_SYSTEM_KEY        -2
+#define MULTI2_ERROR_UNSET_CBC_INIT          -3
+#define MULTI2_ERROR_UNSET_SCRAMBLE_KEY      -4
+
+#endif /* MULTI2_ERROR_CODE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/portable.h	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,38 @@
+#ifndef PORTABLE_H
+#define PORTABLE_H
+
+#if (defined(WIN32) && MSC_VER < 1300) 
+
+typedef unsigned char     uint8_t;
+typedef   signed char      int8_t;
+typedef unsigned short   uint16_t;
+typedef   signed short    int16_t;
+typedef unsigned int     uint32_t;
+typedef   signed int      int32_t;
+typedef unsigned __int64 uint64_t;
+typedef   signed __int64  int64_t;
+
+#else
+
+#include <inttypes.h>
+
+#endif
+
+#if !defined(WIN32)
+	#define _open  open
+	#define _close close
+	#define _read  read
+	#define _write write
+	#define _lseeki64 lseek
+	#define _telli64(fd)  (lseek(fd,0,SEEK_CUR))
+	#define _O_BINARY     (0)
+	#define _O_RDONLY     (O_RDONLY)
+	#define _O_WRONLY     (O_WRONLY)
+	#define _O_SEQUENTIAL (0)
+	#define _O_CREAT      (O_CREAT)
+	#define _O_TRUNC      (O_TRUNC)
+	#define _S_IREAD      (S_IRUSR|S_IRGRP|S_IROTH)
+	#define _S_IWRITE     (S_IWUSR|S_IWGRP|S_IWOTH)
+#endif
+
+#endif /* PORTABLE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/td.c	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,381 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#if defined(WIN32)
+	#include <io.h>
+	#include <windows.h>
+	#include <crtdbg.h>
+#else
+	#define __STDC_FORMAT_MACROS
+	#include <inttypes.h>
+	#include <unistd.h>
+#endif
+
+#include "arib_std_b25.h"
+#include "b_cas_card.h"
+
+typedef struct {
+	int32_t round;
+	int32_t strip;
+	int32_t emm;
+	int32_t verbose;
+	int32_t power_ctrl;
+} OPTION;
+
+static void show_usage();
+static int parse_arg(OPTION *dst, int argc, char **argv);
+static void test_arib_std_b25(const char *src, const char *dst, OPTION *opt);
+static void show_bcas_power_on_control_info(B_CAS_CARD *bcas);
+
+int main(int argc, char **argv)
+{
+	int n;
+	OPTION opt;
+	
+	#if defined(WIN32)
+	_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
+	_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
+	_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
+	_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
+	_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
+	_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
+	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_DELAY_FREE_MEM_DF|_CRTDBG_CHECK_ALWAYS_DF|_CRTDBG_LEAK_CHECK_DF);
+	#endif
+
+	n = parse_arg(&opt, argc, argv);
+	if(n+2 > argc){
+		show_usage();
+		exit(EXIT_FAILURE);
+	}
+
+	test_arib_std_b25(argv[n+0], argv[n+1], &opt);
+
+	#if defined(WIN32)
+	_CrtDumpMemoryLeaks();
+	#endif
+
+	return EXIT_SUCCESS;
+}
+
+static void show_usage()
+{
+	fprintf(stderr, "b25 - ARIB STD-B25 test program ver. 0.2.3 (2008, 12/30)\n");
+	fprintf(stderr, "usage: b25 [options] src.m2t dst.m2t\n");
+	fprintf(stderr, "options:\n");
+	fprintf(stderr, "  -r round (integer, default=4)\n");
+	fprintf(stderr, "  -s strip\n");
+	fprintf(stderr, "     0: keep null(padding) stream (default)\n");
+	fprintf(stderr, "     1: strip null stream\n");
+	fprintf(stderr, "  -m EMM\n");
+	fprintf(stderr, "     0: ignore EMM (default)\n");
+	fprintf(stderr, "     1: send EMM to B-CAS card\n");
+	fprintf(stderr, "  -p power_on_control_info\n");
+	fprintf(stderr, "     0: do nothing additionaly\n");
+	fprintf(stderr, "     1: show B-CAS EMM receiving request (default)\n");
+	fprintf(stderr, "  -v verbose\n");
+	fprintf(stderr, "     0: silent\n");
+	fprintf(stderr, "     1: show processing status (default)\n");
+	fprintf(stderr, "\n");
+}
+
+static int parse_arg(OPTION *dst, int argc, char **argv)
+{
+	int i;
+	
+	dst->round = 4;
+	dst->strip = 0;
+	dst->emm = 0;
+	dst->power_ctrl = 1;
+	dst->verbose = 1;
+
+	for(i=1;i<argc;i++){
+		if(argv[i][0] != '-'){
+			break;
+		}
+		switch(argv[i][1]){
+		case 'm':
+			if(argv[i][2]){
+				dst->emm = atoi(argv[i]+2);
+			}else{
+				dst->emm = atoi(argv[i+1]);
+				i += 1;
+			}
+			break;
+		case 'p':
+			if(argv[i][2]){
+				dst->power_ctrl = atoi(argv[i]+2);
+			}else{
+				dst->power_ctrl = atoi(argv[i+1]);
+				i += 1;
+			}
+			break;
+		case 'r':
+			if(argv[i][2]){
+				dst->round = atoi(argv[i]+2);
+			}else{
+				dst->round = atoi(argv[i+1]);
+				i += 1;
+			}
+			break;
+		case 's':
+			if(argv[i][2]){
+				dst->strip = atoi(argv[i]+2);
+			}else{
+				dst->strip = atoi(argv[i+1]);
+				i += 1;
+			}
+			break;
+		case 'v':
+			if(argv[i][2]){
+				dst->verbose = atoi(argv[i]+2);
+			}else{
+				dst->verbose = atoi(argv[i+1]);
+				i += 1;
+			}
+			break;
+		default:
+			fprintf(stderr, "error - unknown option '-%c'\n", argv[i][1]);
+			return argc;
+		}
+	}
+
+	return i;
+}
+
+static void test_arib_std_b25(const char *src, const char *dst, OPTION *opt)
+{
+	int code,i,n,m;
+	int sfd,dfd;
+
+	int64_t total;
+	int64_t offset;
+
+	ARIB_STD_B25 *b25;
+	B_CAS_CARD   *bcas;
+
+	ARIB_STD_B25_PROGRAM_INFO pgrm;
+
+	uint8_t data[8*1024];
+
+	ARIB_STD_B25_BUFFER sbuf;
+	ARIB_STD_B25_BUFFER dbuf;
+
+	sfd = -1;
+	dfd = -1;
+	b25 = NULL;
+	bcas = NULL;
+
+	sfd = _open(src, _O_BINARY|_O_RDONLY|_O_SEQUENTIAL);
+	if(sfd < 0){
+		fprintf(stderr, "error - failed on _open(%s) [src]\n", src);
+		goto LAST;
+	}
+	
+	_lseeki64(sfd, 0, SEEK_END);
+	total = _telli64(sfd);
+	_lseeki64(sfd, 0, SEEK_SET);
+
+	b25 = create_arib_std_b25();
+	if(b25 == NULL){
+		fprintf(stderr, "error - failed on create_arib_std_b25()\n");
+		goto LAST;
+	}
+
+	code = b25->set_multi2_round(b25, opt->round);
+	if(code < 0){
+		fprintf(stderr, "error - failed on ARIB_STD_B25::set_multi2_round() : code=%d\n", code);
+		goto LAST;
+	}
+
+	code = b25->set_strip(b25, opt->strip);
+	if(code < 0){
+		fprintf(stderr, "error - failed on ARIB_STD_B25::set_strip() : code=%d\n", code);
+		goto LAST;
+	}
+
+	code = b25->set_emm_proc(b25, opt->emm);
+	if(code < 0){
+		fprintf(stderr, "error - failed on ARIB_STD_B25::set_emm_proc() : code=%d\n", code);
+		goto LAST;
+	}
+
+	bcas = create_b_cas_card();
+	if(bcas == NULL){
+		fprintf(stderr, "error - failed on create_b_cas_card()\n");
+		goto LAST;
+	}
+
+	code = bcas->init(bcas);
+	if(code < 0){
+		fprintf(stderr, "error - failed on B_CAS_CARD::init() : code=%d\n", code);
+		goto LAST;
+	}
+
+	code = b25->set_b_cas_card(b25, bcas);
+	if(code < 0){
+		fprintf(stderr, "error - failed on ARIB_STD_B25::set_b_cas_card() : code=%d\n", code);
+		goto LAST;
+	}
+
+	dfd = _open(dst, _O_BINARY|_O_WRONLY|_O_SEQUENTIAL|_O_CREAT|_O_TRUNC, _S_IREAD|_S_IWRITE);
+	if(dfd < 0){
+		fprintf(stderr, "error - failed on _open(%s) [dst]\n", dst);
+		goto LAST;
+	}
+
+	offset = 0;
+	while( (n = _read(sfd, data, sizeof(data))) > 0 ){
+		sbuf.data = data;
+		sbuf.size = n;
+
+		code = b25->put(b25, &sbuf);
+		if(code < 0){
+			fprintf(stderr, "error - failed on ARIB_STD_B25::put() : code=%d\n", code);
+			goto LAST;
+		}
+
+		code = b25->get(b25, &dbuf);
+		if(code < 0){
+			fprintf(stderr, "error - failed on ARIB_STD_B25::get() : code=%d\n", code);
+			goto LAST;
+		}
+
+		if(dbuf.size > 0){
+			n = _write(dfd, dbuf.data, dbuf.size);
+			if(n != dbuf.size){
+				fprintf(stderr, "error failed on _write(%d)\n", dbuf.size);
+				goto LAST;
+			}
+		}
+		
+		offset += sbuf.size;
+		if(opt->verbose != 0){
+			m = (int)(10000*offset/total);
+			fprintf(stderr, "\rprocessing: %2d.%02d%% ", m/100, m%100);
+		}
+	}
+
+	code = b25->flush(b25);
+	if(code < 0){
+		fprintf(stderr, "error - failed on ARIB_STD_B25::flush() : code=%d\n", code);
+		goto LAST;
+	}
+	
+	code = b25->get(b25, &dbuf);
+	if(code < 0){
+		fprintf(stderr, "error - failed on ARIB_STD_B25::get() : code=%d\n", code);
+		goto LAST;
+	}
+
+	if(dbuf.size > 0){
+		n = _write(dfd, dbuf.data, dbuf.size);
+		if(n != dbuf.size){
+			fprintf(stderr, "error - failed on _write(%d)\n", dbuf.size);
+			goto LAST;
+		}
+	}
+
+	if(opt->verbose != 0){
+		fprintf(stderr, "\rprocessing: finish  \n");
+		fflush(stderr);
+		fflush(stdout);
+	}
+
+	n = b25->get_program_count(b25);
+	if(n < 0){
+		fprintf(stderr, "error - failed on ARIB_STD_B25::get_program_count() : code=%d\n", code);
+		goto LAST;
+	}
+	for(i=0;i<n;i++){
+		code = b25->get_program_info(b25, &pgrm, i);
+		if(code < 0){
+			fprintf(stderr, "error - failed on ARIB_STD_B25::get_program_info(%d) : code=%d\n", i, code);
+			goto LAST;
+		}
+		if(pgrm.ecm_unpurchased_count > 0){
+			fprintf(stderr, "warning - unpurchased ECM is detected\n");
+			fprintf(stderr, "  channel:               %d\n", pgrm.program_number);
+			fprintf(stderr, "  unpurchased ECM count: %d\n", pgrm.ecm_unpurchased_count);
+			fprintf(stderr, "  last ECM error code:   %04x\n", pgrm.last_ecm_error_code);
+			#if defined(WIN32)
+			fprintf(stderr, "  undecrypted TS packet: %d\n", pgrm.undecrypted_packet_count);
+			fprintf(stderr, "  total TS packet:       %d\n", pgrm.total_packet_count);
+			#else
+			fprintf(stderr, "  undecrypted TS packet: %"PRId64"\n", pgrm.undecrypted_packet_count);
+			fprintf(stderr, "  total TS packet:       %"PRId64"\n", pgrm.total_packet_count);
+			#endif
+		}
+	}
+
+	if(opt->power_ctrl != 0){
+		show_bcas_power_on_control_info(bcas);
+	}
+
+LAST:
+
+	if(sfd >= 0){
+		_close(sfd);
+		sfd = -1;
+	}
+
+	if(dfd >= 0){
+		_close(dfd);
+		dfd = -1;
+	}
+
+	if(b25 != NULL){
+		b25->release(b25);
+		b25 = NULL;
+	}
+
+	if(bcas != NULL){
+		bcas->release(bcas);
+		bcas = NULL;
+	}
+}
+
+static void show_bcas_power_on_control_info(B_CAS_CARD *bcas)
+{
+	int code;
+	int i,w;
+	B_CAS_PWR_ON_CTRL_INFO pwc;
+
+	code = bcas->get_pwr_on_ctrl(bcas, &pwc);
+	if(code < 0){
+		fprintf(stderr, "error - failed on B_CAS_CARD::get_pwr_on_ctrl() : code=%d\n", code);
+		return;
+	}
+
+	if(pwc.count == 0){
+		fprintf(stdout, "no EMM receiving request\n");
+		return;
+	}
+
+	fprintf(stdout, "total %d EMM receiving request\n", pwc.count);
+	for(i=0;i<pwc.count;i++){
+		fprintf(stdout, "+ [%d] : tune ", i);
+		switch(pwc.data[i].network_id){
+		case 4:
+			w = pwc.data[i].transport_id;
+			fprintf(stdout, "BS-%d/TS-%d ", ((w >> 4) & 0x1f), (w & 7));
+			break;
+		case 6:
+		case 7:
+			w = pwc.data[i].transport_id;
+			fprintf(stdout, "ND-%d/TS-%d ", ((w >> 4) & 0x1f), (w & 7));
+			break;
+		default:
+			fprintf(stdout, "unknown(b:0x%02x,n:0x%04x,t:0x%04x) ", pwc.data[i].broadcaster_group_id, pwc.data[i].network_id, pwc.data[i].transport_id);
+			break;
+		}
+		fprintf(stdout, "between %04d %02d/%02d ", pwc.data[i].s_yy, pwc.data[i].s_mm, pwc.data[i].s_dd);
+		fprintf(stdout, "to %04d %02d/%02d ", pwc.data[i].l_yy, pwc.data[i].l_mm, pwc.data[i].l_dd);
+		fprintf(stdout, "least %d hours\n", pwc.data[i].hold_time);
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/ts_common_types.h	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,36 @@
+#ifndef TS_COMMON_TYPES_H
+#define TS_COMMON_TYPES_H
+
+#include "portable.h"
+
+typedef struct {
+	int32_t           sync;                           /*  0- 7 :  8 bits */
+	int32_t           transport_error_indicator;      /*  8- 8 :  1 bit  */
+	int32_t           payload_unit_start_indicator;   /*  9- 9 :  1 bit  */
+	int32_t           transport_priority;             /* 10-10 :  1 bits */
+	int32_t           pid;                            /* 11-23 : 13 bits */
+	int32_t           transport_scrambling_control;   /* 24-25 :  2 bits */
+	int32_t           adaptation_field_control;       /* 26-27 :  2 bits */
+	int32_t           continuity_counter;             /* 28-31 :  4 bits */
+} TS_HEADER;
+
+typedef struct {
+	int32_t           table_id;                       /*  0- 7 :  8 bits */
+	int32_t           section_syntax_indicator;       /*  8- 8 :  1 bit  */
+	int32_t           private_indicator;              /*  9- 9 :  1 bit  */
+	int32_t           section_length;                 /* 12-23 : 12 bits */
+	int32_t           table_id_extension;             /* 24-39 : 16 bits */
+	int32_t           version_number;                 /* 42-46 :  5 bits */
+	int32_t           current_next_indicator;         /* 47-57 :  1 bit  */
+	int32_t           section_number;                 /* 48-55 :  8 bits */
+	int32_t           last_section_number;            /* 56-63 :  8 bits */
+} TS_SECTION_HEADER;
+
+typedef struct {
+	TS_SECTION_HEADER  hdr;
+	uint8_t           *raw;
+	uint8_t           *data;
+	uint8_t           *tail;
+} TS_SECTION;
+
+#endif /* TS_COMMON_TYPES_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/ts_section_parser.c	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,802 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "ts_section_parser.h"
+#include "ts_section_parser_error_code.h"
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ inner structures
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+typedef struct {
+	void                   *prev;
+	void                   *next;
+	TS_SECTION              sect;
+	int32_t                 ref;
+} TS_SECTION_ELEM;
+
+typedef struct {
+	TS_SECTION_ELEM        *head;
+	TS_SECTION_ELEM        *tail;
+	int32_t                 count;
+} TS_SECTION_LIST;
+
+typedef struct {
+
+	int32_t                 pid;
+
+	TS_SECTION_ELEM        *work;
+	TS_SECTION_ELEM        *last;
+
+	TS_SECTION_LIST         pool;
+	TS_SECTION_LIST         buff;
+
+	TS_SECTION_PARSER_STAT  stat;
+	
+} TS_SECTION_PARSER_PRIVATE_DATA;
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ constant values
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+#define MAX_RAW_SECTION_SIZE 4100
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ function prottypes (interface method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static void release_ts_section_parser(void *parser);
+static int reset_ts_section_parser(void *parser);
+static int put_ts_section_parser(void *parser, TS_HEADER *hdr, uint8_t *data, int size);
+static int get_ts_section_parser(void *parser, TS_SECTION *sect);
+static int ret_ts_section_parser(void *parser, TS_SECTION *sect);
+static int get_count_ts_section_parser(void *parser);
+static int get_stat_ts_section_parser(void *parser, TS_SECTION_PARSER_STAT *stat);
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ global function implementation (factory method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+TS_SECTION_PARSER *create_ts_section_parser()
+{
+	TS_SECTION_PARSER *r;
+	TS_SECTION_PARSER_PRIVATE_DATA *prv;
+
+	int n;
+
+	n  = sizeof(TS_SECTION_PARSER_PRIVATE_DATA);
+	n += sizeof(TS_SECTION_PARSER);
+	
+	prv = (TS_SECTION_PARSER_PRIVATE_DATA *)calloc(1, n);
+	if(prv == NULL){
+		/* failed on malloc() - no enough memory */
+		return NULL;
+	}
+
+	prv->pid = -1;
+
+	r = (TS_SECTION_PARSER *)(prv+1);
+	r->private_data = prv;
+
+	r->release = release_ts_section_parser;
+	r->reset = reset_ts_section_parser;
+	
+	r->put = put_ts_section_parser;
+	r->get = get_ts_section_parser;
+	r->ret = ret_ts_section_parser;
+	
+	r->get_count = get_count_ts_section_parser;
+
+	r->get_stat = get_stat_ts_section_parser;
+
+	return r;
+}
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ function prottypes (private method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static TS_SECTION_PARSER_PRIVATE_DATA *private_data(void *parser);
+static void teardown(TS_SECTION_PARSER_PRIVATE_DATA *prv);
+
+static int put_exclude_section_start(TS_SECTION_PARSER_PRIVATE_DATA *prv, uint8_t *data, int size);
+static int put_include_section_start(TS_SECTION_PARSER_PRIVATE_DATA *prv, uint8_t *data, int size);
+
+static void reset_section(TS_SECTION *sect);
+static void append_section_data(TS_SECTION *sect, uint8_t *data, int size);
+static int check_section_complete(TS_SECTION *sect);
+
+static int compare_elem_section(TS_SECTION_ELEM *a, TS_SECTION_ELEM *b);
+
+static void cancel_elem_empty(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem);
+static void cancel_elem_error(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem);
+static void cancel_elem_same(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem);
+static void commit_elem_updated(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem);
+
+static TS_SECTION_ELEM *query_work_elem(TS_SECTION_PARSER_PRIVATE_DATA *prv);
+
+static void extract_ts_section_header(TS_SECTION *sect);
+
+static TS_SECTION_ELEM *create_ts_section_elem();
+static TS_SECTION_ELEM *get_ts_section_list_head(TS_SECTION_LIST *list);
+static void put_ts_section_list_tail(TS_SECTION_LIST *list, TS_SECTION_ELEM *elem);
+static void unlink_ts_section_list(TS_SECTION_LIST *list, TS_SECTION_ELEM *elem);
+static void clear_ts_section_list(TS_SECTION_LIST *list);
+
+static uint32_t crc32(uint8_t *head, uint8_t *tail);
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ function implementation (interface method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static void release_ts_section_parser(void *parser)
+{
+	TS_SECTION_PARSER_PRIVATE_DATA *prv;
+
+	prv = private_data(parser);
+	if(prv == NULL){
+		return;
+	}
+
+	teardown(prv);
+	
+	memset(parser, 0, sizeof(TS_SECTION_PARSER));
+	free(prv);
+}
+
+static int reset_ts_section_parser(void *parser)
+{
+	TS_SECTION_PARSER_PRIVATE_DATA *prv;
+
+	prv = private_data(parser);
+	if(prv == NULL){
+		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
+	}
+
+	teardown(prv);
+
+	return 0;
+}
+
+static int put_ts_section_parser(void *parser, TS_HEADER *hdr, uint8_t *data, int size)
+{
+	TS_SECTION_PARSER_PRIVATE_DATA *prv;
+	
+	prv = private_data(parser);
+	if( (prv == NULL) || (hdr == NULL) || (data == NULL) || (size < 1) ){
+		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
+	}
+
+	if( (prv->pid >= 0) && (prv->pid != hdr->pid) ){
+		return TS_SECTION_PARSER_ERROR_INVALID_TS_PID;
+	}
+
+	prv->pid = hdr->pid;
+
+	if(hdr->payload_unit_start_indicator == 0){
+		/* exclude section start */
+		return put_exclude_section_start(prv, data, size);
+	}else{
+		/* include section start */
+		return put_include_section_start(prv, data, size);
+	}
+}
+
+static int get_ts_section_parser(void *parser, TS_SECTION *sect)
+{
+	TS_SECTION_PARSER_PRIVATE_DATA *prv;
+	TS_SECTION_ELEM *w;
+
+	prv = private_data(parser);
+	if( (prv == NULL) || (sect == NULL) ){
+		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
+	}
+
+	w = get_ts_section_list_head(&(prv->buff));
+	if(w == NULL){
+		memset(sect, 0, sizeof(TS_SECTION));
+		return TS_SECTION_PARSER_ERROR_NO_SECTION_DATA;
+	}
+
+	memcpy(sect, &(w->sect), sizeof(TS_SECTION));
+	put_ts_section_list_tail(&(prv->pool), w);
+
+	return 0;
+}
+
+static int ret_ts_section_parser(void *parser, TS_SECTION *sect)
+{
+	TS_SECTION_PARSER_PRIVATE_DATA *prv;
+	TS_SECTION_ELEM *w;
+
+	prv = private_data(parser);
+	if( (prv == NULL) || (sect == NULL) ){
+		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
+	}
+
+	w = prv->pool.tail;
+	while(w != NULL){
+		if(w->sect.data == sect->data){
+			break;
+		}
+		w = (TS_SECTION_ELEM *)(w->prev);
+	}
+
+	if( (w != NULL) && (w->ref > 0) ){
+		w->ref -= 1;
+	}
+
+	return 0;
+}
+
+static int get_count_ts_section_parser(void *parser)
+{
+	TS_SECTION_PARSER_PRIVATE_DATA *prv;
+	
+	prv = private_data(parser);
+	if(prv == NULL){
+		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
+	}
+
+	return prv->buff.count;
+}
+
+static int get_stat_ts_section_parser(void *parser, TS_SECTION_PARSER_STAT *stat)
+{
+	TS_SECTION_PARSER_PRIVATE_DATA *prv;
+
+	prv = private_data(parser);
+	if( (prv == NULL) || (stat == NULL) ){
+		return TS_SECTION_PARSER_ERROR_INVALID_PARAM;
+	}
+
+	memcpy(stat, &(prv->stat), sizeof(TS_SECTION_PARSER_STAT));
+
+	return 0;
+}
+
+/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ function implementation (private method)
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+static TS_SECTION_PARSER_PRIVATE_DATA *private_data(void *parser)
+{
+	TS_SECTION_PARSER_PRIVATE_DATA *r;
+	TS_SECTION_PARSER *p;
+
+	p = (TS_SECTION_PARSER *)parser;
+	if(p == NULL){
+		return NULL;
+	}
+
+	r = (TS_SECTION_PARSER_PRIVATE_DATA *)(p->private_data);
+	if( ((void *)(r+1)) != parser ){
+		return NULL;
+	}
+
+	return r;
+}
+
+static void teardown(TS_SECTION_PARSER_PRIVATE_DATA *prv)
+{
+	prv->pid = -1;
+
+	if(prv->work != NULL){
+		free(prv->work);
+		prv->work = NULL;
+	}
+
+	prv->last = NULL;
+	
+	clear_ts_section_list(&(prv->pool));
+	clear_ts_section_list(&(prv->buff));
+
+	memset(&(prv->stat), 0, sizeof(TS_SECTION_PARSER_STAT));
+}
+
+static int put_exclude_section_start(TS_SECTION_PARSER_PRIVATE_DATA *prv, uint8_t *data, int size)
+{
+	TS_SECTION_ELEM *w;
+
+	w = prv->work;
+	if( (w == NULL) || (w->sect.raw == w->sect.tail) ){
+		/* no previous data */
+		return 0;
+	}
+
+	append_section_data(&(w->sect), data, size);
+	if(check_section_complete(&(w->sect)) == 0){
+		/* need more data */
+		return 0;
+	}
+
+	prv->work = NULL;
+
+	if( (w->sect.hdr.section_syntax_indicator != 0) &&
+	    (crc32(w->sect.raw, w->sect.tail) != 0) ){
+		cancel_elem_error(prv, w);
+		return TS_SECTION_PARSER_WARN_CRC_MISSMATCH;
+	}
+
+	if(compare_elem_section(w, prv->last) == 0){
+		/* same section data */
+		cancel_elem_same(prv, w);
+		return 0;
+	}
+
+	commit_elem_updated(prv, w);
+	return 0;
+}
+
+static int put_include_section_start(TS_SECTION_PARSER_PRIVATE_DATA *prv, uint8_t *data, int size)
+{
+	TS_SECTION_ELEM *w;
+	
+	int pointer_field;
+
+	uint8_t *p;
+	uint8_t *tail;
+
+	int r;
+	int length;
+
+	p = data;
+	tail = p + size;
+
+	r = 0;
+
+	pointer_field = p[0];
+	p += 1;
+
+	if( (p+pointer_field) >= tail ){
+		/* input data is probably broken */
+		w = prv->work;
+		prv->work = NULL;
+		if(w != NULL) {
+			if(w->sect.raw != w->sect.tail){
+				cancel_elem_error(prv, w);
+				return TS_SECTION_PARSER_WARN_LENGTH_MISSMATCH;
+			}
+			cancel_elem_empty(prv, w);
+		}
+		return 0;
+	}
+
+	if(pointer_field > 0){
+		r = put_exclude_section_start(prv, p, pointer_field);
+		if(r < 0){
+			return r;
+		}
+		p += pointer_field;
+	}
+
+	w = prv->work;
+	prv->work = NULL;
+	
+	if(w != NULL){
+		if(w->sect.raw != w->sect.tail){
+			cancel_elem_error(prv, w);
+			r = TS_SECTION_PARSER_WARN_LENGTH_MISSMATCH;
+		}else{
+			cancel_elem_empty(prv, w);
+		}
+		w = NULL;
+	}
+
+	do {
+		
+		w = query_work_elem(prv);
+		if(w == NULL){
+			return TS_SECTION_PARSER_ERROR_NO_ENOUGH_MEMORY;
+		}
+		
+		append_section_data(&(w->sect), p, tail-p);
+		if(check_section_complete(&(w->sect)) == 0){
+			/* need more data */
+			prv->work = w;
+			return 0;
+		}
+		length = (w->sect.tail - w->sect.raw);
+
+		if( (w->sect.hdr.section_syntax_indicator != 0) &&
+		    (crc32(w->sect.raw, w->sect.tail) != 0) ){
+			cancel_elem_error(prv, w);
+			r = TS_SECTION_PARSER_WARN_CRC_MISSMATCH;
+		}else if(compare_elem_section(w, prv->last) == 0){
+			cancel_elem_same(prv, w);
+		}else{
+			commit_elem_updated(prv, w);
+		}
+
+		p += length;
+		
+	} while ( (p < tail) && (p[0] != 0xff) );
+
+	return r;
+}
+
+static void reset_section(TS_SECTION *sect)
+{
+	memset(&(sect->hdr), 0, sizeof(TS_SECTION_HEADER));
+	sect->tail = sect->raw;
+	sect->data = NULL;
+}
+
+static void append_section_data(TS_SECTION *sect, uint8_t *data, int size)
+{
+	int m,n;
+	
+	m = sect->tail - sect->raw;
+	n = MAX_RAW_SECTION_SIZE - m;
+
+	if(size < n){
+		n = size;
+	}
+	memcpy(sect->tail, data, n);
+	sect->tail += n;
+	m += n;
+
+	if(sect->data == NULL){
+		extract_ts_section_header(sect);
+	}
+
+	if(sect->data == NULL){
+		/* need more data */
+		return;
+	}
+
+	n = sect->hdr.section_length + 3;
+	if(m > n){
+		sect->tail = sect->raw + n;
+	}
+
+	return;
+}
+
+static int check_section_complete(TS_SECTION *sect)
+{
+	int m,n;
+	
+	if(sect->data == NULL){
+		return 0;
+	}
+
+	m = sect->tail - sect->raw;
+	n = sect->hdr.section_length + 3;
+
+	if(n > m){
+		return 0;
+	}
+
+	return 1;
+}
+
+static int compare_elem_section(TS_SECTION_ELEM *a, TS_SECTION_ELEM *b)
+{
+	int m,n;
+	
+	if( (a == NULL) || (b == NULL) ){
+		return 1;
+	}
+
+	m = a->sect.tail - a->sect.raw;
+	n = b->sect.tail - b->sect.raw;
+	if( m != n ){
+		return 1;
+	}
+
+	if(memcmp(a->sect.raw, b->sect.raw, m) != 0){
+		return 1;
+	}
+
+	return 0;
+}
+
+static void cancel_elem_empty(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem)
+{
+	reset_section(&(elem->sect));
+	elem->ref = 0;
+	put_ts_section_list_tail(&(prv->pool), elem);
+}
+
+static void cancel_elem_error(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem)
+{
+	reset_section(&(elem->sect));
+	elem->ref = 0;
+	put_ts_section_list_tail(&(prv->pool), elem);
+	prv->stat.total += 1;
+	prv->stat.error += 1;
+}
+
+static void cancel_elem_same(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem)
+{
+	reset_section(&(elem->sect));
+	elem->ref = 0;
+	put_ts_section_list_tail(&(prv->pool), elem);
+	prv->stat.total +=1;
+}
+
+static void commit_elem_updated(TS_SECTION_PARSER_PRIVATE_DATA *prv, TS_SECTION_ELEM *elem)
+{
+	if( (prv->last != NULL) && (prv->last->ref > 0) ){
+		prv->last->ref -= 1;
+	}
+
+	elem->ref = 2;
+	prv->last = elem;
+	put_ts_section_list_tail(&(prv->buff), elem);
+	prv->stat.total += 1;
+	prv->stat.unique += 1;
+}
+
+static TS_SECTION_ELEM *query_work_elem(TS_SECTION_PARSER_PRIVATE_DATA *prv)
+{
+	TS_SECTION_ELEM *r;
+
+	r = prv->pool.head;
+	while(r != NULL){
+		if(r->ref < 1){
+			break;
+		}
+		r = (TS_SECTION_ELEM *)(r->next);
+	}
+
+	if(r != NULL){
+		unlink_ts_section_list(&(prv->pool), r);
+		reset_section(&(r->sect));
+		r->ref = 0;
+		return r;
+	}
+
+	return create_ts_section_elem();
+}
+
+static void extract_ts_section_header(TS_SECTION *sect)
+{
+	int size;
+	uint8_t *p;
+	
+	sect->data = NULL;
+	
+	size = sect->tail - sect->raw;
+	if(size < 3){
+		/* need more data */
+		return;
+	}
+
+	p = sect->raw;
+	
+	sect->hdr.table_id                 =  p[0];
+	sect->hdr.section_syntax_indicator = (p[1] >> 7) & 0x01;
+	sect->hdr.private_indicator        = (p[1] >> 6) & 0x01;
+	sect->hdr.section_length           =((p[1] << 8) | p[2]) & 0x0fff;
+	
+	if(sect->hdr.section_syntax_indicator == 0){
+		/* short format section header */
+		sect->data = p+3;
+		return;
+	}
+
+	/* long format section header */
+
+	if(size < 8){
+		/* need more data */
+		return;
+	}
+
+	sect->hdr.table_id_extension       =((p[3] << 8) | p[4]);
+	sect->hdr.version_number           = (p[5] >> 1) & 0x1f;
+	sect->hdr.current_next_indicator   =  p[5]       & 0x01;
+	sect->hdr.section_number           =  p[6];
+	sect->hdr.last_section_number      =  p[7];
+
+	sect->data = p+8;
+
+	return;
+}
+
+static TS_SECTION_ELEM *create_ts_section_elem()
+{
+	TS_SECTION_ELEM *r;
+	int n;
+
+	n = sizeof(TS_SECTION_ELEM) + MAX_RAW_SECTION_SIZE;
+	r = (TS_SECTION_ELEM *)calloc(1, n);
+	if(r == NULL){
+		/* failed on malloc() */
+		return NULL;
+	}
+
+	r->sect.raw = (uint8_t *)(r+1);
+	r->sect.tail = r->sect.raw;
+
+	return r;
+}
+
+static TS_SECTION_ELEM *get_ts_section_list_head(TS_SECTION_LIST *list)
+{
+	TS_SECTION_ELEM *r;
+
+	if(list == NULL){/* invalid param */
+		return NULL;
+	}
+
+	r = list->head;
+	if(r == NULL){
+		return NULL;
+	}
+
+	list->head = (TS_SECTION_ELEM *)(r->next);
+	if(list->head != NULL){
+		list->head->prev = NULL;
+		list->count -= 1;
+	}else{
+		list->tail = NULL;
+		list->count = 0;
+	}
+
+	r->next = NULL;
+	
+	return r;
+}
+
+static void put_ts_section_list_tail(TS_SECTION_LIST *list, TS_SECTION_ELEM *elem)
+{
+	if( (list == NULL) || (elem == NULL) ){
+		/* invalid param */
+		return;
+	}
+
+	if(list->tail != NULL){
+		elem->prev = list->tail;
+		elem->next = NULL;
+		list->tail->next = elem;
+		list->tail = elem;
+		list->count += 1;
+	}else{
+		elem->prev = NULL;
+		elem->next = NULL;
+		list->head = elem;
+		list->tail = elem;
+		list->count = 1;
+	}
+}
+
+static void unlink_ts_section_list(TS_SECTION_LIST *list, TS_SECTION_ELEM *elem)
+{
+	TS_SECTION_ELEM *prev;
+	TS_SECTION_ELEM *next;
+
+	if( (list == NULL) || (elem == NULL) ){
+		/* invalid param */
+		return;
+	}
+
+	prev = (TS_SECTION_ELEM *)(elem->prev);
+	next = (TS_SECTION_ELEM *)(elem->next);
+
+	if(prev != NULL){
+		prev->next = next;
+	}else{
+		list->head = next;
+	}
+	if(next != NULL){
+		next->prev = prev;
+	}else{
+		list->tail = prev;
+	}
+	list->count -= 1;
+}
+
+static void clear_ts_section_list(TS_SECTION_LIST *list)
+{
+	TS_SECTION_ELEM *e;
+	TS_SECTION_ELEM *n;
+
+	if(list == NULL){ /* invalid param */
+		return;
+	}
+
+	e = list->head;
+	while(e != NULL){
+		n = (TS_SECTION_ELEM *)(e->next);
+		free(e);
+		e = n;
+	}
+	
+	list->head = NULL;
+	list->tail = NULL;
+	list->count = 0;
+}
+
+static uint32_t crc32(uint8_t *head, uint8_t *tail)
+{
+	uint32_t crc;
+	uint8_t *p;
+
+	static const uint32_t table[256] = {
+		0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9,
+		0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005,
+		0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, 0x2B4BCB61, 
+		0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD,
+		
+		0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9,
+		0x5F15ADAC, 0x5BD4B01B, 0x569796C2, 0x52568B75, 
+		0x6A1936C8, 0x6ED82B7F, 0x639B0DA6, 0x675A1011,
+		0x791D4014, 0x7DDC5DA3, 0x709F7B7A, 0x745E66CD,
+		
+		0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039,
+		0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5,
+		0xBE2B5B58, 0xBAEA46EF, 0xB7A96036, 0xB3687D81, 
+		0xAD2F2D84, 0xA9EE3033, 0xA4AD16EA, 0xA06C0B5D,
+		
+		0xD4326D90, 0xD0F37027, 0xDDB056FE, 0xD9714B49,
+		0xC7361B4C, 0xC3F706FB, 0xCEB42022, 0xCA753D95,
+		0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1, 
+		0xE13EF6F4, 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D,
+
+		0x34867077, 0x30476DC0, 0x3D044B19, 0x39C556AE,
+		0x278206AB, 0x23431B1C, 0x2E003DC5, 0x2AC12072, 
+		0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16,
+		0x018AEB13, 0x054BF6A4, 0x0808D07D, 0x0CC9CDCA,
+
+		0x7897AB07, 0x7C56B6B0, 0x71159069, 0x75D48DDE, 
+		0x6B93DDDB, 0x6F52C06C, 0x6211E6B5, 0x66D0FB02,
+		0x5E9F46BF, 0x5A5E5B08, 0x571D7DD1, 0x53DC6066,
+		0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA,
+		
+		0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E,
+		0xBFA1B04B, 0xBB60ADFC, 0xB6238B25, 0xB2E29692,
+		0x8AAD2B2F, 0x8E6C3698, 0x832F1041, 0x87EE0DF6, 
+		0x99A95DF3, 0x9D684044, 0x902B669D, 0x94EA7B2A,
+
+		0xE0B41DE7, 0xE4750050, 0xE9362689, 0xEDF73B3E,
+		0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2, 
+		0xC6BCF05F, 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686,
+		0xD5B88683, 0xD1799B34, 0xDC3ABDED, 0xD8FBA05A,
+
+		0x690CE0EE, 0x6DCDFD59, 0x608EDB80, 0x644FC637, 
+		0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB,
+		0x4F040D56, 0x4BC510E1, 0x46863638, 0x42472B8F,
+		0x5C007B8A, 0x58C1663D, 0x558240E4, 0x51435D53, 
+		
+		0x251D3B9E, 0x21DC2629, 0x2C9F00F0, 0x285E1D47,
+		0x36194D42, 0x32D850F5, 0x3F9B762C, 0x3B5A6B9B,
+		0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF,
+		0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623,
+
+		0xF12F560E, 0xF5EE4BB9, 0xF8AD6D60, 0xFC6C70D7,
+		0xE22B20D2, 0xE6EA3D65, 0xEBA91BBC, 0xEF68060B, 
+		0xD727BBB6, 0xD3E6A601, 0xDEA580D8, 0xDA649D6F,
+		0xC423CD6A, 0xC0E2D0DD, 0xCDA1F604, 0xC960EBB3,
+		
+		0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7, 
+		0xAE3AFBA2, 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B,
+		0x9B3660C6, 0x9FF77D71, 0x92B45BA8, 0x9675461F,
+		0x8832161A, 0x8CF30BAD, 0x81B02D74, 0x857130C3, 
+		
+		0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640,
+		0x4E8EE645, 0x4A4FFBF2, 0x470CDD2B, 0x43CDC09C,
+		0x7B827D21, 0x7F436096, 0x7200464F, 0x76C15BF8,
+		0x68860BFD, 0x6C47164A, 0x61043093, 0x65C52D24,
+
+		0x119B4BE9, 0x155A565E, 0x18197087, 0x1CD86D30,
+		0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC,
+		0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088,
+		0x2497D08D, 0x2056CD3A, 0x2D15EBE3, 0x29D4F654,
+
+		0xC5A92679, 0xC1683BCE, 0xCC2B1D17, 0xC8EA00A0,
+		0xD6AD50A5, 0xD26C4D12, 0xDF2F6BCB, 0xDBEE767C,
+		0xE3A1CBC1, 0xE760D676, 0xEA23F0AF, 0xEEE2ED18,
+		0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4, 
+
+		0x89B8FD09, 0x8D79E0BE, 0x803AC667, 0x84FBDBD0,
+		0x9ABC8BD5, 0x9E7D9662, 0x933EB0BB, 0x97FFAD0C,
+		0xAFB010B1, 0xAB710D06, 0xA6322BDF, 0xA2F33668, 
+		0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4,
+	};
+	
+	crc = 0xffffffff;
+
+	p = head;
+	while(p < tail){
+		crc = (crc << 8) ^ table[ ((crc >> 24) ^ p[0]) & 0xff ];
+		p += 1;
+	}
+
+	return crc;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/ts_section_parser.h	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,40 @@
+#ifndef TS_SECTION_PARSER_H
+#define TS_SECTION_PARSER_H
+
+#include "ts_common_types.h"
+
+typedef struct {
+	int64_t total;      /* total received section count      */
+	int64_t unique;     /* unique section count              */
+	int64_t error;      /* crc and other error section count */
+} TS_SECTION_PARSER_STAT;
+
+typedef struct {
+
+	void *private_data;
+
+	void (* release)(void *parser);
+
+	int (* reset)(void *parser);
+
+	int (* put)(void *parser, TS_HEADER *hdr, uint8_t *data, int size);
+	int (* get)(void *parser, TS_SECTION *sect);
+	int (* ret)(void *parser, TS_SECTION *sect);
+
+	int (* get_count)(void *parser);
+	
+	int (* get_stat)(void *parser, TS_SECTION_PARSER_STAT *stat);
+	
+} TS_SECTION_PARSER;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern TS_SECTION_PARSER *create_ts_section_parser();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TS_SECTION_PARSER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/arib25/src/ts_section_parser_error_code.h	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,12 @@
+#ifndef TS_SECTION_PARSER_ERROR_CODE_H
+#define TS_SECTION_PARESR_ERROR_CODE_H
+
+#define TS_SECTION_PARSER_ERROR_INVALID_PARAM        -1
+#define TS_SECTION_PARSER_ERROR_NO_ENOUGH_MEMORY     -2
+#define TS_SECTION_PARSER_ERROR_INVALID_TS_PID       -3
+#define TS_SECTION_PARSER_ERROR_NO_SECTION_DATA      -4
+
+#define TS_SECTION_PARSER_WARN_CRC_MISSMATCH          1
+#define TS_SECTION_PARSER_WARN_LENGTH_MISSMATCH       2
+
+#endif /* TS_SECTION_PARSER_ERROR_CODE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/libccid_Info.plist	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,368 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>BNDL</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>0.0.1d1</string>
+	<key>ifdCapabilities</key>
+	<string>0x00000001</string>
+
+	<!-- Possible values for ifdCapabilities bits
+	1: IFD_GENERATE_HOTPLUG
+	   plugging the reader calls pcscd \-\-hotplug
+
+	Default value is 0x00000001
+	-->
+
+	<key>ifdProtocolSupport</key>
+	<string>0x00000001</string>
+	<key>ifdVersionNumber</key>
+	<string>0x00000001</string>
+
+	<key>ifdLogLevel</key>
+	<string>0x0003</string>
+
+	<!-- Possible values for ifdLogLevel
+	1: CRITICAL  important error messages
+	2: INFO      informative messages like what reader was detected
+	4: COMM      a dump of all the bytes exchanged between the host and
+	             the reader
+	8: PERIODIC  periodic info when pcscd test if a card is present
+	             (every 1/10 of a second)
+
+	The final value is a OR of these values
+
+	Default value: 3 (CRITICAL + INFO)
+	-->
+
+	<key>ifdDriverOptions</key>
+	<string>0x0000</string>
+
+	<!-- Possible values for ifdDriverOptions
+	1: DRIVER_OPTION_CCID_EXCHANGE_AUTHORIZED
+		the CCID Exchange command is allowed. You can use it through
+		SCardControl(hCard, IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE, ...) 
+
+	2: DRIVER_OPTION_GEMPC_TWIN_KEY_APDU
+		If set the GemPC Twin and GemPC Key readers with be configured
+		so that the T=1 TPDU protocol is done by the firmware instead of
+		the driver.
+		This switches the reader in APDU mode and also in EMV mode so
+		may not work with non EMV cards.
+
+	4: DRIVER_OPTION_USE_BOGUS_FIRMWARE
+		Some reader firmwares have bugs. By default the driver refuses
+		to work with such firmware versions. If your reader is rejected
+		because of the firmware (log message: "Firmware (x.y) is
+		bogus!") you can:
+		- upgrade your reader firmware (not all readers can do that)
+		or
+		- get another reader with a new/bugfree firmware
+		or
+		- activate this option but you will have problems depending on
+		  the bug
+
+	8: DRIVER_OPTION_RESET_ON_CLOSE
+		This option may be required on Linux 2.4 so that the
+		device reset if sequencial (bSeq) counter and can be
+		reused if pcscd restart. Otherwise the reader needs to
+		be unplugged/replugged.
+
+	bits 4 & 5: (values 0, 16, 32, 48)
+	  0: power on the card at 5V (default value)
+	 16: power on the card at 3V and then, it 3V fails use 5V
+	 32: power on the card at 1.8V, then 3V and then 5V
+	 48: let the reader decide
+
+	Default value: 0
+	-->
+
+	<key>CFBundleExecutable</key>
+	<string>libccid.so.1.3.1</string>
+
+	<key>ifdManufacturerString</key>
+	<string>Ludovic Rousseau (ludovic.rousseau@free.fr)</string>
+
+	<key>ifdProductString</key>
+	<string>Generic CCID driver v1.3.1</string>
+
+	<key>ifdVendorID</key>
+	<array>
+		<string>0x08E6</string>
+		<string>0x08E6</string>
+		<string>0x08E6</string>
+		<string>0x08E6</string>
+		<string>0x08E6</string>
+		<string>0x08E6</string>
+		<string>0x08E6</string>
+		<string>0x08E6</string>
+		<string>0x08E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x04E6</string>
+		<string>0x076B</string>
+		<string>0x076B</string>
+		<string>0x076B</string>
+		<string>0x076B</string>
+		<string>0x076B</string>
+		<string>0x076B</string>
+		<string>0x076B</string>
+		<string>0x076B</string>
+		<string>0x076B</string>
+		<string>0x076B</string>
+		<string>0x0783</string>
+		<string>0x0783</string>
+		<string>0x0783</string>
+		<string>0x0783</string>
+		<string>0x0783</string>
+		<string>0x0783</string>
+		<string>0x09C3</string>
+		<string>0x09C3</string>
+		<string>0x047B</string>
+		<string>0x413c</string>
+		<string>0x413c</string>
+		<string>0x046a</string>
+		<string>0x046a</string>
+		<string>0x046a</string>
+		<string>0x046a</string>
+		<string>0x072f</string>
+		<string>0x0b97</string>
+		<string>0x0b97</string>
+		<string>0x0D46</string>
+		<string>0x0D46</string>
+		<string>0x0d46</string>
+		<string>0x0d46</string>
+		<string>0x0d46</string>
+		<string>0x0d46</string>
+		<string>0x073D</string>
+		<string>0x073D</string>
+		<string>0x073D</string>
+		<string>0x073D</string>
+		<string>0x073D</string>
+		<string>0x0DC3</string>
+		<string>0x0DC3</string>
+		<string>0x09BE</string>
+		<string>0x0416</string>
+		<string>0x03F0</string>
+		<string>0x03F0</string>
+		<string>0x0B81</string>
+		<string>0x058F</string>
+		<string>0x058F</string>
+		<string>0x15E1</string>
+		<string>0x0BF8</string>
+		<string>0x0BF8</string>
+		<string>0x0DF6</string>
+		<string>0x0973</string>
+		<string>0x0471</string>
+		<string>0x04B9</string>
+		<string>0x1059</string>
+		<string>0x1059</string>
+		<string>0x17EF</string>
+		<string>0x19E7</string>
+		<string>0x09C3</string>
+		<string>0x0783</string>
+		<string>0x0C4B</string>
+	</array>
+
+	<key>ifdProductID</key>
+	<array>
+		<string>0x3437</string>
+		<string>0x3438</string>
+		<string>0x4433</string>
+		<string>0x3478</string>
+		<string>0x3479</string>
+		<string>0x3480</string>
+		<string>0x34EC</string>
+		<string>0xACE0</string>
+		<string>0x1359</string>
+		<string>0x5111</string>
+		<string>0x5113</string>
+		<string>0x5115</string>
+		<string>0x5116</string>
+		<string>0x5117</string>
+		<string>0x5119</string>
+		<string>0x511A</string>
+		<string>0x511C</string>
+		<string>0x511D</string>
+		<string>0x5120</string>
+		<string>0x5121</string>
+		<string>0xE001</string>
+		<string>0x5410</string>
+		<string>0xE003</string>
+		<string>0x1021</string>
+		<string>0x3021</string>
+		<string>0x3621</string>
+		<string>0x3821</string>
+		<string>0x4321</string>
+		<string>0x5121</string>
+		<string>0x5125</string>
+		<string>0x5321</string>
+		<string>0x6622</string>
+		<string>0xA022</string>
+		<string>0x0006</string>
+		<string>0x0007</string>
+		<string>0x0008</string>
+		<string>0x0009</string>
+		<string>0x0010</string>
+		<string>0x9002</string>
+		<string>0x0013</string>
+		<string>0x0014</string>
+		<string>0x020B</string>
+		<string>0x2100</string>
+		<string>0X2101</string>
+		<string>0x0005</string>
+		<string>0x0010</string>
+		<string>0x002D</string>
+		<string>0x003E</string>
+		<string>0x90cc</string>
+		<string>0x7762</string>
+		<string>0x7772</string>
+		<string>0x3001</string>
+		<string>0x3002</string>
+		<string>0x3003</string>
+		<string>0x3010</string>
+		<string>0x4000</string>
+		<string>0x4001</string>
+		<string>0x0B00</string>
+		<string>0x0C00</string>
+		<string>0x0C01</string>
+		<string>0x0007</string>
+		<string>0x0008</string>
+		<string>0x1004</string>
+		<string>0x1102</string>
+		<string>0x0002</string>
+		<string>0x3815</string>
+		<string>0x1024</string>
+		<string>0x0824</string>
+		<string>0x0200</string>
+		<string>0x9520</string>
+		<string>0x9522</string>
+		<string>0x2007</string>
+		<string>0x1005</string>
+		<string>0x1006</string>
+		<string>0x800A</string>
+		<string>0x0003</string>
+		<string>0x040F</string>
+		<string>0x1400</string>
+		<string>0x000C</string>
+		<string>0x000D</string>
+		<string>0x1003</string>
+		<string>0x0002</string>
+		<string>0x0008</string>
+		<string>0x0003</string>
+		<string>0x0300</string>
+	</array>
+
+	<key>ifdFriendlyName</key>
+	<array>
+		<string>Gemplus GemPC Twin</string>
+		<string>Gemplus GemPC Key</string>
+		<string>Gemplus GemPC433 SL</string>
+		<string>Gemplus GemPC Pinpad</string>
+		<string>Gemplus GemCore POS Pro</string>
+		<string>Gemplus GemCore SIM Pro</string>
+		<string>Gemplus GemPC Express</string>
+		<string>Verisign Secure Token</string>
+		<string>VeriSign Secure Storage Token</string>
+		<string>SCM SCR 331-DI</string>
+		<string>SCM SCR 333</string>
+		<string>SCM SCR 335</string>
+		<string>SCM SCR 3310</string>
+		<string>SCM SCR 3320</string>
+		<string>SCM SCR 3340 ExpressCard54</string>
+		<string>SCM SCR 3310 NTTCom</string>
+		<string>Axalto Reflex USB v3</string>
+		<string>SCM SCR 3311</string>
+		<string>SCM SCR 331-DI NTTCom</string>
+		<string>SCM SDI 010</string>
+		<string>SCM SCR 331</string>
+		<string>SCM SCR 355</string>
+		<string>SCM SPR 532</string>
+		<string>OmniKey CardMan 1021</string>
+		<string>OmniKey CardMan 3121</string>
+		<string>OmniKey CardMan 3621</string>
+		<string>OmniKey CardMan 3821</string>
+		<string>OmniKey CardMan 4321</string>
+		<string>OmniKey CardMan 5121</string>
+		<string>OmniKey CardMan 5125</string>
+		<string>OmniKey CardMan 5321</string>
+		<string>OmniKey CardMan 6121</string>
+		<string>Teo by Xiring</string>
+		<string>C3PO LTC31</string>
+		<string>C3PO TLTC2USB</string>
+		<string>C3PO LTC32 USBv2 with keyboard support</string>
+		<string>C3PO KBR36</string>
+		<string>C3PO LTC32</string>
+		<string>C3PO TLTC2USB</string>
+		<string>ActivCard USB Reader 3.0</string>
+		<string>Activkey Sim</string>
+		<string>Silitek SK-3105</string>
+		<string>Dell keyboard SK-3106</string>
+		<string>Dell smart card reader keyboard</string>
+		<string>Cherry XX33</string>
+		<string>Cherry XX44</string>
+		<string>Cherry ST1044U</string>
+		<string>Cherry SmartTerminal ST-2XXX</string>
+		<string>ACS ACR 38U-CCID</string>
+		<string>O2 Micro Oz776</string>
+		<string>O2 Micro Oz776</string>
+		<string>KOBIL KAAN Base</string>
+		<string>KOBIL KAAN Advanced</string>
+		<string>KOBIL KAAN SIM III</string>
+		<string>KOBIL EMV CAP - SecOVID Reader III</string>
+		<string>KOBIL mIDentity</string>
+		<string>KOBIL mIDentity</string>
+		<string>Eutron Digipass 860</string>
+		<string>Eutron SIM Pocket Combo</string>
+		<string>Eutron Smart Pocket</string>
+		<string>Eutron CryptoIdentity</string>
+		<string>Eutron CryptoIdentity</string>
+		<string>Athena ASE IIIe</string>
+		<string>Athena ASEDrive IIIe KB</string>
+		<string>SmartEpad</string>
+		<string>Winbond</string>
+		<string>HP USB Smart Card Keyboard</string>
+		<string>HP USB Smartcard Reader</string>
+		<string>id3 CL1356D</string>
+		<string>Alcor Micro AU9520</string>
+		<string>Alcor Micro AU9522</string>
+		<string>RSA SecurID</string>
+		<string>Fujitsu Siemens SmartCard Keyboard USB 2A</string>
+		<string>Fujitsu Siemens SmartCard USB 2A</string>
+		<string>Sitecom USB simcard reader MD-010</string>
+		<string>SchlumbergerSema Cyberflex Access</string>
+		<string>Philips JCOP41V221</string>
+		<string>SafeNet IKey4000</string>
+		<string>G&D CardToken 350</string>
+		<string>G&D CardToken 550</string>
+		<string>Lenovo Integrated Smart Card Reader</string>
+		<string>Charismathics token</string>
+		<string>ActivCard USB Reader 2.0</string>
+		<string>C3PO LTC31</string>
+		<string>Reiner-SCT cyberJack pinpad(a)</string>
+	</array>
+
+	<key>Copyright</key>
+	<string>This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.</string>
+
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/readme.txt	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,73 @@
+b25.exe ver.0.2.1 LinuxΉłłB
+arib25fBNgmakeƑłĂarib25/src/b25Ƀrh܂B
+gpCuPCSC-Lite(http://pcsclite.alioth.debian.org/)ŁAJ[h[_gp”\ȏԂɂȂĂ邱ƂKvłB
+Windowsł͓S‚HX-520UJJLinuxł͎gpłȂ̂ŒӂKvłB
+NTTComSCR3310-NTTComyathena-scs.hs.shopserve.jp/SHOP/RW001.htmlœ񍐂܂B
+B-CASJ[h̕\ɒӂĉB`bvʂłB
+ł̔}̃J[h[_gpꍇ́APCSC-Litẽy[WɂCCID drivergpA
+/etc/libccid_Info.plist
+====
+	<key>ifdVendorID</key>
+	<array>
+		<string>0xXXXX</string>
+		         
+	</array>
+
+	<key>ifdProductID</key>
+	<array>
+		<string>0xXXXX</string>
+		         
+	</array>
+
+	<key>ifdFriendlyName</key>
+	<array>
+		<string>XXXXXXXXXXXXXXXXXX</string>
+		               
+	</array>
+====
+zipɂ铯̃t@C̓ƓւĉB
+̃t@CʒuDebianˑ܂B
+  Gentooł/usr/lib/readers/usb/ifd-ccid.bundle/Contents/Info.plistɂƂ񍐂܂B
+}yэŋ߂̔}ł̓J[h[_ςĂׁA/etc/libccid_Info.plist̕ύX͕svłB
+
+smartcard_list.txtPCSC-LiteɊ܂܂pcsc_scanpłB
+PCSC-Litẽt@CƒuB-CASB-CASƂĔF܂B
+
+PCSC-LiteAPIWindowsX}[gJ[hANZXpAPIƌ݊łׁA
+قLinuxŃRpCG[ɂȂ镔̑Ώ݂̂łB
+ver.0.2.032bit‹2Gbytet@C̖肪ȂȂ͂łB64bit‹ł2Gbyteȏ̃t@Co邱ƂmFĂ܂B
+
+PCSC-LiteɊ܂܂DWORD̒`͔32bit‹̏ꍇɖ肪܂A֌WȂ܂B
+
+ύX_:
+ver.0.1.2ɑ΂pb`open̈Ă܂Ăӏɖ߂܂B
+ver.0.1.5ŏo̓t@C̃p[~bVK̂𒼂܂Bumaskɏ]悤ɂȂĂ͂łB
+ver.0.2.0ŁA32bitLinux2GByteȏ̃t@CłȂoOC͂łB
+
+extrecdgpĂւ̒ӓ_:
+b25̌Ăяo-p 0 -v 0IvVtKv܂(b25牽o͂΃G[Ƃ݂ȂĂ)Bȉ̏CsȂĉB
+430s
+my @b25_cmd    = (@b25_prefix, $path_b25, $target_encts, $target_ts);
+
+my @b25_cmd    = (@b25_prefix, $path_b25, "-p", "0", "-v", "0", $target_encts, $target_ts);
+
+CZX:
+̃\[X͂܂쐬b25قڂ̂܂܂Ȃ̂ŁA܂̔fɏ]܂B
+arib25/readme.txtɂIWib25ɓYtĂreadme.txtɏĂA
+>@E\[XR[h𗘗pƂɂāÃguĂ
+>@@Ζ am͐ӔC𕉂Ȃ
+>@E\[XR[h𗘗pƂɂāAvOɖ肪Ă
+>@@Ζ am͐ӔC𕉂Ȃ
+>
+>@L 2 ɓӂč쐬ꂽ񎟓I앨ɑ΂āAΖ am
+>@҂ɗ^鏔sgȂ
+Kp܂B
+
+̑:
+̃vOAS-ISŒ񋟂܂BȂɂ肪NĂӔC͎Ă܂B
+
+mF‹:
+  Debian GNU/Linux lenny(testing)
+  Linux 2.6.22.6 SMP PREEMPT x86_64
+
+N/E9PqspSk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arib25v023/smartcard_list.txt	Tue Feb 17 01:40:56 2009 +0900
@@ -0,0 +1,1874 @@
+#
+#    smartcard_list.txt
+#    Copyright (C) 2002-2006  Ludovic Rousseau
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+#    02111-1307  USA
+
+#
+# This list contains a match between an ATR and a card type
+# The list is sorted for edition purposes
+#
+# You can get the latest version of this file from:
+# http://ludovic.rousseau.free.fr/softwares/pcsc-tools/smartcard_list.txt
+#
+# $Id: smartcard_list.txt,v 1.290 2007-10-30 21:12:54 rousseau Exp $
+#
+
+# syntax:
+# ATR in regular expression form
+# \t descriptive text
+# \t descriptive text
+# \t descriptive text
+# empty line
+
+3B F0 12 00 FF 91 81 B1 7C 45 1F 03 99
+	B-CAS
+
+3B 02 14 50
+	Schlumberger Multiflex 3k
+
+3B 02 53 01
+	Gemplus GemClub Memo
+
+3B 04 41 11 77 81
+	Sample Mifare DESFire contactless smartcard from Phillips
+
+3B 04 41 11 77 B1
+	IBM JCOP 30 contactless
+
+3B 04 49 32 43 2E
+	German Health Insurance Card
+	"LogCard" from concept2.com (a indoor rower manufacturer)
+	I2C card
+
+3B 04 92 23 10 91
+	Siemens SLE 4432/42 card
+
+3B 04 A2 13 10 91
+	PM2P Chipkarte SLE 4442, Code FFFFFF
+	Bahn BKK (Deutsche Bahn AG - Insurance Company)
+
+3B 05 68 01 01 02 05
+	Certinomis card (electronic certificates)
+
+3B 06 A2 13 10 91 90 00
+	C3P2K SAMPLE CARD (C3PO, S.L)
+
+3B 09 41 04 11 DD 82 2F 00 00 88
+	1k contactless Mifare
+
+3B 0A 20 62 0C 01 4F 53 45 99 14 AA
+	GSM-SIM BEN (1800MHz)
+
+3B 0F 80 6A 16 32 46 49 53 45 53 8C E0 FF 07 90 00
+	GSM-SIM Sonera (from 1998)
+
+3B 0F FF C1 B5 CC 72 CA 00 00 ??
+	Mifare Std 1K
+
+3B 15 13 80 53 41 52 03
+	Eutron CryptoIdentity (ATMEL AT903232C - 6464C Cryptographic
+	processors, 64KB EEPROM, RSA 2048)
+
+3B 15 94 C3 02 08 16 01
+	GSM-SIM EMT (Estonia)
+
+3B 16 94 71 01 01 00 27 00
+	Cingular GSM SIM Card
+
+3B 16 94 71 01 01 05 02 00
+	GSM SIM Bouygues Telecom
+
+3B 16 94 81 10 06 01 81 2F
+	Schlumberger Cyberflex Access Augmented Crypto
+
+3B 16 94 81 10 06 01 81 3F
+	Schlumberger Cyberflex Access Crypto
+
+3B 16 96 41 73 74 72 69 64
+	Gemalto .NET v2.0
+
+3B 17 13 9C 12 02 01 01 07 40
+	Schlumberger Cyberflex Access Developer 32k
+
+3B 17 94 18 01 01 02 01 41 49
+	white SFR SIM card
+
+3B 17 94 18 02 01 25 01 41 93
+	AT&T Wireless GSM SIM Card
+
+3B 17 94 89 01 02 01 02 41 87
+	Vodafone/Omnitel 16K GSM SIM
+
+3B 19 14 55 90 01 01 01 00 05 08 B0
+	Schlumberger Multiflex 8k
+
+3B 19 14 55 90 01 02 01 00 05 04 B0
+	Schlumberger Multiflex 4k
+
+3B 19 14 59 01 01 0F 01 00 05 08 B0
+	Schlumberger Multiflex 8k
+
+3B 19 94 31 02 05 10 45 98 01 02 4E
+	GSM-SIM EMT (Estonia)
+
+3B 1F 11 00 67 42 41 46 49 53 45 53 52 66 FF 81 90 00
+	Finnish student id card
+
+3B 1F 11 00 67 80 42 46 49 53 45 10 52 66 FF 81 90 00
+	Nokia branded SC (Setec)
+
+3B 1F 11 00 6A 01 38 46 49 53 45 10 8C 02 FF 07 90 00
+	GSM-SIM Saunalahti (from 2004)
+	Finnish cell phone operator "Sonera" SIM card (from 2002)
+
+3B 1F 11 00 6A 31 36 46 49 53 45 13 8C 02 FF 07 90 00
+	GSM-SIM card - Telenor Mobil - http://www.telenor.com/
+
+3B 1F 11 80 6A 16 32 46 49 53 45 15 8C E6 FF 07 90 00
+	GSM SIM card - Tele2 Estonia - http://www.tele2.ee
+
+3B 1F 11 80 6A 32 37 46 49 53 45 12 8C 00 FF 07 90 00
+	Setec Test card, SetCOS 3.7.2, rel 1.3
+
+3B 1F 11 80 6A 32 37 46 49 53 45 12 8C 02 FF 07 90 00
+	GSM-SIM DNA Finland (from 2001)
+
+3B 1F 11 80 6A 80 34 46 49 53 45 53 94 36 FF 07 90 00
+	SetCOS 3.4.0c
+	RSA SecurID 3100
+
+3B 1F 94 00 6A 01 38 46 49 53 45 10 8C 02 FF 07 90 00
+	GSM-SIM Saunalahti (from 2004)
+
+3B 1F 94 80 6A 16 32 46 49 53 45 15 8C E6 FF 07 90 00
+	GSM-SIM Sonera (from 2002)
+
+3B 23 00 00 36 41 81
+	Schlumberger Payflex 4k SAM
+
+3B 23 00 35 11 80
+	Schlumberger Payflex 1k User
+
+3B 23 00 35 11 81
+	Schlumberger Payflex 1k SAM
+
+3B 23 00 35 13 80
+	Schlumberger Cyberflex Access Campus
+
+3B 23 00 35 13 FF
+	Schlumberger MicroPayflex
+
+3B 23 00 35 41 80
+	PayflexHID (idenfitied by Sun Ray Services)
+
+3B 24 00 .. .. .. 45
+	Conax
+
+3B 24 00 30 42 30 30
+	ComHem Digital-TV smartcard (Sweden)
+
+3B 24 00 80 72 94 43
+	MPCOS-3DES 64K \ EMV Filter (Gemplus)
+
+3B 26 00 00 26 40 00 90 00
+	Schlumberger, purse?
+
+3B 26 00 11 04 5C 03 90 00
+	Caixa Abierta (Barcelona, Spain) Cash/Visa Electron
+
+3B 26 00 11 06 23 03 90 00
+	Tarjeta de la Seguridad Social (Spanish Social Insurance Card)
+
+3B 27 00 80 65 A2 .. 01 01 37
+	Gemplus GemSAFE Smart Card (4K)
+
+3B 27 00 80 65 A2 00 01 01 37
+	Gemplus GemSAFE Card CSP v1.0
+
+3B 27 00 80 65 A2 02 02 82 37
+	Gemplus GPK2000s
+
+3B 27 00 80 65 A2 02 03 82 37
+	Gemplus GPK2000sp
+
+3B 27 00 80 65 A2 04 01 01 37
+	Gemplus GPK4000s
+
+3B 27 00 80 65 A2 05 01 01 37
+	Gemplus GPK4000sp
+
+3B 27 00 80 65 A2 06 01 01 37
+	GPK 4000, RSA 512 bits Sign, Unwrap 40 bits
+
+3B 27 00 80 65 A2 0C 01 01 37
+	Gemplus GPK4000
+
+3B 27 00 80 65 A2 8C 3B 27 00
+	GPK 4000, RSA 1024 bits Sign, Unwrap 256 bits
+
+3B 29 00 24 93 01 00 00 00 00 01 A9
+	Telephone chipcard for the Vienna University of Technology
+	http://nic.tuwien.ac.at/telefonie/chipkarte/
+
+3B 29 00 80 72 A4 45 64 00 00 D0 15
+	Moeda Electronica Bradesco (Gemplus MPCOS?) (Brasilia)
+
+3B 29 00 80 72 A4 45 64 00 FF 00 10
+	MPCOS-3DES 8K (Gemplus)
+	MBNA Europe Platinum Plus Mastercard
+	MasterCard Card - Worldcard - Yapıkredi / Turkey
+
+3B 2A 00 80 65 A0 58 04 01 62 72 D6 43
+	Gemplus GemCombiXplore MPCOS Pro
+
+3B 2A 00 80 65 A2 01 00 00 00 72 D6 41
+	MPCOS_EMV_1B
+
+3B 2A 00 80 65 A2 01 00 00 00 72 D6 43
+	MPCOS_EMV_4B
+
+3B 2A 00 80 65 A2 01 .. .. .. 72 D6 41
+	Gemplus MPCOS EMV 1 Byte sectors
+
+3B 2A 00 80 65 A2 01 02 01 31 72 D6 43
+	MPCOS-EMV 64K Functional Sample
+
+3B 2A 00 80 65 A2 01 .. .. .. 72 D6 43
+	Gemplus MPCOS EMV 4 Byte sectors
+
+3B 2F 00 80 69 10 80 00 01 A1 0A 01 01 59 83 0E 90 00
+	Belgium Dexia (Axion) Bank Card
+	Proton/Bancontact Mister Cash/Maestro
+
+3B 32 15 00 06 80
+	Schlumberger Multiflex 8k
+
+3B 32 15 00 06 95
+	Schlumberger Multiflex 8k DES
+
+3B 37 11 00 46 4C 4F 4D 41 90 00
+	SLE 4428
+
+3B 3B .. 00 80 6. A[F,E] 03 0[C,D] .. .. 83 .. 90 00
+	GemXplore Xpresso V3
+
+3B 3B 11 00 80 65 AF 03 0C 01 6F 83 0F 90 00
+	Gemplus GemX{plore,presso} V3-B1
+
+3B 3B 11 00 80 69 AF 03 0C 01 6F 83 0[0,1] 90 00
+	GemXplore'Xpresso V3 64K
+
+3B 3B 94 00 4F 34 10 20 01 04 C0 33 33 90 00
+	SIM card from the italian operator WIND
+
+3B 3B 94 00 67 37 10 00 00 39 60 33 33 90 00
+	Avea GSM / Turkey
+
+3B 3B 94 00 80 65 AF 03 0D 01 74 83 0F 90 00
+	Gemplus GemXplore Xpresso V3 B1P
+	Mobistar SIM - Belgium (Gemplus)
+
+3B 3C 94 00 4B 31 25 A2 10 13 14 47 83 83 90 00
+	GSM SFR
+
+3B 3C 94 00 4C 31 25 A7 20 1B 00 15 83 83 90 00
+	GSM-SIM (900MHz) card of the carrier vodafone for their cellular
+	network (phase 2+ with 3V)
+
+3B 3D 94 00 01 0F 00 36 00 00 86 60 18 04 00 01 07
+	Vodafone GSM / Turkey
+
+3B 3F 11 00 6F AF 65 03 12 01 80 73 32 21 1B 83 0F 90 00
+	GSM SIM card Orange J2RE postpaid
+
+3B 3F 94 00 80 65 AF 03 12 01 79 73 32 21 1B 83 0F 90 00
+	UK O2 GSM SIM (2G Online Prepay Maldives)
+
+3F 3F 94 00 80 69 AF 03 07 01 59 00 00 0A 0E 83 3E 9F 16
+	Finnish SIM card from "Radiolinja" now "Elisa"
+
+3B 3F 94 00 80 69 AF 03 07 06 67 00 00 0A 0E 83 3E 9F 16
+	SFR SIM card (red Gemplus Répertoire)
+
+3B 3F 94 00 80 69 AF 03 07 06 67 09 97 0A 0E 83 3E 9F 16
+	BASE SIM - Belgium (Gemplus)
+
+3B 3F 94 00 80 69 AF 03 0F 02 80 FF FF 06 0E 83 3E 9F 16
+	GSM-SIM Telefonica Movistar, prepaid (Spain)
+
+3B 3F 95 00 80 65 AF 03 12 01 6F 73 32 21 1B 83 00 90 00
+	Gemplus GemXpresso PRO 64 PK SIM
+
+3B 3F 95 00 80 65 AF 03 14 01 8A 73 32 21 1B 83 0F 90 00
+	SIM Vodafone 64k
+
+3F 96 18 80 01 80 51 00 61 10 30 9F
+	Atmel/Athena T0 Inverse Convention PC/SC Compliance Test Card No. 2
+
+3B 3F 95 00 80 69 AF 03 0F 02 80 FF FF 06 0E 83 3E 9F 16
+	AT&T Wireless GSM SIM Card
+
+3B 57 18 02 93 02 01 01 01 90 00
+	Easyflex FastOS 2.0 / Schlumberger
+
+3B 63 00 00 36 41 80
+	Schlumberger Payflex 4k User
+
+3B 64 00 00 80 62 0. 51
+	Setec SetCOS 5.1.0 EMV
+
+3B 64 00 FF 80 62 02 A2
+	VISA credit card (Nordea bank)
+
+3B 64 .. FF 80 62 .. A2
+	JCOP20
+
+3B 65 00 00 29 05 01 02 01
+	ActivCard (Schlumberger) CyberFlex 64K V1 SM 2.1
+
+3B 65 00 00 58 01 01 00 80
+	RBS Advanta Platinum Reserve Master Card
+
+3B 65 00 00 9C 02 02 07 02
+	US Department of Defense, TEST Common Access Card (CAC)
+	Schlumberger Cyberflex Access #2
+	Axalto Cyberflex Access 32K V2
+
+3B 65 00 00 9C 1[0,1] 01 01 03
+	Schlumberger Cyberflex Palmera
+
+3B 66 00 00 00 9C 11 01 01 03
+	Axalto Cyberflex Access 32K V4 SM 1.3
+
+3B 66 00 00 00 9C 11 01 03 01
+	Axalto Cyberflex Access 64K V1 Bio SM 3.1
+
+3B 66 00 00 31 4B 01 01 00 80
+	VISA credit card (Skandiabanken)
+
+3B 66 00 FF 4A 43 4F 50 33 30
+	JCOP30 "OP-DI 16k VISA v2 (JCOP30) ORGA"
+
+3B 66 00 FF 4A 43 4F 50 30 33
+	IBM JCOP 30
+
+3B 67 00 00 00 00 00 00 00 90 00
+	Axa Bank (Belgium) Mastercard Gold / Axa Bank Belgium
+	MisterCash & Proton card
+	VISA Card (emitted by Bank Card Company - Belgium)
+
+3B 67 00 00 00 00 20 00 00 90 00
+	BankID card from Sparebank1
+
+3B 67 00 00 00 31 80 71 86 90 00
+	Swiss ZKB-Bancomat-Card
+
+3B 67 00 00 29 20 00 6F 78 90 00
+	Postbank Chippas (chipknip) Netherlands
+
+3B 67 00 00 2D 20 36 00 78 90 00
+	Swedish cashcard, http://www.ida.liu.se/~TDDB31/Cashcard.pdf
+	Bank Card (ING - Belgium)
+
+3B 67 00 00 7D 20 40 34 3B 90 00
+	Nordea Visa Sweden
+
+3B 67 00 00 85 20 36 30 78 90 00
+	Belgium Fortis Bank
+	Belgium Keytrade Bank
+	Belgium Post Bank
+
+3B 67 00 00 9C 10 01 01 03 FF 07
+	Schlumberger Cyberflex Palmera Protect
+
+3B 67 00 00 A5 20 40 10 1F 90 00
+	Swedish eLegitimation (eID) from Nordea Bank http://www.elegitimation.se/
+
+3B 67 25 00 2A 20 00 4[0,5] 68 90 00
+	Swedish cashcard (proton)
+
+3B 67 25 00 62 24 33 03 ..
+	Bull TB1000 ? (SAM for ATM in Luxemburg)
+
+3B 68 00 00 56 53 44 43 4C 43 31 30
+	VISA (Estonian), made by www.trueb.ch
+
+3B 68 00 00 80 66 A2 06 02 01 32 0E
+	Gemplus GemClub 1K
+
+3B 68 00 00 9D 08 01 02 01 56 49 53
+	Visa Card - bonus - DenizBank / Turkey
+
+3B 68 00 00 9D 08 01 03 01 4F 54 53
+	MasterCard Card - bonus - Garanti Bank / Turkey
+
+3B 68 00 00 9D 08 01 03 01 56 49 53
+	MasterCard Card - bonus - Garanti Bank / Turkey
+	MasterCard Card - bonus plus (paypass) - Garanti Bank / Turkey
+
+3B 68 00 00 9D 08 01 05 01 56 49 53
+	MasterCard Card - CartaSi (Italian Credit Card)
+
+3B 68 00 00 A1 02 02 01 01 56 49 53
+	UK NatWest Business MasterCard
+	UK Barclaycard VISA
+	UK NatWest Platinum MasterCard
+	Visa Card - DenizBank / Turkey
+
+3B 69 00 00 24 94 01 02 01 00 01 01 A9
+	Chipcard from SUN to be used in SunRay's
+	370-4328-01 (31091)
+
+3B 69 00 00 24 94 01 03 01 00 01 00 A9
+	Schlumberger MicroPayflex S card
+
+3B 69 00 00 4A 43 4F 50 33 31 56 32 32
+	Visa Europe Sample Card / Axalto
+
+3B 69 00 00 50 01 01 04 01 00 01 01 A9
+	Sample card given to all attendees of the CTST 2004 SmartCard Conference
+
+3B 69 00 FF 53 6D 40 72 74 43 61 66 65
+	G&D (Giesecke&Devrient) Sm@rtCafé
+
+3B 6A 00 00 80 31 C0 A1 02 03 01 32 81 16
+	Lloyds TSB Visa Credit/Debit Card
+
+3B 6A 00 00 80 65 A2 01 01 01 3D 72 D6 43
+	GemSafe Xpresso 16k
+
+3B 6A 00 00 80 66 A1 09 02 01 63 0E 90 00
+	Danish Visa/Dankort
+	UK MBNA MasterCard
+	Visa Card - Worldcard - YapıKredi / Turkey
+
+3B 6B 00 00 00 31 80 64 2D A0 02 0C 8C 61 27
+	SmartEMV prototype
+
+3B 6B 00 00 00 31 80 64 43 B0 02 00 8C 61 27
+	Bull Odyssey 1.2 (Javacard 2.0)
+
+3B 6B 00 00 80 65 A1 09 03 01 97 83 0E 90 00
+	Visa Card - Worldcard - YapıKredi / Turkey
+
+3B 6B 00 00 80 65 B0 83 01 01 74 83 00 90 00
+	GemXpresso Pro R3 with 64K EEPROM
+
+3B 6B 00 00 80 65 B0 83 01 03 74 83 00 90 00
+	Gemplus GemXpresso PRO 64K R3 v1
+
+3B 6B 00 00 80 65 B0 83 01 04 74 83 00 90 00
+	Gemplus GXP3 64V2N
+	U.S. Department of Defense Common Access Card (DoD CAC)
+
+3B 6B 00 FF 33 00 00 09 FA 10 00 80 01 FF FF
+	Atmel 6464C PRO 64K
+
+3B 6B .. FF 80 62 .. A2 56 46 69 6E 45 49 44
+	JCOP20 v2.x
+
+3B 6C 00 00 10 10 10 30 00 00 00 00 00 00 00 00
+	Datacard Group Aptura Development Card V1.1b
+
+3B 6D 00 00 00 31 C0 71 D6 64 11 22 33 01 83 90 00
+	UK Barclaycard VISA
+	UK Halifax Platinum VISA
+
+3B 6D 00 00 00 31 C0 71 D6 64 34 C7 01 00 84 90 00
+	DeLaRue ProlifIC
+
+3B 6D 00 00 00 31 C0 71 D6 64 34 C7 02 00 84 90 00
+	Cybelys card (Thalys fidelity card)
+
+3B 6D 00 00 00 31 C0 71 D6 64 38 D0 02 00 84 90 00
+	EMV Visa Electron (Oberthur)
+
+3B 6D 00 00 00 31 C0 71 D6 64 38 D0 03 00 84 90 00
+	HSBC Visa/MasterCard credit card
+	Barclay Card MasterCard
+
+3B 6D 00 00 00 31 C0 71 D6 64 4E D8 01 01 84 90 00
+	UK Capital One Platinum MasterCard
+
+3B 6D 00 00 00 31 C0 71 D6 64 58 D7 01 00 84 90 00
+	UK Nationwide Bank Visa Delta
+	UK First Direct Maestro
+	UK Halifax Platinum Visa
+
+3B 6D 00 00 80 31 80 65 B0 06 01 01 77 83 00 90 00
+	GemXpresso Lite: with EMV application
+
+3B 6D 00 00 80 31 80 65 B0 43 01 00 77 83 00 90 00
+	Gemplus GemXpresso Lite
+
+3B 6D 00 00 80 31 80 65 B0 83 01 02 90 83 00 90 00
+	DeutscheBank Identification card
+
+3B 6D 00 FF 00 31 80 71 8E 64 48 D5 02 00 82 90 00
+	Blue for Business, American Express@Business
+
+3B 6E 00 00 00 31 80 71 86 65 01 64 02 22 32 80 90 00
+	MasterCard Card - bonus plus (paypass) - Garanti Bank / Turkey
+
+3B 6E 00 00 00 31 80 71 86 65 01 64 02 22 32 83 90 00
+	MasterCard Card - bonus YKM - Garanti Bank / Turkey
+
+3B 6E 00 00 00 31 80 71 86 65 01 67 02 A0 0A 83 90 00
+	Australian ANZ First Visa Card from the ANZ
+	(Australia and New Zealand) Bank
+
+3B 6E 00 00 00 31 80 71 86 65 47 44 23 01 02 83 90 00
+	Nat West Master Card
+
+3B 6E 00 00 00 31 80 71 86 65 47 44 24 01 81 83 90 00
+	MasterCard Card - Maximum - IS Bank / Turkey
+	Visa Card - Axess - Akbank / Turkey
+
+3B 6E 00 00 00 31 C0 71 86 65 01 64 02 22 33 83 90 00
+	UK NatWest ServiceCard 100 Maestro
+	Visa Card - bonus - Garanti Bank / Turkey
+
+3B 6E 00 00 00 31 C0 71 86 65 01 78 01 27 34 83 90 00
+	UK NatWest ServiceCard 100 Maestro
+	Visa Card - Gold - CARDFINANS  / Turkey
+
+3B 6E 00 00 00 31 C0 71 C6 65 01 B0 01 03 37 83 90 00
+	UK NatWest Business MasterCard
+
+3B 6E 00 00 00 31 C0 71 D6 65 7D E4 01 10 A0 83 90 00
+	VISA card, issued by the ANWB, the Dutch national Automobile club
+	Visa Card - Maximum - Oyak Bank / Turkey
+
+3B 6E 00 00 00 31 C0 71 D6 65 7D E4 01 11 A0 83 90 00
+	UK CapitalOne Platinum Mastercard
+
+3B 6E 00 00 00 31 C0 71 D6 65 A3 03 01 80 00 83 90 00
+	UK First Direct (HSBC) Maestro / Cirrus
+
+3B 6E 00 00 00 62 .. 43 57 41 56 41 4E 54 10 81 90 00
+	Setec SetCOS 4.3.0
+
+3B 6E 00 00 00 62 00 00 57 41 56 41 4E 54 10 81 90 00
+	Setec SetCOS 5.1.0 EMV + AVANT
+
+3B 6E 00 00 45 73 74 45 49 44 20 76 65 72 20 31 2E 30
+	Estonian Identity Card (EstEID v1.5 multos)
+
+3B 6E 00 00 80 31 80 65 B0 03 01 01 5E 83 00 00 90 00
+	FirstUSA Visa
+
+3B 6E 00 00 80 31 80 65 B0 03 02 01 5E 83 00 00 90 00
+	Gemplus GemXpresso 211is
+
+3B 6E 00 FF 00 62 00 00 57 41 56 41 4E 54 10 81 90 00
+	debit card (Visa Electron) issued by Nordea bank
+
+3B 6E 00 FF 45 73 74 45 49 44 20 76 65 72 20 31 2E 30
+	Estonian Identity Card (EstEID v1.0 warm)
+
+3B 6F 00 00 00 67 2. 43 46 49 53 45 12 52 66 FF 81 90 00
+	Setec SetCOS 4.3.2
+
+3B 6F 00 00 80 31 C0 52 00 83 64 02 19 08 32 83 83 90 00
+	Bancomer Mexican Bank
+
+3B 6F 00 00 80 31 C0 52 16 B9 64 05 66 80 32 83 83 90 00
+	Banorte Mexican Bank
+
+3B 6F 00 00 80 31 E0 5B 4E 4F 4B 00 00 00 00 00 00 02 00
+	Norsk-Tipping (Buypass) Monodex card
+
+3B 6F 00 00 80 31 E0 6B 04 06 03 04 40 55 55 55 55 55 55
+	Blue American Express Card
+
+3B 6F 00 00 80 31 E0 6B 04 06 05 02 17 55 55 55 55 55 55
+	Marx Software Security - Cryptoken M2048, MULTOS, Infineon SLE66CX, 64kByte
+	http://www.marx.com/en/
+
+3B 6F 00 00 80 31 E0 6B 04 20 05 02 30 55 55 55 55 55 55
+	Buypass card for Norsk Tipping (http://norsk-tipping.no)
+
+3B 6F 00 00 80 31 E0 6B 84 06 03 04 31 55 55 55 55 55 55
+	Multos Developer Sample
+
+3B 6F 00 00 80 31 E0 6B 84 06 0E 02 02 55 55 55 55 55 55
+	Multos Developer Sample
+
+3B 6F 00 00 80 31 E0 6B 84 20 05 02 39 55 55 55 55 55 55
+	Multos 14D (2-0-10) 64K Developer Card
+
+3B 6F 00 00 80 31 E0 6B 84 20 05 02 42 55 55 55 55 55 55
+	Multos 14Dc(6-0-13) 64K Dual-Interface Developer Card
+
+3B 6F 00 00 80 5A .. 0[1-5] .. .. .. .. .. .. .. .. 82 90 00
+	Card supporting a Calypso application Rev 1
+	Typically: French "Navigo" transport card
+
+3B 6F 00 00 80 66 45 46 01 38 18 03 53 02 31 10 82 90 00
+	Fábrica Nacional de Moneda y Timbre FNMT WG10
+	http://www.fnmt.es/es/html/tage/fichaTarjeta/fp1_ta_01.asp
+
+3B 6F 00 FF 52 53 41 53 65 63 75 72 49 44 28 52 29 31 30
+	RSA SecurID SID800 token
+
+3B 6F 00 FF 53 46 53 45 2D 43 58 33 32 32 2D 56 18 02 02
+	Giesecke & Devrient SmartCafe Expert 2.0
+
+3B 75 12 00 00 29 05 01 04 01
+	CAC Cryptographic Service Provider
+	Axalto Cyberflex Access 64K V1 SM 4.1
+
+3B 75 13 00 00 9C 02 02 01 02
+	Cyberflex Access 32k v2
+
+3B 75 94 00 00 62 02 02 0[1-3] 01
+	Schlumberger Cyberflex 32K e-gate
+
+3B 76 11 00 00 00 9C 11 01 02 02
+	Schlumberger Cyberflex Access 32K
+
+3B 76 11 00 00 00 9C 11 01 02 03
+	RSA SecureID 5100
+
+3B 76 12 00 00 00 9C 11 01 03 03
+	Precise BioMatch (TM) JavaCard (Schlumberger)
+	www.precisebiometrics.com
+
+3B 76 98 00 00 00 9C 11 01 01 02
+	CyberFlex Access 32
+
+3B 7A 11 00 02 48 4F 53 54 06 03 19 02 90 00
+	Swedish bankcard with Mastercard from ICA-banken
+
+3B 7A 13 00 00 00 09 A5 05 01 00 B7 01 A6 01
+	"cleyris" authentication card. monpass.santé from Mutuelle Générale
+
+3B 7A 94 00 00 80 65 A2 01 01 01 3D 72 D6 43
+	Gemplus GemXpresso Pro R3 E32 PK
+
+3B 7B .. 00 00 80 62 0. 51 56 46 69 6E 45 49 44
+	Setec SetCOS 5.1.0
+
+3B 7B 18 00 00 00 31 C0 64 77 E3 03 00 82 90 00
+	Oberthur Cosmopolic 64K v5.2 D
+
+3B 7B 94 00 00 80 62 11 51 56 46 69 6E 45 49 44
+	Finnish Electronic ID card (fineid card www.fineid.fi)
+
+3B 7B 94 00 00 80 65 B0 83 01 0[1,3] 74 83 00 90 00
+	Gemplus GemXpresso Pro R3 (E64 PK)
+
+3B 7B 95 00 00 80 65 B0 83 01 04 74 83 00 90 00
+	Gemplus GemXpresso Pro 64K R3 FIPS v2
+
+3B 7D 11 00 00 00 31 80 71 8E 64 52 D9 01 00 82 90 00
+	Oberthur Galactic V2
+
+3B 7D 11 00 00 00 31 80 71 8E 64 77 E3 01 00 82 90 00
+	Oberthur Cosmo 64k RSA v5
+
+3B 7D 11 00 00 00 31 80 71 8E 64 77 E3 02 00 82 90 00
+	Oberthur 64k v5/2.2.0
+
+3B 7D 11 00 00 00 31 80 71 8E 64 86 D6 01 00 81 90 00
+	DOD-CAC
+
+3B 7D 18 00 00 00 31 80 71 8E 64 77 E3 01 00 82 90 00
+	Oberthur 64k v4/2.1.1
+
+3B 7D 94 00 00 80 31 80 65 B0 83 01 02 90 83 00 90 00
+	Gem e-Seal
+	(GemSafeXpresso 16k R3.2?)
+
+3B 7D 94 00 00 80 31 80 65 B0 83 01 01 90 83 00 90 00
+	GemSafeXpresso 16k R3.2
+
+3B 7D 94 00 00 80 31 80 65 B0 83 02 04 7E 83 00 90 00
+	GXP Pro R3.2 64K, GemSafe applet MPCOS v1.11
+
+3B 7D 96 00 00 80 31 80 65 B0 83 11 40 AC 83 00 90 00
+	GemXpresso R4 64k
+
+3B 7D 96 00 00 80 31 80 65 B0 83 11 C0 A9 83 00 90 00
+	Gemplus X-Presso Pro 64k
+
+3B 7E 11 00 00 00 6A 11 63 54 08 30 24 01 .. .. 21 90 01
+	Sagem Windows for smart cards
+
+3B 7F 11 00 00 00 6A 43 45 52 45 53 02 2C 34 02 00 03 90 00
+	FNMT-CERES ST (Fábrica Nacional de Moneda y Timbre)
+
+3B 7F 11 00 00 80 31 C0 52 21 57 64 02 18 19 53 83 83 90 00
+	banking card (www.caixacatalunya.com)
+	student id of Universitat  Autonoma de Barcelona
+
+3B 7E 13 00 00 00 6A 11 63 54 05 48 .. .. .. 01 22 90 00
+	Sagem Windows for smart cards
+
+3B 7F 13 00 FF 45 43 4F 53 76 31 31 30 28 63 29 50 46 42 4D
+	ECOS-Card [Experimental Card Operating System V.1.1] by Philipp Maier
+	http://www.runningserver.com/?page=runningserver.content.download.ecos
+
+3B 7F 11 00 00 00 31 C0 53 CA C4 01 64 52 D9 04 00 82 90 00
+	DoD CAC, Oberthur CosmopolIC 32K V4
+
+3B 7F 18 00 00 00 31 C0 73 9E 01 0B 64 52 D9 03 00 82 90 00
+	Oberthur Galactic V3 (32k)
+
+3B 7F 18 00 00 00 31 C0 73 9E 01 0B 64 52 D9 04 00 82 90 00
+	Oberthur CosmopolIC 32K v4 Fast ATR
+	Oberthur Authentic
+
+3B 7F 18 00 00 00 31 C0 73 9E 01 0B 64 52 D9 05 00 82 90 00
+	Oberthur 32k BIO
+
+3B 7F 38 00 00 00 6A 43 45 52 45 53 02 2C 34 02 02 03 90 00
+	WG10
+
+3B 7F 38 00 00 00 6A 44 4E 49 65 20 02 4C 34 01 13 03 90 00
+	DNI electronico (Spanish electronic ID card)
+	http://www.dnielectronico.es
+
+3B 81 1F 00 CC 52
+	eToken R2 2242
+
+3B 81 80 01 80 80
+	Mifare DESFire
+
+3B 82 00 55 22
+	GSM-SIM TELE2 Smart (Estonia, prepaid)
+
+3B 82 81 31 76 43 C0 02 C5
+	CardOS/M2 V2.01(SLE44CxxS)
+
+3B 82 81 31 76 43 C1 03 C5
+	i.ti (ticket card for Collogne/Bonn)
+	CardOS M2 Combi V2.02 (SLE44R42S)
+
+3B 83 00 12 10 96
+	GSM-SIM T-Mobil D1 (900MHz)
+
+3B 85 00 12 02 01 00 96
+	GSM-SIM Victorvox D1 (900MHz)
+
+3B 85 00 87 25 01 38 02
+	GSM-SIM Viag Interkom E2 Loop GSM (1800MHz)
+
+3B 85 00 87 25 01 39 00
+	GSM-SIM Telfort (Netherlands) 900 MHz
+
+3B 85 40 20 68 01 01 .. ..
+	Schlumberger Cryptoflex 8k
+
+3B 85 40 20 68 01 01 03 05
+	Schlumberger Cryptoflex Key Generation
+
+3B 85 40 20 68 01 01 05 01
+	Schlumberger Cryptoflex 8k
+
+3B 86 40 20 68 01 01 02 04 AC
+	Activcard Gold, SchlumbergerSema Cryptoflex 8k
+
+3B 85 40 FF 63 01 01 03 01
+	Axalto Cryptoflex 16K
+
+3B 85 40 FE 68 01 01 02 04
+	Axalto CryptoFlex 8K
+
+3B 86 80 01 4A 43 4F 50 33 30 12
+	Mifare ProX T=CL
+
+3B 86 80 01 4A 43 4F 50 33 31 13
+	JCOP BIO 31 Contactless Card
+
+3B 87 81 31 40 43 4D 46 43 20 31 33 31 6F
+	Telekom Paycard
+
+3B 88 81 31 20 55 00 57 69 6E 43 61 72 64 29
+	SmartCard for Windows 1.0
+
+3B 89 00 91 26 91 06 00 01 22 01 00
+	BT Cellnet SIM
+
+3B 8B 80 01 00 64 04 11 01 01 31 80 00 90 00 5A
+	German Passport (issued Nov 2006)
+	United Kingdom e-Passport
+
+3B 89 40 14 47 47 32 36 4D 35 32 38 30
+	GSM-SIM e-plus (1800MHz)
+
+3B 89 80 01 00 64 04 15 01 02 00 90 00 EE
+	German Passport (issued Apr 2007)
+
+3B 89 80 01 4A 43 4F 50 34 31 56 32 32 4D
+	New Zealand e-Passport
+
+3B 89 80 01 4D 54 43 4F 53 73 01 02 01 3F
+	Contactless MTCOS
+	http://www.masktech.de/
+
+3B 89 80 01 53 50 4B 32 35 44 49 90 00 DA
+	SPK 2.5 D1
+
+3B 8A 80 01 00 64 05 5C 02 03 31 80 90 00 16
+	T-System Contactless Netkey Card
+
+3B 8A 80 01 00 64 05 76 02 03 31 80 90 00 3C
+	T-System Contactless TCOS Min
+
+3B 8A 00 91 01 00 16 00 01 16 01 00 96
+	GSM-SIM T-Mobil D1 (900MHz)
+
+3B 8A 00 91 01 00 16 00 01 20 01 00 96
+	GSM-SIM T-D1 prepaid (Xtra)
+
+3B 8A 00 91 01 00 16 00 01 20 02 00 96
+	GSM-SIM (900MHz) card of the carrier t-mobile for their cellular
+	network (phase 2+ with 3V)
+
+3B 8A 00 91 91 00 17 00 01 07 03 00 96
+	T-Mobile prepaid 2G SIM
+
+3B 8E 80 01 80 31 80 66 40 90 89 12 08 02 83 01 90 00 0B
+	ISO 14443B Type T = CL Infineon Card
+
+3B 8E 80 01 80 91 91 31 C0 64 77 E3 03 00 83 82 90 00 1C
+	Belgian Passport
+
+3B 8F 01 80 25 A0 00 00 00 56 57 44 4B 34 30 30 06 00 B7
+	SafeNet IKey4000
+
+3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A
+	Philips MIFARE Standard (1 Kbytes EEPROM)
+	http://www.nxp.com/products/identification/mifare/classic/
+	RFID - ISO 14443 Type A - Transport for London Oyster
+
+3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 02 00 00 00 00 69
+	Mifare card with 4k EEPROM
+
+3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68
+	Contactless Mifare Ultralight
+
+3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 00 00 00 00 00 63
+	RFID - ISO 15693 - EM Microelectronic-Marin SA
+
+3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 12 00 00 00 00 71
+	RFID - ISO 15693 - Texas Instrument
+
+3B 8F 80 01 80 4F 0C A0 00 00 03 06 0A 00 1C 00 00 00 00 7E
+	RFID - HID iCLASS 16K CL
+
+3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77
+	Philips ICode
+	RFID - ISO 15693 - Philips Semiconductors
+
+3B 90 95 80 1F C3 59
+	Dai Nippon Printing Co., DNP Standard-J T3.1
+
+3B 95 15 40 .. 68 01 02 .. ..
+	Schlumberger CryptoFlex 8k v2
+
+3B 95 18 40 FF 62 01 02 01 04
+	Schlumberger Cryptoflex 32K e-gate
+
+3B 95 18 40 FF 62 04 01 01 05
+	Schlumberger CryptoFlex 32Ko V1
+
+3B 95 18 40 FF 64 02 01 01 02
+	Schlumberger CryptoFlex 32Ko
+
+3B 95 94 40 FF 63 01 01 02 01
+	Schlumberger Cryptoflex 16Ko
+
+3B 95 95 40 FF AE 01 01 02 03
+	Axalto Cyberflex Access 64K v2a SM 2.3
+
+3B 95 95 40 FF AE 01 03 00 00
+	Axalto - Cyberflex 64K
+
+3B 95 95 40 FF D0 00 1A 01 01
+	Cyberflex Access 64k (v3)
+
+3B 98 13 40 0A A5 03 01 01 01 AD 13 11
+	Belgium Electronic ID card
+
+3B 98 94 40 0A A5 03 01 01 01 AD 13 10
+	Belgium Electronic ID card
+
+3B 99 94 00 91 08 91 06 00 01 06 06 00
+	GSM-SIM Orange-UK (1800)
+
+3B 9A 94 00 91 01 00 17 00 01 23 10 00 96
+	GSM-SIM Victorvox D1 (900MHz)
+
+3B 9A 94 00 91 01 00 17 00 01 23 11 00 96
+	GSM-SIM Card T-D1 (900MHz)
+
+3B 99 94 00 91 99 93 12 00 01 16 02 00
+	ORGA test systems - GSM Phase 2+ Test SIM
+
+3B 9A 96 00 92 03 49 93 16 00 01 21 01 00
+	GSM-SIM card of the Austrian provider Yesss! (http://www.yesss.at)
+
+3B 9B 95 80 1F 47 80 31 A0 73 BE 21 00 53 34 99 05 D0
+	GSM-SIM EMT "Diil", prepaid (Estonia)
+
+3B 9C 13 11 81 64 72 65 61 6D 63 72 79 70 74 00 04 08
+	XPlusTV & INXCT Access Card-9 (FIRECrypt)
+
+3B 9D 11 40 23 00 68 10 11 4D 69 6F 43 4F 53 00 90 00
+	MioCOS 1.0
+
+3B 9D 94 40 23 00 68 20 01 4D 69 6F 43 4F 53 00 90 00
+	Miotec (http://www.miotec.fi) smartcard running Miocos 2.0 on an Atmel AT90SC646
+
+3B 9E 95 80 1F C3 80 31 A0 73 BE 21 13 67 29 02 01 04 04 CD 39
+	Hutchison/3 3G USIM
+	J+ SWIM WIB UMTS SIM Test card
+	http://www.exceldata.es/microprocess/j%2Bswinwibusim.html
+
+3B 9D 95 80 1F C3 80 31 E0 52 4B 54 62 11 03 73 FE 21 1B 8F
+	KT WiBro UICC (2.3 GHz mobile WiMAX in South Korea)
+
+3B 9F 21 0E 49 52 44 45 54 4F 20 41 43 53 20 56 34 2E 31 9D
+	Foxtel paytv decoder in Australia acs 4.1 Irdeto2
+
+3B 9F .. 80 1F C3 00 68 1. 44 05 01 46 49 53 45 31 C8 .. 90 00 ..
+	Setec SetCOS 4.4.1
+
+3B 9F 94 40 1E 00 67 11 43 46 49 53 45 10 52 66 FF 81 90 00
+	Setec / FINEID
+	SETEC Instant EID
+
+3B 9F 94 40 1E 00 67 16 43 46 49 53 45 10 52 66 FF 81 90 00
+	RSA SecurID 3100 or Utimaco Safeware Smartcard
+	SetCOS 4.3.1 Revision Unknown
+
+3B 9F 94 40 1E 00 67 .. 43 46 49 53 45 10 52 66 FF 81 90 00
+	SLE66CX160S running SETCOS 4.3.1 Revision A
+
+3B 9F 94 80 1F C3 00 68 10 44 05 01 46 49 53 45 31 C8 07 90 00 18
+	SetCOS 4.3.0 32K RSA
+	Instant EID IP2
+	SETEC SetCard 32K PKI Evaluated SetCOS 4.4.1a2
+
+3B 9F 95 80 1F C3 80 31 E0 73 FE 21 1B 63 E2 09 A9 83 0F 90 00 8D
+	GSM-SIM EMT (Estonia, WPKI eID support)
+
+3B 9F 95 80 1F C3 80 31 E0 73 FE 21 1B B3 E2 01 74 83 0F 90 00 88
+	Gemplus GemXplore 3G USIM
+
+3B 9F 95 80 1F C7 80 31 E0 73 FE 21 1B 63 E2 04 A5 83 0F 90 00 88
+	Cingular "64Ksmartchip" GSM SIM
+
+3B 9F 96 80 1F C3 00 68 10 44 05 01 46 49 53 45 31 C8 07 90 00 1A
+	SETEC SetCard 32K PKI Evaluated SetCOS 4.4.1
+
+3B 9F 96 80 1F C3 80 31 E0 73 FE 21 1B B3 E2 02 7E 83 0F 90 00 82
+	Vodafone SIM Card (D2, 1800Mhz, Germany, Twincard, possibly others too?), manufactured by Gemplus (See stamp on the chip)
+
+3B A7 00 40 .. 80 65 A2 08 .. .. ..
+	Gemplus GemSAFE Smart Card (8K)
+
+3B A7 00 40 14 80 65 A2 14 01 01 37
+	Gemplus GPK4000sdo
+
+3B A7 00 40 18 80 65 A2 08 01 01 52
+	Gemplus GPK8000
+	GemSAFE Smart Card (8K)
+
+3B A7 00 40 18 80 65 A2 09 01 01 52
+	Gemplus GPK16000
+
+3B A7 00 40 18 80 65 A2 09 01 02 52
+	Gemplus GPK16000
+
+3B A7 00 40 18 80 65 A2 09 01 03 52
+	Gemplus GemSAFE std (GPK16000?)
+
+3B A8 00 81 71 46 5D 00 54 43 4F 53 31 2E 32 00 65
+	Telesec TCOS 1.2
+
+3B A8 00 81 71 46 5D 00 54 43 4F 53 31 2E 32 4B 2E
+	CeloCom Card with TCOS 1.2
+
+3B AA 00 40 14 47 47 32 47 54 35 53 34 38 30
+	GSM-SIM Libertel (900MHz)
+
+3B AA 00 40 80 53 4F 80 53 45 03 04 11 AA A3
+	"open platform" ATMEGA "new Generation"
+	http://www.masterixweb-italy.com/new/images/articoli/atmega.jpg
+
+3B AB 00 81 31 40 45 80 31 C0 65 08 06 80 00 00 00 00 84
+	Reloadable Visa Cash card (Schlumberger), Bank of America
+
+3B AD 00 40 FF 80 31 80 65 B0 05 01 01 5E 83 00 90 00
+	Dallas Semiconductor iButton
+	JIB
+
+3B B0 11 00 81 31 90 73 F2
+	SamOS 2.7
+
+3B B2 11 00 10 80 00 01
+	Atmel memory card AT88SC0104C
+	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
+
+3B B2 11 00 10 80 00 02
+	Atmel memory card AT88SC0204C (Atmel memory card)
+	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
+
+3B B2 11 00 10 80 00 04
+	Atmel memory card AT88SC0404C
+	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
+
+3B B2 11 00 10 80 00 08
+	Atmel memory card AT88SC0808C
+	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
+
+3B B2 11 00 10 80 00 16
+	Atmel memory card AT88SC1616C
+	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
+
+3B B3 11 00 00 00 00 32
+	Atmel memory card AT88SC3216C
+	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
+
+3B B3 11 00 00 00 00 64
+	Atmel memory card AT88SC6416C
+	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
+
+3B B3 11 00 00 00 01 28
+	Atmel memory card AT88SC12816C
+	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
+
+3B B3 11 00 00 00 02 56
+	Atmel memory card AT88SC25616C
+	http://www.atmel.com/dyn/resources/prod_documents/doc5210.pdf
+
+3B B2 11 00 10 80 00 08
+	Smart VR Card - GD Burti
+
+3B B7 11 00 81 31 90 43 A5 .. .. .. .. .. .. ..
+	Siemens CardOS/M V1.4 (SLE44C80S)
+
+3B B7 11 00 81 31 90 53 B5 .. .. .. .. .. .. ..
+	CardOS EM/V1.4 (SLE44CR80S)
+
+3B B7 18 00 81 31 FE 65 53 50 4B 32 34 90 00 5A
+	Giesecke & Devrient Starcos 2.4
+
+3B B7 18 00 C0 3E 31 FE 65 53 50 4B 32 34 90 00 25
+	G&D STARCOS SPK 2.4
+
+3B B7 94 00 81 31 FE 65 53 50 4B 32 32 90 00 D0
+	Giesecke & Devrient STARCOS SPK2.2
+
+3B B7 94 00 81 31 FE 65 53 50 4B 32 33 90 00 D1
+	Giesecke & Devrient Starcos 2.3
+	Deutsche Bank WebSign (RSA-Card)
+	G&D StarSign Token
+
+3B B8 13 00 81 31 20 5D 00 57 69 6E 43 61 72 64 02
+	SmartCard for Windows 1.1
+
+3B B9 94 00 40 14 47 47 33 4E 48 38 36 34 30
+	GSM-SIM card of the Austrian mobile phone provider One, http://www.one.at
+	Proximus SIM - Belgium (SetCOS?)
+
+3B BA 11 00 81 31 FE 4D 55 45 4B 41 45 20 56 31 2E 30 AE
+	AKİS v1.0
+
+3B BA 13 00 81 31 86 5D 00 64 05 0A 02 01 31 80 90 00 8B
+	Telesec TCOS 2 (SLE44)
+	TCOS 2.0 (on CR80S)
+	Cryptokarte with RSA-Controller, T=1 Protocol
+
+3B BA 14 00 81 31 86 5D 00 64 05 14 02 02 31 80 90 00 91
+	TCOS 2.0 (on CX160S)
+	Telesec TCOS 2 (SLE66)
+
+3B BA 94 00 40 14
+	GG3RS732S0 ?
+
+3B BA 94 00 40 14 47 47 33 52 53 37 31 36 53 30
+	GSM-SIM Viag Interkom E2 Loop (1800MHz)
+	GSM-SIM card of the Austrian A1, http://www.a1.net/privat/home
+
+3B BA 96 00 81 31 86 5D 00 64 05 60 02 03 31 80 90 00 66
+	Telesec TCOS 2 (SLE66P)
+	TCOS 2.0 (on CX320P)
+	TeleSec Netkey Card
+
+3B BA 96 00 81 31 86 5D 00 64 05 7B 02 03 31 80 90 00 7D
+	TeleSec NetKey Card
+	Deutsche Post card (tcos)
+
+3B BC 94 00 40 14 47 47 33 48 33 35 58 53 32 30 30 30
+	GSM-SIM Era-PL
+	T-Mobile GSM SIM Card
+
+3B BC 94 00 40 14 47 47 33 48 33 35 58 56 32 30 30 30
+	GSM SIM CARD 32K, Vodafone
+
+3B BC 94 00 40 14 47 47 33 49 35 43 41 43 31 30 30 30
+	Siemens SIM card
+
+3B BC 94 00 40 14 47 47 33 53 30 35 31 53 31 30 31 30
+	GSM SIM (Tele2, Estonia)
+
+3B BE 11 00 00 41 01 38 00 00 00 00 00 00 00 00 01 90 00
+	ACS (Advanced Card System) ACOS-1
+
+3B BE 11 00 00 41 01 38 00 00 00 00 00 00 00 00 02 90 00
+	ACS (Advanced Card System) ACOS-1 8K
+
+3B BE 11 00 00 41 01 38 01 00 03 00 00 00 00 00 02 90 00
+	ACOS2 test card from ACS reading off a ACR38U
+
+3B BF 11 00 81 31 FE 45 45 50 41 00 00 00 00 21 00 93 42 00 00 00 00 01
+	Austrian BankCard (Old Version - ca. 2004)
+
+3B BF 11 00 81 31 FE 45 45 50 41 00 00 00 00 26 24 68 30 00 00 00 00 AB
+	Austrian BankCard  (Maestro + Quick) (New Version, since 02/2005,
+	with Digital-Signature etc.)
+
+3B BF 11 00 81 31 FE 45 45 50 41 00 00 00 00 28 93 66 23 00 00 03 E8 E4
+	Austrian Maestro BankCard +Quick Buergerkarte
+
+3B BF 11 00 81 31 .. 45 45 50 41 00 00 00 00 .. .. .. .. 00 00 .. .. ..
+	Austrian Quick E-purse
+
+3B BE 18 00 00 41 05 .. 00 00 00 00 00 00 00 00 00 90 00
+	Advanced Card Systems (ACS) ACOS5 Cryptographic Smart Card
+
+3B BE 18 00 00 41 05 10 00 00 00 00 00 00 00 00 00 90 00
+	ACS ACOS5 "ACOS5-32-G" http://www.acs.com.hk/acos5.asp
+
+3B BD 18 00 81 31 FE 45 80 51 02 67 04 14 B1 01 01 02 00 81 05 3D
+	Austrian "e-Card" (=Health Card), BRANDNEW (since 06/2005)
+	special Version of Starcos 3.1
+
+3B BF 11 00 C0 10 31 FE 44 53 4D 40 52 54 20 43 41 46 45 20 31 2E 31 43 C1
+	Giesecke&Devrient SmartCafe 1.1
+
+3B BF 18 00 80 31 70 35 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00 9B
+	Giesecke & Devrient STARCOS S2.1
+
+3B BF 18 00 81 31 70 55 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00 FA
+	Giesecke & Devrient STARCOS S2.1
+
+3B BF 18 00 C0 20 31 70 52 53 54 41 52 43 4F 53 20 53 32 31 20 43 90 00 9C
+	Giesecke & Devrient SPK 2.1 C
+
+3B BF 94 00 81 31 FE 65 45 4C 55 20 41 75 73 74 72 69 61 20 31 2E 32 38
+	A-Trust: trust-sign (Old Version, ca. 2002) for Digital Signature etc.
+	A-Trust: a-sign-premium (ca. 2004) "Bürgerkarte" ("Citizen-Card")
+	for Identifikation, Digital Signature etc.
+	("should be" Starcos 2.3)
+
+3B BF 94 00 81 31 FE 65 45 4C 55 20 41 75 73 74 72 69 61 20 31 2E 32 38
+
+3B BF 96 00 81 31 FE 5D 00 64 .. .. .. .. 31 C0 73 F7 01 D0 00 90 00 ..
+	TCOS 3.0 / NetKey 3.0
+
+3B D0 A8 FF 81 F1 FB 24 00 1F C3 F4
+	Philips DESFire SAM
+
+3B D5 95 04 00 AE 01 02 01 01
+	Axalto Cyberflex Access 64K v2b SM 1.1
+
+3B D6 18 00 80 B1 80 6D 1F 03 80 51 00 61 10 30 9E
+	Atmel/Athena T0 PC/SC Compliance Test Card No. 1
+
+3B D6 18 00 81 B1 80 7D 1F 03 80 51 00 61 10 30 8F
+	ASECard Crypto, http://www.athena-scs.com/product.asp?pid=8
+
+3B DB 11 FF 50 00 FF 00 00 00 00 00 00 00 07 92 16 03
+	NEC V-WAY64 v2.1
+
+3B DB 96 00 80 1F 03 00 31 C0 64 77 E3 03 00 82 90 00 C1
+	CAC (Common Access Card)
+
+3B DB 96 00 81 B1 FE 45 1F 03 80 F9 A0 00 00 03 08 00 00 10 00 18
+	Oberthur CS PIV End Point v1.08 FIPS201 Certified
+
+3B DE 18 FF 81 F1 FB 34 00 1F 07 44 45 53 46 69 72 65 53 41 4D 56 31 2E 30 D2
+	Mifare Desfire SAM Module
+
+3B DE 18 FF C0 80 B1 FE 45 1F 03 45 73 74 45 49 44 20 76 65 72 20 31 2E 30 2B
+	Estonian Identity Card (EstEID v1.0 2006 cold)
+
+3B DF 18 00 81 31 FE 67 00 5C 49 43 4D D4 91 47 D2 76 00 00 38 33 00 58
+	Infineon SICRYPT Card Module D4 PC/SC Compliance Test Card
+
+3B E0 00 00 81 31 20 40 30
+	SmarTEC
+
+3B E2 00 00 40 20 49 ..
+	Schlumberger Cryptoflex 4k
+
+3B E2 00 00 40 20 49 05
+	Schlumberger Cryptoflex DES
+
+3B E2 00 00 40 20 49 06
+	Schlumberger Cryptoflex
+
+3B E2 00 00 40 20 49 07
+	Schlumberger Cryptoflex Key Generation
+
+3B E2 00 FF C1 10 31 FE 55 C8 02 9C
+	Aladdin eToken PRO (USB token)
+	Siemens CardOS M4.0
+
+3B E3 00 FF 91 81 71 26 44 00 01 13 20 2D
+	Metrebus Card
+	(used in Rome to store personal information and Atac subscription.
+	Atac is the public transport company of the city of Rome.)
+	http://www.atac.roma.it/smart/smart.asp?A=2&S=22&PR=4&LNG=2
+
+3B E6 00 FF 81 31 FE 45 4A 43 4F 50 30 33 07
+	IBM JCOP 30/16
+
+3B E6 00 FF 81 31 FE 45 4A 43 4F 50 31 30 05
+	IBM JCOP 10/16
+
+3B E6 00 FF 81 31 FE 45 4A 43 4F 50 32 30 06
+	IBM JCOP 20/16
+	IBM JCOP20 with MIFARE
+	or Datakey Smart Card Model 330J
+	(http://www.datakey.com/products/smart_cards/products_sc_330j.shtml)
+
+3B E6 00 FF 81 31 FE 45 4A 43 4F 50 32 31 07
+	IBM JCOP ID21
+
+3B E6 00 FF 81 31 FE 45 4A 43 4F 50 33 30 07
+	Mifare ProX T=1
+
+3B E6 00 FF 81 31 FE 45 4A 43 4F 50 33 31 06
+	IBM JCOP 30/31bio (contact interface)
+
+3B E7 00 00 91 81 31 FE 41 01 10 30 01 00 90 80 49
+	"FirmenTicket" from the "Rheinbahn" for the "VRR"
+	its a ticket corporates can buy for their employees. so its called
+	"FirmenTicket". "Rheinbahn" is the local service operator for the
+	mass traffic in and around duesseldorf/germany. "VRR" is traffic
+	network spanning over at least a big part of north rhine westphalia
+	(Verkehrsverbund Rhein-Ruhr)
+	(http://www.vrr.de/de/tickets_und_tarife/vielfahrer/firmenticket/index.php)
+
+3B E9 00 00 81 21 45 45 4D 56 5F 41 54 52 20 06 6C
+	VISA card, issued by HVB Bank Czech Republic (http://www.hvb.cz)
+
+3B E9 00 00 81 21 45 56 49 53 5F 49 4E 46 20 06 78
+	VISA card, issued by the Austrian "Raiffeisen" bank (http://www.raiffeisen.at/
+	Visa Card - Maximum - Oyak Bank / Turkey
+
+3B E9 00 00 81 31 FE 45 4A 43 4F 50 34 31 56 32 32 A7
+	IBM JCOP v2.2 41
+
+3B E9 00 FF C1 10 31 FE 55 C8 01 20 50 4E 34 30 31 32 AD
+	Siemens CardOS/M 3.0 (SLE66CX160S)
+
+3B EA 00 FF 81 31 20 75 00 64 05 14 01 02 31 00 90 00 27
+	GCOS-MDK
+
+3B EA 00 FF 81 31 FE 45 54 55 42 2D 43 4B 01 03 01 00 7B
+	Technische Universität Berlin - Campus Karte
+	Maybe Sm@rtCafé Expert 2.0 (Giesecke & Devrient)
+	or GemXpresso 211 PK (Gemplus)
+	Includes a Mifare-Chip (1 KB - Memory-Chip)
+
+3B EB 00 00 81 31 42 45 4E 4C 43 68 53 43 4B 30 34 30 31 2B
+	Dutch University accesscard & Electronic purse & telphone card
+
+3B EB 00 00 81 31 42 45 4E 4C 43 68 69 70 70 65 72 30 31 0A
+	Dutch Post (Chipper)
+
+3B EC 00 FF 81 31 FE 45 A0 00 00 00 56 33 33 30 4A 33 06 00 A1
+	Datakey model 330J card, www.datakey.com
+	http://www.hmk.de/downloads/datakey/Model_330J_Smart_Card.pdf
+	Model 330J JavaCard v2.1.1
+	Global Platform v2.0.1 specifications.
+	JCCOS operating system applet (Java-based Cryptographic Card
+	Operating System)
+
+3B EF 00 00 40 14 80 25 43 45 52 45 53 57 01 16 01 01 03 90 00
+	Electronic Identification Card from the FNMT, the Spanish Official
+	Certification Authority (Fábrica Nacional de Moneda y Timbre)
+	FNMT-Ceres Siemens Infineon SLE 19
+
+3B EF 00 00 40 14 80 25 43 45 52 45 53 57 05 60 01 02 03 90 00
+	FNMT-Ceres Siemens Infineon SLE 20
+	Fábrica Nacional de Moneda y Timbre
+
+3B EF 00 00 81 31 20 49 00 5C 50 43 54 10 27 F8 D2 76 00 00 38 33 00 4D
+	Infineon Technologies PC/SC Compliance Test Card V1.0
+
+3B EF 00 00 81 31 FC 45 80 31 80 65 11 01 13 00 01 53 41 43 45 81 04 21
+	Slovenska sporitelna (SLSP) Bank card, Maestro Card with chip
+
+3B EF 00 FF 81 31 20 45 42 61 73 69 63 43 61 72 64 20 5A 43 32 2E 33 BD
+	ZeitControl BasicCard Enhanced 2.3
+
+3B EF 00 FF 81 31 20 45 42 61 73 69 63 43 61 72 64 20 5A 43 33 2E 33 BC
+	Electronic Purse (Elton Senegal)
+
+3B EF 00 FF 81 31 50 45 65 63 0D 24 20 02 80 00 05 08 33 56 10 01 02 43
+	German ec card
+
+3B EF 00 FF 81 31 20 75 42 61 73 69 63 43 61 72 64 20 5A 43 33 2E 33 8C
+	ZeitControl BasicCard Enhanced 3.3
+
+3B EF 00 FF 81 31 20 75 42 61 73 69 63 43 61 72 64 20 5A 43 33 2E 37 88
+	ZeitControl BasicCard Enhanced 3.7
+
+3B EF 00 FF 81 31 20 75 42 61 73 69 63 43 61 72 64 20 5A 43 33 2E 39 86
+	ZeitControl BasicCard Enhanced 3.9
+
+3B EF 00 FF 81 31 42 45 .* 38
+	UNI-Card
+
+3B EF 00 FF 81 31 42 45 65 63 03 02 03 02 80 00 22 40 48 95 96 00 20 28
+	Scard Sparkasse Detmold, Deutschland BLZ 47650130
+
+3B EF 00 FF 81 31 50 45 42 61 73 69 63 43 61 72 64 20 5A 43 31 2E 31 CC
+	ZeitControl BasicCard Compact 1.1
+
+3B EF 00 FF 81 31 50 45 65 63 .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+	GeldKarte v2 (Germany)
+
+3B EF 00 FF 81 31 50 45 65 63 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+	Geldkarte v2
+
+3B EF 00 FF 81 31 50 45 65 63 08 0B 40 02 80 00 08 15 20 03 36 04 00 7E
+	old banking card (electronic-card / Maestro / Geldkarte) of the
+	Stadt-Sparkasse Duesseldorf (like the above, but old - around 2002).
+
+3B EF 00 FF 81 31 52 45 4D 46 43 20 49 42 4D 20 34 30 48 39 36 30 31 FB
+	IBM MFC 3.5 file system smart card
+	(Card from the book "Smart Card Application Development Using Java")
+
+3B EF 00 FF 81 31 60 45 65 63 04 02 11 00 00 00 00 00 A5 32 A5 01 11 B6
+	GledKarte
+	Siemens M3-Module with a Motorola SC-28.
+	G&D (Giesecke&Devrient) Geldkarten-OS mit der Version 11
+
+3B EF 00 FF 81 31 60 45 65 63 06 03 14 02 50 00 06 51 08 11 5E 01 41 90
+	Geldkarte from Deutsche Bank, Thomson-Chip
+
+3B EF 00 FF 81 31 66 45 49 42 4D 20 4D 46 43 34 30 30 32 30 38 33 31 A1
+	IBM MFC 4.1 file system smart card
+	Card from the book "Smart Card Application Development Using Java"
+	authors: Uwe Hansmann, Martin. S. Nicklous, Thomas Schäck, Achim Schneider, Frank Seliger
+
+3B EF 00 FF 81 31 66 45 65 63 20 20 49 42 4D 20 33 2E 31 20 20 20 20
+	IBM eCash
+
+3B EF 00 FF 81 31 66 45 65 63 20 20 49 42 4D 20 33 2E 31 20 20 20 20 CF
+	IBM eCash
+
+3B EF 00 FF 81 31 86 45 49 42 4D 20 4D 46 43 34 30 30 30 30 38 33 31 43
+	ComCard MFC 4.1
+
+3B EF 00 FF 81 31 FE 45 65 63 11 04 01 02 80 00 0F 27 40 00 03 01 00 E1
+	Postbank Geldkarte
+
+3B EF 00 FF 81 31 FE 45 65 63 11 04 01 02 80 00 0F 46 20 04 23 01 00 C4
+	Postbank ec/Maestro (Germany)
+
+3B EF 00 FF 81 31 FE 45 80 31 C0 6B 49 42 4D 20 4A 65 74 5A 20 4D 32 39
+	UBS Internet Card (IBM JetZ M2)
+
+3B F2 18 00 02 C1 0A 31 FE 55 C8 07 76
+	Siemens CardOS V4.3
+
+3B F2 18 00 02 C1 0A 31 FE 58 C8 08 74
+	Siemens CardOS V4.3B
+
+3B F2 18 00 02 C1 0A 31 FE 58 C8 09 75
+	Siemens CardOS V4.2B
+
+3B F2 18 00 FF C1 0A 31 FE 55 C8 06 8A
+	Siemens CardOS M 4.2 (SLE66CX642P)
+
+3B F2 98 00 FF C1 10 31 FE 55 C8 03 15
+	Siemens CardOS M 4.01 (SLE66CX320P)
+
+3B F2 98 00 FF C1 10 31 FE 55 C8 04 12
+	CardOS M4.01a (SLE66CX322P)
+
+3B F4 18 00 02 C1 0A 31 FE 58 56 34 63 76 C5
+	Eutron CryptoIdentity (reader + card token)
+
+3B F4 18 00 FF 81 31 80 55 00 31 80 00 C7
+	Identity card of Italian Republic
+
+3B F4 98 00 FF C1 10 31 FE 55 4D 34 63 76 B4
+	Eutron Digipass 860 (reader + card token)
+
+3B F5 91 00 FF 91 81 71 FE 40 00 41 00 00 00 00 05
+	Contactless Mifare Ultralight
+
+3B F5 91 00 FF 91 81 71 FE 40 00 41 08 00 00 00 0D
+	Contactless Mifare
+
+3B F5 91 00 FF 91 81 71 FE 40 00 41 18 00 00 00 1D
+	Contactless Mifare 4k
+
+3B F5 91 00 FF 91 81 71 FE 40 00 41 88 00 00 00 8D
+	Contactless Mifare 1k or 4k
+
+3B F6 18 00 FF 81 31 FE 45 4A 43 4F 50 32 30 0E
+	IBM JCOP20
+
+3B F6 18 00 FF 81 31 FE 45 4A 43 4F 50 33 30 0F
+	Philips P8RF5016 running IBM JCOP 30 (contact interface)
+
+3B F6 18 00 FF 81 31 FE 45 4A 43 4F 50 33 31 0E
+	IBM JCOP BIO31
+	IBM JCOP BIO31 Java card
+
+3B F7 11 00 01 40 96 54 30 04 0E 6C B6 D6 90 00
+	PIC16F876-04/SP (PICCard2) or
+	PIC16F84A-04/P + 24LC16B (PICCard1) or
+	Canal + Canal Digital Spain year 2000/2001 or
+	PIC Silver Card 2 (PIC16F876/7 + 24C64)
+
+3B F7 11 00 01 40 96 58 42 14 0E 6C B6 D6
+	UK on digital (terrestrial digital TV card)
+
+3B F7 11 00 01 40 96 70 70 07 0E 6C B6 D6 90 00
+	M-II (a.k.a. M-2, a.k.a. Platinum Card), AT90SC6464C based
+	KnotCard II
+	TitaniumElite
+
+3B F7 11 00 01 40 96 70 70 17 0E 6C B6 D6
+	Canal Satellite card (VERSION 7.1  SYSTEM / SECA2)
+
+3B F7 91 00 FF 91 81 71 FE 40 00 41 20 00 11 77 81 80 40
+	Contactless Mifare DESFire
+
+3B F8 18 00 00 81 31 FE 45 00 73 C8 40 13 00 90 00 93
+	Giesecke & Devrient Sm@rtCafé Expert 3.0
+
+3B F9 94 00 00 81 31 FE 65 46 54 20 56 31 30 30 90 00 83
+	ePass 2000
+
+3B FA 11 00 02 40 60 43 C6 02 F8 03 03 00 00 90 00
+	DeLaRue DX(?)
+
+3B FA 13 00 00 81 31 FE 45 4A 43 4F 50 34 31 56
+	JCOP41 V221
+
+3B FA 13 00 FF 81 31 80 45 00 31 C1 73 C0 01 00 00 90 00 B1
+	OpenPGP
+
+3B FA 94 00 00 81 31 20 43 80 65 A2 01 01 01 3D 72 D6 43 21
+	GemXpresso Pro R3 32PK (MPCOS, T=1)
+
+3B FA 98 00 FF C1 10 31 FE 55 C8 03 53 41 47 5F 50 4B 49 32 77
+	Siemens corporate ID card (access to the building / rooms etc,
+	stores PKI private keys/certificates)
+
+3B FA 98 00 FF C1 10 31 FE 55 C8 04 53 41 47 5F 50 4B 49 32 70
+	Siemens Belgium Corporate Card
+
+3B FB 13 00 FF 81 31 80 75 5A 43 36 2E 35 20 52 45 56 20 43 64
+	ZeitControl BasicCard 6.5, multiapplication with 30 kByte EEPROM
+
+3B FB 13 00 FF 81 31 80 75 5A 43 35 2E 35 20 52 45 56 20 47 63
+	ZeitControl BasicCard 5.5
+
+3B FB 13 00 FF C0 80 31 80 75 5A 43 35 2E 34 20 52 45 56 20 41 A5
+	ZeitControl BasicCard Professional 5.4 Revision A
+
+3B FB 96 00 00 80 31 FE 45 00 31 C0 64 77 E3 02 00 82 90 00 76
+	Oberthur ID-One Cosmo
+
+3B FB 98 00 FF C1 10 31 FE 55 00 64 05 20 47 03 31 80 00 90 00 F3
+	Gemplus GemGate 32K
+	distributed by Postecert (www.postecert.it) to legally sign documents
+
+3B FC 98 00 FF C1 10 31 FE 55 C8 03 49 6E 66 6F 63 61 6D 65 72 65 28
+	New Card Infocamere (Italy) series 1402...
+	 http://www.card.infocamere.it/
+	 Siemens Informatica - Siemens M4.01a
+	 chip Infineon SLE66CX322P (CC EAL5)
+	 Memory EEPROM: 32KB
+	 Operating system CARDOS
+	 Max numero dei tentativi PIN: 3
+	 Pin: da 5 a 8 digit
+	 Unblocked by tool CARDOS API 2.2
+
+3B FD 18 00 00 80 31 FE 45 00 31 80 71 8E 64 52 D9 04 00 81 90 00 5B
+	Oberthur Card Systems, authentIC
+
+3B FD 94 00 00 81 31 20 43 80 31 80 65 B0 83 02 04 7E 83 00 90 00 B6
+	GXPPRo-R3.x STD PTS T=1
+
+3B FD 94 00 00 81 31 60 65 80 31 C0 69 4D 54 43 4F 53 73 01 01 11 E0
+	MTCOS Light, http://www.masktech.de/products/mtcoslight/index.html
+
+3B FE 91 00 FF 91 81 71 FE 40 00 41 28 00 01 80 81 00 73 C8 40 00 00 90 00 4D
+	Philips SmartMX chip (IBMs JCOP OS)
+
+3B FE 94 00 FF 80 B1 FA 45 1F 03 45 73 74 45 49 44 20 76 65 72 20 31 2E 30 43
+	Estonian Identity Card (EstEID v1.0 cold)
+
+3B FF 11 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D0
+	Datakey 32K PKI Smart Card Model 330
+	(http://www.datakey.com/products/smart_cards/products_sc_330.shtml)
+
+3B FF 11 00 00 81 71 40 42 00 00 21 01 31 42 52 00 0[0,5] 63 .. .. .. .. 90 00.*
+	Smart Card "The Smart Way to Login"
+	Used on Acer TravelMate to secure boot
+
+3B FF 11 00 02 40 64 80 69 A2 07 01 03 57 00 00 FF 00 83 00 90 00
+	Gemplus GemXpresso
+
+3B FF 13 00 00 81 31 FE 4D 80 25 A0 00 00 00 56 57 44 4B 33 33 30 06 00 D2
+	Datakey DCOS model 330 (DKCCOS 6.0 token)
+
+3B FF 13 00 FF 80 31 FE 45 53 46 53 45 2D 43 58 33 32 32 2D 56 18 02 08 76
+	SmartCafe Expert Java
+
+3B FF 13 00 FF 80 31 FE 45 53 46 53 45 2D 43 58 33 32 32 2D 56 18 03 08 77
+	Giesecke & Devrient SmartCafe Expert 32K v2.0 #2
+
+3B FF 13 00 FF 81 31 FE 45 65 63 11 04 50 02 80 00 08 39 00 04 02 05 02 E9
+	German "Geldkarte" supplied by the Deutsche Bank in Karlsruhe,
+	Baden-Württemberg, Germany.
+
+3B FF 13 00 FF 81 31 FE 45 65 63 11 04 50 02 80 00 08 54 00 04 23 05 02 A5
+	Maestrocard/Geldkarte (Stadtsparkasse Haltern, Germany)
+
+3B FF 13 00 FF 81 31 FE 5D 80 25 A0 00 00 00 56 57 44 4B 33 32 30 05 00 3F
+	Datakey DCOS model 320
+
+3B FF 18 00 00 81 31 FE 45 00 6B 04 05 01 00 01 11 01 43 4E 53 10 31 80 69
+	Sanitary Card of "Friuli Venezia Giulia" region (Italian Republic)
+	Carta Nazionale dei Servizi (Italia) http://cartaservizi.regione.fvg.it/
+
+3B FF 18 00 FF 80 31 FE 45 53 46 53 45 2D 43 58 33 32 32 2D 56 18 03 08 7C
+	Giesecke & Devrient Sm@rtCafé Expert 2.0
+
+3B FF 18 00 FF 80 31 FE 45 53 6D 40 72 74 43 61 66 65 45 78 70 65 72 74 65
+	Giesecke & Devrient SmartCafe 32K v1
+
+3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 00 26 00 04 10 09
+	Maestrocard/Geldkarte (Postbank, Germany)
+
+3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 01 55 00 04 10 7B
+	Volksbank VR-BankCard (GeldKarte)
+
+3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 07 88 00 04 10 A0
+	HBCI-Karte (Berliner Sparkasse, Germany)
+
+3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 05 29 00 04 10 03
+	Geldkarte/HBCI(DDV-1) (Stadtsparkasse Vorpommern, Germany)
+
+3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 13 82 00 04 10 BE
+	Bremer Karte ("Geldkarte und BSAG-Kundenkarte in einem.")
+	http://www.bsag.de/4911.php
+
+3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 14 06 00 04 10 3D
+	Geldkarte/HBCI(DDV-1) (Staedtische Sparkasse Offenbach, Germany)
+
+3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 50 00 10 90 55 70 00 04 10 0A
+	EC-Card from DKB (Deutsche Kreditbank AG)
+
+3B FF 18 00 FF 81 31 3C 45 65 63 0D 02 31 02 80 00 12 24 30 00 20 04 10 59
+	Geldkarte (Germany)
+
+3B FF 18 00 FF 81 31 50 45 65 63 .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+	GeldKarte v3 (Germany)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 0D 08 65 07 64 00 0D 91 04 90 00 06 16 0E
+	German Railway's (Deutsche Bahn AG) "Konzernausweis"
+
+3B FF 18 00 FF 81 31 FE 45 65 63 0D 04 50 02 80 00 08 90 09 70 00 05 00 2A
+	Landesbank baden-Württemberg Geldkarte
+
+3B FF 18 00 FF 81 31 FE 45 65 63 0D 07 63 05 28 00 0D 90 81 06 00 06 15 58
+	Geldkarte/HBCI (Frankfurter Sparkasse, Germany)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 0D 07 63 07 64 00 0D 90 58 45 00 06 15 8C
+	Stadtsparkasse München electronic cash card / Geldkarte
+
+3B FF 18 00 FF 81 31 FE 45 65 63 0D 07 63 07 64 00 0D 90 73 07 00 06 15 E5
+	Sparkasse Acchen HBCI Geld Karte
+
+3B FF 18 00 FF 81 31 FE 45 65 63 0D 07 63 07 64 00 0D 90 74 32 00 06 15 D7
+	German HBCI-Banking Card with 'Geldkarte' from the bank "Sparkasse Marburg-Biedenkopf"
+
+3B FF 18 00 FF 81 31 FE 45 65 63 0D 07 63 07 64 00 0D 90 92 61 00 06 15 62
+	Geldkarte (Frankfurter Sparkasse, Germany)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 03 50 02 80 00 08 27 70 02 06 05 01 8A
+	old banking card (electronic-card / Maestro / Geldkarte) of the
+	"Volksbank Gelderland eG" (around 2003)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 05 40 02 50 00 10 55 10 03 03 05 00 43
+	belongs to a banking card (electronic-card / Maestro / Geldkarte).
+	the bank calls it "VR-BankCard". the banks name is "Volksbank
+	Gelderland eG" and is part of the "Volksbanken und Raiffeisenbanken"
+	(http://www.vb-gelderland.de/html/5/2394/rubrik/1282.html)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 05 50 03 10 05 00 43
+	HBCI-Karte (Bordesholmer Sparkasse, Germany)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 19 10 04 20 05 00 28
+	Stadtsparkasse München HBCI card / Geldkarte
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 25 60 05 12 05 00 57
+	Geldkarte/HBCI(DDV-1) (Stadtsparkasse Vorpommern, Germany)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 27 30 02 16 05 00 06
+	GeldKarte from Sparkasse bank
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 27 80 03 25 05 00 84
+	Volksbank VR-BankCard (GeldKarte)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 06 40 02 50 00 10 28 50 01 11 05 00 6D
+	HBCI Bancing Card of Sparkasse Pforzheim
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 06 62 02 80 00 11 06 60 03 04 06 13 87
+	Geldkarte (Volksbank Offenburg, Germany)
+
+3B FF 18 00 FF 81 31 .. 45 65 63 .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+	Geldkarte (generic ATR)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 06 62 02 80 00 11 20 90 03 09 06 13 5C
+	Geldkarte [ec, Maestro] (1822 direkt Frankfurter Sparkasse, Germany)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 06 62 02 80 00 11 43 50 01 17 06 13 E3
+	EC-Card of Sparkasse Pforzheim Calw
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 06 62 02 80 00 11 16 50 05 17 06 13 B2
+	FinTS (BBBank Karlsruhe, Germany)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 08 43 02 50 00 10 46 50 01 08 05 30 27
+	HBCI-Karte (Sparkasse Altmark-West, Salzwedel, Germany)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 08 66 02 80 00 11 40 50 03 18 06 20 D4
+	banking card (electronic-card / Maestro / Geldkarte). the bank+calls
+	it "S-Card" or "Sparkassen-Card". the banks name is "Stadtsparkasse
+	Duesseldorf" and is part of the "Sparkassen-Finanzgruppe" (a finance
+	group, network of local banks).
+
+3B FF 18 00 FF 81 31 FE 45 65 63 11 08 66 02 80 00 11 56 00 03 18 06 20 92
+	Geldkarte [ec, Maestro] (Sparkasse Langen-Seligenstadt, Germany)
+
+3B FF 18 00 FF 81 31 FE 45 65 63 1A 01 41 02 50 00 10 52 09 05 67 05 10 21
+	Maestro/Geldkarte (BBBank Karlsruhe, Germany)
+
+3B FF 18 00 FF 81 31 FE 55 00 6B 02 09 02 00 01 01 01 43 4E 53 10 31 80 9F
+	Carta Nazionale dei Servizi - InfoCamere
+
+3B FF 18 00 FF 81 31 FE 55 00 6B 02 09 02 00 01 11 01 43 4E 53 10 31 80 8F
+	Carta Regionale dei Servizi - Regione Lombardia
+
+3B FF 18 00 FF 81 31 FE 55 00 6B 02 09 02 00 01 11 01 43 4E 53 11 31 80 8E
+	Infocamere CNS
+
+3B FF 18 00 FF C1 0A 31 FE 55 00 6B 05 08 C8 05 01 11 01 43 4E 53 10 31 80 0C
+	Carta Regionale dei Servizi - Regione Lombardia
+
+3B FF 32 00 00 10 80 80 31 E0 5B 47 42 50 00 00 00 00 00 00 02 55
+	UK NatWest BT PayToView Mondex
+
+3B FF 94 00 00 40 0A 80 31 00 73 12 21 13 57 4A 33 0E 02 32 41 00
+	Turkcell SIMPlus64 / Turkey
+
+3B FF 94 00 FF 80 B1 FE 45 1F 03 00 68 D2 76 00 00 28 FF 05 1E 31 80 00 90 00 23
+	D-Trust Signature Card (www.d-trust.net):
+	- Citizencard of the People of Ulm in Germany (Bürgerkarte)
+	- Qualified Electronic Signature Card (Qualifizierte Signaturkarte)
+
+3B FF 94 00 FF C0 0A 1F 43 80 31 E0 73 36 21 13 57 4A 43 49 1C 31 30 32 1C
+	Giesecke & Devrient - UniverSIM Pegasus
+
+3B FF 95 00 FF 40 0A 80 31 00 73 1A 21 13 57 4A 50 48 60 31 41 47
+	Vodafone 64 KB SIM with Javacard
+
+3B FF 95 00 FF 40 0A 80 31 E8 73 F6 21 13 67 4A 47 48 60 31 42 00
+	Giesecke & Devrient STARSIM
+
+3B FF 96 00 FF C0 0A 1F 43 80 31 E0 73 36 21 13 57 4A 43 49 1C 31 30 32 1E
+	Giesecke & Devrient - UniverSIM Pegasus
+
+3B FF 95 00 FF C0 0A 1F 43 80 31 E0 73 F6 21 13 57 4A 33 48 61 32 41 47 D6
+	GSM SIM (issued by e-plus, Germany)
+
+3F 05 DC 20 FC 00 01
+	DigiCash Facility Card
+
+3F 28 00 00 11 14 00 03 68 90 00
+	SIMEMU - a DIY GSM SIM card - http://simemu.cjb.net/
+
+3F 2D 00 27 A0 51 82 7D 00 00 00 52 00 0C 90 00
+	Porta Moedas Multibanco (Portugeese electronic purse)
+
+3F 2F 00 80 59 AF 02 01 01 30 00 00 0A 0E 83 06 9F 12
+	Gemplus GemXplore
+
+3F 2F 00 80 59 AF 02 01 02 30 00 0C 0A 0E 83 1E 9F 16
+	GSM-SIM (900MHz) card of the carrier "Mannesmann Mobilfunk" for
+	their network "D2-Privat" - now known as Vodafone Mobilfunk
+	(http://www.vodafone.de/).
+
+3F 2F 00 80 69 AE 02 02 01 36 00 00 0A 0E 83 3E 9F 16
+	GSM-SIM e-plus (1800MHz)
+
+3F 2F 00 80 69 AF 02 04 01 36 00 02 0A 0E 83 3E 9F 16
+	GSM-SIM D2 CallYa (900MHz)
+
+3F 2F 00 80 69 AF 03 07 03 52 00 00 0A 0E 83 3E 9F 16
+	GemXplore 98 V1 16K
+
+3F 2F 00 80 69 AF 03 07 03 52 00 0D 0A 0E 83 3E 9F 16
+	GSM-SIM Debitel D2 (900MHz)
+
+3F 2F 00 80 69 AF 03 07 03 5A 00 15 0A 0E 83 3E 9F 16
+	Virgin Mobile SIM (Gemplus)
+
+3F 67 25 00 21 20 00 0F 78 90 00
+	Bank Nederlandse Gemeenten, BNG Data Services
+
+3F 65 25 .. .. 04 6C 90 .0
+	Carte Bancaire (French banking card)
+
+3F 65 25 00 2[2,C] 09 [F,6]9 90 00
+	Sesam Vitale (French health card)
+
+3F 65 25 00 2B 09 62 90 00
+	Coinamatic SmartyCity smartcard
+
+3F 65 25 00 2B 09 EB 90 00
+	Bull Scot 5
+
+3F 65 25 00 52 09 6A 90 00
+	French carte Vitale
+
+3F 65 25 08 22 04 68 90 00
+	France Telecom card (ex Pastel card)
+
+3F 65 25 08 33 04 20 90 00
+	D-Trust card
+
+3F 65 35 10 02 04 6C 90 00
+	Postcard (Switzerland)
+
+3F 65 35 64 02 04 6C 90 40
+	Postcard (Switzerland)
+
+3F 67 25 00 26 14 00 20 68 90 00
+	Pay-TV card from Casema Cable Television, Netherland
+
+3F 67 25 00 2A 20 00 0F 68 90 00
+	Carte Grand Voyageur (SNCF: French train company)
+
+3F 67 25 00 2A 20 00 40 68 9F 00
+	Swiss Cash card
+
+3F 67 25 00 2A 20 00 4[0,1] 68 90 00
+	Dutch ChipKnip, Proton
+	(chip Bull CC 60 V1, Bull CC 60 V2 or Bull CC 1000)
+
+3F 67 25 04 21 20 00 07 68 90 00
+	Philips TB100 (C-MOS chip)
+
+3F 67 2F 04 11 20 00 00 68 90 00
+	BULL HN ITALIA 06/92 - 100.000 - 64MP
+	La Sapienza - Universita' di Roma
+
+3F 69 00 00 24 AF 01 70 01 01 FF 90 00
+	French GSM SIM card (900MHz)
+
+3F 6C 00 00 24 A0 30 00 FF 00 00 01 00 04 90 00
+	Gemplus MCOS 16K DES Sample Card
+
+3F 6C 00 00 25 A0 30 89 76 00 00 04 01 0C 90 00
+	MCOS 24k EEPROM
+
+3F 6C 00 00 3C A0 30 9E 61 00 00 01 00 04 90 00
+	Gemplus - British Gas - Gascard
+
+3F 6C 00 00 3C A0 30 A7 58 00 00 01 01 8C 90 00
+	Rendezvous Series 7 (D2-Mac satellite TV card)
+
+3F 6D 00 00 80 31 80 65 B0 05 01 02 5E 83 00 90 00
+	Gemplus GemXpresso 211PK or 211PK-IS
+
+3F 6D 00 00 80 31 80 65 B0 05 01 02 5E 92 00 90 00
+	Gemplus GemXpresso 32K
+
+3F 77 18 25 00 29 14 00 62 68 90 00
+	Viaccess card
+
+3F 78 12 25 01 40 B0 03 4A 50 20 48 55
+	DSS/DTV H
+
+3F 7E 11 25 05 40 B0 08 00 00 4D 59 00 00 00 53 4B 0B 07
+	BSkyB Series 11 (DSS satellite TV card)
+
+3F 7F 11 25 05 40 B0 0F 69 FF 4D 59 00 00 00 53 4B 0C 06 00
+	Sky Series 12 (DSS satellite TV card)
+
+3F 7E 11 25 09 40 B0 01 00 00 4D 59 00 00 03 53 4B 0A 01
+	Sky Series 10 (DSS satellite TV card)
+
+3F 7E 11 25 05 40 B0 08 00 00 4D 59 00 00 00 53 4B 0B 08
+	Sky Series 11 (DSS satellite TV card)
+
+3F 7F 13 25 03 33 B0 06 69 FF 4A 50 D0 00 00 53 59 00 00 00
+	Sky 2005/6 (DSS satellite TV card)
+
+3F 7F 13 25 03 38 B0 04 FF FF 4A 50 00 00 29 48 55 .. .. ..
+	DSS/DTV HU
+
+3F 7F 13 25 03 40 B0 0B 69 4C 4A 50 C0 00 00 53 59 00 00 00
+	Sky Digital (DSS satellite TV card)
+
+3F 78 13 25 03 40 B0 20 FF FF 4A 50 00
+	DSS/DTV P4
+
+3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 30 20 52 65 76 41 32 30 48
+	DSS/DISH ROM10
+
+3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 30 20 52 65 76 41 32 31 49
+	PayTV card for DishNetwork Sat receiver http://www.dishnetwork.com/
+
+3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 31 20 52 65 76 42
+	NTL digial TV card (Nagravision)
+
+3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 31 20 52 65 76 42 30 36 4E
+	Telewest Broadband (Nagravision)
+
+3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 31 20 52 65 76 42 30 42 3A
+	NagraVision card for StarHub Digital Cable DVB-C Singapore
+
+3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 31 20 52 65 76 42 30 44 3C
+	NagraVision card for Virgin Media in the UK
+
+3F FF 95 00 FF 91 81 71 FE 47 00 44 4E 41 53 50 31 31 30 20 52 65 76 41 30 31 14
+	TVA Digital - Nagra Vision ID TV-01
+
+3F FF 95 00 FF 91 81 71 FE 47 00 44 4E 41 53 50 31 31 30 20 52 65 76 41 43 33 65
+	Brazilian NET Digital (Cable TV provider) - Nagra Vision "NASP110 RevA01"
+
+# do not delete
--- a/recpt1/Makefile	Mon Feb 16 21:40:16 2009 +0900
+++ b/recpt1/Makefile	Tue Feb 17 01:40:56 2009 +0900
@@ -5,7 +5,7 @@
 B25      = -DB25
 
 ifdef B25
-  B25_PATH = ../arib25v021/arib25/src
+  B25_PATH = ../arib25v023/arib25/src
   B25_CLEAN = clean_b25
 #  B25_OBJS = B25Decoder.o
   B25_OBJS_EXT = $(B25_PATH)/arib_std_b25.o $(B25_PATH)/b_cas_card.o $(B25_PATH)/multi2.o $(B25_PATH)/ts_section_parser.o
--- a/recpt1/decoder.h	Mon Feb 16 21:40:16 2009 +0900
+++ b/recpt1/decoder.h	Tue Feb 17 01:40:56 2009 +0900
@@ -1,8 +1,8 @@
 #ifndef _DECODER_H_
 #define _DECODER_H_
 
-#include "../arib25v021/arib25/src/arib_std_b25.h"
-#include "../arib25v021/arib25/src/b_cas_card.h"
+#include "../arib25v023/arib25/src/arib_std_b25.h"
+#include "../arib25v023/arib25/src/b_cas_card.h"
 
 typedef struct decoder
 {
--- a/recpt1/recpt1.c	Mon Feb 16 21:40:16 2009 +0900
+++ b/recpt1/recpt1.c	Tue Feb 17 01:40:56 2009 +0900
@@ -1,24 +1,27 @@
-#include	<stdio.h>
-#include	<sys/types.h>
-#include	<sys/stat.h>
-#include	<fcntl.h>
-#include	<time.h>
-#include	<stdlib.h>
-#include	<string.h>
-#include	<pthread.h>
-#include        <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <stdio.h>
 
-#include	<sys/ioctl.h>
-#include	"pt1_ioctl.h"
+#include <sys/ioctl.h>
+#include "pt1_ioctl.h"
 
 #include "recpt1.h"
 #include "decoder.h"
 
 /* globals */
-int	wfd;		// ե񤭹
+int	wfd;		/* for output file */
 int	f_exit = FALSE ;
-decoder *dec;
 
+typedef struct thread_data {
+  QUEUE_T *queue;
+  decoder *decoder;
+} thread_data;
 
 // ȿơ֥Ѵ
 ISDB_T_FREQ_CONV_TABLE *
@@ -41,7 +44,7 @@
 create_queue(size_t size)
 {
   QUEUE_T*	p_queue;
-  int		memsize = sizeof(QUEUE_T) + (size * sizeof(BUFSZ));
+  int		memsize = sizeof(QUEUE_T) + size * sizeof(BUFSZ);
 
   p_queue = (QUEUE_T*)calloc(memsize, sizeof(char));
 
@@ -68,16 +71,14 @@
   }
 }
 
-// ؿ̾: enqueue
-//  塼˥ǡ
-//  ǡʾϡ֥åޤ
+/* enqueue data. this function will block if queue is full. */
 void
 enqueue(QUEUE_T *p_queue, BUFSZ *data)
 {
   pthread_mutex_lock(&p_queue->mutex);
-  // -- 顢ƥ륻 --
+  /* entered critical section */
 
-  // 󤸤ʤʤޤԤ
+  /* wait until queue is not full */
   while(!p_queue->no_full) {
     pthread_cond_wait(&p_queue->cond_full, &p_queue->mutex);
     printf("Full\n");
@@ -91,67 +92,68 @@
   p_queue->no_full--;
   p_queue->no_empty++;
 
+  /* leaving critical section */
   pthread_mutex_unlock(&p_queue->mutex);
   pthread_cond_signal(&p_queue->cond_empty);
 }
 
-// ؿ̾: dequeue
-//  塼˥ǡ
-//  ǡʾϡ֥åޤ
+/* dequeue data. this function will block if queue is empty. */
 BUFSZ *
 dequeue(QUEUE_T *p_queue)
 {
-  void	*result;
+  BUFSZ	*buffer;
 
   pthread_mutex_lock(&p_queue->mutex);
-  // -- 顢ƥ륻 --
+  /* entered the critical section*/
 
-  // äݤʤʤޤԤ
+  /* wait until queue is filled */
   while (!p_queue->no_empty) {
     pthread_cond_wait(&p_queue->cond_empty, &p_queue->mutex);
   }
 
-  // ǡФ
-  result = p_queue->buffer[p_queue->out];
+  /* take buffer address */
+  buffer = p_queue->buffer[p_queue->out];
 
   // ˥ǡФ򥤥󥯥
   p_queue->out++;
   p_queue->out %= p_queue->size;
 
-  // ե饰ι
+  /* update flags */
   p_queue->no_full++;
   p_queue->no_empty--;
 
-  // -- ޤǡƥ륻 --
+  /* leaving the critical section */
   pthread_mutex_unlock(&p_queue->mutex);
   pthread_cond_signal(&p_queue->cond_full);
 
-  return result;
+  return buffer;
 }
 
 /* this function will be a writing thread */
 void *
 write_func(void *p)
 {
-  QUEUE_T *p_queue = (QUEUE_T*)p;
-  BUFSZ	*ptr ;
+  thread_data *data = (thread_data *)p;
+  QUEUE_T *p_queue = data->queue;
+  decoder *dec = data->decoder;
+  BUFSZ	*buf ;
   ARIB_STD_B25_BUFFER sbuf, dbuf;
 
   while(1){
-    ptr = dequeue(p_queue);
+    buf = dequeue(p_queue);
     /* no entry in the queue */
-    if(ptr == NULL){
+    if(buf == NULL){
       close(wfd);
       break ;
     }
 
-    sbuf.data = ptr->buffer;
-    sbuf.size = ptr->size;
+    sbuf.data = buf->buffer;
+    sbuf.size = buf->size;
 
     /* write data to output file*/
     b25_decode(dec, &sbuf, &dbuf);
     write(wfd, dbuf.data, dbuf.size);
-    free(ptr);
+    free(buf);
 
     /* normal exit */
     if((f_exit) && (!p_queue->no_empty)){
@@ -178,8 +180,10 @@
   pthread_t dequeue_threads;
   QUEUE_T *p_queue = create_queue(MAX_QUEUE);
   BUFSZ	*bufptr ;
+  decoder *dec;
+  thread_data tdata;
 
-  if(argc < 4){
+  if(argc < 4) {
     printf("Usage %s: channel recsec destfile\n", argv[0]);
     printf("channel =\n");
     printf("151chBSī\n");
@@ -195,7 +199,7 @@
     return 1;
   }
   ptr = searchrecoff(argv[1]);
-  if(ptr == NULL){
+  if(ptr == NULL) {
     printf("Channel Select Error(%s)\n", argv[1]);
     return 1 ;
   }
@@ -203,25 +207,25 @@
   freq.frequencyno = ptr->set_freq ;
   freq.slot = ptr->add_freq ;
 
-  if(ptr->type == CHTYPE_SATELLITE){
-    for(lp = 0 ; lp < 2 ; lp++){
+  if(ptr->type == CHTYPE_SATELLITE) {
+    for(lp = 0 ; lp < 2 ; lp++) {
       fd = open(bsdev[lp], O_RDONLY);
-      if(fd >= 0){
+      if(fd >= 0) {
 	break ;
       }
     }
-    if(fd < 0){
+    if(fd < 0) {
       printf("Device Open Error\n");
       return 1;
     }
-  }else{
-    for(lp = 0 ; lp < 2 ; lp++){
+  } else {
+    for(lp = 0 ; lp < 2 ; lp++) {
       fd = open(isdb_t_dev[lp], O_RDONLY);
-      if(fd >= 0){
+      if(fd >= 0) {
 	break ;
       }
     }
-    if(fd < 0){
+    if(fd < 0) {
       printf("Device Open Error\n");
       return 1;
     }
@@ -232,49 +236,54 @@
   dec = b25_startup();
 
   /* open output file */
-  wfd = open64(argv[3], (O_RDWR | O_CREAT | O_TRUNC), 0666);
-  if(wfd < 0){
+  wfd = open(argv[3], (O_RDWR | O_CREAT | O_TRUNC), 0666);
+  if(wfd < 0) {
     printf("Output File Open Error(%s)\n", argv[3]);
     return 0;
   }
 
-  if(ioctl(fd, SET_CHANNEL, &freq) < 0){
+  if(ioctl(fd, SET_CHANNEL, &freq) < 0) {
     printf("Tuner Select Error\n");
     return 0 ;
   }
 
   /* make reading thread */
-  pthread_create(&dequeue_threads, NULL, write_func, p_queue);
-  if(ioctl(fd, START_REC, 0) < 0){
+  tdata.queue = p_queue;
+  tdata.decoder = dec;
+  pthread_create(&dequeue_threads, NULL, write_func, &tdata);
+
+  /* start recording*/
+  if(ioctl(fd, START_REC, 0) < 0) {
     printf("Tuner Start Error\n");
     return 0 ;
   }
 
   time(&start_time);
 
-  /* read-write loop */
-  while(1){
+  /* read from tuner */
+  while(1) {
     time(&cur_time);
-    bufptr = calloc(1, sizeof(BUFSZ));
+    bufptr = malloc(sizeof(BUFSZ));
     bufptr->size = read(fd, bufptr->buffer, MAX_READ_SIZE);
-    if(bufptr->size <= 0){
-      if((cur_time - start_time) >= recsec){
+    if(bufptr->size <= 0) {
+      if((cur_time - start_time) >= recsec) {
 	f_exit = TRUE ;
 	enqueue(p_queue, NULL);
 	break ;
-      }else{
+      } else {
 	continue ;
       }
     }
     enqueue(p_queue, bufptr);
 
-    if((cur_time - start_time) >= recsec){
+    /* stop recording */
+    if((cur_time - start_time) >= recsec) {
       ioctl(fd, STOP_REC, 0);
-      //ʤʤޤǥǡɤ߽Ф
-      while(1){
-	bufptr = calloc(1, sizeof(BUFSZ));
+      /* read remaining data */
+      while(1) {
+	bufptr = malloc(sizeof(BUFSZ));
 	bufptr->size = read(fd, bufptr->buffer, MAX_READ_SIZE);
-	if(bufptr->size <= 0){
+	if(bufptr->size <= 0) {
 	  f_exit = TRUE ;
 	  enqueue(p_queue, NULL);
 	  break ;
@@ -284,7 +293,8 @@
       break ;
     }
   }
-  close(fd); /* close tuner */
+  /* close tuner */
+  close(fd);
 
   /* wait reading thread */
   pthread_join(dequeue_threads, NULL);
--- a/recpt1/recpt1.h	Mon Feb 16 21:40:16 2009 +0900
+++ b/recpt1/recpt1.h	Tue Feb 17 01:40:56 2009 +0900
@@ -19,12 +19,12 @@
 #define		TRUE	1
 #define		FALSE	0
 
-typedef	struct	_BUFSZ{
-	int		size ;
-	u_char	buffer[MAX_READ_SIZE];
-}BUFSZ;
+typedef	struct	_BUFSZ {
+  int	 size ;
+  u_char buffer[MAX_READ_SIZE];
+} BUFSZ;
 
-typedef	struct	_QUEUE_T{
+typedef	struct	_QUEUE_T {
   unsigned int		in;		// 륤ǥå
   unsigned int		out;		// ˽Фǥå
   unsigned int		size;		// 塼Υ
@@ -34,14 +34,14 @@
   pthread_cond_t	cond_full;	// ǡΤȤԤĤ cond
   pthread_cond_t	cond_empty;	// ǡΤȤԤĤ cond
   BUFSZ			*buffer[1];	// Хåեݥ
-}QUEUE_T;
+} QUEUE_T;
 
 typedef	struct	_ISDB_T_FREQ_CONV_TABLE {
-	int		set_freq ;				// ºݤioctl()Ԥ
-	int		type ;					// ͥ륿
-	int		add_freq ;				// ɲäȿ(BS/CSξϥåֹ)
-	char	*parm_freq ;			// ѥ᡼Ǽ
-}ISDB_T_FREQ_CONV_TABLE;
+  int	set_freq ;	// ºݤioctl()Ԥ
+  int	type ;		// ͥ륿
+  int	add_freq ;	// ɲäȿ(BS/CSξϥåֹ)
+  char	*parm_freq ;	// ѥ᡼Ǽ
+} ISDB_T_FREQ_CONV_TABLE;
 
 // Ѵơ֥(ISDB-T)
 #define		MAX_CHANNEL_SELECT		123