This file is indexed.

/usr/share/perl5/Net/SNMP/Transport/IPv4/UDP.pm is in libnet-snmp-perl 6.0.1-2.

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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# -*- mode: perl -*-
# ============================================================================

package Net::SNMP::Transport::IPv4::UDP;

# $Id: UDP.pm,v 4.0 2009/09/09 15:05:33 dtown Rel $

# Object that handles the UDP/IPv4 Transport Domain for the SNMP Engine.

# Copyright (c) 2001-2009 David M. Town <dtown@cpan.org>
# All rights reserved.

# This program is free software; you may redistribute it and/or modify it
# under the same terms as the Perl 5 programming language system itself.

# ============================================================================

use strict;

use Net::SNMP::Transport qw( DOMAIN_UDPIPV4 );

use IO::Socket qw( SOCK_DGRAM );

## Version of the Net::SNMP::Transport::IPv4::UDP module

our $VERSION = v4.0.0;

## Handle importing/exporting of symbols

use base qw( Net::SNMP::Transport::IPv4 Net::SNMP::Transport );

sub import
{
   return Net::SNMP::Transport->export_to_level(1, @_);
}

## RFC 3411 - snmpEngineMaxMessageSize::=INTEGER (484..2147483647)

sub MSG_SIZE_DEFAULT_UDP4  { 1472 }  # Ethernet(1500) - IPv4(20) - UDP(8)

# [public methods] -----------------------------------------------------------

sub new
{
   return shift->SUPER::_new(@_);
}

sub send
{
   my $this = shift;

   $this->_error_clear();

   if (length($_[0]) > $this->{_max_msg_size}) {
      return $this->_error(
         'The message size %d exceeds the maxMsgSize %d',
         length($_[0]), $this->{_max_msg_size}
      );
   }

   my $bytes = $this->{_socket}->send($_[0], 0, $this->{_dest_name});

   return defined($bytes) ? $bytes : $this->_perror('Send failure');
}

sub recv
{
   my $this = shift;

   $this->_error_clear();

   my $name = $this->{_socket}->recv($_[0], $this->_shared_max_size(), 0);

   return defined($name) ? $name : $this->_perror('Receive failure');
}

sub domain
{
   return DOMAIN_UDPIPV4; # transportDomainUdpIpv4
}

sub type
{
   return 'UDP/IPv4'; # udpIpv4(1)
}

sub agent_addr
{
   my ($this) = @_;

   $this->_error_clear();

   my $name = $this->{_socket}->sockname() || $this->{_sock_name};

   if ($this->{_socket}->connect($this->{_dest_name})) {
      $name = $this->{_socket}->sockname() || $this->{_sock_name};
      if (!$this->{_socket}->connect((pack('x') x length $name))) {
         $this->_perror('Failed to disconnect');
      }
   }

   return $this->_address($name);
}

# [private methods] ----------------------------------------------------------

sub _protocol_name
{
   return 'udp';
}

sub _protocol_type
{
   return SOCK_DGRAM;
}

sub _msg_size_default
{
   return MSG_SIZE_DEFAULT_UDP4;
}

sub _tdomain
{
   return DOMAIN_UDPIPV4;
}

# ============================================================================
1; # [end Net::SNMP::Transport::IPv4::UDP]