Monday, January 30, 2017

Partial/Selective Decoding

These days, many critical applications require real time processing of large volumes of data/messages. Often only the data contained in a few selected fields is of value.

Some such application areas include Big Data, Self Optimizing Networks (SON), Lawful Interception, Routers, Protocol Analyzers, V2X, etc. Big Data is characterized by three main elements - the “3Vs”, volume, variety, and velocity. Extremely large and complex data sets (volume) of different types and natures (variety) need to be processed in real time at very fast rates (velocity). SONs need to process in real time, huge numbers of messages received from different nodes. V2X applications need to work with huge amounts of data received from both vehicles and the roadside infrastructure.

When designing such applications, you will be challenged to process a few selected fields contained within a large set of ASN.1 messages at very fast rate without traversing the complex message structures. In addition, you may need to modify some of those fields without decoding and re-encoding the entire message. OSS’ new partial/selective decoding feature is specifically targeted to meet these requirements.

The partial/selective decoding feature of the OSS ASN.1 Tools is very easy to use. Simply mark the fields in your ASN.1 specification that  you are interested in decoding, and for each field specify a callback function which you want the decoder to invoke after decoding the field. That’s it! You are done. No need to decode the whole message, no need to traverse a complex decoded structure value to find the fields of interest. The decoder will start decoding the message, reach the first field as fast as possible, and call the callback function with the decoded value, along with its offset and length within the encoded message. The decoder will repeat this process for each of the marked fields. You can also instruct the decoder to skip the decoding of the remaining fields after decoding a particular field. This functionality is useful in implementing conditional decoding logic.

Here is a little insight into the implementation of the partial/selective decoding feature. The OSS ASN.1 Tools offer two directives OSS.DataCallback and OSS.InfoCallback to support this feature. The former should be applied to all fields you are interested in decoding. However, if a field is part of many types, the OSS.InfoCallback directive can be used to find which type contains the field being decoded. For example, if a ZipCode field is part of both the HomeAddress and CompanyAddress message and you are interested in decoding only the ZipCode of HomeAddress, you can mark ZipCode with the OSS.DataCallback directive, and HomeAddress and CompanyAddress with OSS.InfoCallback. The callback functions of the OSS.InfoCallback directives can be used to identify which ZipCode is being decoded.

In the callback function, it is also possible to change the encoding of a field within the encoded message. When the decoder invokes the callback function, along with the decoded value, it also returns the offset and length of the encoding of the field. If the encoding length of the modified value is same as the encoding length of its original value, the new encoding of the field can be updated in the message. This feature is useful for the router applications which need to update only an address field within the message. There is no need to decode the whole message, modify it, and re-encode it.

The partial/selective decoding feature can be used along with traditional (full) decoding, or the Tools can be instructed to generate code only for the partial/selective decoding feature. The latter significantly reduces the footprint, for it generates only code sufficient to decode the marked fields.

Please refer to this link for detailed technical information about this feature. If you are interested in a trial of this feature, you can download the trial tools, or contact OSS at info@oss.com. This feature is currently supported in the ASN.1/C and ASN.1/C++ Tools.