| 1 | package Net::Hotline::Protocol::Header; | ||||||||||
| 2 | |||||||||||
| 3 | ## Copyright(c) 1998-2002 by John C. Siracusa. All rights reserved. This | ||||||||||
| 4 | ## program is free software; you can redistribute it and/or modify it under | ||||||||||
| 5 | ## the same terms as Perl itself. | ||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | $VERSION = '0.80'; | |||||||||
| 12 | |||||||||||
| 13 | sub new | ||||||||||
| 14 | 0 | ▶ | { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 15 | 0 | my($class, $data) = @_; | |||||||||
| 16 | 0 | my($self); | |||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | if(defined($data)) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | { | ||||||||||
| 20 | 0 | $self = | |||||||||
| 21 | { | ||||||||||
| 22 | 'TYPE' => substr($data, 0, 4), | ||||||||||
| 23 | 'SEQ' => substr($data, 4, 4), | ||||||||||
| 24 | 'TASK' => substr($data, 8, 4), | ||||||||||
| 25 | 'LEN' => substr($data, 12, 4), | ||||||||||
| 26 | 'LEN2' => substr($data, 16, 4) | ||||||||||
| 27 | }; | ||||||||||
| 28 | } | ||||||||||
| 29 | else | ||||||||||
| 30 | { | ||||||||||
| 31 | 0 | $self = | |||||||||
| 32 | { | ||||||||||
| 33 | 'TYPE' => 0x00000000, | ||||||||||
| 34 | 'SEQ' => 0x00000000, | ||||||||||
| 35 | 'TASK' => 0x00000000, | ||||||||||
| 36 | 'LEN' => 0x00000000, | ||||||||||
| 37 | 'LEN2' => 0x00000000 | ||||||||||
| 38 | }; | ||||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 0 | bless $self, $class; | |||||||||
| 42 | 0 | return $self; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | sub type | ||||||||||
| 46 | 0 | ▶ | { | ||||||||
|
Subroutine
type: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 47 | 0 | ▶ | $_[0]->{'TYPE'} = $_[1] if(defined($_[1])); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | 0 | return $_[0]->{'TYPE'}; | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | sub seq | ||||||||||
| 52 | 0 | ▶ | { | ||||||||
|
Subroutine
seq: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 53 | 0 | ▶ | $_[0]->{'SEQ'} = $_[1] if(defined($_[1])); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | return $_[0]->{'SEQ'}; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | sub task | ||||||||||
| 58 | 0 | ▶ | { | ||||||||
|
Subroutine
task: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 59 | 0 | ▶ | $_[0]->{'TASK'} = $_[1] if(defined($_[1])); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | 0 | return $_[0]->{'TASK'}; | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | sub len | ||||||||||
| 64 | 0 | ▶ | { | ||||||||
|
Subroutine
len: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 65 | 0 | ▶ | $_[0]->{'LEN'} = $_[1] if(defined($_[1])); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 0 | return $_[0]->{'LEN'}; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | sub len2 | ||||||||||
| 70 | 0 | ▶ | { | ||||||||
|
Subroutine
len2: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 71 | 0 | ▶ | $_[0]->{'LEN2'} = $_[1] if(defined($_[1])); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 72 | 0 | return $_[0]->{'LEN2'}; | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | sub header | ||||||||||
| 76 | 0 | ▶ | { | ||||||||
|
Subroutine
header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 77 | return pack("N5", $_[0]->{'TYPE'}, | ||||||||||
| 78 | $_[0]->{'SEQ'}, | ||||||||||
| 79 | $_[0]->{'TASK'}, | ||||||||||
| 80 | $_[0]->{'LEN'}, | ||||||||||
| 81 | 0 | $_[0]->{'LEN2'}); | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | 1 | 1; | |||||||||