| 1 | package Net::IMP::Remote::Storable; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use Net::IMP::Remote::Protocol; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use Net::IMP qw(:DEFAULT :log); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use Net::IMP::Debug; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use Net::IMP::Remote::DualvarMapping; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | ▶ | use Storable (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 2 | my $wire_version = 0x00000001; | |||||||||
| 12 | |||||||||||
| 13 | sub new { | ||||||||||
| 14 | 1 | ▶ | bless {}, shift; | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | sub buf2rpc { | ||||||||||
| 18 | 46 | ▶ | my ($self,$rdata) = @_; | ||||||||
|
Subroutine
buf2rpc: called CC=6 SCAR=18.1
Pod
undocumented
| |||||||||||
| 19 | 46 | ▶ | decode: | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | return if length($$rdata)<6; | ||||||||||
| 21 | 42 | my ($len) = unpack("x2L",$$rdata); | |||||||||
| 22 | 42 | ▶ | return if length($$rdata) - 6 < $len; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 12 | my ($op,$args) = unpack("SL/a*",$$rdata); | |||||||||
| 24 | 12 | substr($$rdata,0,$len+6,''); | |||||||||
| 25 | 12 | $args = Storable::thaw($args); | |||||||||
| 26 | 12 | ▶ | if ( $op == IMPRPC_SET_VERSION ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 1 | ▶ | die "wrong version $args->[0], can do $wire_version only" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | if $args->[0] != $wire_version; | ||||||||||
| 29 | 1 | ▶ | return if $$rdata eq ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 0 | goto decode; | |||||||||
| 31 | } | ||||||||||
| 32 | 11 | return rpc_i2d([$op,@$args]); | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | sub rpc2buf { | ||||||||||
| 36 | 12 | ▶ | my ($self,$rpc) = @_; | ||||||||
|
Subroutine
rpc2buf: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 37 | 12 | my ($op,@args) = @{ rpc_d2i($rpc) }; | |||||||||
| 38 | 12 | return pack("SL/a*",$op,Storable::nfreeze(\@args)); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | sub init { | ||||||||||
| 42 | 1 | ▶ | my ($self,$side) = @_; | ||||||||
|
Subroutine
init: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 43 | 1 | ▶ | return if $side == 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 1 | $self->rpc2buf([IMPRPC_SET_VERSION,$wire_version]) | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 2 | 1; | |||||||||