Smpp::Char; // 8 bit signed
(typedef char - used in a C-Octet string)
Smpp::String; // C-Octet string
(typedef std::basic_string)
Smpp::Uint8; // Octet (unsigned) (typedef
unsigned char)
Smpp::Uint16; // 16 bit unsigned integer (typedef unsigned
short)
Smpp::Uint32; // 32 bit unsigned integer(typedef unsigned
int)
Smpp::SubmitSm
pdu;
The parameters (with the exceptions of address and short message) can be
assigned to and from their underlining basic type e.g.std::string s =
"xyz";
Smpp::ServiceType servtype(s);
Smpp::String s1 =
servtype;
Smpp::DataCoding datacoding;
datacoding = 2;
int i =
datacoding;
The mandatory parameters can be set using operations with a similar name to
the parameter descriptions in the SMPP specification,
e.g.pdu.service_type("ABCDE");
Similarly the parameter value
can be accessed byconst Smpp::ServiceType& s =
pdu.service_type();
Smpp::SmeAddress
. It is composed of a TON, NPI and
address (Smpp::Ton
, Smpp::Npi
and
Smpp::Address
respectively). The address len defaults to 21
characters but can be changed by setting the len argument. The constructors
areSmpp::SmeAddress();
Smpp::SmeAddress(const Smpp::Ton& ton,
const Smpp::Npi& npi, const Smpp::Address& addr, size_t
len);
Smpp::SmeAddress(const Smpp::Address& addr, size_t
len);
const Smpp::Ton& ton() const;
const Smpp::Npi&
npi() const;
const Smpp::Address& address() const;
size_t length()
const;
Smpp::ShortMessage
which can be constructed
using/* Octet array and length */
Smpp::ShortMessage(Smpp::Uint8*
data, Smpp::Uint8 length);
/* C++ String (std::string)
*/
Smpp::ShortMessage(Smpp::String& data);
/* NULL terminated C string
*/
Smpp::ShortMessage(Smpp::Char* data);
Internally the data is stored as a std::vector<Smpp::Uint8> and can be
accessed as follows// a constance reference
const
std::vector<Smpp::Uint8>& sm = pdu.short_message();
//
therefore you can do the
following
pdu.short_message().size();
pdu.short_message().begin();
pdu.short_message().end();
insert_tlv(const
Smpp::Tlv&)
member function.Smpp::Tlv(Smpp::Uint16& tag,
Smpp::Uint16& length, Smpp::Uint8* value);
void insert_tlv( const
Smpp::Tlv& tlv );
Smpp::SubmitSm pdu;
Smpp::Tlv
tlv(Smpp::Tlv::message_payload, 5, "Hello");
pdu.insert_tlv(tlv);
There are also special TLV member functions for the different value
typesvoid insert_8bit_tlv(Smpp::Uint16 tag, const Smpp::Uint8
value);
void insert_16bit_tlv(Smpp::Uint16 tag, const Smpp::Uint16
value);
void insert_32bit_tlv(Smpp::Uint16 tag, const Smpp::Uint32
value);
void insert_string_tlv(Smpp::Uint16 tag, const Smpp::String&
value);
void insert_array_tlv(Smpp::Uint16 tag, Smpp::Uint16 length, const
Smpp::Uint8* value);
There are three ways of accessing TLVs. A user should not modify the TLVs
returned as it may corrupt the entire PDU.
(i) By accessing the entire list
(internally the TLVs are stored in a std::list<const Tlv*> list which is
typedef'd to TlvList.const TlvList& tlv_list()
const;
(ii) If it is possible to have more than one occurance of a TLV
use the member functionconst TlvList find_tlv_list(Uint16 tag)
const;
(iii) By accessing an individual elementconst Tlv*
find_tlv(Uint16 tag) const;
If in the first two cases there are no TLVs then the list will have zero elements, in the third case a 0 is returned.
A TLV can also be removed byvoid remove_tlv(Uint16 tag);