Class: Majoron::AntHill::SMPP::SMPPBind

Inherits:
SMPPPDU
  • Object
show all
Defined in:
lib/pdu/smpp_bind.rb

Instance Attribute Summary collapse

Attributes inherited from SMPPPDU

#header

Instance Method Summary collapse

Methods inherited from SMPPPDU

#command_id, #command_length, #command_status, #command_status=, #sequence_number, #sequence_number=

Constructor Details

#initialize(command_id, command_status, sequence_number) ⇒ SMPPBind

Returns a new instance of SMPPBind.



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/pdu/smpp_bind.rb', line 23

def initialize(command_id, command_status, sequence_number)
	super(command_id, command_status, sequence_number)

	#Init fields
	@system_id = ""
	@password = ""
	@system_type = ""
	@interface_version = InterfaceVersion::SMPP_VER_5_0
	@addr_ton = TON::UNKNOWN
	@addr_npi = NPI::UNKNOWN
	@address_range = ""

end

Instance Attribute Details

#addr_npiObject

Returns the value of attribute addr_npi.



97
98
99
# File 'lib/pdu/smpp_bind.rb', line 97

def addr_npi
  @addr_npi
end

#addr_tonObject

Returns the value of attribute addr_ton.



96
97
98
# File 'lib/pdu/smpp_bind.rb', line 96

def addr_ton
  @addr_ton
end

#address_rangeObject

Returns the value of attribute address_range.



98
99
100
# File 'lib/pdu/smpp_bind.rb', line 98

def address_range
  @address_range
end

#interface_versionObject

Returns the value of attribute interface_version.



95
96
97
# File 'lib/pdu/smpp_bind.rb', line 95

def interface_version
  @interface_version
end

#passwordObject

Returns the value of attribute password.



93
94
95
# File 'lib/pdu/smpp_bind.rb', line 93

def password
  @password
end

#system_idObject

Mandatory fields



92
93
94
# File 'lib/pdu/smpp_bind.rb', line 92

def system_id
  @system_id
end

#system_typeObject

Returns the value of attribute system_type.



94
95
96
# File 'lib/pdu/smpp_bind.rb', line 94

def system_type
  @system_type
end

Instance Method Details

#decode_packet(decoder) ⇒ Object

Interface to decode SMPP packet



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/pdu/smpp_bind.rb', line 51

def decode_packet(decoder)
	# Decode header and mandatory fields
	@header = decoder.decode_header()
	@system_id = decoder.decode_system_id(command_length())
	@password = decoder.decode_password(command_length())
	@system_type = decoder.decode_system_type(command_length())
	@interface_version = decoder.decode_interface_version(command_length())
	@addr_ton = decoder.decode_addr_ton(command_length())
	@addr_npi = decoder.decode_addr_npi(command_length())
	@address_range = decoder.decode_address_range(command_length())
end

#encode_packet(encoder) ⇒ Object

Interface to encode SMPP packet



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/pdu/smpp_bind.rb', line 38

def encode_packet(encoder)
	# Encode header and mandatory fields
	encoder.encode_header(@header)
	encoder.encode_system_id(@system_id)
	encoder.encode_password(@password)
	encoder.encode_system_type(@system_type)
	encoder.encode_interface_version(@interface_version)
	encoder.encode_addr_ton(@addr_ton)
	encoder.encode_addr_npi(@addr_npi)
	encoder.encode_address_range(@address_range)
end

#output_packet(outputter) ⇒ Object

Interface to output SMPP packet



78
79
80
81
82
83
84
85
86
87
88
# File 'lib/pdu/smpp_bind.rb', line 78

def output_packet(outputter)
	# Output header and mandatory fields
	outputter.output_header(@header)
	outputter.output_system_id(@system_id)
	outputter.output_password(@password)
	outputter.output_system_type(@system_type)
	outputter.output_interface_version(@interface_version)
	outputter.output_addr_ton(@addr_ton)
	outputter.output_addr_npi(@addr_npi)
	outputter.output_address_range(@address_range)
end

#validate_packet(validator) ⇒ Object

Interface to validate SMPP packet



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/pdu/smpp_bind.rb', line 64

def validate_packet(validator)
	# Decode header and mandatory fields
	validator.validate_header(@header)
	validator.validate_system_id(@system_id)
	validator.validate_password(@password)
	validator.validate_system_type(@system_type)
	validator.validate_interface_version(@interface_version)
	validator.validate_addr_ton(@addr_ton)
	validator.validate_addr_npi(@addr_npi)
	validator.validate_address_range(@address_range)

end