line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
18
|
|
|
1
|
|
|
|
|
46
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
419
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '0.80'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
0
|
|
|
0
|
0
|
|
my($class, $data) = @_; |
16
|
0
|
|
|
|
|
|
my($self); |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
if(defined($data)) |
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
|
|
|
|
|
|
|
{ |
47
|
0
|
0
|
|
0
|
0
|
|
$_[0]->{'TYPE'} = $_[1] if(defined($_[1])); |
48
|
0
|
|
|
|
|
|
return $_[0]->{'TYPE'}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub seq |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
0
|
|
0
|
0
|
|
$_[0]->{'SEQ'} = $_[1] if(defined($_[1])); |
54
|
0
|
|
|
|
|
|
return $_[0]->{'SEQ'}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub task |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
0
|
|
0
|
0
|
|
$_[0]->{'TASK'} = $_[1] if(defined($_[1])); |
60
|
0
|
|
|
|
|
|
return $_[0]->{'TASK'}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub len |
64
|
|
|
|
|
|
|
{ |
65
|
0
|
0
|
|
0
|
0
|
|
$_[0]->{'LEN'} = $_[1] if(defined($_[1])); |
66
|
0
|
|
|
|
|
|
return $_[0]->{'LEN'}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub len2 |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
0
|
|
0
|
0
|
|
$_[0]->{'LEN2'} = $_[1] if(defined($_[1])); |
72
|
0
|
|
|
|
|
|
return $_[0]->{'LEN2'}; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub header |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
0
|
0
|
|
return pack("N5", $_[0]->{'TYPE'}, |
78
|
|
|
|
|
|
|
$_[0]->{'SEQ'}, |
79
|
|
|
|
|
|
|
$_[0]->{'TASK'}, |
80
|
|
|
|
|
|
|
$_[0]->{'LEN'}, |
81
|
|
|
|
|
|
|
$_[0]->{'LEN2'}); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |