Dafocus logo a&apm;b logo

Encodix Access module

Encodix standard C module is designed to produce a static C structure meant to be manually accessed by the programmer.
This suites the needs of a standard application, where each field is treated by a specific piece of code which is implementing the protocol.
Other applications, instead, have different needs.
Let's think of the case of a "message editor". This application runs on a host machine and allows the user to compose test messages by setting all the values manually: the application then encodes such messages into their binary form on a file; viceversa, the same application must be able to take a binary message and to present it in readable form to the user, for examination or further editing.

The static structures produced by the standard Encodix C module would make the development of our "message editor" quite annoying.
In fact it would force us to manually writing specific code for each specific message, information element and down to each subfield, just because we have to access the structures. This approach, applied to our "message editor" example, could partially nullify the advantage of having the automatic code generation of Encodix, because it would force us to maintain both Encodix source files and the editor code.

Here is where the Access module comes in.

Basic concepts

The Access module generates C++ code that implements two concepts: type description and data description. We define the following Encodix source file as an exaple:

gsm-0407 LOCATION_UPDATING_REQUEST {
  ProtocolDiscriminator = 0101;
  MessageType           = xx001000;

   LocationUpdatingType   M V   1/2 integer;     
   CiphKeySequenceNum     M V   1/2 integer;     
   LocationAreaId         M V   5   LocationAreaId; 
   MobileStationClassmark M V   1   MobileStationClassmark1;
   MobileId               M LV  2-9 MobileId;
33 MobStatClsMrkForUmts   O TLV 5   MobileStationClassmark2;
};

bit-field MobileStationClassmark1 {
	size: 1 octets;
	bit 8:    spare void default = 0;
	bits 6-7: RevisionLevel integer;
	bit  5:   EsInd boolean;
	bit  4:   A5_1  boolean;
	bit 1-3:  RfPowerCapability integer;
}

Type description

Type description is a tree of C++ objects which describes the data types. For example, a type descriptor would say something like:
A LOCATION UPDATING REQUEST message is a structure containing the following fields: LocationUpdatingType, CiphKeySequenceNum, LocationAreaId, MobileStationClassmark, etcetera;
the LocationUpdatingType field contains a 4-bit integer;
the MobileStationClassmark, instead, is itself a structure: it contains RevisionLevel, a 2-bit integer, EsInd, a boolean etcetera.

The type descriptor above can be traversed by a program that has no knowledge of the "LOCATION UPDATING REQUEST"; our hypothetical "message editor" could use that description to dynamically create an appropriate dialog box for editing such messages.
If the description of the " LOCATION UPDATING REQUEST" message changes, we just need to re-run Encodix and recompile the "message editor" application.

Data description

Once we have dynamically designed our dialog box, the user can fill out all the fields. We still have a problem: ho do we transfer all this data to Encodix so it can encode it? And how do we access the data once Encodix has decoded a binary message?
This is addressed by the "data description". The "data description" is a tree of C++ objects describing the data itself; for example, a data descriptor would say something like:
We have a LOCATION UPDATING REQUEST message; the LocationUpdatingType field is 2, while the CiphKeySequenceNum is 7; the field EsInd of MobileStationClassmark is set to FALSE, while... etc.
Once again, the data description can be traversed by out program, which can use it to fill the dialog box fields.

Encodix description... >>>
The CSN.1 module... >>>
Generated languages... >>>
The generations process and examples... >>>