############################################################################# # # File: Ident.itcl # # Description: Inbound identification block for TCD to Server conversation # # $$$TIVO COPYRIGHT (Jak Mang, Brian Beach)$$$ # # This data block is created on the TCD, and read on the server. # There are multiple versions of this structure, which are created by # different versions of the software on the TCD: # # Version 1: initial version # Version 2: same structure, but requests version 2 of SvrResp from server # Version 3: Moved to HTTP cgi, added optional IDB_DEBUG # # # NOTE: The version numbers of Ident and SvrResp are always incremented # together. # # Modified by AltEPG Project # ************************************************************ # AltEPG Project Source Code Version Control # $FileID: git::root/tvlib/tcl/tv/Ident.itcl $ # $Revision: altepg1.0c root 2011-09-17 23:39:32 +0100 Finalising altepg1.0c $ # Description: See above # ************************************************************ ############################################################################# source $tcl_library/tv/Inc.itcl namespace eval IdentPCodes { variable signalType st variable connector con variable dbsRemoteMethod drm variable enterKeyRequired ekr variable disableAutoRec dar variable postalCode zip variable recordQuality rcq variable timeZone tz variable audioSource as variable cableBoxCodeNum ccn variable cableBoxBrand brn variable lineups lin variable irCodeSpeed irs variable numTuners tun variable setupComplete suc } proc Stringify { inlistlist } { set outstring "" set numlists [llength $inlistlist] for {set i 0} { $i < $numlists } {incr i 1} { set sublist [lindex $inlistlist $i] set numpairs [llength $sublist] for {set j 0 } { $j < $numpairs } {incr j 1} { set pair [lindex $sublist $j] set lhs [lindex $pair 0] set rhs [lindex $pair 1] set outstring $outstring$lhs=$rhs if { $j < $numpairs-1 } { set outstring $outstring, } } if { $i < $numlists-1 } { set outstring $outstring\; } } return $outstring } class Ident { private variable netVersion "" private variable netMagic "" private variable IdentMagic "" private variable IdentVersion "" private variable centerID "" private variable reasonCode 0 private variable softwareDesc "" private variable locationID "" private variable sequenceCookie "" private variable headendID "" private variable showcaseDesc "" private variable errMsg "" private variable dialConfig "" private variable genreDesc "" private variable irdbDesc "" private variable debugStr "" private variable debug 0 private variable messageDesc "" private variable irdbVersion "" private variable genreVersion "" private variable logoVersion "" private variable affiliationVersion "" private variable showcaseVersion "" private variable simulateMode 0 private variable callId "" private variable demoMode "" private variable swVerName "" private variable sourceParameterList "" private variable sourceParameterString "" private variable configParameterList "" private variable configParameterString "" private variable apgOnly "" private variable useChksums "" private variable premiumShowcases "" private variable captureRequests "" private variable menuItems "" private variable otherDataSets "" private variable rbBackgrounds "" private variable dataGroupList "" # 2011-07-29 B.Mills Addition for AltEPG version control private variable altEPGClientVersion "" private variable nicInstalled "" # The last successfully loaded inventory file private variable inventoryFile "" # The count of objects in /Database/Waiting private variable waitingCount 0 private variable confInfo "" # The DATE (days since 1/1/70) of the last # successful planY download private variable lastAvalancheDownload 0 # Does this call have a human waiting? private variable userInitiated constructor {} { set IdentMagic 0xdeadcafe set IdentVersion 3 set netMagic $IdentMagic set netVersion $IdentVersion set swVerName "UNKNOWN" set useChksums "TRUE" } method blockFromEnv {} method writeBlock {conn} method setVal {field val} method getVal {field} method print {} method authorize {} method activation {} method mapToKit {map} method processAdmin {} method getRequiredEnv {varName} method getOptionalEnv {varName} method getErrMsg {} method getDebug {} # method getSerNo {val} method setSimulateMode {val} } ###################################################################### # # TCD -- these methods are run only on the TCD. # # Only one version of the structure needs to be supported. The server # is expected to be able to understand whatever version the TCD sends. # ###################################################################### ######## # # writeBlock # ######## body Ident::writeBlock {name} { global env # version 1: set rc 1 set sendFileName "/var/tmp/${name}.send" if { [catch {set conn [open $sendFileName "w"]}]} { putlog "failed to open $sendFileName" set rc 0 } else { puts $conn "POST /tivo-service/HServer.cgi HTTP/1.0" puts $conn "Content-Type: text/plain" puts $conn "IDB_VERSION: $netVersion" puts $conn "IDB_CENTERID: $centerID" puts $conn "IDB_REASONCODE: $reasonCode" puts $conn "IDB_SWDESC: $softwareDesc" puts $conn "IDB_LOCATIONID: $locationID" puts $conn "IDB_SEQCOOKIE: $sequenceCookie" puts $conn "IDB_HEADEND: $headendID" puts $conn "IDB_SHOWCASES: $showcaseDesc" puts $conn "IDB_INVFILE: $inventoryFile" puts $conn "IDB_WAITCOUNT: $waitingCount" puts $conn "IDB_TCINFO: $confInfo" puts $conn "IDB_CURCODE: $dialConfig" puts $conn "IDB_MESSAGE_DESC: $messageDesc" puts $conn "IDB_IRDBVERSION: $irdbVersion" puts $conn "IDB_GENREVERSION: $genreVersion" puts $conn "IDB_LOGOVERSION: $logoVersion" puts $conn "IDB_AFFILIATIONVERSION: $affiliationVersion" puts $conn "IDB_SHOWCASEVERSION: $showcaseVersion" puts $conn "IDB_DEMOMODE: $demoMode" puts $conn "IDB_CUR_SWNAME: $swVerName" puts $conn "IDB_APG_ONLY: $apgOnly" puts $conn "IDB_USECHKSUMS: $useChksums" puts $conn "IDB_PREMIUM_SHOWCASES: $premiumShowcases" puts $conn "IDB_CAPTURE_REQUESTS: $captureRequests" puts $conn "IDB_MENU_ITEMS: $menuItems" puts $conn "IDB_OTHER_DATASETS: $otherDataSets" puts $conn "IDB_RB_BACKGROUNDS: $rbBackgrounds" puts $conn "IDB_DATAGROUPLIST: $dataGroupList" puts $conn "IDB_LAST_AVL_DL: $lastAvalancheDownload" puts $conn "IDB_USER_INITIATED: $userInitiated" # # For server-side logging, send out the MFS space statistics # set mfsList {MFS_TOTAPP MFS_AVAILAPP MFS_TOTMEDIA MFS_AVAILMEDIA \ MFS_TOTCLIPS MFS_AVAILCLIPS MFS_TOTRBACKS MFS_AVAILRBACKS} foreach mfsItem $mfsList { set size "unknown" if {[catch {set size $env($mfsItem)}]} { putlog "couldn't get MFS space for: $mfsItem" } puts $conn "IDB_$mfsItem: $size" } # # Add these in for debugging # puts $conn "TCD_ID: $centerID" puts $conn "CALL_ID: $callId" # # These are put in as per request of customer service... puts $conn "IDB_SOURCEPARAMETERS: $sourceParameterString" puts $conn "IDB_CONFIGPARAMETERS: $configParameterString" # 2011-07-29 B.Mills Addition for AltEPG version control puts $conn "IDB_ALTEPG_CLIENT_VERSION: $altEPGClientVersion" puts $conn "IDB_NIC_INSTALLED: $nicInstalled" set now [clock seconds] puts $conn "IDB_TIMESTAMP: $now" puts $conn "Content-Length: 0" # puts $conn ""; # end version 1 } catch {flush $conn} catch {close $conn} return $rc } body Ident::getSerNo {val} { if [regexp {([A-Z]+)([0-9]+)} $val fullMatch prefix centerId] { putlog "getSerNo $val returns $centerId" return $centerId } if [regexp {(000)([0-9]+)} $val fullMatch prefix centerId] { putlog "getSerNo $val returns $centerId" return $centerId } putlog "getSerNo $val returns $val" return $val } ######## # # setVal # ######## body Ident::setVal {field val} { switch -exact $field { centerID { set centerID $val } reasonCode { set reasonCode $val } softwareDesc { set softwareDesc $val } locationID { set locationID $val } headendID { set headendID $val } sequenceCookie { set sequenceCookie $val } showcaseDesc { set showcaseDesc $val } inventoryFile { set inventoryFile $val } waitingCount { set waitingCount $val } confInfo { set confInfo $val } dialConfig { set dialConfig $val } messageDesc { set messageDesc $val } irdbVersion { set irdbVersion $val } genreVersion { set genreVersion $val } logoVersion { set logoVersion $val } affiliationVersion { set affiliationVersion $val } showcaseVersion { set showcaseVersion $val } swVerName { set swVerName $val } apgOnly { set apgOnly $val } premiumShowcases { set premiumShowcases $val } captureRequests { set captureRequests $val } menuItems { set menuItems $val } otherDataSets { set otherDataSets $val } rbBackgrounds { set rbBackgrounds $val } dataGroupList { set dataGroupList $val } sourceParameterList { set sourceParameterList $val set sourceParameterString [Stringify $sourceParameterList] } sourceParameterString { set sourceParameterString $val } configParameterList { set configParameterList $val set configParameterString [Stringify $configParameterList] } configParameterString { set configParameterString $val } callId { set callId $val } demoMode { set demoMode $val } swVerName { set swVerName $val } lastAvalancheDownload { set lastAvalancheDownload $val } userInitiated { set userInitiated $val } # 2011-07-29 B.Mills Addition for AltEPG version control altEPGClientVersion { set altEPGClientVersion $val } nicInstalled { set nicInstalled $val } default { putlog "Ident::setVal unknown field: $field" } } } ######## # # print # ######## body Ident::print {} { putlog "" putlog " Start Ident =====================" putlog " version: $netVersion" putlog " centerID: $centerID" putlog " reasonCode: $reasonCode" putlog " softwareDesc: $softwareDesc" putlog " locationID: $locationID" putlog " sequenceCookie: $sequenceCookie" putlog " headendID: $headendID" putlog " showcaseDesc: $showcaseDesc" putlog " inventoryFile: $inventoryFile" putlog " waitingCount: $waitingCount" putlog " dialConfig: $dialConfig" putlog " confInfo: $confInfo" putlog " messageDesc: $messageDesc" putlog " irdbVersion: $irdbVersion" putlog " genreVersion: $genreVersion" putlog " logoVersion: $logoVersion" putlog " affiliationVersion: $affiliationVersion" putlog " showcaseVersion: $showcaseVersion" putlog " swVerName: $swVerName" putlog "configParameterList: $configParameterString" putlog "sourceParameterList: $sourceParameterString" putlog " apgOnly: $apgOnly" putlog " useChksums: $useChksums" putlog " premiumShowcases: $premiumShowcases" putlog " captureRequests: $captureRequests" putlog " menuItems: $menuItems" putlog " otherDataSets: $otherDataSets" putlog " rbBackgrounds: $rbBackgrounds" putlog " dataGroupList: $dataGroupList" putlog " lstAvalancheDnload: $lastAvalancheDownload" putlog " userInitiated: $userInitiated" # 2011-07-29 B.Mills Addition for AltEPG version control putlog "altEPGClientVersion: $altEPGClientVersion" putlog " nicInstalled: $nicInstalled" putlog "End Ident =====================" putlog "" } ######## # # getVal # ######## body Ident::getVal {field} { switch -exact $field { version { return $netVersion } centerID { return $centerID } reasonCode { return $reasonCode } softwareDesc { return $softwareDesc } locationID { return $locationID } headendID { return $headendID } sequenceCookie { return $sequenceCookie } showcaseDesc { return $showcaseDesc } inventoryFile { return $inventoryFile } waitingCount { return $waitingCount } dialConfig { return $dialConfig } messageDesc { return $messageDesc } irdbVersion { return $irdbVersion } genreVersion { return $genreVersion } logoVersion { return $logoVersion } affiliationVersion { return $affiliationVersion } showcaseVersion { return $showcaseVersion } swVerName { return $swVerName } dataGroupList { return $dataGroupList } sourceParameterList { return $sourceParameterList } sourceParameterString { return $sourceParameterString } configParameterList { return $configParameterList } configParameterString { return $configParameterString } lastAvalancheDownload { return $lastAvalancheDownload } # 2011-07-29 B.Mills Addition for AltEPG version control altEPGClientVersion { return $altEPGClientVersion } nicInstalled { return $nicInstalled } userInitiated { return $userInitiated } default { if {$debug} {putlog "Ident::getVal unknown field: $field" } } } } body Ident::getErrMsg {} { return $errMsg } body Ident::getDebug {} { return $debug } body Ident::setSimulateMode {val} { set simulateMode $val }