source: A2P/a2p/AFPDS/MODCA/NOP.pm @ 5

Last change on this file since 5 was 3, checked in by guillaume, 17 years ago
  • AUTHORS: Ajout des différents contributeurs
  • COPYING: Ajout de la licence GPL v3
  • a2p: Préparation des sources pour leur publication sous GPL
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1#
2# Copyright (c) 2004-2007 - Consultas, PKG.fr
3#
4# This file is part of A2P.
5#
6# A2P is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# A2P is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with A2P; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19#
20# $Id: NOP.pm 3 2007-10-18 16:20:19Z g $
21#
22# Class to export No Operation members
23#
24
25package AFPDS::MODCA::NOP ;
26
27use strict ;
28use A2P::Globals ;
29use A2P::Syslog ;
30use AFPDS::MODCA::Common ;
31
32BEGIN {
33    our $VERSION = sprintf "%s", q$Rev: 1007 $ =~ /([0-9.]+)\s+/ ;
34}
35our $VERSION ;
36our @ISA = ("AFPDS::MODCA");
37our $IDENTS ;
38
39sub _ID { 0xD3EEEE }
40
41sub new {
42    my $class = shift ;
43    &Debug("new " . __PACKAGE__ . " v$VERSION object");
44
45    my $self = {
46        FLUX     => 0,        # Associated flux
47        IDENT    => _ID,      # MO:DCA identity
48        FLAG     => 0,        # MO:DCA flags
49        RESERVED => 0,        # MO:DCA reserved
50        LONG     => 0,        # MO:DCA buffer length
51        BUFFER   => ''        # MO:DCA content buffer
52    };
53
54    return bless $self , $class ;
55}
56
57sub validate {
58    my $self = shift ;
59
60    # Just control the autorized size of buffer
61    return ( 251, "Not authorized " . $self->{LONG} . " buffer size" )
62        if ( $self->{LONG} < 0 or $self->{LONG} > 32759 );
63
64    return () ;
65}
66
67sub create {
68    my $self = shift ;
69
70    # Convert buffer
71    my $info = $self->convert ;
72
73    # Strip from bad chars
74    $info =~ s/[\x00-\x1F\x80\x9F]/./g ;
75
76    # Just output in log
77    &Info( sprintf( "%s", $info ) );
78
79    return () ;
80}
81
82&Debug("Module " . __PACKAGE__ . " v$VERSION loaded");
83
84( $IDENTS->{&_ID} ) = __PACKAGE__ =~ /(\w+)$/ ;
Note: See TracBrowser for help on using the repository browser.