/usr/share/perl5/Device/Gsm/Sms/Token/OA.pm is in libdevice-gsm-perl 1.60-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | # Sms::Token::OA - SMS OA (originating address) token
# Copyright (C) 2002-2006 Cosimo Streppone, cosimo@cpan.org
#
# This program is free software; you can redistribute it and/or modify
# it only under the terms of Perl itself.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Perl licensing terms for details.
#
# $Id$
package Sms::Token::OA;
use integer;
use strict;
use Device::Gsm::Sms::Token;
@Sms::Token::OA::ISA = ('Sms::Token');
# takes (scalar message (string) reference)
# returns success/failure of decoding
# if all ok, removes OA from message
sub decode {
my ($self, $rMessage) = @_;
my $ok = 0;
# Detect originating address length
my $oa_len = hex(substr $$rMessage, 0, 2);
# Get number type (0x91=international, 0x81=local)
my $oa_type = substr($$rMessage, 2, 2);
# Number of octets to remove from message
my $oa_octets = (($oa_len + 1) >> 1) << 1;
# Get address
my $addr = Device::Gsm::Pdu::decode_address(
substr($$rMessage, 0, 4 + $oa_octets));
$self->set('length' => $oa_len);
$self->set('type' => $oa_type);
$self->set('address' => $addr);
$self->data($oa_len, $oa_type, $addr);
$self->state(Sms::Token::DECODED);
# Remove OA from message
$$rMessage = substr($$rMessage, 4 + $oa_octets);
return 1;
}
#
# [token]->encode( [$data] )
#
# encodes originating address (OA)
#
sub encode {
my $self = shift;
my $oa_len = $self->get('length');
# XXX TO BE COMPLETED...
return $oa_len;
}
sub toString {
my $self = shift;
my $str = $self->get('address');
# Prepend + to number if international
if ($str !~ /^\s*\+/ && $self->get('type') eq '91') {
$str = '+' . $str;
}
return $str;
}
1;
|