(RADIATOR) Pre Handler hook help...

Robert Blayzor noc at inoc.net
Fri Jul 12 15:21:19 CDT 2002

We have an handler which uses the following hook:

        Identifier              DSL1
        Secret                  shhhh
        DupInterval             2
        NasType                 ignore
        PreHandlerHook sub { ${$_[0]}->add_attr('NAS-Port-Type',
'SDSL'); my $i_p = ${$_[0]\
}->get_attr('RB-NAS-Real-Port'); my $i_a = sprintf("%s/%s/%s.%s", map
oct("0b$_"), unpack("\
B32", pack("N", $i_p)) =~ /(.{5})(.{3})(.{8})(.*)/);
', $i_a);}

In a nutshell the Hander basically adds a NAS-Port-Type and is to take a
32bit integer representation of DSL ports and put them in the
'Calling-Station-Id' attribute.  

The output should come out to be soething like:  5/0/0/233, etc.
However everything comes out at 0/0/0.0, like $i_p is null, but it's not
because the following code (if I reverse things) works fine...

        PreHandlerHook sub { ${$_[0]}->add_attr('NAS-Port-Type',
'SDSL'); my $i_p = ${$_[0]\
${$_[0]}->add_attr('Calling-Station-Id', $i_p);}

Output the following code right from PERL works fine too:

perl -e 'print sprintf("%s/%s/%s.%s", map(oct("0b$_"), unpack("B32",
pack("N", 671088873)) =~ /(.{5})(.{3})(.{8})(.*)/)) ."\n";'

Any ideas?  I really need to get this to work.  Thanks!

Robert Blayzor, BOFH
rblayzor at inoc.net

"Pinky, you've left the lens cap of your mind on again."
 - The Brain

Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.

More information about the radiator mailing list