diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/index.html b/index.html new file mode 100644 index 0000000..ae72d7a --- /dev/null +++ b/index.html @@ -0,0 +1,99 @@ + + + + + + + thuck/python-smpp @ GitHub + + + + + + + Fork me on GitHub + +
+ +
+ + + + +
+ +

python-smpp + by thuck

+ +
+ SMPP lib and client for python +
+ +

Python is a great language, for a while I was looking for a SMPP lib, and didn't find one that really makes things like I imagined, so I decided to create a new one based on twisted...

Dependencies

+

Not finished

+

Install

+

Not finished

+

License

+

Python-smpp is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. + +Python-smpp is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +

+

Authors

+

Denis Doria

+

Contact

+

Denis Doria (denisdoria@gmail.com)

+ + +

Download

+

+ You can download this project in either + zip or + tar formats. +

+

You can also clone the project with Git + by running: +

$ git clone git://github.com/thuck/python-smpp
+

+ + + +
+ + + + diff --git a/src/smpp.py b/src/smpp.py deleted file mode 100644 index fbf4ad9..0000000 --- a/src/smpp.py +++ /dev/null @@ -1,5 +0,0 @@ -''' -Created on Jan 18, 2010 - -@author: thuck -''' diff --git a/src/smpp_const.py b/src/smpp_const.py deleted file mode 100644 index 1e493ca..0000000 --- a/src/smpp_const.py +++ /dev/null @@ -1,126 +0,0 @@ -#SMPP Command set -GENERIC_NACK = '80000000' -BIND_RECEIVER = '00000001' -BIND_RECEIVER_RESP = '80000001' -BIND_TRANSMITTER = '00000002' -BIND_TRANSMITTER_RESP = '80000002' -QUERY_SM = '00000003' -QUERY_SM_RESP = '80000003' -SUBMIT_SM = '00000004' -SUBMIT_SM_RESP = '80000004' -DELIVER_SM = '00000005' -DELIVER_SM_RESP = '80000005' -UNBIND = '00000006' -UNBIND_RESP = '80000006' -REPLACE_SM = '00000007' -REPLACE_SM_RESP = '80000007' -CANCEL_SM = '00000008' -CANCEL_SM_RESP = '80000008' -BIND_TRANSCEIVER = '00000009' -BIND_TRANSCEIVER_RESP = '80000009' -OUTBIND = '0000000b' -ENQUIRE_LINK = '00000015' -ENQUIRE_LINK_RESP = '80000015' -SUBMIT_MULTI = '00000021' -SUBMIT_MULTI_RESP = '80000021' -ALERT_NOTIFICATION = '00000102' -DATA_SM = '00000103' -DATA_SM_RESP = '80000103' - -#Command Status -ESME_ROK = '00000000' -ESME_RINVMSGLEN = '00000001' -ESME_RINVCMDLEN = '00000002' -ESME_RINVCMDID = '00000003' -ESME_RINVBNDSTS = '00000004' -ESME_RALYBND = '00000005' -ESME_RINVPRTFLG = '00000006' -ESME_RINVREGDLVFLG = '00000007' -ESME_RSYSERR = '00000008' -ESME_RINVSRCADR = '0000000a' -ESME_RINVDSTADR = '0000000b' -ESME_RINVMSGID = '0000000c' -ESME_RBINDFAIL = '0000000d' -ESME_RINVPASWD = '0000000e' -ESME_RINVSYSID = '0000000f' -ESME_RCANCELFAIL = '00000011' -ESME_RREPLACEFAIL = '00000013' -ESME_RMSGQFUL = '00000014' -ESME_RINVSERTYP = '00000015' -ESME_RINVNUMDESTS = '00000033' -ESME_RINVDLNAME = '00000034' -ESME_RINVDESTFLAG = '00000040' -ESME_RINVSUBREP = '00000042' -ESME_RINVESMCLASS = '00000043' -ESME_RCNTSUBDL = '00000044' -ESME_RSUBMITFAIL = '00000045' -ESME_RINVSRCTON = '00000048' -ESME_RINVSRCNPI = '00000049' -ESME_RINVDSTTON = '00000050' -ESME_RINVDSTNPI = '00000051' -ESME_RINVSYSTYP = '00000053' -ESME_RINVREPFLAG = '00000054' -ESME_RINVNUMMSGS = '00000055' -ESME_RTHROTTLED = '00000058' -ESME_RINVSCHED = '00000061' -ESME_RINVEXPIRY = '00000062' -ESME_RINVDFTMSGID = '00000063' -ESME_RX_T_APPN = '00000064' -ESME_RX_P_APPN = '00000065' -ESME_RX_R_APPN = '00000066' -ESME_RQUERYFAIL = '00000067' -ESME_RINVOPTPARSTREAM = '000000c0' -ESME_ROPTPARNOTALLWD = '000000c1' -ESME_RINVPARLEN = '000000c2' -ESME_RMISSINGOPTPARAM = '000000c3' -ESME_RINVOPTPARAMVAL = '000000c4' -ESME_RDELIVERYFAILURE = '000000fe' -ESME_RUNKNOWNERR = '000000ff' - -#Optional parameters -DEST_ADDR_SUBUNIT = '0005' -DEST_NETWORK_TYPE = '0006' -DEST_BEARER_TYPE = '0007' -DEST_TELEMATICS_ID = '0008' -SOURCE_ADDR_SUBUNIT = '000d' -SOURCE_NETWORK_TYPE = '000e' -SOURCE_BEARER_TYPE = '000f' -SOURCE_TELEMATICS_ID = '0010' -QOS_TIME_TO_LIVE = '0017' -PAYLOAD_TYPE = '0019' -ADDITIONAL_STATUS_INFO_TEXT = '001d' -RECEIPTED_MESSAGE_ID = '001e' -MS_MSG_WAIT_FACILITIES = '0030' -PRIVACY_INDICATOR = '0201' -SOURCE_SUBADDRESS = '0202' -DEST_SUBADDRESS = '0203' -USER_MESSAGE_REFERENCE = '0204' -USER_RESPONSE_CODE = '0205' -SOURCE_PORT = '020a' -DESTINATION_PORT = '020b' -SAR_MSG_REF_NUM = '020c' -LANGUAGE_INDICATOR = '020d' -SAR_TOTAL_SEGMENTS = '020e' -SAR_SEGMENT_SEQNUM = '020f' -SC_INTERFACE_VERSION = '0210' -CALLBACK_NUM_PRES_IND = '0302' -CALLBACK_NUM_ATAG = '0303' -NUMBER_OF_MESSAGES = '0304' -CALLBACK_NUM = '0381' -DPF_RESULT = '0420' -SET_DPF = '0421' -MS_AVAILABILITY_STATUS = '0422' -NETWORK_ERROR_CODE = '0423' -MESSAGE_PAYLOAD = '0424' -DELIVERY_FAILURE_REASON = '0425' -MORE_MESSAGES_TO_SEND = '0426' -MESSAGE_STATE = '0427' -USSD_SERVICE_OP = '0501' -DISPLAY_TIME = '1201' -SMS_SIGNAL = '1203' -MS_VALIDITY = '1204' -ALERT_ON_MESSAGE_DELIVERY = '130c' -ITS_REPLY_TYPE = '1380' -ITS_SESSION_INFO = '1383' - - diff --git a/src/smpp_operation.py b/src/smpp_operation.py deleted file mode 100644 index 71863ea..0000000 --- a/src/smpp_operation.py +++ /dev/null @@ -1,272 +0,0 @@ -import smpp_const -import smpp_parts as part -import asyncore -import socket -import binascii -import time - -class Header(object): - def __init__(self, command_id = None, - command_status = None, sequence_number = None): - self.command_length = part.CommandLength() - self.command_id = part.CommandID(command_id) - self.command_status = part.CommandStatus(command_status) - self.sequence_number = part.SequenceNumber(sequence_number) - self.body = [] - self.optional_parameter = [] - - def format_message(self): - message = '' - full_body = self.body[:] - full_body.extend(self.optional_parameter) - for i in self.body: - message += i() - - message = '%s%s%s%s%s' % (self.command_length(full_body), - self.command_id(), - self.command_status(), self.sequence_number(), - message) - - for i in self.optional_parameter: - if len(i) > 0: - message += i() - - return message - - -class BindTransmitter(Header): - def __init__(self, sequence_numb, system_id = '', password = '', - system_type = '', interface_version = 52, - addr_ton = 0, addr_npi = 0, address_range = ''): - - Header.__init__(self, command_id = smpp_const.BIND_TRANSMITTER, - command_status = smpp_const.ESME_ROK, - sequence_number = sequence_numb) - - self.system_id = part.SystemID(system_id) - self.password = part.Password(password) - self.system_type = part.SystemType(system_type) - self.interface_version = part.InterfaceVersion(interface_version) - self.addr_ton = part.AddrTon(addr_ton) - self.addr_npi = part.AddrNpi(addr_npi) - self.address_range = part.AddressRange(address_range) - self.body = [self.system_id, self.password, - self.system_type, self.interface_version, - self.addr_ton, self.addr_npi, self.address_range] - - - -class BindTransmitterResp(Header): - def __init__(self, sequence_numb, command_stat = smpp_const.ESME_ROK, - system_id = '', sc_interface_version = None): - - Header.__init__(self, command_id = smpp_const.BIND_TRANSMITTER_RESP, - command_status = command_stat, - sequence_number = sequence_numb) - self.system_id = part.SystemID(system_id) - self.sc_interface_version = part.SCInterfaceVersion(sc_interface_version) - - self.body = [self.system_id] - self.optional_parameter = [self.sc_interface_version] - - def format_message(self): - message = '' - full_body = self.body[:] - full_body.extend(self.optional_parameter) - - if self.command_status() == smpp_const.ESME_ROK: - for i in self.body: - message += i() - message = '%s%s%s%s%s' % (self.command_length(full_body), - self.command_id(), - self.command_status(), - self.sequence_number(), message) - for i in self.optional_parameter: - if len(i) > 0: - message += i() - - else: - message = '%s%s%s%s' % (self.command_length([]), - self.command_id(), - self.command_status(), - self.sequence_number()) - - return message - - -class BindReceiver(Header): - def __init__(self, sequence_numb, system_id = '', password = '', - system_type = '', interface_version = 52, - addr_ton = 0, addr_npi = 0, address_range = ''): - - Header.__init__(self, command_id = smpp_const.BIND_RECEIVER, - command_status = smpp_const.ESME_ROK, - sequence_number = sequence_numb) - - self.system_id = part.SystemID(system_id) - self.password = part.Password(password) - self.system_type = part.SystemType(system_type) - self.interface_version = part.InterfaceVersion(interface_version) - self.addr_ton = part.AddrTon(addr_ton) - self.addr_npi = part.AddrNpi(addr_npi) - self.address_range = part.AddressRange(address_range) - self.body = [self.system_id, self.password, - self.system_type, self.interface_version, - self.addr_ton, self.addr_npi, self.address_range] - - -class BindReceiverResp(BindTransmitterResp): - pass - -class BindTranceiver(Header): - def __init__(self, sequence_numb, system_id = '', password = '', - system_type = '', interface_version = 52, - addr_ton = 0, addr_npi = 0, address_range = ''): - - Header.__init__(self, command_id = smpp_const.BIND_TRANSCEIVER, - command_status = smpp_const.ESME_ROK, - sequence_number = sequence_numb) - - self.system_id = part.SystemID(system_id) - self.password = part.Password(password) - self.system_type = part.SystemType(system_type) - self.interface_version = part.InterfaceVersion(interface_version) - self.addr_ton = part.AddrTon(addr_ton) - self.addr_npi = part.AddrNpi(addr_npi) - self.address_range = part.AddressRange(address_range) - self.body = [self.system_id, self.password, - self.system_type, self.interface_version, - self.addr_ton, self.addr_npi, self.address_range] - - -class BindTranceiverResp(Header): - def __init__(self, sequence_numb, command_stat = smpp_const.ESME_ROK, - system_id = '', sc_interface_version = None): - - Header.__init__(self, command_id = smpp_const.BIND_TRANSCEIVER_RESP, - command_status = command_stat, - sequence_number = sequence_numb) - self.system_id = part.SystemID(system_id) - self.sc_interface_version = part.SCInterfaceVersion(sc_interface_version) - - self.body = [self.system_id] - self.optional_parameter = [self.sc_interface_version] - -class OutBind(Header): - def __init__(self, sequence_numb, system_id = '', password = '', - system_type = '', interface_version = 52, - addr_ton = 0, addr_npi = 0, address_range = ''): - - Header.__init__(self, command_id = smpp_const.OUTBIND, - command_status = smpp_const.ESME_ROK, - sequence_number = sequence_numb) - - self.system_id = part.SystemID(system_id) - self.password = part.Password(password) - - self.body = [self.system_id, self.password] - -class UnBind(Header): - def __init__(self, sequence_numb): - Header.__init__(self, command_id = smpp_const.UNBIND, - command_status = smpp_const.ESME_ROK, - sequence_number = sequence_numb) - -class UnBindResp(Header): - def __init__(self, sequence_numb): - Header.__init__(self, command_id = smpp_const.UNBIND_RESP, - command_status = smpp_const.ESME_ROK, - sequence_number = sequence_numb) - -class GenericNack(Header): - def __init__(self, command_stat, sequence_numb): - Header.__init__(self, command_id = smpp_const.GENERIC_NACK, - command_status = command_stat, - sequence_number = sequence_numb) - -class SubmitSM(Header): - def __init__(self, sequence_numb, - dest_addr_ton, dest_addr_npi, - destination_addr, esm_class, - protocol_id, priority_flag, - registered_delivery, replace_if_present_flag, - data_coding, sm_length, short_message, - - service_type = smpp_const.ESME_ROK, - source_addr_ton = 0, source_addr_npi = 0, - source_addr = '', schedule_delivery_time = '', - validity_period = '', sm_default_msg_id = 0, - - ): - Header.__init__(self, command_id = smpp_const.SUBMIT_SM, - command_status = smpp_const.ESME_ROK, - sequence_number = sequence_numb) - self.service_type = part.ServiceType(service_type) - - -class EnquireLink(Header): - def __init__(self, sequence_numb): - Header.__init__(self, command_id = smpp_const.ENQUIRE_LINK, - command_status = smpp_const.ESME_ROK, - sequence_number = sequence_numb) - - -class EnquireLinkResp(Header): - def __init__(self, sequence_numb): - Header.__init__(self, command_id = smpp_const.ENQUIRE_LINK_RESP, - command_status = smpp_const.ESME_ROK, - sequence_number = sequence_numb) - - -class Client(asyncore.dispatcher): - def __init__(self, host, port, bind): - asyncore.dispatcher.__init__(self) - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self.connect( (host, port) ) - self.bind = bind - self.send_buf = '' - self.recv_buf = '' - self.sequence_number = 0 - self.enquire_time = 0 - - def handle_connect(self): - self.bind.sequence_number(self.sequence_number) - self.send(binascii.a2b_hex(self.bind.format_message())) - self.sequence_number += 1 - self.enquire_time = time.time() - - def handle_close(self): - self.close() - - def handle_read(self): - data = self.recv(4) - length = int(binascii.b2a_hex(data),16) - raw_pdu = self.recv(length - 4) - a = data + raw_pdu - print binascii.b2a_hex(a) - - def handle_write(self): - if time.time() - self.enquire_time >= 10: - self.send(binascii.unhexlify(EnquireLink(self.sequence_number).format_message())) - self.sequence_number +=1 - self.enquire_time = time.time() - - - -if __name__ == '__main__': - - bind = BindTransmitter(10, system_id = 'denis', password = 'buga', addr_npi = 1, addr_ton = 2) - #print BindTransmitterResp(10).format_message() - #print BindReceiver(10, system_id = 'denis', password = 'buga', addr_npi = 1, addr_ton = 2).format_message() - #print BindReceiverResp(10, sc_interface_version = 52).format_message() - #print BindTranceiver(10, system_id = 'denis', password = 'buga', addr_npi = 1, addr_ton = 2).format_message() - #print BindTranceiverResp(10, command_stat = smpp_const.ESME_RBINDFAIL, sc_interface_version = 52).format_message() - #print OutBind(10, password = 'buga').format_message() - #print UnBind(10).format_message() - #print UnBindResp(10).format_message() - #print GenericNack(smpp_const.ESME_RALYBND, 10).format_message() - - client = Client('localhost', 8003, bind) - - - asyncore.loop() diff --git a/src/smpp_parts.py b/src/smpp_parts.py deleted file mode 100644 index bc5e93e..0000000 --- a/src/smpp_parts.py +++ /dev/null @@ -1,376 +0,0 @@ -import smpp_const - -class CommandLength(object): - - def __call__(self, param_order): - return hex(sum([len(i) for i in param_order])+16).replace('0x', '').zfill(8) - -class CommandID(object): - #Must check if is a valid command_id - def __init__(self, value): - self._value = value - - def __call__(self, value = None): - if value == None: - return self._value - else: - self._value = value - -class CommandStatus(object): - #Must check if is a valid command_status - def __init__(self, value): - self._value = value - - def __call__(self, value = None): - if value == None: - return self._value - else: - self._value = value - -class SequenceNumber(object): - def __init__(self, value): - self._value = hex(value).replace('0x', '').zfill(8) - - def __call__(self, value = None): - if value == None: - return self._value - else: - self._value = hex(value).replace('0x', '').zfill(8) - -class Parameter(object): - def __init__(self, type_, value, max_size, min_size = 0): - self.type = type_ - self.max_size = max_size - self.min_size = min_size - self.set_value = {'string':self._string_parser, - 'int':self._int_parser, - 'bit':self._bit_parser}.get(type_) - self.set_value(value) - - def _string_parser(self, value): - self._value = value.encode('hex') - - if len(self._value) > self.max_size: - raise ValueError(self.__class__.__name__+' cannot exceed '+str(self.max_size)+' characters') - elif len(self._value) < self.min_size: - raise ValueError(self.__class__.__name__+' cannot be less than '+str(self.max_size)+' characters') - self._value = '%s00' % (self._value) - - def _int_parser(self, value): - self._value = hex(value).replace('0x', '').zfill(2) - if len(self._value) > self.max_size: - raise ValueError(self.__class__.__name__+' cannot exceed 255 as value (00 - ff)') - - def _bit_parser(self, value): - self._value = value.zfill(2) - if self._value not in ('00', '01', '10', '11'): - raise ValueError(self.__class__.__name__+' Bit mask wrong value') - - def __len__(self): - return len(self._value)/2 - - def __call__(self, value = None): - if value == None: - return self._value - else: - self.set_value(value) - -class IntParameter(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'int', value, 2) - -class TLV(object): - def __init__(self, parameter_tag, type_, value, max_size, min_size = 0): - - self.parameter_tag = parameter_tag - if value: - self.value = Parameter(type_, value, max_size, min_size) - self.length = len(self.value) - else: - self.value = None - self.length = 0 - - def __len__(self): - if self.value: - return 4 + self.length - else: - return 0 - - def __call__(self, value = None): - if value == None: - return '%s%s%s' % (self.parameter_tag, hex(len(self.value)).replace('0x', '').zfill(4), self.value()) - else: - self.value(value) - self.length = len(self.value) - - -class SystemID(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'string', value, 32) - -class Password(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'string', value, 18) - -class SystemType(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'string', value, 26) - -class InterfaceVersion(IntParameter): - pass - -class AddrTon(IntParameter): - pass - -class AddrNpi(IntParameter): - pass - -class AddressRange(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'string', value, 82) - -class ServiceType(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'string', value, 12) - -class SourceAddrTon(IntParameter): - pass - -class SourceAddrNpi(IntParameter): - pass - -class SourceAddr(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'string', value, 42) - -class DestAddrTon(IntParameter): - pass - -class DestAddrNpi(IntParameter): - pass - -class DestinationAddr(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'string', value, 42) - -class EsmClass(IntParameter): - pass - -class ProtocolID(IntParameter): - pass - -class PriorityFlag(IntParameter): - pass - -class ScheduleDeliveryTime(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'string', value, 34, min_size = 2) - -class ValidityPeriod(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'string', value, 34, min_size = 2) - -class RegisteredDelivery(IntParameter): - pass - -class ReplaceIfPresentFlag(IntParameter): - pass - -class DataCoding(IntParameter): - pass - -class SmDefaultMsgID(IntParameter): - pass - -class SmLength(IntParameter): - pass - -class ShortMessage(Parameter): - def __init__(self, value): - Parameter.__init__(self, 'string', value, 508) - -class DestAddrSubunit(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.DEST_ADDR_SUBUNIT, 'int', value, 2) - -class SourceAddrSubunit(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SOURCE_ADDR_SUBUNIT, 'int', value, 2) - -class DestNetworkType(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.DEST_NETWORK_TYPE, 'int', value, 2) - -class SourceNetworkType(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SOURCE_NETWORK_TYPE, 'int', value, 2) - - -class DestBearerType(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.DEST_BEARER_TYPE, 'int', value, 2) - -class SourceBearerType(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.DEST_BEARER_TYPE, 'int', value, 2) - - -class DestTelematicsID(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.DEST_TELEMATICS_ID, 'int', value, 4) - - -class SourceTelematicsID(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SOURCE_TELEMATICS_ID, 'int', value, 2) - - -class QosTimeToLive(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.QOS_TIME_TO_LIVE, 'int', value, 8) - - -class PayloadType(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.PAYLOAD_TYPE, 'int', value, 2) - -class AdditionalStatusInfoText(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.ADDITIONAL_STATUS_INFO_TEXT, 'string', value, 512, min_size = 2) - -class ReceiptMessageID(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.RECEIPTED_MESSAGE_ID, 'string', value, 130, min_size = 2) - -class MsMsgWaitFacilities(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.MS_MSG_WAIT_FACILITIES, 'bit', value, 2) - - -class PrivacyIndicator(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.PRIVACY_INDICATOR, 'int', value, 2) - -class SourceSubaddress(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SOURCE_SUBADDRESS, 'string', value, 56, min_size = 4) - -class DestSubaddress(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.DEST_SUBADDRESS, 'string', value, 56, min_size = 4) - -class UserMessageReference(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.USER_MESSAGE_REFERENCE, 'int', value, 4) - -class UserResponseCode(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.USER_RESPONSE_CODE, 'int', value, 2) - -class LanguageIndicator(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.LANGUAGE_INDICATOR, 'int', value, 2) - -class SourcePort(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SOURCE_PORT, 'int', value, 4) - -class DestinationPort(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.DESTINATION_PORT, 'int', value, 4) - -class SarMsgRefNum(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SAR_MSG_REF_NUM, 'int', value, 4) - -class SarTotalSegments(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SAR_TOTAL_SEGMENTS, 'int', value, 2) - - -class SarSegmentSeqnum(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SAR_SEGMENT_SEQNUM, 'int', value, 2) - - -class SCInterfaceVersion(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SC_INTERFACE_VERSION, 'int', value, 2) - -class DisplayTime(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.DISPLAY_TIME, 'int', value, 2) - - -class MsTime(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.MS_VALIDITY, 'int', value, 2) - -class DpfResult(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.DPF_RESULT, 'int', value, 2) - -class SetDpf(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SET_DPF, 'int', value, 2) - -class MsAvailabilityStatus(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.MS_AVAILABILITY_STATUS, 'int', value, 2) - -class NetworkErrorCode(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.NETWORK_ERROR_CODE, 'string', value, 6) - -class MessagePayload(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.MESSAGE_PAYLOAD, 'string', value, 1024) - -class DeliveryFailureReason(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.DELIVERY_FAILURE_REASON, 'int', value, 2) - -class MoreMessagesToSend(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.MORE_MESSAGES_TO_SEND, 'int', value, 2) - -class MessageState(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.MESSAGE_STATE, 'int', value, 2) - -class CallbackNum(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.CALLBACK_NUM, 'string', value, 38, min_size = 8) - -class CallbackNumPresInd(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.CALLBACK_NUM_PRES_IND, 'bit', value, 2) - -class CallbackNumAtag(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.CALLBACK_NUM_ATAG, 'string', value, 130) - -class NumberOfMessages(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.NUMBER_OF_MESSAGES, 'int', value, 2) - -class SmsSignal(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.SMS_SIGNAL, 'int', value, 4) - -class AlertOnMessageDelivery(TLV): - def __init__(self): - TLV.__init__(self, smpp_const.ALERT_ON_MESSAGE_DELIVERY, 'string', '', 0) - -class ItsReplayType(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.ITS_REPLY_TYPE, 'int', value, 2) - -class ItsSessionInfo(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.ITS_SESSION_INFO, 'string', value, 4) - -class UssdServiceOp(TLV): - def __init__(self, value): - TLV.__init__(self, smpp_const.USSD_SERVICE_OP, 'string', value, 2) -