kons_font 13
# eksperymenty z IOR (cel: dodac SSL do combat!)
# + lepsze narzedzia do manipulowania ob. ior...
# + co jest w IOR?
#Â 1. IOR zawiera type_id (repoid) oraz profile
#Â 2. profil zawieraja m.in. komponenty
#Â 3. komponent zawiera component_data i tag
#
lappend auto_path ./combat-tcl-0.7.4; package re combat
proc err kod {catch $kod err; return $err}
proc j ob {join [$ob configure] \n}
proc znajdz_tag {li tag} {
 foreach e $li {if {[$e cget -tag]==$tag} {return $e}}
 error "nie znaleziono tagu $tag !!!"
}
set o1 [corba::string_to_object file://[pwd]/Hello.ior]
set o2 [corba::string_to_object file://[pwd]/Hello_ssl.ior]
set ior1 [[Combat::CORBA::ORB::GetObjFromHandle $o1] cget -ior]
 #% ::Combat::IOP::iOR0
set ior2 [[Combat::CORBA::ORB::GetObjFromHandle $o2] cget -ior]
 #% ::Combat::IOP::iOR1
$ior1 cget -type_id
 #% IDL:HelloApp/Hello:1.0
$ior2 cget -type_id
 #% IDL:HelloApp2/Hello:1.0
set prof1 [znajdz_tag [$ior1 cget -profiles] 0]
 #% ::Combat::IIOP::profileBody0
set prof2 [znajdz_tag [$ior2 cget -profiles] 0]
 #% ::Combat::IIOP::profileBody1
$prof1 cget -port
 #% 49815
$prof1 cget -components
 #%
$prof2 cget -port
 #% 0
$prof2 cget -components
 #% ::Combat::IOP::taggedComponent0 ::Combat::IOP::taggedComponent1 ::Combat::CONV_FRAME::codeSetInfo1
set ssl2 [znajdz_tag [$prof2 cget -components] 20]
 #% ::Combat::IOP::taggedComponent0
set ssl2a [znajdz_tag [$prof2 cget -components] 0]
 #% ::Combat::IOP::taggedComponent1
j $ssl2
 #% -component_data <undefined> z`?ó
-tag <undefined> 20
binary scan [$ssl2 cget -component_data] c* x; set x
 #% 0 0 0 122 0 96 -52 -13
set port [expr {([lindex $x end-1]&0xFF)*256+([lindex $x end]&0xFF)}]
 #% 52467
j $ssl2a
 #% -component_data <undefined> JAC
-tag <undefined> 0
binary scan [$ssl2a cget -component_data] c* x; set x
 #% 0 0 0 0 74 65 67 0
exit