anthill_smpp_ruby 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +21 -0
- data/README +30 -0
- data/anthill_smpp_ruby.gemspec +18 -0
- data/changelog +43 -0
- data/data/dumps/random_command.dump +1 -0
- data/data/dumps/smpp_alert_notification.dump +1 -0
- data/data/dumps/smpp_bind_receiver.dump +1 -0
- data/data/dumps/smpp_bind_receiver_resp.dump +1 -0
- data/data/dumps/smpp_bind_transceiver.dump +1 -0
- data/data/dumps/smpp_bind_transceiver_1.dump +2 -0
- data/data/dumps/smpp_bind_transceiver_resp.dump +1 -0
- data/data/dumps/smpp_bind_transmitter.dump +1 -0
- data/data/dumps/smpp_bind_transmitter_resp.dump +1 -0
- data/data/dumps/smpp_broadcast_sm.dump +1 -0
- data/data/dumps/smpp_broadcast_sm_resp.dump +1 -0
- data/data/dumps/smpp_cancel_broadcast_sm.dump +1 -0
- data/data/dumps/smpp_cancel_broadcast_sm_resp.dump +1 -0
- data/data/dumps/smpp_cancel_sm.dump +1 -0
- data/data/dumps/smpp_cancel_sm_resp.dump +1 -0
- data/data/dumps/smpp_data_sm.dump +1 -0
- data/data/dumps/smpp_data_sm_resp.dump +1 -0
- data/data/dumps/smpp_deliver_sm.dump +1 -0
- data/data/dumps/smpp_deliver_sm_resp.dump +1 -0
- data/data/dumps/smpp_enquire_link.dump +1 -0
- data/data/dumps/smpp_enquire_link_resp.dump +1 -0
- data/data/dumps/smpp_generic_nack.dump +1 -0
- data/data/dumps/smpp_outbind.dump +1 -0
- data/data/dumps/smpp_query_broadcast_sm.dump +1 -0
- data/data/dumps/smpp_query_broadcast_sm_resp.dump +1 -0
- data/data/dumps/smpp_query_broadcast_sm_resp_1.dump +1 -0
- data/data/dumps/smpp_query_sm.dump +1 -0
- data/data/dumps/smpp_query_sm_resp.dump +1 -0
- data/data/dumps/smpp_replace_sm.dump +1 -0
- data/data/dumps/smpp_replace_sm_resp.dump +1 -0
- data/data/dumps/smpp_submit_multi.dump +1 -0
- data/data/dumps/smpp_submit_multi_resp.dump +1 -0
- data/data/dumps/smpp_submit_sm.dump +1 -0
- data/data/dumps/smpp_submit_sm_resp.dump +1 -0
- data/data/dumps/smpp_unbind.dump +1 -0
- data/data/dumps/smpp_unbind_resp.dump +1 -0
- data/data/pdus/random_command.xml +35 -0
- data/data/pdus/smpp_alert_notification.xml +14 -0
- data/data/pdus/smpp_alert_notification_no_optional.xml +13 -0
- data/data/pdus/smpp_bind_receiver.xml +17 -0
- data/data/pdus/smpp_bind_receiver_resp.xml +12 -0
- data/data/pdus/smpp_bind_receiver_resp_no_optional.xml +11 -0
- data/data/pdus/smpp_bind_transceiver.xml +17 -0
- data/data/pdus/smpp_bind_transceiver_resp.xml +12 -0
- data/data/pdus/smpp_bind_transceiver_resp_no_optional.xml +11 -0
- data/data/pdus/smpp_bind_transmitter.xml +17 -0
- data/data/pdus/smpp_bind_transmitter_resp.xml +12 -0
- data/data/pdus/smpp_bind_transmitter_resp_no_optional.xml +11 -0
- data/data/pdus/smpp_broadcast_sm.xml +47 -0
- data/data/pdus/smpp_broadcast_sm_no_optional.xml +26 -0
- data/data/pdus/smpp_broadcast_sm_resp.xml +14 -0
- data/data/pdus/smpp_broadcast_sm_resp_no_optional.xml +8 -0
- data/data/pdus/smpp_cancel_broadcast_sm.xml +17 -0
- data/data/pdus/smpp_cancel_broadcast_sm_no_optional.xml +15 -0
- data/data/pdus/smpp_cancel_broadcast_sm_resp.xml +7 -0
- data/data/pdus/smpp_cancel_sm.xml +18 -0
- data/data/pdus/smpp_cancel_sm_resp.xml +10 -0
- data/data/pdus/smpp_commands.xsd +914 -0
- data/data/pdus/smpp_data_sm.xml +58 -0
- data/data/pdus/smpp_data_sm_no_optional.xml +17 -0
- data/data/pdus/smpp_data_sm_resp.xml +15 -0
- data/data/pdus/smpp_data_sm_resp_no_optional.xml +8 -0
- data/data/pdus/smpp_deliver_sm.xml +46 -0
- data/data/pdus/smpp_deliver_sm_no_optional.xml +25 -0
- data/data/pdus/smpp_deliver_sm_resp.xml +14 -0
- data/data/pdus/smpp_deliver_sm_resp_no_optional.xml +8 -0
- data/data/pdus/smpp_enquire_link.xml +10 -0
- data/data/pdus/smpp_enquire_link_resp.xml +10 -0
- data/data/pdus/smpp_generic_nack.xml +10 -0
- data/data/pdus/smpp_outbind.xml +12 -0
- data/data/pdus/smpp_query_broadcast_sm.xml +12 -0
- data/data/pdus/smpp_query_broadcast_sm_no_optional.xml +11 -0
- data/data/pdus/smpp_query_broadcast_sm_resp.xml +17 -0
- data/data/pdus/smpp_query_broadcast_sm_resp_no_optional.xml +15 -0
- data/data/pdus/smpp_query_sm.xml +11 -0
- data/data/pdus/smpp_query_sm_resp.xml +11 -0
- data/data/pdus/smpp_replace_sm.xml +18 -0
- data/data/pdus/smpp_replace_sm_no_optional.xml +17 -0
- data/data/pdus/smpp_replace_sm_resp.xml +7 -0
- data/data/pdus/smpp_submit_multi.xml +73 -0
- data/data/pdus/smpp_submit_multi_no_optional.xml +51 -0
- data/data/pdus/smpp_submit_multi_resp.xml +35 -0
- data/data/pdus/smpp_submit_sm.xml +57 -0
- data/data/pdus/smpp_submit_sm_no_optional.xml +28 -0
- data/data/pdus/smpp_submit_sm_resp.xml +8 -0
- data/data/pdus/smpp_unbind.xml +10 -0
- data/data/pdus/smpp_unbind_resp.xml +10 -0
- data/examples/dump_viewer.rb +298 -0
- data/examples/pdu_composer.rb +1331 -0
- data/knownbugs +24 -0
- data/lib/anthill_smpp_ruby.rb +83 -0
- data/lib/i_smpp_outputter.rb +425 -0
- data/lib/pdu/smpp_alert_notification.rb +132 -0
- data/lib/pdu/smpp_bind.rb +102 -0
- data/lib/pdu/smpp_bind_receiver.rb +29 -0
- data/lib/pdu/smpp_bind_receiver_resp.rb +30 -0
- data/lib/pdu/smpp_bind_resp.rb +100 -0
- data/lib/pdu/smpp_bind_transceiver.rb +29 -0
- data/lib/pdu/smpp_bind_transceiver_resp.rb +31 -0
- data/lib/pdu/smpp_bind_transmitter.rb +29 -0
- data/lib/pdu/smpp_bind_transmitter_resp.rb +30 -0
- data/lib/pdu/smpp_broadcast_sm.rb +566 -0
- data/lib/pdu/smpp_broadcast_sm_resp.rb +130 -0
- data/lib/pdu/smpp_cancel_broadcast_sm.rb +143 -0
- data/lib/pdu/smpp_cancel_broadcast_sm_resp.rb +60 -0
- data/lib/pdu/smpp_cancel_sm.rb +110 -0
- data/lib/pdu/smpp_cancel_sm_resp.rb +60 -0
- data/lib/pdu/smpp_data_sm.rb +679 -0
- data/lib/pdu/smpp_data_sm_resp.rb +148 -0
- data/lib/pdu/smpp_deliver_sm.rb +458 -0
- data/lib/pdu/smpp_deliver_sm_resp.rb +137 -0
- data/lib/pdu/smpp_enquire_link.rb +59 -0
- data/lib/pdu/smpp_enquire_link_resp.rb +61 -0
- data/lib/pdu/smpp_generic_nack.rb +61 -0
- data/lib/pdu/smpp_outbind.rb +71 -0
- data/lib/pdu/smpp_pdu.rb +90 -0
- data/lib/pdu/smpp_query_broadcast_sm.rb +120 -0
- data/lib/pdu/smpp_query_broadcast_sm_resp.rb +192 -0
- data/lib/pdu/smpp_query_sm.rb +92 -0
- data/lib/pdu/smpp_query_sm_resp.rb +92 -0
- data/lib/pdu/smpp_replace_sm.rb +172 -0
- data/lib/pdu/smpp_replace_sm_resp.rb +61 -0
- data/lib/pdu/smpp_resp.rb +40 -0
- data/lib/pdu/smpp_submit_multi.rb +517 -0
- data/lib/pdu/smpp_submit_multi_resp.rb +90 -0
- data/lib/pdu/smpp_submit_sm.rb +591 -0
- data/lib/pdu/smpp_submit_sm_resp.rb +72 -0
- data/lib/pdu/smpp_unbind.rb +60 -0
- data/lib/pdu/smpp_unbind_resp.rb +61 -0
- data/lib/smpp_constants.rb +917 -0
- data/lib/smpp_csv_outputter.rb +1601 -0
- data/lib/smpp_datatypes.rb +89 -0
- data/lib/smpp_decoder.rb +627 -0
- data/lib/smpp_encoder.rb +495 -0
- data/lib/smpp_hex_outputter.rb +36 -0
- data/lib/smpp_outputter_base.rb +315 -0
- data/lib/smpp_structures.rb +98 -0
- data/lib/smpp_txt_outputter.rb +1895 -0
- data/lib/smpp_validator.rb +373 -0
- data/lib/smpp_xml_outputter.rb +34 -0
- data/roadmap +18 -0
- data/setup.rb +1585 -0
- data/test/anthill_smpp_test.rb +29 -0
- data/test/smpp_codec_test.rb +30 -0
- data/test/smpp_datatypes_test.rb +69 -0
- data/test/smpp_outputter_test.rb +1261 -0
- data/test/smpp_parsing_test.rb +1758 -0
- data/test/smpp_rawdump_test.rb +2095 -0
- data/test/smpp_validator_test.rb +441 -0
- metadata +206 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
module Majoron
|
|
20
|
+
module AntHill
|
|
21
|
+
module SMPP
|
|
22
|
+
class SMPPReplaceSM < SMPPPDU
|
|
23
|
+
def initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil)
|
|
24
|
+
super(CommandId::CM_REPLACE_SM, command_status, sequence_number)
|
|
25
|
+
|
|
26
|
+
# Mandatory fields
|
|
27
|
+
@message_id = ""
|
|
28
|
+
@source_addr_ton = TON::UNKNOWN
|
|
29
|
+
@source_addr_npi = NPI::UNKNOWN
|
|
30
|
+
@source_addr = ""
|
|
31
|
+
@schedule_delivery_time = ""
|
|
32
|
+
@validity_period = ""
|
|
33
|
+
@registered_delivery = 0
|
|
34
|
+
@sm_default_msg_id = 0
|
|
35
|
+
@sm_length = 0
|
|
36
|
+
@short_message = ""
|
|
37
|
+
|
|
38
|
+
# Optional fields
|
|
39
|
+
@message_payload = nil
|
|
40
|
+
|
|
41
|
+
# Optional fields length
|
|
42
|
+
@message_payload_len = SMPPTLVLen::ZERO_LEN
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Interface to encode SMPP packet
|
|
47
|
+
def encode_packet(encoder)
|
|
48
|
+
# Encode header and mandatory fields
|
|
49
|
+
encoder.encode_header(@header)
|
|
50
|
+
encoder.encode_message_id(@message_id)
|
|
51
|
+
encoder.encode_source_addr_ton(@source_addr_ton)
|
|
52
|
+
encoder.encode_source_addr_npi(@source_addr_npi)
|
|
53
|
+
encoder.encode_source_addr21(@source_addr)
|
|
54
|
+
encoder.encode_schedule_delivery_time(@schedule_delivery_time)
|
|
55
|
+
encoder.encode_validity_period(@validity_period)
|
|
56
|
+
encoder.encode_registered_delivery(@registered_delivery)
|
|
57
|
+
encoder.encode_sm_default_msg_id(@sm_default_msg_id)
|
|
58
|
+
encoder.encode_sm_length(@sm_length)
|
|
59
|
+
encoder.encode_short_message(@short_message)
|
|
60
|
+
|
|
61
|
+
# Encode optional fields
|
|
62
|
+
encoder.encode_message_payload(@message_payload,
|
|
63
|
+
@message_payload_len) if !@message_payload.nil?
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Interface to decode SMPP packet
|
|
67
|
+
def decode_packet(decoder)
|
|
68
|
+
# Decode header and mandatory fields
|
|
69
|
+
@header = decoder.decode_header()
|
|
70
|
+
@message_id = decoder.decode_message_id(command_length())
|
|
71
|
+
@source_addr_ton = decoder.decode_source_addr_ton(command_length())
|
|
72
|
+
@source_addr_npi = decoder.decode_source_addr_npi(command_length())
|
|
73
|
+
@source_addr = decoder.decode_source_addr21(command_length())
|
|
74
|
+
@schedule_delivery_time = decoder.decode_schedule_delivery_time(command_length())
|
|
75
|
+
@validity_period = decoder.decode_validity_period(command_length())
|
|
76
|
+
@registered_delivery = decoder.decode_registered_delivery(command_length())
|
|
77
|
+
@sm_default_msg_id = decoder.decode_sm_default_msg_id(command_length())
|
|
78
|
+
@sm_length = decoder.decode_sm_length(command_length())
|
|
79
|
+
@short_message = decoder.decode_short_message(@sm_length, command_length())
|
|
80
|
+
|
|
81
|
+
# Decode optional fields
|
|
82
|
+
while decoder.has_tlvs()
|
|
83
|
+
case decoder.get_tlv_code()
|
|
84
|
+
when OptTags::TAG_MESSAGE_PAYLOAD
|
|
85
|
+
@message_payload, @message_payload_len =
|
|
86
|
+
decoder.decode_message_payload(command_length())
|
|
87
|
+
else
|
|
88
|
+
# Report about error
|
|
89
|
+
raise Errors::UNKNOWN_TAG_MSG + decoder.get_tlv_error()
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Interface to validate SMPP packet
|
|
95
|
+
def validate_packet(validator)
|
|
96
|
+
# Validate header and mandatory fields
|
|
97
|
+
validator.validate_header(@header)
|
|
98
|
+
validator.validate_message_id(@message_id)
|
|
99
|
+
validator.validate_source_addr_ton(@source_addr_ton)
|
|
100
|
+
validator.validate_source_addr_npi(@source_addr_npi)
|
|
101
|
+
validator.validate_source_addr21(@source_addr)
|
|
102
|
+
validator.validate_schedule_delivery_time(@schedule_delivery_time)
|
|
103
|
+
validator.validate_validity_period(@validity_period)
|
|
104
|
+
validator.validate_registered_delivery(@registered_delivery)
|
|
105
|
+
validator.validate_sm_default_msg_id(@sm_default_msg_id)
|
|
106
|
+
validator.validate_sm_length(@sm_length)
|
|
107
|
+
validator.validate_short_message(@short_message)
|
|
108
|
+
|
|
109
|
+
# Validate optional fields
|
|
110
|
+
validator.validate_message_payload(@message_payload,
|
|
111
|
+
@message_payload_len) if !@message_payload.nil?
|
|
112
|
+
|
|
113
|
+
# Validate complex rules
|
|
114
|
+
validator.validate_short_message_payload(@short_message,
|
|
115
|
+
@message_payload) if !@message_payload.nil?
|
|
116
|
+
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Interface to output SMPP packet
|
|
120
|
+
def output_packet(outputter)
|
|
121
|
+
# Output header and mandatory fields
|
|
122
|
+
outputter.output_header(@header)
|
|
123
|
+
outputter.output_message_id(@message_id)
|
|
124
|
+
outputter.output_source_addr_ton(@source_addr_ton)
|
|
125
|
+
outputter.output_source_addr_npi(@source_addr_npi)
|
|
126
|
+
outputter.output_source_addr21(@source_addr)
|
|
127
|
+
outputter.output_schedule_delivery_time(@schedule_delivery_time)
|
|
128
|
+
outputter.output_validity_period(@validity_period)
|
|
129
|
+
outputter.output_registered_delivery(@registered_delivery)
|
|
130
|
+
outputter.output_sm_default_msg_id(@sm_default_msg_id)
|
|
131
|
+
outputter.output_sm_length(@sm_length)
|
|
132
|
+
outputter.output_short_message(@short_message)
|
|
133
|
+
|
|
134
|
+
# Output optional fields
|
|
135
|
+
outputter.output_message_payload(@message_payload,
|
|
136
|
+
@message_payload_len) if !@message_payload.nil?
|
|
137
|
+
end
|
|
138
|
+
public
|
|
139
|
+
def short_message=(short_message)
|
|
140
|
+
@short_message = short_message
|
|
141
|
+
@short_message_len = short_message.size()
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def message_payload=(message_payload)
|
|
145
|
+
@message_payload = message_payload
|
|
146
|
+
@message_payload_len = message_payload.size()
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
public
|
|
151
|
+
# Mandatory fields
|
|
152
|
+
attr_accessor :message_id
|
|
153
|
+
attr_accessor :source_addr_ton
|
|
154
|
+
attr_accessor :source_addr_npi
|
|
155
|
+
attr_accessor :source_addr
|
|
156
|
+
attr_accessor :schedule_delivery_time
|
|
157
|
+
attr_accessor :validity_period
|
|
158
|
+
attr_accessor :registered_delivery
|
|
159
|
+
attr_accessor :sm_default_msg_id
|
|
160
|
+
attr_accessor :sm_length
|
|
161
|
+
attr_reader :short_message
|
|
162
|
+
|
|
163
|
+
# Optional fields
|
|
164
|
+
attr_reader :message_payload
|
|
165
|
+
|
|
166
|
+
# Optional fields length
|
|
167
|
+
attr_accessor :message_payload_len
|
|
168
|
+
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
module Majoron
|
|
20
|
+
module AntHill
|
|
21
|
+
module SMPP
|
|
22
|
+
class SMPPReplaceSMResp < SMPPResp
|
|
23
|
+
# Constructor.
|
|
24
|
+
def initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil)
|
|
25
|
+
super(CommandId::CM_REPLACE_SM_RESP, command_status, sequence_number)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Interface to encode SMPP packet
|
|
29
|
+
def encode_packet(encoder)
|
|
30
|
+
# Encode header and mandatory fields
|
|
31
|
+
encoder.encode_header(@header)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Interface to decode SMPP packet
|
|
35
|
+
def decode_packet(decoder)
|
|
36
|
+
# Decode header and mandatory fields
|
|
37
|
+
@header = decoder.decode_header()
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Interface to validate SMPP packet
|
|
41
|
+
def validate_packet(validator)
|
|
42
|
+
# Validate header and mandatory fields
|
|
43
|
+
validator.validate_header(@header)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Interface to output SMPP packet
|
|
47
|
+
def output_packet(outputter)
|
|
48
|
+
# Output header and mandatory fields
|
|
49
|
+
outputter.output_header(@header)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
public
|
|
53
|
+
# Mandatory fields
|
|
54
|
+
|
|
55
|
+
# Optional fields
|
|
56
|
+
|
|
57
|
+
# Optional fields length
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
module Majoron
|
|
20
|
+
module AntHill
|
|
21
|
+
module SMPP
|
|
22
|
+
# The base class for all SMPP responses.
|
|
23
|
+
class SMPPResp < SMPPPDU
|
|
24
|
+
|
|
25
|
+
# Constructor
|
|
26
|
+
def initialize(command_id, command_status, sequence_number)
|
|
27
|
+
super(command_id, command_status, sequence_number)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Init object based on packets, for example init SMPPDataSMResp
|
|
31
|
+
# packet based on SMPPDataSM packet
|
|
32
|
+
def init (package, command_status = ErrorCode::ESME_ROK)
|
|
33
|
+
@header.sequence_number = package.seqeunce_number
|
|
34
|
+
@header.command_status = command_status
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2007 Majoron.com (developers@majoron.com)
|
|
3
|
+
# Original sources are available at www.majoron.com
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
module Majoron
|
|
20
|
+
|
|
21
|
+
module AntHill
|
|
22
|
+
module SMPP
|
|
23
|
+
class SMPPSubmitMulti < SMPPPDU
|
|
24
|
+
def initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil)
|
|
25
|
+
super(CommandId::CM_SUBMIT_MULTI, command_status, sequence_number)
|
|
26
|
+
|
|
27
|
+
# Mandatory fields
|
|
28
|
+
@service_type = 0
|
|
29
|
+
@source_addr_ton = TON::UNKNOWN
|
|
30
|
+
@source_addr_npi = NPI::UNKNOWN
|
|
31
|
+
@source_addr = ""
|
|
32
|
+
@number_of_dest = 0
|
|
33
|
+
@dest_addresses = []
|
|
34
|
+
@esm_class = 0
|
|
35
|
+
@protocol_id = 0
|
|
36
|
+
@priority_flag = 0
|
|
37
|
+
@schedule_delivery_time = ""
|
|
38
|
+
@validity_period = ""
|
|
39
|
+
@registered_delivery = 0
|
|
40
|
+
@replace_if_present_flag = 0
|
|
41
|
+
@data_coding = 0
|
|
42
|
+
@sm_default_msg_id = 0
|
|
43
|
+
@sm_length = 0
|
|
44
|
+
@short_message = ""
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# Optional fields
|
|
48
|
+
@user_message_reference = nil
|
|
49
|
+
@source_port = nil
|
|
50
|
+
@source_addr_subunit = nil
|
|
51
|
+
@destination_port = nil
|
|
52
|
+
@dest_addr_subunit = nil
|
|
53
|
+
@sar_msg_ref_num = nil
|
|
54
|
+
@sar_total_segments = nil
|
|
55
|
+
@sar_segment_seqnum = nil
|
|
56
|
+
@payload_type = nil
|
|
57
|
+
@message_payload = nil
|
|
58
|
+
@privacy_indicator = nil
|
|
59
|
+
@callback_num = nil
|
|
60
|
+
@callback_num_pres_ind = nil
|
|
61
|
+
@callback_num_atag = nil
|
|
62
|
+
@source_subaddress = nil
|
|
63
|
+
@dest_subaddress = nil
|
|
64
|
+
@display_time = nil
|
|
65
|
+
@sms_signal = nil
|
|
66
|
+
@ms_validity = nil
|
|
67
|
+
@ms_msg_wait_facilities = nil
|
|
68
|
+
@alert_on_msg_delivery = nil
|
|
69
|
+
@language_indicator = nil
|
|
70
|
+
|
|
71
|
+
# Optional fields length
|
|
72
|
+
@user_message_reference_len = SMPPTLVLen::WORD_LEN
|
|
73
|
+
@source_port_len = SMPPTLVLen::WORD_LEN
|
|
74
|
+
@source_addr_subunit_len = SMPPTLVLen::BYTE_LEN
|
|
75
|
+
@destination_port_len = SMPPTLVLen::WORD_LEN
|
|
76
|
+
@dest_addr_subunit_len = SMPPTLVLen::BYTE_LEN
|
|
77
|
+
@sar_msg_ref_num_len = SMPPTLVLen::WORD_LEN
|
|
78
|
+
@sar_total_segments_len = SMPPTLVLen::BYTE_LEN
|
|
79
|
+
@sar_segment_seqnum_len = SMPPTLVLen::BYTE_LEN
|
|
80
|
+
@payload_type_len = SMPPTLVLen::BYTE_LEN
|
|
81
|
+
@message_payload_len = SMPPTLVLen::ZERO_LEN
|
|
82
|
+
@privacy_indicator_len = SMPPTLVLen::BYTE_LEN
|
|
83
|
+
@callback_num_len = SMPPTLVLen::ZERO_LEN
|
|
84
|
+
@callback_num_pres_ind_len = SMPPTLVLen::BYTE_LEN
|
|
85
|
+
@callback_num_atag_len = SMPPTLVLen::ZERO_LEN
|
|
86
|
+
@source_subaddress_len = SMPPTLVLen::ZERO_LEN
|
|
87
|
+
@dest_subaddress_len = SMPPTLVLen::ZERO_LEN
|
|
88
|
+
@display_time_len = SMPPTLVLen::BYTE_LEN
|
|
89
|
+
@sms_signal_len = SMPPTLVLen::WORD_LEN
|
|
90
|
+
@ms_validity_len = SMPPTLVLen::BYTE_LEN
|
|
91
|
+
@ms_msg_wait_facilities_len = SMPPTLVLen::BYTE_LEN
|
|
92
|
+
@alert_on_msg_delivery_len = SMPPTLVLen::BYTE_LEN
|
|
93
|
+
@language_indicator_len = SMPPTLVLen::BYTE_LEN
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Interface to encode SMPP packet
|
|
97
|
+
def encode_packet(encoder)
|
|
98
|
+
# Encode header and mandatory fields
|
|
99
|
+
encoder.encode_header(@header)
|
|
100
|
+
encoder.encode_service_type(@service_type)
|
|
101
|
+
encoder.encode_source_addr_ton(@source_addr_ton)
|
|
102
|
+
encoder.encode_source_addr_npi(@source_addr_npi)
|
|
103
|
+
encoder.encode_source_addr21(@source_addr)
|
|
104
|
+
encoder.encode_number_of_dest(@number_of_dest)
|
|
105
|
+
encoder.encode_dest_addresses(@dest_addresses)
|
|
106
|
+
encoder.encode_esm_class(@esm_class)
|
|
107
|
+
encoder.encode_protocol_id(@protocol_id)
|
|
108
|
+
encoder.encode_priority_flag(@priority_flag)
|
|
109
|
+
encoder.encode_schedule_delivery_time(@schedule_delivery_time)
|
|
110
|
+
encoder.encode_validity_period(@validity_period)
|
|
111
|
+
encoder.encode_registered_delivery(@registered_delivery)
|
|
112
|
+
encoder.encode_replace_if_present_flag(@replace_if_present_flag)
|
|
113
|
+
encoder.encode_data_coding(@data_coding)
|
|
114
|
+
encoder.encode_sm_default_msg_id(@sm_default_msg_id)
|
|
115
|
+
encoder.encode_sm_length(@sm_length)
|
|
116
|
+
encoder.encode_short_message(@short_message)
|
|
117
|
+
|
|
118
|
+
# Encode optional fields
|
|
119
|
+
encoder.encode_user_message_reference(@user_message_reference,
|
|
120
|
+
@user_message_reference_len) if !@user_message_reference.nil?
|
|
121
|
+
encoder.encode_source_port(@source_port,
|
|
122
|
+
@source_port_len) if !@source_port.nil?
|
|
123
|
+
encoder.encode_source_addr_subunit(@source_addr_subunit,
|
|
124
|
+
@source_addr_subunit_len) if !@source_addr_subunit.nil?
|
|
125
|
+
encoder.encode_destination_port(@destination_port,
|
|
126
|
+
@destination_port_len) if !@destination_port.nil?
|
|
127
|
+
encoder.encode_dest_addr_subunit(@dest_addr_subunit,
|
|
128
|
+
@dest_addr_subunit_len) if !@dest_addr_subunit.nil?
|
|
129
|
+
encoder.encode_sar_msg_ref_num(@sar_msg_ref_num,
|
|
130
|
+
@sar_msg_ref_num_len) if !@sar_msg_ref_num.nil?
|
|
131
|
+
encoder.encode_sar_total_segments(@sar_total_segments,
|
|
132
|
+
@sar_total_segments_len) if !@sar_total_segments.nil?
|
|
133
|
+
encoder.encode_sar_segment_seqnum(@sar_segment_seqnum,
|
|
134
|
+
@sar_segment_seqnum_len) if !@sar_segment_seqnum.nil?
|
|
135
|
+
encoder.encode_payload_type(@payload_type,
|
|
136
|
+
@payload_type_len) if !@payload_type.nil?
|
|
137
|
+
encoder.encode_message_payload(@message_payload,
|
|
138
|
+
@message_payload_len) if !@message_payload.nil?
|
|
139
|
+
encoder.encode_privacy_indicator(@privacy_indicator,
|
|
140
|
+
@privacy_indicator_len) if !@privacy_indicator.nil?
|
|
141
|
+
encoder.encode_callback_num(@callback_num,
|
|
142
|
+
@callback_num_len) if !@callback_num.nil?
|
|
143
|
+
encoder.encode_callback_num_pres_ind(@callback_num_pres_ind,
|
|
144
|
+
@callback_num_pres_ind_len) if !@callback_num_pres_ind.nil?
|
|
145
|
+
encoder.encode_callback_num_atag(@callback_num_atag,
|
|
146
|
+
@callback_num_atag_len) if !@callback_num_atag.nil?
|
|
147
|
+
encoder.encode_source_subaddress(@source_subaddress,
|
|
148
|
+
@source_subaddress_len) if !@source_subaddress.nil?
|
|
149
|
+
encoder.encode_dest_subaddress(@dest_subaddress,
|
|
150
|
+
@dest_subaddress_len) if !@dest_subaddress.nil?
|
|
151
|
+
encoder.encode_display_time(@display_time,
|
|
152
|
+
@display_time_len) if !@display_time.nil?
|
|
153
|
+
encoder.encode_sms_signal(@sms_signal,
|
|
154
|
+
@sms_signal_len) if !@sms_signal.nil?
|
|
155
|
+
encoder.encode_ms_validity(@ms_validity,
|
|
156
|
+
@ms_validity_len) if !@ms_validity.nil?
|
|
157
|
+
encoder.encode_ms_msg_wait_facilities(@ms_msg_wait_facilities,
|
|
158
|
+
@ms_msg_wait_facilities_len) if !@ms_msg_wait_facilities.nil?
|
|
159
|
+
encoder.encode_alert_on_msg_delivery(@alert_on_msg_delivery,
|
|
160
|
+
@alert_on_msg_delivery_len) if !@alert_on_msg_delivery.nil?
|
|
161
|
+
encoder.encode_language_indicator(@language_indicator,
|
|
162
|
+
@language_indicator_len) if !@language_indicator.nil?
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Interface to decode SMPP packet
|
|
166
|
+
def decode_packet(decoder)
|
|
167
|
+
# Decode header and mandatory fields
|
|
168
|
+
@header = decoder.decode_header()
|
|
169
|
+
@service_type = decoder.decode_service_type(command_length())
|
|
170
|
+
@source_addr_ton = decoder.decode_source_addr_ton(command_length())
|
|
171
|
+
@source_addr_npi = decoder.decode_source_addr_npi(command_length())
|
|
172
|
+
@source_addr = decoder.decode_source_addr21(command_length())
|
|
173
|
+
@number_of_dest = decoder.decode_number_of_dest(command_length())
|
|
174
|
+
@dest_addresses = decoder.decode_dest_addresses(@number_of_dest, command_length())
|
|
175
|
+
@esm_class = decoder.decode_esm_class(command_length())
|
|
176
|
+
@protocol_id = decoder.decode_protocol_id(command_length())
|
|
177
|
+
@priority_flag = decoder.decode_priority_flag(command_length())
|
|
178
|
+
@schedule_delivery_time = decoder.decode_schedule_delivery_time(command_length())
|
|
179
|
+
@validity_period = decoder.decode_validity_period(command_length())
|
|
180
|
+
@registered_delivery = decoder.decode_registered_delivery(command_length())
|
|
181
|
+
@replace_if_present_flag = decoder.decode_replace_if_present_flag(command_length())
|
|
182
|
+
@data_coding = decoder.decode_data_coding(command_length())
|
|
183
|
+
@sm_default_msg_id = decoder.decode_sm_default_msg_id(command_length())
|
|
184
|
+
@sm_length = decoder.decode_sm_length(command_length())
|
|
185
|
+
@short_message = decoder.decode_short_message(@sm_length, command_length())
|
|
186
|
+
|
|
187
|
+
# Decode optional fields
|
|
188
|
+
while decoder.has_tlvs()
|
|
189
|
+
case decoder.get_tlv_code()
|
|
190
|
+
when OptTags::TAG_USER_MESSAGE_REFERENCE
|
|
191
|
+
@user_message_reference, @user_message_reference_len =
|
|
192
|
+
decoder.decode_user_message_reference(command_length())
|
|
193
|
+
when OptTags::TAG_SOURCE_PORT
|
|
194
|
+
@source_port, @source_port_len =
|
|
195
|
+
decoder.decode_source_port(command_length())
|
|
196
|
+
when OptTags::TAG_SOURCE_ADDR_SUBUNIT
|
|
197
|
+
@source_addr_subunit, @source_addr_subunit_len =
|
|
198
|
+
decoder.decode_source_addr_subunit(command_length())
|
|
199
|
+
when OptTags::TAG_DESTINATION_PORT
|
|
200
|
+
@destination_port, @destination_port_len =
|
|
201
|
+
decoder.decode_destination_port(command_length())
|
|
202
|
+
when OptTags::TAG_DEST_ADDR_SUBUNIT
|
|
203
|
+
@dest_addr_subunit, @dest_addr_subunit_len =
|
|
204
|
+
decoder.decode_dest_addr_subunit(command_length())
|
|
205
|
+
when OptTags::TAG_DEST_ADDR_SUBUNIT
|
|
206
|
+
@dest_addr_subunit, @dest_addr_subunit_len =
|
|
207
|
+
decoder.decode_dest_addr_subunit(command_length())
|
|
208
|
+
when OptTags::TAG_SAR_MSG_REF_NUM
|
|
209
|
+
@sar_msg_ref_num, @sar_msg_ref_num_len =
|
|
210
|
+
decoder.decode_sar_msg_ref_num(command_length())
|
|
211
|
+
when OptTags::TAG_SAR_TOTAL_SEGMENTS
|
|
212
|
+
@sar_total_segments, @sar_total_segments_len =
|
|
213
|
+
decoder.decode_sar_total_segments(command_length())
|
|
214
|
+
when OptTags::TAG_SAR_SEGMENT_SEQNUM
|
|
215
|
+
@sar_segment_seqnum, @sar_segment_seqnum_len =
|
|
216
|
+
decoder.decode_sar_segment_seqnum(command_length())
|
|
217
|
+
when OptTags::TAG_PAYLOAD_TYPE
|
|
218
|
+
@payload_type, @payload_type_len =
|
|
219
|
+
decoder.decode_payload_type(command_length())
|
|
220
|
+
when OptTags::TAG_MESSAGE_PAYLOAD
|
|
221
|
+
@message_payload, @message_payload_len =
|
|
222
|
+
decoder.decode_message_payload(command_length())
|
|
223
|
+
when OptTags::TAG_PRIVACY_INDICATOR
|
|
224
|
+
@privacy_indicator, @privacy_indicator_len =
|
|
225
|
+
decoder.decode_privacy_indicator(command_length())
|
|
226
|
+
when OptTags::TAG_CALLBACK_NUM
|
|
227
|
+
@callback_num, @callback_num_len =
|
|
228
|
+
decoder.decode_callback_num(command_length())
|
|
229
|
+
when OptTags::TAG_CALLBACK_NUM_PRES_IND
|
|
230
|
+
@callback_num_pres_ind, @callback_num_pres_ind_len =
|
|
231
|
+
decoder.decode_callback_num_pres_ind(command_length())
|
|
232
|
+
when OptTags::TAG_CALLBACK_NUM_ATAG
|
|
233
|
+
@callback_num_atag, @callback_num_atag_len =
|
|
234
|
+
decoder.decode_callback_num_atag(command_length())
|
|
235
|
+
when OptTags::TAG_SOURCE_SUBADDRESS
|
|
236
|
+
@source_subaddress, @source_subaddress_len =
|
|
237
|
+
decoder.decode_source_subaddress(command_length())
|
|
238
|
+
when OptTags::TAG_DEST_SUBADDRESS
|
|
239
|
+
@dest_subaddress, @dest_subaddress_len =
|
|
240
|
+
decoder.decode_dest_subaddress(command_length())
|
|
241
|
+
when OptTags::TAG_DISPLAY_TIME
|
|
242
|
+
@display_time, @display_time_len =
|
|
243
|
+
decoder.decode_display_time(command_length())
|
|
244
|
+
when OptTags::TAG_SMS_SIGNAL
|
|
245
|
+
@sms_signal, @sms_signal_len =
|
|
246
|
+
decoder.decode_sms_signal(command_length())
|
|
247
|
+
when OptTags::TAG_MS_VALIDITY
|
|
248
|
+
@ms_validity, @ms_validity_len =
|
|
249
|
+
decoder.decode_ms_validity(command_length())
|
|
250
|
+
when OptTags::TAG_MS_MSG_WAIT_FACILITIES
|
|
251
|
+
@ms_msg_wait_facilities, @ms_msg_wait_facilities_len =
|
|
252
|
+
decoder.decode_ms_msg_wait_facilities(command_length())
|
|
253
|
+
when OptTags::TAG_ALERT_ON_MESSAGE_DELIVERY
|
|
254
|
+
@alert_on_msg_delivery, @alert_on_msg_delivery_len =
|
|
255
|
+
decoder.decode_alert_on_msg_delivery(command_length())
|
|
256
|
+
when OptTags::TAG_LANGUAGE_INDICATOR
|
|
257
|
+
@language_indicator, @language_indicator_len =
|
|
258
|
+
decoder.decode_language_indicator(command_length())
|
|
259
|
+
else
|
|
260
|
+
# Report about error
|
|
261
|
+
raise Errors::UNKNOWN_TAG_MSG + decoder.get_tlv_error()
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Interface to validate SMPP packet
|
|
267
|
+
def validate_packet(validator)
|
|
268
|
+
# Validate header and mandatory fields
|
|
269
|
+
validator.validate_header(@header)
|
|
270
|
+
validator.validate_service_type(@service_type)
|
|
271
|
+
validator.validate_source_addr_ton(@source_addr_ton)
|
|
272
|
+
validator.validate_source_addr_npi(@source_addr_npi)
|
|
273
|
+
validator.validate_source_addr21(@source_addr)
|
|
274
|
+
validator.validate_number_of_dest(@number_of_dest)
|
|
275
|
+
validator.validate_dest_addresses(@dest_addresses, @number_of_dest)
|
|
276
|
+
validator.validate_esm_class(@esm_class)
|
|
277
|
+
validator.validate_protocol_id(@protocol_id)
|
|
278
|
+
validator.validate_priority_flag(@priority_flag)
|
|
279
|
+
validator.validate_schedule_delivery_time(@schedule_delivery_time)
|
|
280
|
+
validator.validate_validity_period(@validity_period)
|
|
281
|
+
validator.validate_registered_delivery(@registered_delivery)
|
|
282
|
+
validator.validate_replace_if_present_flag(@replace_if_present_flag)
|
|
283
|
+
validator.validate_data_coding(@data_coding)
|
|
284
|
+
validator.validate_sm_default_msg_id(@sm_default_msg_id)
|
|
285
|
+
validator.validate_sm_length(@sm_length)
|
|
286
|
+
validator.validate_short_message(@short_message)
|
|
287
|
+
|
|
288
|
+
# Validate optional fields
|
|
289
|
+
validator.validate_user_message_reference(@user_message_reference,
|
|
290
|
+
@user_message_reference_len) if !@user_message_reference.nil?
|
|
291
|
+
validator.validate_source_port(@source_port,
|
|
292
|
+
@source_port_len) if !@source_port.nil?
|
|
293
|
+
validator.validate_source_addr_subunit(@source_addr_subunit,
|
|
294
|
+
@source_addr_subunit_len) if !@source_addr_subunit.nil?
|
|
295
|
+
validator.validate_destination_port(@destination_port,
|
|
296
|
+
@destination_port_len) if !@destination_port.nil?
|
|
297
|
+
validator.validate_dest_addr_subunit(@dest_addr_subunit,
|
|
298
|
+
@dest_addr_subunit_len) if !@dest_addr_subunit.nil?
|
|
299
|
+
validator.validate_sar_msg_ref_num(@sar_msg_ref_num,
|
|
300
|
+
@sar_msg_ref_num_len) if !@sar_msg_ref_num.nil?
|
|
301
|
+
validator.validate_sar_total_segments(@sar_total_segments,
|
|
302
|
+
@sar_total_segments_len) if !@sar_total_segments.nil?
|
|
303
|
+
validator.validate_sar_segment_seqnum(@sar_segment_seqnum,
|
|
304
|
+
@sar_segment_seqnum_len) if !@sar_segment_seqnum.nil?
|
|
305
|
+
validator.validate_payload_type(@payload_type,
|
|
306
|
+
@payload_type_len) if !@payload_type.nil?
|
|
307
|
+
validator.validate_message_payload(@message_payload,
|
|
308
|
+
@message_payload_len) if !@message_payload.nil?
|
|
309
|
+
validator.validate_privacy_indicator(@privacy_indicator,
|
|
310
|
+
@privacy_indicator_len) if !@privacy_indicator.nil?
|
|
311
|
+
validator.validate_callback_num(@callback_num,
|
|
312
|
+
@callback_num_len) if !@callback_num.nil?
|
|
313
|
+
validator.validate_callback_num_pres_ind(@callback_num_pres_ind,
|
|
314
|
+
@callback_num_pres_ind_len) if !@callback_num_pres_ind.nil?
|
|
315
|
+
validator.validate_callback_num_atag(@callback_num_atag,
|
|
316
|
+
@callback_num_atag_len) if !@callback_num_atag.nil?
|
|
317
|
+
validator.validate_source_subaddress(@source_subaddress,
|
|
318
|
+
@source_subaddress_len) if !@source_subaddress.nil?
|
|
319
|
+
validator.validate_dest_subaddress(@dest_subaddress,
|
|
320
|
+
@dest_subaddress_len) if !@dest_subaddress.nil?
|
|
321
|
+
validator.validate_display_time(@display_time,
|
|
322
|
+
@display_time_len) if !@display_time.nil?
|
|
323
|
+
validator.validate_sms_signal(@sms_signal,
|
|
324
|
+
@sms_signal_len) if !@sms_signal.nil?
|
|
325
|
+
validator.validate_ms_validity(@ms_validity,
|
|
326
|
+
@ms_validity_len) if !@ms_validity.nil?
|
|
327
|
+
validator.validate_ms_msg_wait_facilities(@ms_msg_wait_facilities,
|
|
328
|
+
@ms_msg_wait_facilities_len) if !@ms_msg_wait_facilities.nil?
|
|
329
|
+
validator.validate_alert_on_msg_delivery(@alert_on_msg_delivery,
|
|
330
|
+
@alert_on_msg_delivery_len) if !@alert_on_msg_delivery.nil?
|
|
331
|
+
validator.validate_language_indicator(@language_indicator,
|
|
332
|
+
@language_indicator_len) if !@language_indicator.nil?
|
|
333
|
+
|
|
334
|
+
# Validate complex rules
|
|
335
|
+
validator.validate_short_message_payload(@short_message,
|
|
336
|
+
@message_payload) if !@message_payload.nil?
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
# Interface to output SMPP packet
|
|
340
|
+
def output_packet(outputter)
|
|
341
|
+
# Output header and mandatory fields
|
|
342
|
+
outputter.output_header(@header)
|
|
343
|
+
outputter.output_service_type(@service_type)
|
|
344
|
+
outputter.output_source_addr_ton(@source_addr_ton)
|
|
345
|
+
outputter.output_source_addr_npi(@source_addr_npi)
|
|
346
|
+
outputter.output_source_addr21(@source_addr)
|
|
347
|
+
outputter.output_number_of_dest(@number_of_dest)
|
|
348
|
+
outputter.output_dest_addresses(@dest_addresses)
|
|
349
|
+
outputter.output_esm_class(@esm_class)
|
|
350
|
+
outputter.output_protocol_id(@protocol_id)
|
|
351
|
+
outputter.output_priority_flag(@priority_flag)
|
|
352
|
+
outputter.output_schedule_delivery_time(@schedule_delivery_time)
|
|
353
|
+
outputter.output_validity_period(@validity_period)
|
|
354
|
+
outputter.output_registered_delivery(@registered_delivery)
|
|
355
|
+
outputter.output_replace_if_present_flag(@replace_if_present_flag)
|
|
356
|
+
outputter.output_data_coding(@data_coding)
|
|
357
|
+
outputter.output_sm_default_msg_id(@sm_default_msg_id)
|
|
358
|
+
outputter.output_sm_length(@sm_length)
|
|
359
|
+
outputter.output_short_message(@short_message)
|
|
360
|
+
|
|
361
|
+
# Output optional fields
|
|
362
|
+
outputter.output_user_message_reference(@user_message_reference,
|
|
363
|
+
@user_message_reference_len) if !@user_message_reference.nil?
|
|
364
|
+
outputter.output_source_port(@source_port,
|
|
365
|
+
@source_port_len) if !@source_port.nil?
|
|
366
|
+
outputter.output_source_addr_subunit(@source_addr_subunit,
|
|
367
|
+
@source_addr_subunit_len) if !@source_addr_subunit.nil?
|
|
368
|
+
outputter.output_destination_port(@destination_port,
|
|
369
|
+
@destination_port_len) if !@destination_port.nil?
|
|
370
|
+
outputter.output_dest_addr_subunit(@dest_addr_subunit,
|
|
371
|
+
@dest_addr_subunit_len) if !@dest_addr_subunit.nil?
|
|
372
|
+
outputter.output_sar_msg_ref_num(@sar_msg_ref_num,
|
|
373
|
+
@sar_msg_ref_num_len) if !@sar_msg_ref_num.nil?
|
|
374
|
+
outputter.output_sar_total_segments(@sar_total_segments,
|
|
375
|
+
@sar_total_segments_len) if !@sar_total_segments.nil?
|
|
376
|
+
outputter.output_sar_segment_seqnum(@sar_segment_seqnum,
|
|
377
|
+
@sar_segment_seqnum_len) if !@sar_segment_seqnum.nil?
|
|
378
|
+
outputter.output_payload_type(@payload_type,
|
|
379
|
+
@payload_type_len) if !@payload_type.nil?
|
|
380
|
+
outputter.output_message_payload(@message_payload,
|
|
381
|
+
@message_payload_len) if !@message_payload.nil?
|
|
382
|
+
outputter.output_privacy_indicator(@privacy_indicator,
|
|
383
|
+
@privacy_indicator_len) if !@privacy_indicator.nil?
|
|
384
|
+
outputter.output_callback_num(@callback_num,
|
|
385
|
+
@callback_num_len) if !@callback_num.nil?
|
|
386
|
+
outputter.output_callback_num_pres_ind(@callback_num_pres_ind,
|
|
387
|
+
@callback_num_pres_ind_len) if !@callback_num_pres_ind.nil?
|
|
388
|
+
outputter.output_callback_num_atag(@callback_num_atag,
|
|
389
|
+
@callback_num_atag_len) if !@callback_num_atag.nil?
|
|
390
|
+
outputter.output_source_subaddress(@source_subaddress,
|
|
391
|
+
@source_subaddress_len) if !@source_subaddress.nil?
|
|
392
|
+
outputter.output_dest_subaddress(@dest_subaddress,
|
|
393
|
+
@dest_subaddress_len) if !@dest_subaddress.nil?
|
|
394
|
+
outputter.output_display_time(@display_time,
|
|
395
|
+
@display_time_len) if !@display_time.nil?
|
|
396
|
+
outputter.output_sms_signal(@sms_signal,
|
|
397
|
+
@sms_signal_len) if !@sms_signal.nil?
|
|
398
|
+
outputter.output_ms_validity(@ms_validity,
|
|
399
|
+
@ms_validity_len) if !@ms_validity.nil?
|
|
400
|
+
outputter.output_ms_msg_wait_facilities(@ms_msg_wait_facilities,
|
|
401
|
+
@ms_msg_wait_facilities_len) if !@ms_msg_wait_facilities.nil?
|
|
402
|
+
outputter.output_alert_on_msg_delivery(@alert_on_msg_delivery,
|
|
403
|
+
@alert_on_msg_delivery_len) if !@alert_on_msg_delivery.nil?
|
|
404
|
+
outputter.output_language_indicator(@language_indicator,
|
|
405
|
+
@language_indicator_len) if !@language_indicator.nil?
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
public
|
|
409
|
+
|
|
410
|
+
def dest_addresses=(dest_addresses)
|
|
411
|
+
@dest_addresses = dest_addresses
|
|
412
|
+
@number_of_dest = dest_addresses.size()
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
def short_message=(short_message)
|
|
416
|
+
@short_message = short_message
|
|
417
|
+
@short_message_len = short_message.size()
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
def message_payload=(message_payload)
|
|
421
|
+
@message_payload = message_payload
|
|
422
|
+
@message_payload_len = message_payload.size()
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
def callback_num=(callback_num)
|
|
426
|
+
@callback_num = callback_num
|
|
427
|
+
@callback_num_len = callback_num.size()
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
def callback_num_atag=(callback_num_atag)
|
|
431
|
+
@callback_num_atag = callback_num_atag
|
|
432
|
+
@callback_num_atag_len = callback_num_atag.size()
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
def source_subaddress=(source_subaddress)
|
|
436
|
+
@source_subaddress = source_subaddress
|
|
437
|
+
@source_subaddress_len = source_subaddress.size()
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
def dest_subaddress=(dest_subaddress)
|
|
441
|
+
@dest_subaddress = dest_subaddress
|
|
442
|
+
@dest_subaddress_len = dest_subaddress.size()
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
public
|
|
447
|
+
# Mandatory fields
|
|
448
|
+
attr_accessor :service_type
|
|
449
|
+
attr_accessor :source_addr_ton
|
|
450
|
+
attr_accessor :source_addr_npi
|
|
451
|
+
attr_accessor :source_addr
|
|
452
|
+
attr_accessor :number_of_dest
|
|
453
|
+
attr_reader :dest_addresses
|
|
454
|
+
attr_accessor :esm_class
|
|
455
|
+
attr_accessor :protocol_id
|
|
456
|
+
attr_accessor :priority_flag
|
|
457
|
+
attr_accessor :schedule_delivery_time
|
|
458
|
+
attr_accessor :validity_period
|
|
459
|
+
attr_accessor :registered_delivery
|
|
460
|
+
attr_accessor :replace_if_present_flag
|
|
461
|
+
attr_accessor :data_coding
|
|
462
|
+
attr_accessor :sm_default_msg_id
|
|
463
|
+
attr_accessor :sm_length
|
|
464
|
+
attr_reader :short_message
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
# Optional fields
|
|
468
|
+
attr_accessor :user_message_reference
|
|
469
|
+
attr_accessor :source_port
|
|
470
|
+
attr_accessor :source_addr_subunit
|
|
471
|
+
attr_accessor :destination_port
|
|
472
|
+
attr_accessor :dest_addr_subunit
|
|
473
|
+
attr_accessor :sar_msg_ref_num
|
|
474
|
+
attr_accessor :sar_total_segments
|
|
475
|
+
attr_accessor :sar_segment_seqnum
|
|
476
|
+
attr_accessor :payload_type
|
|
477
|
+
attr_reader :message_payload
|
|
478
|
+
attr_accessor :privacy_indicator
|
|
479
|
+
attr_reader :callback_num
|
|
480
|
+
attr_accessor :callback_num_pres_ind
|
|
481
|
+
attr_reader :callback_num_atag
|
|
482
|
+
attr_reader :source_subaddress
|
|
483
|
+
attr_reader :dest_subaddress
|
|
484
|
+
attr_accessor :display_time
|
|
485
|
+
attr_accessor :sms_signal
|
|
486
|
+
attr_accessor :ms_validity
|
|
487
|
+
attr_accessor :ms_msg_wait_facilities
|
|
488
|
+
attr_accessor :alert_on_msg_delivery
|
|
489
|
+
attr_accessor :language_indicator
|
|
490
|
+
|
|
491
|
+
# Optional fields length
|
|
492
|
+
attr_accessor :user_message_reference_len
|
|
493
|
+
attr_accessor :source_port_len
|
|
494
|
+
attr_accessor :source_addr_subunit_len
|
|
495
|
+
attr_accessor :destination_port_len
|
|
496
|
+
attr_accessor :dest_addr_subunit_len
|
|
497
|
+
attr_accessor :sar_msg_ref_num_len
|
|
498
|
+
attr_accessor :sar_total_segments_len
|
|
499
|
+
attr_accessor :sar_segment_seqnum_len
|
|
500
|
+
attr_accessor :payload_type_len
|
|
501
|
+
attr_accessor :message_payload_len
|
|
502
|
+
attr_accessor :privacy_indicator_len
|
|
503
|
+
attr_accessor :callback_num_len
|
|
504
|
+
attr_accessor :callback_num_pres_ind_len
|
|
505
|
+
attr_accessor :callback_num_atag_len
|
|
506
|
+
attr_accessor :source_subaddress_len
|
|
507
|
+
attr_accessor :dest_subaddress_len
|
|
508
|
+
attr_accessor :display_time_len
|
|
509
|
+
attr_accessor :sms_signal_len
|
|
510
|
+
attr_accessor :ms_validity_len
|
|
511
|
+
attr_accessor :ms_msg_wait_facilities_len
|
|
512
|
+
attr_accessor :alert_on_msg_delivery_len
|
|
513
|
+
attr_accessor :language_indicator_len
|
|
514
|
+
end
|
|
515
|
+
end
|
|
516
|
+
end
|
|
517
|
+
end
|