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.
Files changed (154) hide show
  1. data/MIT-LICENSE +21 -0
  2. data/README +30 -0
  3. data/anthill_smpp_ruby.gemspec +18 -0
  4. data/changelog +43 -0
  5. data/data/dumps/random_command.dump +1 -0
  6. data/data/dumps/smpp_alert_notification.dump +1 -0
  7. data/data/dumps/smpp_bind_receiver.dump +1 -0
  8. data/data/dumps/smpp_bind_receiver_resp.dump +1 -0
  9. data/data/dumps/smpp_bind_transceiver.dump +1 -0
  10. data/data/dumps/smpp_bind_transceiver_1.dump +2 -0
  11. data/data/dumps/smpp_bind_transceiver_resp.dump +1 -0
  12. data/data/dumps/smpp_bind_transmitter.dump +1 -0
  13. data/data/dumps/smpp_bind_transmitter_resp.dump +1 -0
  14. data/data/dumps/smpp_broadcast_sm.dump +1 -0
  15. data/data/dumps/smpp_broadcast_sm_resp.dump +1 -0
  16. data/data/dumps/smpp_cancel_broadcast_sm.dump +1 -0
  17. data/data/dumps/smpp_cancel_broadcast_sm_resp.dump +1 -0
  18. data/data/dumps/smpp_cancel_sm.dump +1 -0
  19. data/data/dumps/smpp_cancel_sm_resp.dump +1 -0
  20. data/data/dumps/smpp_data_sm.dump +1 -0
  21. data/data/dumps/smpp_data_sm_resp.dump +1 -0
  22. data/data/dumps/smpp_deliver_sm.dump +1 -0
  23. data/data/dumps/smpp_deliver_sm_resp.dump +1 -0
  24. data/data/dumps/smpp_enquire_link.dump +1 -0
  25. data/data/dumps/smpp_enquire_link_resp.dump +1 -0
  26. data/data/dumps/smpp_generic_nack.dump +1 -0
  27. data/data/dumps/smpp_outbind.dump +1 -0
  28. data/data/dumps/smpp_query_broadcast_sm.dump +1 -0
  29. data/data/dumps/smpp_query_broadcast_sm_resp.dump +1 -0
  30. data/data/dumps/smpp_query_broadcast_sm_resp_1.dump +1 -0
  31. data/data/dumps/smpp_query_sm.dump +1 -0
  32. data/data/dumps/smpp_query_sm_resp.dump +1 -0
  33. data/data/dumps/smpp_replace_sm.dump +1 -0
  34. data/data/dumps/smpp_replace_sm_resp.dump +1 -0
  35. data/data/dumps/smpp_submit_multi.dump +1 -0
  36. data/data/dumps/smpp_submit_multi_resp.dump +1 -0
  37. data/data/dumps/smpp_submit_sm.dump +1 -0
  38. data/data/dumps/smpp_submit_sm_resp.dump +1 -0
  39. data/data/dumps/smpp_unbind.dump +1 -0
  40. data/data/dumps/smpp_unbind_resp.dump +1 -0
  41. data/data/pdus/random_command.xml +35 -0
  42. data/data/pdus/smpp_alert_notification.xml +14 -0
  43. data/data/pdus/smpp_alert_notification_no_optional.xml +13 -0
  44. data/data/pdus/smpp_bind_receiver.xml +17 -0
  45. data/data/pdus/smpp_bind_receiver_resp.xml +12 -0
  46. data/data/pdus/smpp_bind_receiver_resp_no_optional.xml +11 -0
  47. data/data/pdus/smpp_bind_transceiver.xml +17 -0
  48. data/data/pdus/smpp_bind_transceiver_resp.xml +12 -0
  49. data/data/pdus/smpp_bind_transceiver_resp_no_optional.xml +11 -0
  50. data/data/pdus/smpp_bind_transmitter.xml +17 -0
  51. data/data/pdus/smpp_bind_transmitter_resp.xml +12 -0
  52. data/data/pdus/smpp_bind_transmitter_resp_no_optional.xml +11 -0
  53. data/data/pdus/smpp_broadcast_sm.xml +47 -0
  54. data/data/pdus/smpp_broadcast_sm_no_optional.xml +26 -0
  55. data/data/pdus/smpp_broadcast_sm_resp.xml +14 -0
  56. data/data/pdus/smpp_broadcast_sm_resp_no_optional.xml +8 -0
  57. data/data/pdus/smpp_cancel_broadcast_sm.xml +17 -0
  58. data/data/pdus/smpp_cancel_broadcast_sm_no_optional.xml +15 -0
  59. data/data/pdus/smpp_cancel_broadcast_sm_resp.xml +7 -0
  60. data/data/pdus/smpp_cancel_sm.xml +18 -0
  61. data/data/pdus/smpp_cancel_sm_resp.xml +10 -0
  62. data/data/pdus/smpp_commands.xsd +914 -0
  63. data/data/pdus/smpp_data_sm.xml +58 -0
  64. data/data/pdus/smpp_data_sm_no_optional.xml +17 -0
  65. data/data/pdus/smpp_data_sm_resp.xml +15 -0
  66. data/data/pdus/smpp_data_sm_resp_no_optional.xml +8 -0
  67. data/data/pdus/smpp_deliver_sm.xml +46 -0
  68. data/data/pdus/smpp_deliver_sm_no_optional.xml +25 -0
  69. data/data/pdus/smpp_deliver_sm_resp.xml +14 -0
  70. data/data/pdus/smpp_deliver_sm_resp_no_optional.xml +8 -0
  71. data/data/pdus/smpp_enquire_link.xml +10 -0
  72. data/data/pdus/smpp_enquire_link_resp.xml +10 -0
  73. data/data/pdus/smpp_generic_nack.xml +10 -0
  74. data/data/pdus/smpp_outbind.xml +12 -0
  75. data/data/pdus/smpp_query_broadcast_sm.xml +12 -0
  76. data/data/pdus/smpp_query_broadcast_sm_no_optional.xml +11 -0
  77. data/data/pdus/smpp_query_broadcast_sm_resp.xml +17 -0
  78. data/data/pdus/smpp_query_broadcast_sm_resp_no_optional.xml +15 -0
  79. data/data/pdus/smpp_query_sm.xml +11 -0
  80. data/data/pdus/smpp_query_sm_resp.xml +11 -0
  81. data/data/pdus/smpp_replace_sm.xml +18 -0
  82. data/data/pdus/smpp_replace_sm_no_optional.xml +17 -0
  83. data/data/pdus/smpp_replace_sm_resp.xml +7 -0
  84. data/data/pdus/smpp_submit_multi.xml +73 -0
  85. data/data/pdus/smpp_submit_multi_no_optional.xml +51 -0
  86. data/data/pdus/smpp_submit_multi_resp.xml +35 -0
  87. data/data/pdus/smpp_submit_sm.xml +57 -0
  88. data/data/pdus/smpp_submit_sm_no_optional.xml +28 -0
  89. data/data/pdus/smpp_submit_sm_resp.xml +8 -0
  90. data/data/pdus/smpp_unbind.xml +10 -0
  91. data/data/pdus/smpp_unbind_resp.xml +10 -0
  92. data/examples/dump_viewer.rb +298 -0
  93. data/examples/pdu_composer.rb +1331 -0
  94. data/knownbugs +24 -0
  95. data/lib/anthill_smpp_ruby.rb +83 -0
  96. data/lib/i_smpp_outputter.rb +425 -0
  97. data/lib/pdu/smpp_alert_notification.rb +132 -0
  98. data/lib/pdu/smpp_bind.rb +102 -0
  99. data/lib/pdu/smpp_bind_receiver.rb +29 -0
  100. data/lib/pdu/smpp_bind_receiver_resp.rb +30 -0
  101. data/lib/pdu/smpp_bind_resp.rb +100 -0
  102. data/lib/pdu/smpp_bind_transceiver.rb +29 -0
  103. data/lib/pdu/smpp_bind_transceiver_resp.rb +31 -0
  104. data/lib/pdu/smpp_bind_transmitter.rb +29 -0
  105. data/lib/pdu/smpp_bind_transmitter_resp.rb +30 -0
  106. data/lib/pdu/smpp_broadcast_sm.rb +566 -0
  107. data/lib/pdu/smpp_broadcast_sm_resp.rb +130 -0
  108. data/lib/pdu/smpp_cancel_broadcast_sm.rb +143 -0
  109. data/lib/pdu/smpp_cancel_broadcast_sm_resp.rb +60 -0
  110. data/lib/pdu/smpp_cancel_sm.rb +110 -0
  111. data/lib/pdu/smpp_cancel_sm_resp.rb +60 -0
  112. data/lib/pdu/smpp_data_sm.rb +679 -0
  113. data/lib/pdu/smpp_data_sm_resp.rb +148 -0
  114. data/lib/pdu/smpp_deliver_sm.rb +458 -0
  115. data/lib/pdu/smpp_deliver_sm_resp.rb +137 -0
  116. data/lib/pdu/smpp_enquire_link.rb +59 -0
  117. data/lib/pdu/smpp_enquire_link_resp.rb +61 -0
  118. data/lib/pdu/smpp_generic_nack.rb +61 -0
  119. data/lib/pdu/smpp_outbind.rb +71 -0
  120. data/lib/pdu/smpp_pdu.rb +90 -0
  121. data/lib/pdu/smpp_query_broadcast_sm.rb +120 -0
  122. data/lib/pdu/smpp_query_broadcast_sm_resp.rb +192 -0
  123. data/lib/pdu/smpp_query_sm.rb +92 -0
  124. data/lib/pdu/smpp_query_sm_resp.rb +92 -0
  125. data/lib/pdu/smpp_replace_sm.rb +172 -0
  126. data/lib/pdu/smpp_replace_sm_resp.rb +61 -0
  127. data/lib/pdu/smpp_resp.rb +40 -0
  128. data/lib/pdu/smpp_submit_multi.rb +517 -0
  129. data/lib/pdu/smpp_submit_multi_resp.rb +90 -0
  130. data/lib/pdu/smpp_submit_sm.rb +591 -0
  131. data/lib/pdu/smpp_submit_sm_resp.rb +72 -0
  132. data/lib/pdu/smpp_unbind.rb +60 -0
  133. data/lib/pdu/smpp_unbind_resp.rb +61 -0
  134. data/lib/smpp_constants.rb +917 -0
  135. data/lib/smpp_csv_outputter.rb +1601 -0
  136. data/lib/smpp_datatypes.rb +89 -0
  137. data/lib/smpp_decoder.rb +627 -0
  138. data/lib/smpp_encoder.rb +495 -0
  139. data/lib/smpp_hex_outputter.rb +36 -0
  140. data/lib/smpp_outputter_base.rb +315 -0
  141. data/lib/smpp_structures.rb +98 -0
  142. data/lib/smpp_txt_outputter.rb +1895 -0
  143. data/lib/smpp_validator.rb +373 -0
  144. data/lib/smpp_xml_outputter.rb +34 -0
  145. data/roadmap +18 -0
  146. data/setup.rb +1585 -0
  147. data/test/anthill_smpp_test.rb +29 -0
  148. data/test/smpp_codec_test.rb +30 -0
  149. data/test/smpp_datatypes_test.rb +69 -0
  150. data/test/smpp_outputter_test.rb +1261 -0
  151. data/test/smpp_parsing_test.rb +1758 -0
  152. data/test/smpp_rawdump_test.rb +2095 -0
  153. data/test/smpp_validator_test.rb +441 -0
  154. metadata +206 -0
@@ -0,0 +1,132 @@
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 SMPPAlertNotification < SMPPPDU
23
+ def initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil)
24
+ super(CommandId::CM_ALERT_NOTIFICATION, command_status, sequence_number)
25
+
26
+ # Mandatory fields
27
+ @source_addr_ton = TON::UNKNOWN
28
+ @source_addr_npi = TON::UNKNOWN
29
+ @source_addr = ""
30
+ @esme_addr_ton = TON::UNKNOWN
31
+ @esme_addr_npi = TON::UNKNOWN
32
+ @esme_addr = ""
33
+
34
+
35
+ # Optional fields
36
+ @ms_availability_status = nil
37
+
38
+ # Optional fields len
39
+ @ms_availability_status_len = SMPPTLVLen::BYTE_LEN
40
+
41
+ end
42
+
43
+ # Interface to encode SMPP packet
44
+ def encode_packet(encoder)
45
+ # Encode header and mandatory fields
46
+ encoder.encode_header(@header)
47
+ encoder.encode_source_addr_ton(@source_addr_ton)
48
+ encoder.encode_source_addr_npi(@source_addr_npi)
49
+ encoder.encode_source_addr65(@source_addr)
50
+ encoder.encode_esme_addr_ton(@esme_addr_ton)
51
+ encoder.encode_esme_addr_npi(@esme_addr_npi)
52
+ encoder.encode_esme_addr(@esme_addr)
53
+
54
+ # Encode optional fields
55
+ encoder.encode_ms_availability_status(@ms_availability_status,
56
+ @ms_availability_status_len) if !@ms_availability_status.nil?
57
+ end
58
+
59
+ # Interface to decode SMPP packet
60
+ def decode_packet(decoder)
61
+ # Decode header and mandatory fields
62
+ @header = decoder.decode_header()
63
+ @source_addr_ton = decoder.decode_source_addr_ton(command_length())
64
+ @source_addr_npi = decoder.decode_source_addr_npi(command_length())
65
+ @source_addr = decoder.decode_source_addr65(command_length())
66
+ @esme_addr_ton = decoder.decode_esme_addr_ton(command_length())
67
+ @esme_addr_npi = decoder.decode_esme_addr_npi(command_length())
68
+ @esme_addr = decoder.decode_esme_addr(command_length())
69
+
70
+ # Decode optional fields
71
+ while decoder.has_tlvs()
72
+ case decoder.get_tlv_code()
73
+ when OptTags::TAG_MS_AVAILABILITY_STATUS
74
+ @ms_availability_status, @ms_availability_status_len =
75
+ decoder.decode_ms_availability_status(command_length())
76
+ else
77
+ # Report about error
78
+ raise Errors::UNKNOWN_TAG_MSG + decode.get_tlv_error()
79
+ end
80
+ end
81
+ end
82
+
83
+ # Interface to validate SMPP packet
84
+ def validate_packet(validator)
85
+ # Decode header and mandatory fields
86
+ validator.validate_header(@header)
87
+ validator.validate_source_addr_ton(@source_addr_ton)
88
+ validator.validate_source_addr_npi(@source_addr_npi)
89
+ validator.validate_source_addr65(@source_addr)
90
+ validator.validate_esme_addr_ton(@esme_adddr_ton)
91
+ validator.validate_esme_addr_npi(@esme_addr_npi)
92
+ validator.validate_esme_addr(@esme_addr)
93
+
94
+ # Validate optional fields
95
+ validator.validate_ms_availability_status(@ms_availability_status,
96
+ @ms_availability_status_len) if !@ms_availability_status.nil?
97
+
98
+ end
99
+
100
+ # Interface to output SMPP packet
101
+ def output_packet(outputter)
102
+ # Output header and mandatory fields
103
+ outputter.output_header(@header)
104
+ outputter.output_source_addr_ton(@source_addr_ton)
105
+ outputter.output_source_addr_npi(@source_addr_npi)
106
+ outputter.output_source_addr65(@source_addr)
107
+ outputter.output_esme_addr_ton(@esme_addr_ton)
108
+ outputter.output_esme_addr_npi(@esme_addr_npi)
109
+ outputter.output_esme_addr(@esme_addr)
110
+
111
+ # Output optional fields
112
+ outputter.output_ms_availability_status(@ms_availability_status,
113
+ @ms_availability_status_len) if !@ms_availability_status.nil?
114
+ end
115
+ public
116
+ # Mandatory fields
117
+ attr_accessor :source_addr_ton
118
+ attr_accessor :source_addr_npi
119
+ attr_accessor :source_addr
120
+ attr_accessor :esme_addr_ton
121
+ attr_accessor :esme_addr_npi
122
+ attr_accessor :esme_addr
123
+
124
+ # Optional fields
125
+ attr_accessor :ms_availability_status
126
+
127
+ # Optional fields len
128
+ attr_accessor :ms_availability_status_len
129
+ end
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,102 @@
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 SMPPBind < SMPPPDU
23
+ def initialize(command_id, command_status, sequence_number)
24
+ super(command_id, command_status, sequence_number)
25
+
26
+ #Init fields
27
+ @system_id = ""
28
+ @password = ""
29
+ @system_type = ""
30
+ @interface_version = InterfaceVersion::SMPP_VER_5_0
31
+ @addr_ton = TON::UNKNOWN
32
+ @addr_npi = NPI::UNKNOWN
33
+ @address_range = ""
34
+
35
+ end
36
+
37
+ # Interface to encode SMPP packet
38
+ def encode_packet(encoder)
39
+ # Encode header and mandatory fields
40
+ encoder.encode_header(@header)
41
+ encoder.encode_system_id(@system_id)
42
+ encoder.encode_password(@password)
43
+ encoder.encode_system_type(@system_type)
44
+ encoder.encode_interface_version(@interface_version)
45
+ encoder.encode_addr_ton(@addr_ton)
46
+ encoder.encode_addr_npi(@addr_npi)
47
+ encoder.encode_address_range(@address_range)
48
+ end
49
+
50
+ # Interface to decode SMPP packet
51
+ def decode_packet(decoder)
52
+ # Decode header and mandatory fields
53
+ @header = decoder.decode_header()
54
+ @system_id = decoder.decode_system_id(command_length())
55
+ @password = decoder.decode_password(command_length())
56
+ @system_type = decoder.decode_system_type(command_length())
57
+ @interface_version = decoder.decode_interface_version(command_length())
58
+ @addr_ton = decoder.decode_addr_ton(command_length())
59
+ @addr_npi = decoder.decode_addr_npi(command_length())
60
+ @address_range = decoder.decode_address_range(command_length())
61
+ end
62
+
63
+ # Interface to validate SMPP packet
64
+ def validate_packet(validator)
65
+ # Decode header and mandatory fields
66
+ validator.validate_header(@header)
67
+ validator.validate_system_id(@system_id)
68
+ validator.validate_password(@password)
69
+ validator.validate_system_type(@system_type)
70
+ validator.validate_interface_version(@interface_version)
71
+ validator.validate_addr_ton(@addr_ton)
72
+ validator.validate_addr_npi(@addr_npi)
73
+ validator.validate_address_range(@address_range)
74
+
75
+ end
76
+
77
+ # Interface to output SMPP packet
78
+ def output_packet(outputter)
79
+ # Output header and mandatory fields
80
+ outputter.output_header(@header)
81
+ outputter.output_system_id(@system_id)
82
+ outputter.output_password(@password)
83
+ outputter.output_system_type(@system_type)
84
+ outputter.output_interface_version(@interface_version)
85
+ outputter.output_addr_ton(@addr_ton)
86
+ outputter.output_addr_npi(@addr_npi)
87
+ outputter.output_address_range(@address_range)
88
+ end
89
+
90
+ public
91
+ # Mandatory fields
92
+ attr_accessor :system_id
93
+ attr_accessor :password
94
+ attr_accessor :system_type
95
+ attr_accessor :interface_version
96
+ attr_accessor :addr_ton
97
+ attr_accessor :addr_npi
98
+ attr_accessor :address_range
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,29 @@
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 SMPPBindReceiver < SMPPBind
23
+ def initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil)
24
+ super(CommandId::CM_BIND_RECEIVER, command_status, sequence_number)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,30 @@
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 SMPPBindReceiverResp < SMPPBindResp
23
+ # Constructor.
24
+ def initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil)
25
+ super(CommandId::CM_BIND_RECEIVER_RESP, command_status, sequence_number)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,100 @@
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 SMPPBindResp < SMPPResp
23
+ def initialize(command_id, command_status, sequence_number)
24
+ super(command_id, command_status, sequence_number)
25
+
26
+ # Mandatory fields
27
+ @system_id = ""
28
+
29
+ # Optional fields
30
+ @sc_interface_version = nil
31
+
32
+ # Optional fields len
33
+ @sc_interface_version_len = SMPPTLVLen::BYTE_LEN
34
+ end
35
+
36
+ # Interface to encode SMPP packet
37
+ def encode_packet(encoder)
38
+ # Encode header and mandatory fields
39
+ encoder.encode_header(@header)
40
+ encoder.encode_system_id(@system_id)
41
+
42
+ # Encode optional fields
43
+ encoder.encode_sc_interface_version(@sc_interface_version,
44
+ @sc_interface_version_len) if !@sc_interface_version.nil?
45
+ end
46
+
47
+ # Interface to decode SMPP packet
48
+ def decode_packet(decoder)
49
+ # Decode header and mandatory fields
50
+ @header = decoder.decode_header()
51
+ @system_id = decoder.decode_system_id(command_length())
52
+
53
+ # Decode optional fields
54
+ while decoder.has_tlvs()
55
+ case decoder.get_tlv_code()
56
+ when OptTags::TAG_SC_INTERFACE_VERSION
57
+ @sc_interface_version, @sc_interface_version_len =
58
+ decoder.decode_sc_interface_version(command_length())
59
+ else
60
+ # Report about error
61
+ raise Errors::UNKNOWN_TAG_MSG + decoder.get_tlv_error()
62
+ end
63
+ end
64
+ end
65
+
66
+ # Interface to validate SMPP packet
67
+ def validate_packet(validator)
68
+ # Validate header and mandatory fields
69
+ validator.validate_header(@header)
70
+ validator.validate_system_id(@system_id)
71
+
72
+ # Validate optional fields
73
+ validator.validate_sc_interface_version(@sc_interface_version,
74
+ @sc_interface_version_len) if !@sc_interface_version.nil?
75
+ end
76
+
77
+ # Interface to output SMPP packet
78
+ def output_packet(outputter)
79
+ # Output header and mandatory fields
80
+ outputter.output_header(@header)
81
+ outputter.output_system_id(@system_id)
82
+
83
+ # Output optional fields
84
+ outputter.output_sc_interface_version(@sc_interface_version,
85
+ @sc_interface_version_len) if !@sc_interface_version.nil?
86
+ end
87
+
88
+ public
89
+ # Mandatory fields
90
+ attr_accessor :system_id
91
+
92
+ # Optional fields
93
+ attr_accessor :sc_interface_version
94
+
95
+ # Optional fields length
96
+ attr_accessor :sc_interface_version_len
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,29 @@
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 SMPPBindTransceiver < SMPPBind
23
+ def initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil)
24
+ super(CommandId::CM_BIND_TRANSCEIVER, command_status, sequence_number)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,31 @@
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 SMPPBindTransceiverResp < SMPPBindResp
23
+ # Constructor.
24
+ def initialize(command_status = ErrorCode::ESME_ROK, sequence_number = nil)
25
+ super(CommandId::CM_BIND_TRANSCEIVER_RESP, command_status, sequence_number)
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end