1/* ====================================================================
2 * The Kannel Software License, Version 1.0
3 *
4 * Copyright (c) 2001-2014 Kannel Group
5 * Copyright (c) 1998-2001 WapIT Ltd.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 *    notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in
17 *    the documentation and/or other materials provided with the
18 *    distribution.
19 *
20 * 3. The end-user documentation included with the redistribution,
21 *    if any, must include the following acknowledgment:
22 *       "This product includes software developed by the
23 *        Kannel Group (http://www.kannel.org/)."
24 *    Alternately, this acknowledgment may appear in the software itself,
25 *    if and wherever such third-party acknowledgments normally appear.
26 *
27 * 4. The names "Kannel" and "Kannel Group" must not be used to
28 *    endorse or promote products derived from this software without
29 *    prior written permission. For written permission, please
30 *    contact org@kannel.org.
31 *
32 * 5. Products derived from this software may not be called "Kannel",
33 *    nor may "Kannel" appear in their name, without prior written
34 *    permission of the Kannel Group.
35 *
36 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39 * DISCLAIMED.  IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS
40 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
41 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
42 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
45 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
46 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47 * ====================================================================
48 *
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Kannel Group.  For more information on
51 * the Kannel Group, please see <http://www.kannel.org/>.
52 *
53 * Portions of this software are based upon software originally written at
54 * WapIT Ltd., Helsinki, Finland for the Kannel project.
55 */
56
57/*
58 * smpp_pdu.def - definitions of SMPP PDU structure
59 *
60 * Lars Wirzenius
61 * Daniel Lukic <lukic@vivatech.de>:
62 *     Initial optional parameters implementation.
63 * Alexander Malysh <a.malysh@centrium.de>:
64 *     Extended optional parameters implementation.
65 * Stipe Tolj <stolj at kannel.org>:
66 *     Adding SMPP v5.0 PDUs
67 */
68
69
70#include "smpp_pdu_opt.def"
71
72
73#ifndef PDU
74#error Macro PDU not defined.
75#endif
76
77#ifndef INTEGER
78#error Macro INTEGER not defined.
79#endif
80
81#ifndef NULTERMINATED
82#error Macro NULTERMINATED not defined.
83#endif
84
85#ifndef OCTETS
86#error Macro OCTETS not defined.
87#endif
88
89#ifndef OPTIONAL_BEGIN
90#error Macro OPTIONAL_BEGIN not defined.
91#endif
92
93#ifndef TLV_INTEGER
94#error Macro TLV_INTEGER not defined.
95#endif
96
97#ifndef TLV_NULTERMINATED
98#error Macro TLV_NULTERMINATED not defined.
99#endif
100
101#ifndef TLV_OCTETS
102#error Macro TLV_OCTETS not defined.
103#endif
104
105#ifndef OPTIONAL_END
106#error Macro OPTIONAL_END not defined.
107#endif
108
109/*
110 * All SMPP PDUs have a common header consisting of four integers.
111 * The first integer, command_length, is dealt with implicitly by
112 * the I/O stuff, so we don't store it in the PDU data structure.
113 * The other three are defined in the HEADER macro.
114 */
115#ifdef HEADER
116#error Macro HEADER was already defined.
117#endif
118#define HEADER	\
119    INTEGER(command_id, 4) \
120    INTEGER(command_status, 4) \
121    INTEGER(sequence_number, 4)
122
123/*
124 * PDUs defined in SMPP v3.4
125 */
126PDU(bind_transmitter,
127    0x00000002,
128    HEADER
129    NULTERMINATED(system_id, 16)
130    NULTERMINATED(password, 9)
131    NULTERMINATED(system_type, 13)
132    INTEGER(interface_version, 1)
133    INTEGER(addr_ton, 1)
134    INTEGER(addr_npi, 1)
135    NULTERMINATED(address_range, 41)
136)
137
138PDU(bind_transmitter_resp,
139    0x80000002,
140    HEADER
141    NULTERMINATED(system_id, 16)
142    OPTIONAL_BEGIN
143    TLV_INTEGER(sc_interface_version, 1)
144    OPTIONAL_END
145)
146
147PDU(bind_receiver,
148    0x00000001,
149    HEADER
150    NULTERMINATED(system_id, 16)
151    NULTERMINATED(password, 9)
152    NULTERMINATED(system_type, 13)
153    INTEGER(interface_version, 1)
154    INTEGER(addr_ton, 1)
155    INTEGER(addr_npi, 1)
156    NULTERMINATED(address_range, 41)
157)
158
159PDU(bind_receiver_resp,
160    0x80000001,
161    HEADER
162    NULTERMINATED(system_id, 16)
163    OPTIONAL_BEGIN
164    TLV_INTEGER(sc_interface_version, 1)
165    OPTIONAL_END
166)
167
168PDU(bind_transceiver,
169    0x00000009,
170    HEADER
171    NULTERMINATED(system_id, 16)
172    NULTERMINATED(password, 9)
173    NULTERMINATED(system_type, 13)
174    INTEGER(interface_version, 1)
175    INTEGER(addr_ton, 1)
176    INTEGER(addr_npi, 1)
177    NULTERMINATED(address_range, 41)
178)
179
180PDU(bind_transceiver_resp,
181    0x80000009,
182    HEADER
183    NULTERMINATED(system_id, 16)
184    OPTIONAL_BEGIN
185    TLV_INTEGER(sc_interface_version, 1)
186    OPTIONAL_END
187)
188
189PDU(outbind,
190    0x0000000B,
191    HEADER
192    NULTERMINATED(system_id, 16)
193    NULTERMINATED(password, 9)
194)
195
196PDU(unbind,
197    0x00000006,
198    HEADER
199)
200
201PDU(unbind_resp,
202    0x80000006,
203    HEADER
204)
205
206PDU(generic_nack,
207    0x80000000,
208    HEADER
209)
210
211PDU(submit_sm,
212    0x00000004,
213    HEADER
214    NULTERMINATED(service_type, 6)
215    INTEGER(source_addr_ton, 1)
216    INTEGER(source_addr_npi, 1)
217    NULTERMINATED(source_addr, 21)
218    INTEGER(dest_addr_ton, 1)
219    INTEGER(dest_addr_npi, 1)
220    NULTERMINATED(destination_addr, 21)
221    INTEGER(esm_class, 1)
222    INTEGER(protocol_id, 1)
223    INTEGER(priority_flag, 1)
224    NULTERMINATED(schedule_delivery_time, 17)
225    NULTERMINATED(validity_period, 17)
226    INTEGER(registered_delivery, 1)
227    INTEGER(replace_if_present_flag, 1)
228    INTEGER(data_coding, 1)
229    INTEGER(sm_default_msg_id, 1)
230    INTEGER(sm_length, 1)
231    OCTETS(short_message, sm_length)
232    OPTIONAL_BEGIN
233    /* defined in SMPP v3.4 */
234    TLV_INTEGER(user_message_reference, 2)
235    TLV_INTEGER(source_port, 2)
236    TLV_INTEGER(source_addr_subunit, 1)
237    TLV_INTEGER(destination_port, 2)	/* renamed to 'dest_port' in SMPP v5.0 ?? */
238    TLV_INTEGER(dest_addr_subunit, 1)
239    TLV_INTEGER(sar_msg_ref_num, 2)
240    TLV_INTEGER(sar_total_segments, 1)
241    TLV_INTEGER(sar_segment_seqnum, 1)
242    TLV_INTEGER(more_messages_to_send, 1)
243    TLV_INTEGER(payload_type, 1)
244    TLV_OCTETS(message_payload, 0, 65536)
245    TLV_INTEGER(privacy_indicator, 1)
246    TLV_OCTETS(callback_num, 4, 19)
247    TLV_INTEGER(callback_num_pres_ind, 1)
248    TLV_OCTETS(callback_num_atag, 0, 65)
249    TLV_OCTETS(source_subaddress, 2, 23)
250    TLV_OCTETS(dest_subaddress, 2, 23)
251    TLV_INTEGER(user_response_code, 1)
252    TLV_INTEGER(display_time, 1)
253    TLV_INTEGER(sms_signal, 2)
254    TLV_INTEGER(ms_validity, 1)
255    TLV_INTEGER(ms_msg_wait_facilities, 1)
256    TLV_INTEGER(number_of_messages, 1)
257    TLV_INTEGER(alert_on_message_delivery, 0)
258    TLV_INTEGER(language_indicator, 1)
259    TLV_INTEGER(its_reply_type, 1)
260    TLV_OCTETS(its_session_info, 2, 2)
261    TLV_OCTETS(ussd_service_op, 1, 1)
262    /* added in SMPP v5.0 */
263    TLV_OCTETS(billing_identification, 1, 1024)
264    TLV_INTEGER(dest_addr_np_country, 5)
265    TLV_OCTETS(dest_addr_np_information, 10, 10)
266    TLV_INTEGER(dest_addr_np_resolution, 1)
267    TLV_INTEGER(dest_bearer_type, 1)
268    TLV_NULTERMINATED(dest_network_id, 65)
269    TLV_INTEGER(dest_network_type, 1)
270    TLV_OCTETS(dest_node_id, 6, 6)
271    TLV_INTEGER(dest_telematics_id, 2)
272    TLV_INTEGER(qos_time_to_live, 4)
273    TLV_INTEGER(set_dpf, 1)
274    TLV_INTEGER(source_bearer_type, 1)
275    TLV_NULTERMINATED(source_network_id, 65)
276    TLV_INTEGER(source_network_type, 1)
277    TLV_OCTETS(source_node_id, 6, 6)
278    TLV_INTEGER(source_telematics_id, 1)
279    OPTIONAL_END
280)
281
282PDU(submit_sm_resp,
283    0x80000004,
284    HEADER
285    NULTERMINATED(message_id, 65)
286	OPTIONAL_BEGIN
287	/* added in SMPP v5.0 */
288    TLV_NULTERMINATED(additional_status_info_text, 256)
289    TLV_INTEGER(delivery_failure_reason, 1)
290    TLV_INTEGER(dpf_result, 1)
291    TLV_OCTETS(network_error_code, 3, 3)
292    OPTIONAL_END
293)
294
295PDU(submit_multi,
296    0x00000021,
297    HEADER
298    NULTERMINATED(service_type, 6)
299    INTEGER(source_addr_ton, 1)
300    INTEGER(source_addr_npi, 1)
301    NULTERMINATED(source_addr, 21)
302    INTEGER(number_of_dests, 1)
303    NULTERMINATED(dest_address_es, 254 * 24)
304    INTEGER(esm_class, 1)
305    INTEGER(protocol_id, 1)
306    INTEGER(priority_flag, 1)
307    NULTERMINATED(schedule_delivery_time, 17)
308    NULTERMINATED(validity_period, 17)
309    INTEGER(registered_delivery, 1)
310    INTEGER(replace_if_present_flag, 1)
311    INTEGER(data_coding, 1)
312    INTEGER(sm_default_msg_id, 1)
313    INTEGER(sm_length, 1)
314    OCTETS(short_message, sm_length)
315    OPTIONAL_BEGIN
316    /* defined in SMPP v3.4 */
317    TLV_INTEGER(user_message_reference, 2)
318    TLV_INTEGER(source_port, 2)
319    TLV_INTEGER(source_addr_subunit, 1)
320    TLV_INTEGER(destination_port, 2)
321    TLV_INTEGER(dest_addr_subunit, 1)
322    TLV_INTEGER(sar_msg_ref_num, 2)
323    TLV_INTEGER(sar_total_segments, 1)
324    TLV_INTEGER(sar_segment_seqnum, 1)
325    TLV_INTEGER(payload_type, 1)
326    TLV_OCTETS(message_payload, 0, 65536)
327    TLV_INTEGER(privacy_indicator, 1)
328    TLV_OCTETS(callback_num, 4, 19)
329    TLV_INTEGER(callback_num_pres_ind, 1)
330    TLV_OCTETS(callback_num_atag, 0, 65)
331    TLV_OCTETS(source_subaddress, 2, 23)
332    TLV_OCTETS(dest_subaddress, 2, 23)
333    TLV_INTEGER(display_time, 1)
334    TLV_INTEGER(sms_signal, 2)
335    TLV_INTEGER(ms_validity, 1)
336    TLV_INTEGER(ms_msg_wait_facilities, 1)
337    TLV_INTEGER(alert_on_message_delivery, 0)
338    TLV_INTEGER(language_indicator, 1)
339    /* added in SMPP v5.0 */
340    TLV_OCTETS(billing_identification, 1, 1024)
341    TLV_INTEGER(dest_addr_np_country, 5)
342    TLV_OCTETS(dest_addr_np_information, 10, 10)
343    TLV_INTEGER(dest_addr_np_resolution, 1)
344    TLV_INTEGER(dest_bearer_type, 1)
345    TLV_NULTERMINATED(dest_network_id, 65)
346    TLV_INTEGER(dest_network_type, 1)
347    TLV_OCTETS(dest_node_id, 6, 6)
348    TLV_INTEGER(dest_telematics_id, 2)
349    TLV_INTEGER(its_reply_type, 1)
350    TLV_OCTETS(its_session_info, 2, 2)
351    TLV_INTEGER(more_messages_to_send, 1)
352    TLV_INTEGER(number_of_messages, 1)
353    TLV_INTEGER(qos_time_to_live, 4)
354    TLV_INTEGER(set_dpf, 1)
355    TLV_INTEGER(source_bearer_type, 1)
356    TLV_NULTERMINATED(source_network_id, 65)
357    TLV_INTEGER(source_network_type, 1)
358    TLV_OCTETS(source_node_id, 6, 6)
359    TLV_INTEGER(source_telematics_id, 1)
360    TLV_INTEGER(user_response_code, 1)
361    OPTIONAL_END
362)
363
364PDU(submit_multi_resp,
365    0x80000021,
366    HEADER
367    NULTERMINATED(message_id, 65)
368    INTEGER(no_unsuccess, 1)
369    //VAR_OCTETS(unsuccess_sme, 6, 27)
370    //OCTETS(unsuccess_sme, 27)
371	OPTIONAL_BEGIN
372	/* added in SMPP v5.0 */
373    TLV_NULTERMINATED(additional_status_info_text, 256)
374    TLV_INTEGER(delivery_failure_reason, 1)
375    TLV_INTEGER(dpf_result, 1)
376    TLV_OCTETS(network_error_code, 3, 3)
377    OPTIONAL_END
378)
379
380PDU(deliver_sm,
381    0x00000005,
382    HEADER
383    NULTERMINATED(service_type, 6)
384    INTEGER(source_addr_ton, 1)
385    INTEGER(source_addr_npi, 1)
386    NULTERMINATED(source_addr, 21)
387    INTEGER(dest_addr_ton, 1)
388    INTEGER(dest_addr_npi, 1)
389    NULTERMINATED(destination_addr, 21)
390    INTEGER(esm_class, 1)
391    INTEGER(protocol_id, 1)
392    INTEGER(priority_flag, 1)
393    NULTERMINATED(schedule_delivery_time, 17)
394    NULTERMINATED(validity_period, 17)
395    INTEGER(registered_delivery, 1)
396    INTEGER(replace_if_present_flag, 1)
397    INTEGER(data_coding, 1)
398    INTEGER(sm_default_msg_id, 1)
399    INTEGER(sm_length, 1)
400    OCTETS(short_message, sm_length)
401    OPTIONAL_BEGIN
402    /* defined in SMPP v3.4 */
403    TLV_INTEGER(user_message_reference, 2)
404    TLV_INTEGER(source_port, 2)
405    TLV_INTEGER(destination_port, 2) /* renamed to 'dest_port' in SMPP v5.0 ?? */
406    TLV_INTEGER(sar_msg_ref_num, 2)
407    TLV_INTEGER(sar_total_segments, 1)
408    TLV_INTEGER(sar_segment_seqnum, 1)
409    TLV_INTEGER(user_response_code, 1)
410    TLV_INTEGER(privacy_indicator, 1)
411    TLV_INTEGER(payload_type, 1)
412    TLV_OCTETS(message_payload, 0, 65536)
413    TLV_OCTETS(callback_num, 4, 19)
414    TLV_OCTETS(source_subaddress, 2, 23)
415    TLV_OCTETS(dest_subaddress, 2, 23)
416    TLV_INTEGER(language_indicator, 1)
417    TLV_OCTETS(its_session_info, 2, 2)
418    TLV_OCTETS(network_error_code, 3, 3)
419    TLV_INTEGER(message_state, 1)
420    TLV_NULTERMINATED(receipted_message_id, 65)
421    /* added in SMPP v5.0 */
422    TLV_OCTETS(callback_num_atag, 0, 65)
423    TLV_INTEGER(callback_num_pres_ind, 1)
424    TLV_INTEGER(dest_addr_np_country, 5)
425    TLV_OCTETS(dest_addr_np_information, 10, 10)
426    TLV_INTEGER(dest_addr_np_resolution, 1)
427    TLV_INTEGER(dest_addr_subunit, 1)
428    TLV_NULTERMINATED(dest_network_id, 65)
429    TLV_INTEGER(dpf_result, 1)
430    TLV_INTEGER(its_reply_type, 1)
431    TLV_INTEGER(source_addr_subunit, 1)
432    TLV_NULTERMINATED(source_network_id, 65)
433    TLV_OCTETS(source_node_id, 6, 6)
434    TLV_OCTETS(ussd_service_op, 1, 1)
435    OPTIONAL_END
436)
437
438PDU(deliver_sm_resp,
439    0x80000005,
440    HEADER
441    NULTERMINATED(message_id, 1)
442    OPTIONAL_BEGIN
443    /* added in SMPP v5.0 */
444    TLV_NULTERMINATED(additional_status_info_text, 256)
445    TLV_INTEGER(delivery_failure_reason, 1)
446    TLV_OCTETS(network_error_code, 3, 3)
447    OPTIONAL_END
448)
449
450PDU(data_sm,
451    0x00000103,
452    HEADER
453    NULTERMINATED(service_type, 6)
454    INTEGER(source_addr_ton, 1)
455    INTEGER(source_addr_npi, 1)
456    NULTERMINATED(source_addr, 65)
457    INTEGER(dest_addr_ton, 1)
458    INTEGER(dest_addr_npi, 1)
459    NULTERMINATED(destination_addr, 65)
460    INTEGER(esm_class, 1)
461    INTEGER(registered_delivery, 1)
462    INTEGER(data_coding, 1)
463    OPTIONAL_BEGIN
464    /* defined in SMPP v3.4 */
465    TLV_INTEGER(source_port, 2)
466    TLV_INTEGER(source_addr_subunit, 1)
467    TLV_INTEGER(source_network_type, 1)
468    TLV_INTEGER(source_bearer_type, 1)
469    TLV_INTEGER(source_telematics_id, 1)
470    TLV_INTEGER(destination_port, 2)
471    TLV_INTEGER(dest_addr_subunit, 1)
472    TLV_INTEGER(dest_network_type, 1)
473    TLV_INTEGER(dest_bearer_type, 1)
474    TLV_INTEGER(dest_telematics_id, 2)
475    TLV_INTEGER(sar_msg_ref_num, 2)
476    TLV_INTEGER(sar_total_segments, 1)
477    TLV_INTEGER(sar_segment_seqnum, 1)
478    TLV_INTEGER(more_messages_to_send, 1)
479    TLV_INTEGER(qos_time_to_live, 4)
480    TLV_INTEGER(payload_type, 1)
481    TLV_OCTETS(message_payload, 0, 65536)
482    TLV_INTEGER(set_dpf, 1)
483    TLV_NULTERMINATED(receipted_message_id, 65)
484    TLV_INTEGER(message_state, 1)
485    TLV_OCTETS(network_error_code, 3, 3)
486    TLV_INTEGER(user_message_reference, 2)
487    TLV_INTEGER(privacy_indicator, 1)
488    TLV_OCTETS(callback_num, 4, 19)
489    TLV_INTEGER(callback_num_pres_ind, 1)
490    TLV_OCTETS(callback_num_atag, 0, 65)
491    TLV_OCTETS(source_subaddress, 2, 23)
492    TLV_OCTETS(dest_subaddress, 2, 23)
493    TLV_INTEGER(user_response_code, 1)
494    TLV_INTEGER(display_time, 1)
495    TLV_INTEGER(sms_signal, 2)
496    TLV_INTEGER(ms_validity, 1)
497    TLV_INTEGER(ms_msg_wait_facilities, 1)
498    TLV_INTEGER(number_of_messages, 1)
499    TLV_INTEGER(alert_on_message_delivery, 0)
500    TLV_INTEGER(language_indicator, 1)
501    TLV_INTEGER(its_reply_type, 1)
502    TLV_OCTETS(its_session_info, 2, 2)
503    /* added in SMPP v5.0 */
504    TLV_OCTETS(billing_identification, 1, 1024)
505    TLV_INTEGER(dest_addr_np_country, 5)
506    TLV_OCTETS(dest_addr_np_information, 10, 10)
507    TLV_INTEGER(dest_addr_np_resolution, 1)
508    TLV_NULTERMINATED(dest_network_id, 65)
509    TLV_OCTETS(dest_node_id, 6, 6)
510    TLV_NULTERMINATED(source_network_id, 65)
511    TLV_OCTETS(source_node_id, 6, 6)
512    TLV_OCTETS(ussd_service_op, 1, 1)
513    OPTIONAL_END
514)
515
516PDU(data_sm_resp,
517    0x80000103,
518    HEADER
519    NULTERMINATED(message_id, 65)
520    OPTIONAL_BEGIN
521    /* defined in SMPP v3.4 */
522    TLV_NULTERMINATED(additional_status_info_text, 256)
523    TLV_INTEGER(delivery_failure_reason, 1)
524    TLV_INTEGER(dpf_result, 1)
525    TLV_OCTETS(network_error_code, 3, 3)
526    OPTIONAL_END
527)
528
529PDU(query_sm,
530    0x00000003,
531    HEADER
532    NULTERMINATED(message_id, 65)
533    INTEGER(source_addr_ton, 1)
534    INTEGER(source_addr_npi, 1)
535    NULTERMINATED(source_addr, 21)
536)
537
538PDU(query_sm_resp,
539    0x80000003,
540    HEADER
541    NULTERMINATED(message_id, 65)
542    NULTERMINATED(final_date, 17)
543    INTEGER(message_state, 1)
544    INTEGER(error_code, 1)
545)
546
547PDU(cancel_sm,
548    0x00000008,
549    HEADER
550    NULTERMINATED(service_type, 6)
551    NULTERMINATED(message_id, 65)
552    INTEGER(source_addr_ton, 1)
553    INTEGER(source_addr_npi, 1)
554    NULTERMINATED(source_addr, 21)
555    INTEGER(dest_addr_ton, 1)
556    INTEGER(dest_addr_npi, 1)
557    NULTERMINATED(destination_addr, 65)
558)
559
560PDU(cancel_sm_resp,
561    0x80000008,
562    HEADER
563)
564
565PDU(replace_sm,
566    0x00000007,
567    HEADER
568    NULTERMINATED(service_type, 6)
569    NULTERMINATED(message_id, 65)
570    INTEGER(source_addr_ton, 1)
571    INTEGER(source_addr_npi, 1)
572    NULTERMINATED(source_addr, 21)
573    NULTERMINATED(schedule_delivery_time, 17)
574    NULTERMINATED(validity_period, 17)
575    INTEGER(registered_delivery, 1)
576    INTEGER(sm_default_msg_id, 1)
577    INTEGER(sm_length, 1)
578    OCTETS(short_message, sm_length)
579    OPTIONAL_BEGIN
580    /* added in SMPP v5.0 */
581    TLV_OCTETS(message_payload, 0, 65536)
582    OPTIONAL_END
583)
584
585PDU(replace_sm_resp,
586    0x80000007,
587    HEADER
588)
589
590PDU(enquire_link,
591    0x00000015,
592    HEADER
593)
594
595PDU(enquire_link_resp,
596    0x80000015,
597    HEADER
598)
599
600PDU(alert_notification,
601    0x00000102,
602    HEADER
603    INTEGER(source_addr_ton, 1)
604    INTEGER(source_addr_npi, 1)
605    NULTERMINATED(source_addr, 21)
606    INTEGER(esme_addr_ton, 1)
607    INTEGER(esme_addr_npi, 1)
608    NULTERMINATED(esme_addr, 65)
609    OPTIONAL_BEGIN
610    /* defined in SMPP v3.4 */
611    TLV_INTEGER(ms_availability_status, 1)
612    OPTIONAL_END
613)
614
615/*
616 * PDUs defined in SMPP v5.0
617 */
618PDU(broadcast_sm,
619    0x00000111,
620    HEADER
621    NULTERMINATED(service_type, 6)
622    INTEGER(source_addr_ton, 1)
623    INTEGER(source_addr_npi, 1)
624    NULTERMINATED(source_addr, 21)
625    NULTERMINATED(message_id, 65)
626    INTEGER(priority_flag, 1)
627    NULTERMINATED(schedule_delivery_time, 17)
628    NULTERMINATED(validity_period, 17)
629    INTEGER(registered_delivery, 1)
630    INTEGER(replace_if_present_flag, 1)
631    INTEGER(data_coding, 1)
632    INTEGER(sm_default_msg_id, 1)
633    OPTIONAL_BEGIN
634    TLV_OCTETS(broadcast_area_identifier, 1, 101)
635    TLV_OCTETS(broadcast_content_type, 3, 3)
636    TLV_OCTETS(broadcast_rep_num, 3, 3)
637    TLV_OCTETS(broadcast_frequency_interval, 3, 3)
638    //OPTIONAL_BEGIN
639    TLV_INTEGER(alert_on_message_delivery, 0)
640    TLV_INTEGER(broadcast_channel_indicator, 1)
641    TLV_OCTETS(broadcast_content_type_info, 1, 254)
642    TLV_INTEGER(broadcast_message_class, 1)
643    TLV_OCTETS(broadcast_service_group, 1, 254)
644    TLV_OCTETS(callback_num, 4, 19)
645    TLV_OCTETS(callback_num_atag, 0, 65)
646    TLV_INTEGER(callback_num_pres_ind, 1)
647    TLV_INTEGER(dest_addr_subunit, 1)
648    TLV_OCTETS(dest_subaddress, 2, 23)
649    TLV_INTEGER(destination_port, 2)	/* called 'dest_port' in SMPP v5.0 spec?? */
650    TLV_INTEGER(display_time, 1)
651    TLV_INTEGER(language_indicator, 1)
652    TLV_OCTETS(message_payload, 0, 65536)
653    TLV_INTEGER(ms_validity, 1)
654    TLV_INTEGER(payload_type, 1)
655    TLV_INTEGER(privacy_indicator, 1)
656    TLV_INTEGER(sms_signal, 2)
657    TLV_INTEGER(source_addr_subunit, 1)
658    TLV_INTEGER(source_port, 2)
659    TLV_OCTETS(source_subaddress, 2, 23)
660    TLV_INTEGER(user_message_reference, 2)
661    OPTIONAL_END
662)
663
664PDU(broadcast_sm_resp,
665    0x80000111,
666    HEADER
667    NULTERMINATED(message_id, 65)
668    OPTIONAL_BEGIN
669    TLV_INTEGER(broadcast_error_status, 4)
670    TLV_OCTETS(failed_broadcast_area_identifier, 1, 101)
671    OPTIONAL_END
672)
673
674PDU(query_broadcast_sm,
675    0x00000112,
676    HEADER
677    NULTERMINATED(message_id, 65)
678    INTEGER(source_addr_ton, 1)
679    INTEGER(source_addr_npi, 1)
680    NULTERMINATED(source_addr, 21)
681    OPTIONAL_BEGIN
682    TLV_INTEGER(user_message_reference, 2)
683    OPTIONAL_END
684)
685
686PDU(query_broadcast_sm_resp,
687    0x80000112,
688    HEADER
689    NULTERMINATED(message_id, 65)
690    OPTIONAL_BEGIN
691    TLV_INTEGER(message_state, 1)
692    TLV_OCTETS(broadcast_area_identifier, 1, 101)
693    TLV_INTEGER(broadcast_area_success, 1)
694    //OPTIONAL_BEGIN
695    TLV_NULTERMINATED(broadcast_end_time, 16)
696    TLV_INTEGER(user_message_reference, 2)
697    OPTIONAL_END
698)
699
700PDU(cancel_broadcast_sm,
701    0x00000113,
702    HEADER
703    NULTERMINATED(service_type, 6)
704    NULTERMINATED(message_id, 65)
705    INTEGER(source_addr_ton, 1)
706    INTEGER(source_addr_npi, 1)
707    NULTERMINATED(source_addr, 21)
708    OPTIONAL_BEGIN
709    TLV_OCTETS(broadcast_content_type, 3, 3)
710    TLV_INTEGER(user_message_reference, 2)
711    OPTIONAL_END
712)
713
714PDU(cancel_broadcast_sm_resp,
715    0x80000113,
716    HEADER
717)
718
719#undef PDU
720#undef INTEGER
721#undef NULTERMINATED
722#undef OCTETS
723#undef HEADER
724#undef OPTIONAL_BEGIN
725#undef TLV_INTEGER
726#undef TLV_NULTERMINATED
727#undef TLV_OCTETS
728#undef OPTIONAL_END
729
730