A formal notation for describing messages in binary protocols
Messages in binary protocols are often defined using ad hoc encodings. They are especially prevalent in bandwidth constrained systems such as wireless protocols where bit efficiency is important. These messages cannot be easily described using existing message description languages such as ASN.1, or in the case of CSN.1, the notation does not support message parser generation well.
Without a formal notation to capture this type of messages, they are often described informally using tables, illustrations, and plain English. This forces software engineers to implement the message parsing code by hand. Some standards define a large number of messages, many of which have complicated structures. Hand coding these parsers leads to long development cycles and error-prone code.
All that has changed with the introduction of the Transfer Syntax Notation One (TSN.1). The notation is designed specifically for messages that require flexible and custom encoding. TSN.1 enables system designers to define a message directly in terms of the actual bit sequence transmitted. In various literatures, this is often referred as the concrete or transfer syntax of a message. As demonstrated by our flagship product, TSN.1 Compiler (patent pending), software development tools can be used to automatically generate message parsers.
As illustrated in the following examples, message in many existing network communication standards can be naturally expressed in TSN.1. For a complete specification of TSN.1, please refer to the TSN.1 Specification document.
TCPHeader() ::=
{
SourcePort 16;
DestinationPort 16;
SequenceNumber 32;
AcknowledgementNumber 32;
HLen 4;
reserve 6;
// Code Bits
URG 1;
ACK 1;
PSH 1;
RST 1;
SYN 1;
FIN 1;
Window 16;
CheckSum 16;
UrgentPointer 16;
Options (HLen - 5) * 32;
}
IPHeader() ::=
{
Version 4;
HLen 4;
ServiceType 8;
TotalLength 16;
Identifcation 16;
Flags 3;
FragmentOffset 13;
TimeToLive 8;
Protocol 8;
HeaderCheckSum 16;
SourceIPAddress 32;
DestinationIPAddress 32;
Options (HLen - 5) * 32;
}
is2000_fdsch_HDM() ::=
{
USE_TIME 1;
ACTION_TIME 6;
HDM_SEQ 2;
SRCH_WIN_A 4;
T_ADD 6;
T_DROP 6;
T_COMP 4;
T_TDROP 4;
FRAME_OFFSET 4;
PRIVATE_LCM 1;
RESET_L2 1;
ENCRYPT_MODE 2;
FREQ_INCL 1;
if(FREQ_INCL == 1)
{
CDMA_FREQ 11;
}
PILOTS[] :
{
PILOT_PN 9;
PWR_COMB_IND 1;
CODE_CHAN 8;
}
}
is856_rup_TrafficChannelAssignment() ::=
{
var N 4;
MessageSequence 8;
ChannelIncluded 1;
if(ChannelIncluded == 1)
{
Channel :
{
SystemType 8;
BandClass 5;
ChannelNumber 11;
}
}
FrameOffset 4;
DRCLength 2;
DRCChannelGain 6;
AckChannelGain 6;
NumPilots 4;
Pilots[NumPilots] :
{
PilotPN 9;
SofterHandoff 1;
MACIndex 6;
DRCCover 3;
RABLength 2;
RABOffset 3;
if(SofterHandoff == 0)
{
N = N + 1;
}
}
optional RELEASE_A :
{
MACIndexMSBsIncluded 1;
if(MACIndexMSBsIncluded == 1)
{
MACIndexMSBs[NumPilots] :
{
MACIndexMSB 1;
RAChannelGain 2;
}
DSCChannelGain 5;
DSC[N] 3;
}
}
}
ts24008_AttachRequest() ::=
{
SkipIndicator 4 = 0x0; // 0000
ProtocolDiscriminator 4 = 0x8; // 1000
MessageType 8 = 0x1; // 00000001
MSNetworkCapability : ts24008_MSNetworkCapabilityIE;
CipheringKeySequence : ts24008_CipheringKeySequenceIE;
AttachType : ts24008_AttachTypeIE;
DRXParameter : ts24008_DRXParameterIE;
PTMSIorIMSI : ts24008_MobileIdentityIE;
OldRoutingAreaId : ts24008_RoutingAreaIdIE;
MSRadioAccessCapability : ts24008_MSRadioAccessCapabilityIE;
OptionalIES[] : // variable number of optional IEs
{
IEI_MSN 4; // IEI most significant nible
if(IEI_MSN == 9) // TMSI Status
{
reserve 3;
TMSIFlag 1;
}
else
{
IEI_LSN 4; // IEI least significant nible
IE : case (IEI_MSN << 4 | IEI_LSN) of
{
0x19 => OldPTMSISignature : ts24008_PTMSISignatureIE;
0x17 => RequestedReadyTimer : ts24008_GPRSTimerIE;
0x33 => PSLCSCapability : ts24008_PSLCSCapabilityIE;
_ => UnknownIE : ts24008_UnknownIE;
}
}
}
}
wifi_mac_CapabilityInformation() ::=
{
ESS 1;
IBSS 1;
CFPollable 1;
CFPollRequest 1;
Privacy 1;
ShortPreamble 1;
PBCC 1;
ChannelAgility 1;
reserve 2;
ShortSlotTime 1;
reserve 2;
DSSS_OFDM 1;
reserve 2;
}
wimax_mac_ARQFeedbackIE() ::=
{
CID 16;
LAST 1;
ACKType 2;
BSN 11;
NumACKMaps 2;
if(ACKType != 1)
{
ACKMaps [ NumACKMaps + 1 ] : // Array of ACKMaps
{
if(ACKType != 3)
{
SelectiveACKMap 16;
}
else
{
SequenceFormat 1;
if(SequenceFormat == 0)
{
SequenceACKMap 2;
Sequence1Length 6;
Sequence2Length 6;
reserve 1;
}
else
{
SequenceACKMap 3;
Sequence1Length 4;
Sequence2Length 4;
Sequenc32Length 4;
}
}
}
}
if(LAST != 1)
{
Next : wimax_mac_ARQFeedbackIE; // Recursion
}
}