COPS-Client

 view release on metacpan or  search on metacpan

examples/new_cops_test.pl  view on Meta::CPAN

			);

	$cops_client->envelope_add (
			[
			Envelope_Type		=> "authorize,reserve,commit",
			Service_Type		=> 'DOCSIS Service Class Name',
			ServiceClassName 	=> 'S_down'
			]
			);

	my $timer= time();

	$cops_client->rks_set (
			[
			PRKS_IPAddress		=> '192.168.50.2',
			PRKS_Port		=> 2000,
			PRKS_Flags		=> 1,
			SRKS_IPAddress		=> 0,
			SRKS_Port		=> 0,
			SRKS_Flags		=> 0,
			BCID_TimeStamp		=> $timer,
			BCID_ElementID		=> '99999999',
			BCID_TimeZone		=> '00000000',
			BCID_EventCounter	=> 12347890
			]
			);

#	$cops_client->opaque_set (
#			[
#			OpaqueData		=> 'a test'
#			]

lib/COPS/Client.pm  view on Meta::CPAN

        GateTOSField    - IP TOS and Precedence value.

        GateTOSMask     - IP TOS Mask settings

        GateClass       - This field is broken down into 8 bits as follows
                       
                          Bit 0-2   - Priority of 0-7
                          Bit 3     - PreEmption bit
                          Bit 4-7   - Configurable but should default 0

        Gate_T1         - Gate T1 timer

        Gate_T2         - Gate T2 timer

        Gate_T3         - Gate T3 timer

        Gate_T4         - Gate T4 timer

    An example of use would be

    $cops_client->gate_specification_add(
        [
        Direction       => 'Downstream',
        DSCPToSMark     => 0,
        Priority        => 0,
        PreEmption      => 0,
        Gate_Flags      => 0,

lib/COPS/Client.pm  view on Meta::CPAN


    BCID_TimeZone                  - This is an eight(8) character entry and specifies
                                     the timezone of the entry. 

    BCID_EventCounter              - This is a 32bit number and can be anything within that
                                     range. This could be an auto-increment in a table, so
                                     allowing GateID to be linked back later.

    An example of use would be

        my $timer=time();

        $cops_client->rks_set (
                        [
                        PRKS_IPAddress          => '192.168.50.2',
                        PRKS_Port               => 2000,
                        PRKS_Flags              => 0,
                        SRKS_IPAddress          => 0,
                        SRKS_Port               => 0,
                        SRKS_Flags              => 0,
                        BCID_TimeStamp          => $timer,
                        BCID_ElementID          => '99999999',
                        BCID_TimeZone           => '00000000',
                        BCID_EventCounter       => 12347890
                        ]
                        );

    You can omit fields which are not used and they will default to 0, but for completeness
    are included above.
 
=head2 decode_radius_attribute

lib/COPS/Client.pm  view on Meta::CPAN


sub gate_reasons
{
my ( $self ) = shift;
my ( $reason ) = shift;
my ( @reasons ) = 
		(
		"",
		"Close Initiated by CMTS because of reservation reassignment",
		"Close Initiated by CMTS because of lack of DOCSIS responses",
		"Close Initiated by CMTS because of timer T1 expiry",
		"Close Initiated by CMTS because of timer T2 expiry",
		"Inactivity timer (T3) expired",
		"Close Initiated by CMTS because of a lack of reservation maintenance",
		"Gate state unchanged, but volume limit reached",
		"Close Initiated by CMTS because of timer T4 expiry",
		"Gate State unchanged, but timer T2 expiry caused reservation reduction",
		"Gate State unchanged, but time limit reached",
		"Close Initiated by PS or CMTS, volume limit reached",
		"Close Initiated by PS or CMTS, time limit reached",
		"Close Initiated by CMTS, other"
		);

if ( !$reasons[$reason] )
	{
	return "Other";
	}

lib/COPS/Client.pm  view on Meta::CPAN

sub timebase_set
{
my ( $self ) = shift;
my ( $data ) = shift;
if ( $self->{_GLOBAL}{'DEBUG'}> 4 )
	{
	print "Time set to '".$data."'\n";
	}
if ( $data > 0 )
	{
	my $timer_encode = $self->encode_time_limit( $data );
	$self->{_GLOBAL}{'TimeLimit'} = $timer_encode;
	}
return 1;
}

sub timebase_clear
{
my ( $self ) = shift;
$self->{_GLOBAL}{'TimeLimit'} = "";
return 1;
}

sub volume_set
{
my ( $self ) = shift;
my ( $data ) = shift;
if ( $data>0 )
	{ 
	my $timer_encode = $self->encode_byte_limit( $data ); 
	$self->{_GLOBAL}{'VolumeLimit'} = $timer_encode;
	}
return 1;
}

sub volume_clear
{
my ( $self ) = shift;
$self->{_GLOBAL}{'VolumeLimit'} = "";
return 1;
}



( run in 0.888 second using v1.01-cache-2.11-cpan-49f99fa48dc )