CSN1.info logo by Dafocus

Introduction

The CSN.1 formal language has been introduced by 3GPP at the end of the 90's to describe mostly the encoded format of GSM L3 messages.
Before that, those encoding were expressed only by mean of various unformal tables and text parts, describing the meaning of each bit.

The goals of CSN.1 were to:

  • have a unified language for all the description;
  • describe the encoding formally;
  • encourage the creation of automatic encoding/decoding generators;
An example of CSN.1, just to see how it looks like, is the following:

From 3GPP TS 44.060 V6.7.0 (2004-05), chapter 11.2.5b Packet DBPSCH Assignment:
< Packet DBPSCH Assignment message content > ::=
  < PAGE_MODE : bit (2) >
  { 0 | 1 <PERSISTENCE_LEVEL : bit (4) > * 4 }
  { { 0 < Global TFI : < Global TFI IE > >
    | 10  < G-RNTI : bit (32) > 
    | 11  < Packet Request Reference : < Packet Request Reference IE >> }
    { 0                     -- Message escape
      { < CHANNEL_DESCRIPTION : < Channel Description struct >>
        { 0 | 1 < TIMING_ADVANCE_VALUE : bit (8) > }
        < NETWORK_RESPONSE_TIMES : < Network Response Times struct >>
        < padding bits >          -- truncation at end of message allowed, bits '0' assumed
        ! < Non-distribution part error : bit (*) = < no string > > }
      ! < Message escape : 1 bit (*) = <no string> > }
    ! < Address information part error : bit (*) = < no string > > }
  ! < Distribution part error : bit (*) = < no string > > ;

< Channel Description struct > ::=
  < CHANNEL_TYPE : bit (6) >
  < DOWNLINK_TIMESLOT_ALLOCATION : bit (8) >
  { 0                               -- Symmetric uplink and downlink timeslot allocation
  | 1   < UPLINK_TIMESLOT_ALLOCATION : bit (8) > } -- Asymmetric uplink and downlink timeslot allocation
  { 0 | 1   < USF : bit (3) >
      < USF_GRANULARITY : bit (1) > }
  < POWER_COMMAND : < Power Command struct > >
  { 0 | 1 < CHANNEL_MODE : bit (8) > }
  < TSC : bit (3) >
  { 0 < MAIO : bit (6) >
    < HSN : bit (6) >
  | 1 < ARFCN : bit (10) > } ;

Bit stream

CSN.1 works with a logical stream of bits.
The stream is made of bits that can assume two values: 0 or 1.
When transported by an octet stream, the first bit of the bitstream is the most significative bit of the first octet of the octet stream.

A CSN.1 definition can describe a string of bits with arbitrary length, including those that are not multiples of 8.

What CSN.1 defines and what it doesn't

A CSN.1 definition is about the syntax of a transmission. In other words, it explains what sequences of bits are valid and which are not.
Also, it defines where in the sequence are to be found the relevant information (i.e. the values) transported by the message.

CSN.1 does not define any semantics: therefore, the meaning of the transported values (and whether they make sense altogether or not) is defined elsewhere.

Example 1:
< foo bar > ::= 00010010;
In example 1, the "foo bar" definition defines a fixed value, 0x12. When encoding, it always sends 0x12; when decoding, it expects a single octet set to 0x12, otherwise it will not be considered as valid.

Example 2:
< xyz > ::= 0000 {0001 | 0010};
In example 2, the "xyz" definition defines two possible 8-bit values, 0x01 and 0x02. When decoding, it expects a single octet either set to 0x01 or 0x02, otherwise it will not be considered as valid. When encoding, it will allow to encode 0x01 or 0x02.
Please note that the definition above does not define when to encode 0x01 or 0x02: it just says that both values are syntactically correct. It is up to the application to know when to send one or the other.