Class Symbiosis::Firewall::Ports
In: firewall/lib/symbiosis/firewall/ports.rb
Parent: Object
Array Utmp EventMachine::Connection ApacheLogger StandardError CrontabFormatError Enumerable IPAddr ::IPAddr Host Range Domain ConfigFile Prosody Tinydns Apache Webalizer Directory IPListDirectory TemplateDirectory Domains Alert Crontab CrontabRecord StateDB Check Runner TCPConnection Test Process BlacklistDB Template Logtail Pattern Ports Blacklist Monitor ConfigFiles Utils Firewall Symbiosis dot/f_0.png

This class is used to convert names to port numbers using the details from /etc/services.

This class only has class methods so that it is accessible globally.

Methods

defined?   empty?   load   lookup   reset   services  

Public Class methods

Is the name defined in /etc/services?

We read the services-file and store the data from within it into a hash for later lookups.

The hash has the form

 {
   name => port
 }

Find the TCP/UDP port of the named service.

If the name looks like a number, then we convert that to an integer, and return. Otherwise the name is looked up in @services. If no port is found, nil is returned.

Empty the services hash, to force a reload.

Just return the hash of services, in the form

 {
  name => port,
 }

[Validate]