This file is indexed.

/usr/share/perl5/Net/SIP/ReceiveChain.pm is in libnet-sip-perl 0.683-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
###########################################################################
# package Net::SIP::ReceiveChain
# used to put Authorize, Registrar, StatelessProxy etc together so that
# the object first in chain will try to handle the packets first and
# pass them only to the next object if it was not fully handled by the
# previous object
# each object in chain returns TRUE from method receive if it handled
# the packet fully
###########################################################################

use strict;
use warnings;

package Net::SIP::ReceiveChain;
use fields qw( objects filter );
use Net::SIP::Util 'invoke_callback';

###########################################################################
# creates new ReceiveChain object
# Args: ($class,$objects,%args)
#   $objects: \@list of objects which it should put in the chain
#   %args:
#      filter: callback invoked on each packet to find out if it should
#         be processed by this chain
#      methods: \@list of methods, used if no filter is given
# Returns: $self
###########################################################################
sub new {
	my ($class,$objects,%args) = @_;
	my $self = fields::new( $class );
	if ( ! ( $self->{filter} = $args{filter} )) {
		if ( my $m = $args{methods} ) {
			# predefined filter to filter based on method
			my %m = map { $_ => 1 } @$m;
			my $method_filter = sub {
				my ($hm,$packet) = @_;
				return $hm->{ $packet->method }
			};
			$self->{filter} = [ $method_filter, \%m ];
		}
	}
	$self->{objects} = $objects;
	return $self;
}

###########################################################################
# handle packet, called from Net::SIP::Dispatcher on incoming requests
# Args: ($self,$packet,$leg,$addr)
#  $packet: Net::SIP::Packet
#  $leg: Net::SIP::Leg where request came in (and response gets send out)
#  $addr: ip:port where request came from and response will be send
# Returns: TRUE if it handled the packet
###########################################################################
sub receive {
	my Net::SIP::ReceiveChain $self = shift;
	my ($packet,$leg,$addr) = @_;

	if ( my $f = $self->{filter} ) {
		# check if packet should be handled by filter
		return if ! invoke_callback($f,$packet,$leg,$addr);
	}
	foreach my $object (@{ $self->{objects} }) {
		my $handled = $object->receive($packet,$leg,$addr);
		return $handled if $handled;
	}
	return; # not handled
}

1;