Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Rules for Encoding/Decoding

Rules for Encoding/Decoding 27 Sep 2004 07:11 #6764

Hi,

I have couple of questions regarding Codecs system on TTCN-3 system.

1) How can I use multiple Encoder/Decoders in a TTCN-3 system ?

2) I have seen "Encode with " in the TTCN-3 specification. If this is the way to
specify different codecs, then How can I write Encoding Rules ?

Any example will really help. Thanks in advance.

Regards,
Satish
The administrator has disabled public write access.

Rules for Encoding/Decoding 27 Sep 2004 13:10 #6767

  • Antti Hyrkk
  • Antti Hyrkk's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 43
  • Karma: 0
>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.]On Behalf Of ext Gvks Satish-a14577
> Sent: Monday, September 27, 2004 09:12 AM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Rules for Encoding/Decoding
> Hi,
>
> I have couple of questions regarding Codecs system on TTCN-3 system.
>
> 1) How can I use multiple Encoder/Decoders in a TTCN-3 system ?

How exactly you can use them is tool specific.

Either the tool provides you a set of codecs or you have to write your
own. If you write your own codecs, you might want to look at the ETSI
standard ETSI ES 201 873-6 - TTCN-3 Control Interface (TCI), and from
there the TCI Coding/Decoding Interface (TCI-CD) part, which "
includes all operations needed to retrieve and access codecs, i.e.
encoders or decoders, for encoding data to be sent, defined using the
TTCN-3 encode attribute, and to decode received data"

Somehow the TTCN-3 tool you use has to know what your codecs are
and when they should be used. This is not specified in the standard.
The tool might ask from you with some method what is the codec it
should assign A) to a certain encode-attribute value, B) to a type
identifier, C) to a type class, or maybe this is done in some
other way. Anyway, it depends on the tool how this is done.

Example for A:

A codec named C is assigned encode-attribute value "E". C is used with
every type, that has this encode attribute.

Example for B:

A codec named C is assigned to type identifier T. C is used whenever
a value of type T is encoded or decoded.

Example for C:

A codec named C is assigned to type class RECORD. C is used whenever
a value, whose type class is RECORD, is encoder or decoded.

> 2) I have seen "Encode with " in the TTCN-3 specification. If this is
> the way to specify different codecs, then How can I write Encoding
> Rules ?

You can assign encode- and variant-attributes to TTCN-3 language
elements. With encode-attribute you can tell your TTCN-3 tool what kind
of encoding and decoding you want to use. Based on these attributes,
or by some other means, the TTCN-3 tool you are using uses the right
codecs. How it knows to call the right codec depends on the tool
(look at those A, B, C examples).

For example, there could be a type definition

type hexstring HexSequence with { encode "Repeated"; variant "5" }

When a I create a value of that type like below

var HexSequence hexSeq = '01AB'H;

and I send it to the SUT, what I want to be sent is a repeated
sequence of byte values 0 1 A B as many times as I have specified in
the variant attribute. So hexSeq would be encoded as

01AB01AB01AB01AB01AB

The name of my own encoder which does this kind of encodings is
"Repeated", and by defining encode-attribute value "Repeated" to the
type MyHexSequence, I am trying to tell the TTCN-3 tool that it should
use my codec. So the rule in this case is the name of my codec, but it
does not have to be name of a codec. It can be any textual instructions
which somehow get translated to a codec, or maybe to several codecs.
It can be a URL of a web page from which the tool retrieves further
encoding instructions for the type if that's the way the tool works.

Another type definition could be

type hexstring MyTlvHexString with { encode "TypeLengthValue" }

The encode attribute value "TypeLengthValue" refers to a codec, which
encodes values in format type, length, value.

So

var TlvHexString hexStr = '01AB'H;

might be encoded as byte string

01 02 01 AB

in which first 01 would mean type "hexstring", 02 would be the length of
the value part in bytes. 01 AB would be the value.


BR
Antti
The administrator has disabled public write access.

Rules for Encoding/Decoding 28 Sep 2004 06:03 #6771

Hello Antti,

Thanks a lot for your detailed mail. Most of my doubts are clear after reading
your mail.

Thanks & Regards,
Satish

Original Message
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Antti Hyrkkanen
Sent: Monday, September 27, 2004 6:40 PM
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Rules for Encoding/Decoding


>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.]On Behalf Of ext Gvks Satish-a14577
> Sent: Monday, September 27, 2004 09:12 AM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Rules for Encoding/Decoding
> Hi,
>
> I have couple of questions regarding Codecs system on TTCN-3 system.
>
> 1) How can I use multiple Encoder/Decoders in a TTCN-3 system ?

How exactly you can use them is tool specific.

Either the tool provides you a set of codecs or you have to write your own. If
you write your own codecs, you might want to look at the ETSI standard ETSI ES
201 873-6 - TTCN-3 Control Interface (TCI), and from there the TCI
Coding/Decoding Interface (TCI-CD) part, which " includes all operations needed
to retrieve and access codecs, i.e. encoders or decoders, for encoding data to
be sent, defined using the TTCN-3 encode attribute, and to decode received data"

Somehow the TTCN-3 tool you use has to know what your codecs are and when they
should be used. This is not specified in the standard. The tool might ask from
you with some method what is the codec it should assign A) to a certain encode-
attribute value, B) to a type identifier, C) to a type class, or maybe this is
done in some other way. Anyway, it depends on the tool how this is done.

Example for A:

A codec named C is assigned encode-attribute value "E". C is used with every
type, that has this encode attribute.

Example for B:

A codec named C is assigned to type identifier T. C is used whenever a value of
type T is encoded or decoded.

Example for C:

A codec named C is assigned to type class RECORD. C is used whenever a value,
whose type class is RECORD, is encoder or decoded.

> 2) I have seen "Encode with " in the TTCN-3 specification. If this is
> the way to specify different codecs, then How can I write Encoding
> Rules ?

You can assign encode- and variant-attributes to TTCN-3 language elements. With
encode-attribute you can tell your TTCN-3 tool what kind of encoding and
decoding you want to use. Based on these attributes, or by some other means, the
TTCN-3 tool you are using uses the right codecs. How it knows to call the right
codec depends on the tool (look at those A, B, C examples).

For example, there could be a type definition

type hexstring HexSequence with { encode "Repeated"; variant "5" }

When a I create a value of that type like below

var HexSequence hexSeq = '01AB'H;

and I send it to the SUT, what I want to be sent is a repeated sequence of byte
values 0 1 A B as many times as I have specified in the variant attribute. So
hexSeq would be encoded as

01AB01AB01AB01AB01AB

The name of my own encoder which does this kind of encodings is "Repeated", and
by defining encode-attribute value "Repeated" to the type MyHexSequence, I am
trying to tell the TTCN-3 tool that it should use my codec. So the rule in this
case is the name of my codec, but it does not have to be name of a codec. It can
be any textual instructions which somehow get translated to a codec, or maybe to
several codecs. It can be a URL of a web page from which the tool retrieves
further encoding instructions for the type if that's the way the tool works.

Another type definition could be

type hexstring MyTlvHexString with { encode "TypeLengthValue" }

The encode attribute value "TypeLengthValue" refers to a codec, which encodes
values in format type, length, value.

So

var TlvHexString hexStr = '01AB'H;

might be encoded as byte string

01 02 01 AB

in which first 01 would mean type "hexstring", 02 would be the length of the
value part in bytes. 01 AB would be the value.


BR
Antti
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin