Class: Diameter::Internals::AVPNames

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/diameter/avp.rb

Overview

Maps AVP names to their on-the-wire values and data definitions.

Constant Summary

Constants included from Constants

Constants::AVAILABLE_AVPS

Constants included from Constants::Vendors

Constants::Vendors::TGPP

Constants included from Constants::AVPType

Constants::AVPType::GROUPED, Constants::AVPType::IPADDR, Constants::AVPType::OCTETSTRING, Constants::AVPType::U32

Class Method Summary collapse

Class Method Details

.add(name, code, type, vendor = nil) ⇒ Object

See Also:

  • {AVP{AVP.define}


28
29
30
# File 'lib/diameter/avp.rb', line 28

def self.add(name, code, type, vendor=nil)
  @custom_avps[name] = vendor.nil? ? [code, type] : [code, type, vendor]
end

.get(name) ⇒ Array(Fixnum, AVPType), Array(Fixnum, AVPType, Vendor)

Converts an AVP name into its code number, data type, and (if applicable) vendor ID.

Parameters:

  • name (String)

    The AVP name

Returns:

  • (Array(Fixnum, AVPType))

    if this is not vendor-specific

  • (Array(Fixnum, AVPType, Vendor))

    if this is vendor-specific



20
21
22
23
24
25
# File 'lib/diameter/avp.rb', line 20

def self.get(name)
  code, type, vendor = @custom_avps.merge(AVAILABLE_AVPS)[name]
  vendor ||= 0
  fail "AVP name #{name} not recognised" unless code
  [code, type, vendor]
end