Hi all !
Here is the first draft of the kannel protocol, any help/comments will
be highly appreciated !
== Oscar
Tashi Delek
Kannel Protocol Description
Packet description, draft v0.1
Description by:
Oscar Medina Duarte
{moscar}[at]gmail.com
Protocol Description
This protocol has been designed with the purpose of mantaining a connection
between kannel bearerbox and another box, tipically an smsbox and/or a wapbox.
Kannel protocol session:
A session is initated when a kannel box client requests to connect to a bearer
box and sends an administration command requesting to be identified.
And finishes when the bearer box request's the client box to shutdown or reset.
During the session, both parts can request heartbeats to each other to ensure
that the link is up and to measure the round trip of packages, wich is not yet
hanled by the current implementation of the protocol.
Kannel session to a smsbox
When a smsbox has established a session, it will send and receive sms packets
wich contain a short message, a destination (MT) address, a source (MO) address
and an identification number, among other fields.
Kannel session to a wapbox
When a wap box has established a session, it will send and receive wdp datagrams
though the connection containing, the source and destination's ports and
addresses, and user data.
Protocol's Operations
Heartbeating
Sms boxing
Wap boxing
Packet BNF:
<message> := <lenght><type><packet>
<packet> := <heartbeat_packet> | <admin_packet> | <sms_packet> |
<ack_packet> | <wdp_datagram_packet>
<heartbeat_packet> := <load>
<admin_packet> := <adm_comand><boxc_id>
<sms_packet> := <sender><receiver><udhdata><msgdata><time>\
<smsc_id><service><account><uuid><sms_type>\
<mclass><mwi><coding><compress><validity>\
<deferred><dlr_mask><dlr_url><pid><alt_dcs>\
<rpi><charset><boxc_id><binfo><msg_left><priority>
<ack_packet> := <nack><time><uuid>
<wdp_datagram_packet> := <source_address><source_port>\
<destination_address><destination_port>\
<user_data>
<lenght> := <INT>
<type> := <INT>
<load> := <INT>
<adm_comand> := <INT>
<boxc_id> := <STRING>
<sender> := <STRING>
<receiver> := <STRING>
<udhdata> := <STRING>
<msgdata> := <STRING>
<time> := <INT>
<smsc_id> := <STRING>
<service> := <STRING>
<account> := <STRING>
<sms_type> := <INT>
<mclass> := <INT>
<mwi> := <INT>
<coding> := <INT>
<compress> := <INT>
<validity> := <INT>
<deferred> := <INT>
<dlr_mask> := <INT>
<dlr_url> := <STRING>
<pid> := <INT>
<alt_dcs> := <INT>
<rpi> := <INT>
<charset> := <STRING>
<binfo> := <STRING>
<msg_left> := <INT>
<priority> := <INT>
<nack> := <INT>
<source_address> := <STRING>
<source_port> := <INT>
<destination_address> := <STRING>
<destination_port> := <INT>
<user_data> := <STRING>
<uuid> := <lenght><UUID>
<STRING> := <lenght><OctetString>
<UUID> := BYTE{16}
<INT> := BYTE{4}
<OctetString> := BYTE*
Protocol's Glossary
message .- Is the unit of data trasmited over a link in a box to box session.
packet .- Is the biggest meaningful part transmited by a box.
heartbeat_packet .- Is the kind of packet used for the heartbeating operation.
admin_packet .- Is the kind of packet used to send commands among boxes.
sms_packet .- Is the kind of packet used to transfer SMS messages.
ack_packet .- Is the packet used to send acknowledges.
wdp_datagram_packet .- Is the packet to carry wdp datagrams.
lenght .- It is the number of bytes left plus one.
type .- Is the type of packet contained in a message.
Package types:
0 = heartbeat
1 = admin
2 = sms
3 = ack
4 = wdp_datagram
5 = msg_type_count
load .-
adm_comand .- Is the command contained by an admin command.
Admin commands:
cmd_shutdown = 0
cmd_suspend = 1
cmd_resume = 2
cmd_identify = 3
cmd_restart = 4
boxc_id .- It is the client box ID
sender .- Is the address of the originating entity of an sms message.
receiver .- Is the address of the destination for an sms message
udhdata .- User Data Header.
msgdata .- Is the data contained in a sms message, generally text.
time .-
smsc_id .- Is the internal name of the smsc link that received the sms message
or the smsc link that should send the message.
service .-
account .-
sms_type .- It indicates the type of sms message.
SMS types:
mo = 0,
mt_reply = 1,
mt_push = 2,
report_mo = 3,
report_mt = 4
mclass .-
mwi .-
coding .-
compres .-
validity .-
deferred .-
dlr_mask .-
dlr_url .-
pid .-
alt_dcs .-
rpi .-
charset .- It indicates the Charset used to encode the SMS message's data
binfo .-
msg_left .-
priority .-
nack .- It indicates the ack status in a ack packet.
Ack status:
ack_success = 0,
ack_failed = 1,
ack_failed_tmp = 2,
ack_buffered = 3
source_address .- It is the originating IP address of the datagram.
source_port .- Is is the originating port of the datagram.
destination_address .- It is the destination address for the datagram.
destination_port .- It is the destination port for the datagram.
user_data .- It is the data inside the datagram.
uuid .- UUID plus a 4 byte lenght heading the field.
STRING .- It is and octet string leaded by a 4 byte lenght field.
UUID .- Universal Unique IDentifier defined by the IETF
(http://www1.ics.uci.edu/~ejw/authoring/uuid-guid/draft-leach-uuids-guids-01.txt)
INT .- It is a 4 byte signed integer.
OctetString .- It is an array of 8 bit bytes.