# $Id: GIOP.pm 1360 2006-06-14 06:33:50Z rvosa $ # Subversion: $Rev: 117 $ # Copyright (c) 1997 Lunatech Research / Bart Schuller # Modified by Giles Atkinson 1999. # See the file "Artistic" in the distribution for licensing and # (lack of) warranties. use COPE::CORBA::ORB; use Log::Log4perl; use COPE::CORBA::ORB; Log::Log4perl::init( COPE::CORBA::ORB->LOGPERLCONF ); # module GIOP package GIOP; my $logger = Log::Log4perl::get_logger('GIOP'); # enum MsgType sub Request { $logger->info(0); return 0; } sub Reply { $logger->info(1); return 1; } sub CancelRequest { $logger->info(2); return 2; } sub LocateRequest { $logger->info(3); return 3; } sub LocateReply { $logger->info(4); return 4; } sub CloseConnection { $logger->info(5); return 5; } sub MessageError { $logger->info(6); return 6; } # enum LocateStatusType sub UNKNOWN_OBJECT { $logger->info(0); return 0; } sub OBJECT_HERE { $logger->info(1); return 1; } sub OBJECT_FORWARD { $logger->info(2); return 2; } # struct Version package GIOP::Version; @ISA = qw(CORBA::_Struct); $logger = Log::Log4perl::get_logger('GIOP.Version'); sub _marshal { $logger->info("Marshalling"); my ($self) = pop; # sic CORBA::ORB::_marshal_char( @_, $self->{major} ); CORBA::ORB::_marshal_char( @_, $self->{minor} ); } sub _unmarshal { $logger->info("Unmarshalling"); my $self = {}; $self->{major} = CORBA::ORB::_unmarshal_char(@_); $self->{minor} = CORBA::ORB::_unmarshal_char(@_); return bless $self, 'GIOP::Version'; } #$_tc = _create_struct_tc('', 'Version', # major => $CORBA::_tc_char, # minor => $CORBA::_tc_char, #); # struct MessageHeader package GIOP::MessageHeader; @ISA = qw(CORBA::_Struct); $logger = Log::Log4perl::get_logger('GIOP.MessageHeader'); # string, index, byte_order, self sub _marshal { $logger->info("Marshalling"); my ($self) = pop; # sic CORBA::ORB::_marshal_char_array( @_, $self->{magic}, 4 ); GIOP::Version::_marshal( @_, $self->{GIOP_version} ); CORBA::ORB::_marshal_boolean( @_, $self->{byte_order} ); CORBA::ORB::_marshal_octet( @_, $self->{message_type} ); CORBA::ORB::_marshal_ulong( @_, $self->{message_size} ); } sub _unmarshal { $logger->info("Unmarshalling"); my ($byte_order_ref) = pop; my $self = {}; $self->{magic} = CORBA::ORB::_unmarshal_char_array( @_, $$byte_order_ref, 4 ); $self->{GIOP_version} = GIOP::Version::_unmarshal( @_, $$byte_order_ref ); $self->{byte_order} = CORBA::ORB::_unmarshal_boolean( @_, $$byte_order_ref ); $$byte_order_ref = $self->{byte_order}; $self->{message_type} = CORBA::ORB::_unmarshal_octet( @_, $$byte_order_ref ); $self->{message_size} = CORBA::ORB::_unmarshal_ulong( @_, $$byte_order_ref ); return bless $self, 'GIOP::MessageHeader'; } #$_tc = _create_struct_tc('', 'MessageHeader', # magic => create_array_tc(4, $CORBA::_tc_char), # GIOP_version => $GIOP::Version::_tc, # byte_order => $CORBA::_tc_boolean, # message_type => $CORBA::_tc_octet, # message_size => $CORBA::_tc_ulong, #); # struct RequestHeader package GIOP::RequestHeader; @ISA = qw(CORBA::_Struct); $logger = Log::Log4perl::get_logger('GIOP.RequestHeader'); sub _marshal { $logger->info("Marshalling"); my ($self) = pop; # sic CORBA::ORB::_marshal_sequence( @_, $self->{service_context}, \&IOP::ServiceContext::_marshal ); CORBA::ORB::_marshal_ulong( @_, $self->{request_id} ); CORBA::ORB::_marshal_boolean( @_, $self->{response_expected} ); CORBA::ORB::_marshal_octet_sequence( @_, $self->{object_key} ); CORBA::ORB::_marshal_string( @_, $self->{operation} ); CORBA::ORB::_marshal_octet_sequence( @_, $self->{requesting_principal} ); } sub _unmarshal { $logger->info("Unmarshalling"); my $self = {}; $self->{service_context} = CORBA::ORB::_unmarshal_sequence( @_, \&IOP::ServiceContext::_unmarshal ); $self->{request_id} = CORBA::ORB::_unmarshal_ulong(@_); $self->{response_expected} = CORBA::ORB::_unmarshal_boolean(@_); $self->{object_key} = CORBA::ORB::_unmarshal_octet_sequence(@_); $self->{operation} = CORBA::ORB::_unmarshal_string(@_); $self->{requesting_principal} = CORBA::ORB::_unmarshal_octet_sequence(@_); return bless $self, 'GIOP::RequestHeader'; } #$_tc = _create_struct_tc('', 'RequestHeader', # service_context => $IOP::ServiceContextList::_tc, # request_id => $CORBA::_tc_ulong, # response_expected => $CORBA::_tc_boolean, # object_key => create_sequence_tc(0,$CORBA::_tc_octet), # operation => create_string_tc(0), # requesting_principal => $CORBA::_tc_Principal, #); package GIOP; $logger = Log::Log4perl::get_logger('GIOP'); # enum ReplyStatusType sub NO_EXCEPTION () { $logger->info(0); return 0; } sub USER_EXCEPTION () { $logger->info(1); return 1; } sub SYSTEM_EXCEPTION () { $logger->info(2); return 2; } sub LOCATION_FORWARD () { $logger->info(3); return 3; } # struct ReplyHeader package GIOP::ReplyHeader; @ISA = qw(CORBA::_Struct); $logger = Log::Log4perl::get_logger('GIOP.ReplyHeader'); sub _unmarshal { $logger->info("Unmarshalling"); my $self = {}; $self->{service_context} = CORBA::ORB::_unmarshal_sequence( @_, \&IOP::ServiceContext::_unmarshal ); $self->{request_id} = CORBA::ORB::_unmarshal_ulong(@_); $self->{reply_status} = CORBA::ORB::_unmarshal_enum(@_); return bless $self, 'GIOP::ReplyHeader'; } sub _marshal { $logger->info("Marshalling"); my ($self) = pop; # sic CORBA::ORB::_marshal_sequence( @_, $self->{service_context}, \&IOP::ServiceContext::_marshal ); CORBA::ORB::_marshal_ulong( @_, $self->{request_id} ); CORBA::ORB::_marshal_enum( @_, $self->{reply_status} ); } # This code from Anne-Kathrin Lange # struct LocateRequestHeader package GIOP::LocateRequestHeader; @ISA = qw(CORBA::_Struct); $logger = Log::Log4perl::get_logger('GIOP.LocateRequestHeader'); sub _marshal { $logger->info("Marshalling"); my ($self) = pop; # sic CORBA::ORB::_marshal_ulong( @_, $self->{request_id} ); CORBA::ORB::_marshal_octet_sequence( @_, $self->{object_key} ); } sub _unmarshal { $logger->info("Unmarshalling"); my $self = {}; $self->{request_id} = CORBA::ORB::_unmarshal_ulong(@_); $self->{object_key} = CORBA::ORB::_unmarshal_octet_sequence(@_); return bless $self, 'GIOP::LocateRequestHeader'; } 1; __END__ =head1 NAME GIOP::LocateRequestHeader A class to ... =head1 SYNOPSIS use GIOP::LocateRequestHeader; =head1 DESCRIPTION The GIOP::LocateRequestHeader class implements ... =head1 OPTIONS -D - show debugging information -h - show help -v - show version Other options ... =head1 SUBROUTINES =head2 Request Parameters: none Insert description of subroutine here... =head2 Reply Parameters: none Insert description of subroutine here... =head2 CancelRequest Parameters: none Insert description of subroutine here... =head2 LocateRequest Parameters: none Insert description of subroutine here... =head2 LocateReply Parameters: none Insert description of subroutine here... =head2 CloseConnection Parameters: none Insert description of subroutine here... =head2 MessageError Parameters: none Insert description of subroutine here... =head2 UNKNOWN_OBJECT Parameters: none Insert description of subroutine here... =head2 OBJECT_HERE Parameters: none Insert description of subroutine here... =head2 OBJECT_FORWARD Parameters: none Insert description of subroutine here... =head2 _marshal Parameters: none Insert description of subroutine here... =head2 _unmarshal (constructor) Parameters: none Insert description of constructor here... =head2 _marshal Parameters: none Insert description of subroutine here... =head2 _unmarshal (constructor) Parameters: none Insert description of constructor here... =head2 _marshal Parameters: none Insert description of subroutine here... =head2 _unmarshal (constructor) Parameters: none Insert description of constructor here... =head2 NO_EXCEPTION Parameters: none Insert description of subroutine here... =head2 USER_EXCEPTION Parameters: none Insert description of subroutine here... =head2 SYSTEM_EXCEPTION Parameters: none Insert description of subroutine here... =head2 LOCATION_FORWARD Parameters: none Insert description of subroutine here... =head2 _unmarshal (constructor) Parameters: none Insert description of constructor here... =head2 _marshal Parameters: none Insert description of subroutine here... =head2 _marshal Parameters: none Insert description of subroutine here... =head2 _unmarshal (constructor) Parameters: none Insert description of constructor here... =head1 FILES Files used by the GIOP::LocateRequestHeader class ... =head1 SEE ALSO Related information ... =head1 WARNINGS ... =head1 NOTES ... =head1 BUGS What? =cut