line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FTN::SRIF; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
57452
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
132
|
|
4
|
5
|
|
|
5
|
|
15
|
use strict; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
81
|
|
5
|
5
|
|
|
5
|
|
13
|
use Carp qw( croak ); |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
1245
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
FTN::SRIF - Perl extension to parse an Fidonet/FTN Standard Request Information File. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.09 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Parsing an FTN SRIF (Standard Request Information File) received by an FTN mailer for what |
22
|
|
|
|
|
|
|
is being requested by another mailer. A common use of such files is for use by an external |
23
|
|
|
|
|
|
|
request processor (ERP) for an Fidonet/FTN mailer. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
To give an example of it being used: |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use FTN::SRIF qw(&parse_srif); |
28
|
|
|
|
|
|
|
... |
29
|
|
|
|
|
|
|
$srif_info = FTN::SRIF::parse_srif($SRIF); |
30
|
|
|
|
|
|
|
... |
31
|
|
|
|
|
|
|
$request_file = ${$srif_info}{'RequestList'}; |
32
|
|
|
|
|
|
|
$response_file = ${$srif_info}{'ResponseList'}; |
33
|
|
|
|
|
|
|
... |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 EXPORT |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The following is a list of functions that can be exported: parse_srif(). |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 FUNCTIONS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 parse_srif |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Syntax: $srif_info = parse_srif($srif_file); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Parses the SRIF $srif_file and returns the information therein as a refererence |
46
|
|
|
|
|
|
|
to a hash containing the SRIF information. Note that the only keyword that is |
47
|
|
|
|
|
|
|
allowed to have multiple values is the one for Akas, which is returned as a |
48
|
|
|
|
|
|
|
refererence to an array containing the Akas list. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
The base set of keys to the hash, and also that required in the SRIF, |
51
|
|
|
|
|
|
|
are as follows: |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=over 4 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item Sysop |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This is the name of the remote sysop |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item AKA |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This is the main aka of the remote system in 4D or 5D notation. A zero |
64
|
|
|
|
|
|
|
as point number may be ommited, the domain with "@" is optional. This |
65
|
|
|
|
|
|
|
is included in a key, Akas, which is a reference to an array containing it. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item Baud |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This is the effective baud rate, not the fixed DTE rate |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item Time |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This is the time till next event which does not allow file requests. |
76
|
|
|
|
|
|
|
Use -1 if there is no limit. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item RequestList |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This is the filename of the file containing the request list. If |
82
|
|
|
|
|
|
|
the request(s) is for files, it will be a listing of files being |
83
|
|
|
|
|
|
|
requested. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item ResponseList |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This is the filename of the response list. It must not be equal |
89
|
|
|
|
|
|
|
to RequestList. One file per line, including drives/pathes to the |
90
|
|
|
|
|
|
|
file. The first character defines the way the mailer should act after |
91
|
|
|
|
|
|
|
sending that file: |
92
|
|
|
|
|
|
|
= erase file if sent successfully |
93
|
|
|
|
|
|
|
+ do not erase the file after sent |
94
|
|
|
|
|
|
|
- erase the file in any case after session |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item RemoteStatus |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Defines whether the session is protected by password or not. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item SystemStatus |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Defines whether the remote system is listed in any current nodelist |
105
|
|
|
|
|
|
|
of a system. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=back |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The following are optional statements: these parameters are already known and defined, |
110
|
|
|
|
|
|
|
but an ERP should run also without them: |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=over 4 |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item SessionProtocol |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
e.g. ZAP,ZMO,XMA. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item AKA |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Additional AKAs. One AKA is required (see REQUIRED section, above) |
122
|
|
|
|
|
|
|
They are included in a key, Akas, which is a reference to an array |
123
|
|
|
|
|
|
|
containing them. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item Site |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
The site info as given e.g. in EMSI handshake |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item Location |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
The location info as given e.g. in EMSI handshake |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item Phone |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
The phone number info as given e.g. in EMSI handshake |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item CallerID |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
The phone number as delivered by the PTT. This is |
144
|
|
|
|
|
|
|
only possible in digital networks like ISDN. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item Password |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
On protected sessions, the session password. If |
150
|
|
|
|
|
|
|
no protected session, this parameter must be ommited! |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item DTE |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
The PC<->Modem speed (so call DTE rate) |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item PORT |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
The FOSSIL Communication Port. The Mailer should |
161
|
|
|
|
|
|
|
leave the fossil "hot" for the Request Processor |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item Mailer |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
The Mailer name as defined by FTC |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item MailerCode |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
The hex code of the remote mailer as defined by FTC |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item SerialNumber |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
The remote mailer's serial number if transfered |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item Version |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
The remote mailer's version number if transfered |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item Revision |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
The remote mailer's revision number if transfered |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item SessionType |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
The session-type, this may be one of the known |
192
|
|
|
|
|
|
|
session types or "OTHER" if not (yet) defined |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item OurAKA |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
If the mailer does AKA matching, the AKA of the |
198
|
|
|
|
|
|
|
mailer being called |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item TRANX |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
The unix-style time stamp (hexadecimal notation |
204
|
|
|
|
|
|
|
of seconds since 1.1.1980) |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=back |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub parse_srif { |
211
|
|
|
|
|
|
|
|
212
|
2
|
|
|
2
|
1
|
350
|
my $srif_file = shift; |
213
|
|
|
|
|
|
|
|
214
|
2
|
|
|
|
|
2
|
my (%srif_info, $keyword, $value, @akas); |
215
|
|
|
|
|
|
|
|
216
|
2
|
50
|
|
|
|
59
|
open my $srif_handle, q{<}, "$srif_file" or croak ("Could not open SRIF file $srif_file."); |
217
|
|
|
|
|
|
|
|
218
|
2
|
|
|
|
|
34
|
while (<$srif_handle>) { |
219
|
|
|
|
|
|
|
|
220
|
26
|
|
|
|
|
67
|
($keyword, $value) = split(' ', $_, 2); |
221
|
|
|
|
|
|
|
|
222
|
26
|
100
|
|
|
|
44
|
if ($keyword ne "AKA") { |
223
|
|
|
|
|
|
|
|
224
|
20
|
|
|
|
|
62
|
$srif_info{$keyword} = $value; # add to SRIF hash |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
} else { |
227
|
|
|
|
|
|
|
|
228
|
6
|
|
|
|
|
16
|
push @akas, $value; # add to akas array |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
2
|
|
|
|
|
10
|
close ($srif_handle); |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
# Add a reference to the Akas array to the srif_info hash. |
237
|
2
|
|
|
|
|
4
|
$srif_info{Akas} = \@akas; |
238
|
|
|
|
|
|
|
|
239
|
2
|
|
|
|
|
8
|
return \%srif_info; |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head2 get_request_list |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Syntax: @request_list = get_request_list($request_file); |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Reads the request file passed to it and returns a reference to an array of lines |
247
|
|
|
|
|
|
|
containing the list of requests in that request file. |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=cut |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
sub get_request_list { |
252
|
|
|
|
|
|
|
|
253
|
1
|
|
|
1
|
1
|
79
|
my $request_file = shift; |
254
|
|
|
|
|
|
|
|
255
|
1
|
50
|
|
|
|
40
|
open my $req_handle, q{<}, "$request_file" |
256
|
|
|
|
|
|
|
or croak ("Could not open Request File $request_file"); |
257
|
|
|
|
|
|
|
|
258
|
1
|
|
|
|
|
10
|
my @request_list = <$req_handle>; |
259
|
|
|
|
|
|
|
|
260
|
1
|
|
|
|
|
5
|
close($req_handle); |
261
|
|
|
|
|
|
|
|
262
|
1
|
|
|
|
|
3
|
return \@request_list; |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head1 AUTHOR |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
Robert James Clay, C<< >> |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head1 BUGS |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
274
|
|
|
|
|
|
|
the web interface at L. |
275
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your bug as |
276
|
|
|
|
|
|
|
I make changes. |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head1 SUPPORT |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
perldoc FTN::SRIF |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
You can also look for information at: |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=over 4 |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
L |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
L |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=item * CPAN Ratings |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
L |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=item * Search CPAN |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
L |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=back |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=head1 SEE ALSO |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
For more information regarding SRIF, see L |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
See also L, for an example of usage of this module. |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
Copyright 2001-2003,2010-2012 Robert James Clay, all rights reserved. |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
319
|
|
|
|
|
|
|
under the same terms as Perl itself. |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=cut |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
1; # End of FTN::SRIF |