| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SMS::Handler; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.005_62; |
|
4
|
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
31683
|
use Carp; |
|
|
6
|
|
|
|
|
13
|
|
|
|
6
|
|
|
|
|
496
|
|
|
6
|
6
|
|
|
6
|
|
34
|
use strict; |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
209
|
|
|
7
|
6
|
|
|
6
|
|
43
|
use warnings; |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
656
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# $Id: Handler.pm,v 1.7 2003/01/14 20:32:34 lem Exp $ |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=pod |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
SMS::Handler - Base class for processing SMS messages in sms-agent |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use SMS::Handler; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This module implements the base implementation (virtual class) for a |
|
26
|
|
|
|
|
|
|
class that processes SMS messages. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
SMS messages will be passed as a hash reference, which contains the |
|
29
|
|
|
|
|
|
|
following keys. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=over 2 |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item C |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
The TON for the source address of the SMS. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item C |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
The NPI for the source address of the SMS. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item C |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The source address. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item C |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
The TON for the destination address of the SMS. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item C |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
The NPI for the destination address of the SMS. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item C |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
The destination address. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item C |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
The actual SMS. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=back |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The hash reference will be passed to a method called C<-Ehandle>, |
|
64
|
|
|
|
|
|
|
which derived classes are expected to implement. This method must |
|
65
|
|
|
|
|
|
|
return the following OR-ed values to indicate the required action on |
|
66
|
|
|
|
|
|
|
the SMS. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub handle |
|
71
|
|
|
|
|
|
|
{ |
|
72
|
0
|
|
|
0
|
0
|
|
croak "SMS::Handler::handle is a virtual function\n"; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=pod |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over 4 |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item C |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Causes the next handler in sequence to be tried. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
|
84
|
|
|
|
|
|
|
|
|
85
|
6
|
|
|
6
|
|
33
|
use constant SMS_CONTINUE => 0x00; |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
485
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=pod |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item C |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Tells C to stop trying to look for another handler to |
|
92
|
|
|
|
|
|
|
process the SMS. If this value is not ORed in the return of the |
|
93
|
|
|
|
|
|
|
method, the next handler in sequence is tried. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
|
96
|
|
|
|
|
|
|
|
|
97
|
6
|
|
|
6
|
|
31
|
use constant SMS_STOP => 0x01; |
|
|
6
|
|
|
|
|
11
|
|
|
|
6
|
|
|
|
|
323
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item C |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Tells C to remove the SMS from any queue it may have the |
|
102
|
|
|
|
|
|
|
message in. Normally this is done on success. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
|
105
|
|
|
|
|
|
|
|
|
106
|
6
|
|
|
6
|
|
33
|
use constant SMS_DEQUEUE => 0x02; |
|
|
6
|
|
|
|
|
23
|
|
|
|
6
|
|
|
|
|
778
|
|
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=pod |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=back |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Normally, you want to use C whenever you produce a final |
|
113
|
|
|
|
|
|
|
answer. You probably want to add C too. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
require Exporter; |
|
118
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
119
|
|
|
|
|
|
|
our @EXPORT = qw( |
|
120
|
|
|
|
|
|
|
SMS_CONTINUE |
|
121
|
|
|
|
|
|
|
SMS_STOP |
|
122
|
|
|
|
|
|
|
SMS_DEQUEUE |
|
123
|
|
|
|
|
|
|
); |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub new { |
|
126
|
0
|
|
|
0
|
0
|
|
croak |
|
127
|
|
|
|
|
|
|
"SMS::Handler is meant as a base class. This is a virtual function.\n"; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |
|
131
|
|
|
|
|
|
|
__END__ |