Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » TTCN-3 decoding hypothesis(ETSI ITS, BTP protocol)
TTCN-3 decoding hypothesis [message #1755105] Tue, 28 February 2017 08:24 Go to next message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Hi All,

I have some questions regarding RAW decoding.
My situation is the following:
1) I want to decode ETSI ITS BTP layer. This BTP layer can beof type BTP-A or BTP-B;
2) In my BTP_Port.cc file, I have an Event_Handler method which processes incoming BTP packets;
3) This method also calls the RAW decoding method based of the BTP port type;
3) Based on TTCN-3 TCI standard, I have a decoding hypothesis which indicates me the expected typing to be decoded

So here is my issue: The Event_Handler method has no information to select which kind of BTP is expected by the TTCN-3 receive() function (BTP-A or BTP-B). It is decoded as BTP-A. So, in my test case, if I'm expected a BTP-A, it's OK, the test is PASS. Unfortunately, if I'm expecting a BTP-B, the test is FAIL.

May I ask you some hints to fix these kinds of decoding issues?

Many thanks in advance for your support,

Best regards,

Yann Garcia
Senior Software Engineer
MCAD.net
**************************************
FSCOM
7 rue Soutrane - Garbejaire
F-06560 Sophia Antipolis cedex, FRANCE
************************************************
Tel: +33 (0)4 93 95 82 93
Tel: +33 (0)4 92 94 49 08
Mobile: +33 (0)7 61 00 77 05
Email: yann.garcia@fscom.fr
Skype: yann.garcia
Google+: garcia.yann@gmail.com
Re: TTCN-3 decoding hypothesis [message #1755112 is a reply to message #1755105] Tue, 28 February 2017 08:46 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Yann,

according to :

ETSI TS 102 636-5-1 V1.1.1 (2011-02)
Technical Specification
Intelligent Transport Systems (ITS);
Vehicular Communications;
GeoNetworking;
Part 5: Transport Protocols;
Sub-part 1: Basic Transport Protocol

index.php/fa/28598/0/


Lenard will give you details about encoding/decoding BTP.

Best regards
Elemer


  • Attachment: BTP.png
    (Size: 28.41KB, Downloaded 446 times)
Re: TTCN-3 decoding hypothesis [message #1755121 is a reply to message #1755105] Tue, 28 February 2017 09:24 Go to previous messageGo to next message
Lenard Nagy is currently offline Lenard NagyFriend
Messages: 54
Registered: September 2016
Member
Hi Yann,

This problem we have solved in this code with the variant specifications handled by Titan's RAWencoder:

//BTP-------------------------------------------------------------------------------
//BTPRequest

type record ExtBtpPayload {
  //DecodedBtpPayload decodedPayload optional,
  BtpRawPayload rawPayload
} with { variant "" };

type record ExtBtpReq {
  OCT1           nextheader,
  BtpHeader      header,
  ExtBtpPayload  payload optional
} with { variant (header)  "CROSSTAG( btpAHeader, nextheader = '01'O; 
  btpBHeader, nextheader = '02'O; )"  };

external function f_enc_ExtBtpReq(in ExtBtpReq pdu) return octetstring

with { extension "prototype(convert)"
  extension "encode(RAW)"
};

function f_enc_BtpReq(in BtpReq pdu) return octetstring
{

  var ExtBtpReq v_ExtBtpReq

  v_ExtBtpReq.nextheader:='00'O;
  v_ExtBtpReq.header:=pdu.msgOut.header;
  v_ExtBtpReq.payload.rawPayload:=pdu.msgOut.payload.rawPayload;

  //Temporary hack 
  //v_ExtBtpReq.payload.decodedPayload:=omit;


  return f_enc_ExtBtpReq(v_ExtBtpReq);
}



//BtpIndication
type record ExtBtpInd {
  OCT1           nextheader,
  BtpHeader      header,
  octetstring    rawPayload optional
} with { variant (header)  "CROSSTAG( btpAHeader, nextheader = '01'O; 
  btpBHeader, nextheader = '02'O; )"  };

external function f_dec_ExtBtpInd(in octetstring stream) return ExtBtpInd
with { extension "prototype(convert)"
  extension "decode(RAW)"
  extension "errorbehavior(ALL:WARNING)"
};

function f_dec_BtpInd(in octetstring stream) return BtpInd {

  var ExtBtpInd v_ExtBtpInd:=f_dec_ExtBtpInd(stream)

  var BtpInd v_BtpInd

  v_BtpInd.msgIn.header:=v_ExtBtpInd.header;
  if (ispresent(v_ExtBtpInd.rawPayload)) {
    v_BtpInd.msgIn.payload.rawPayload:=v_ExtBtpInd.rawPayload;

    var DecodedBtpPayload v_decodedPayload;
    if (v_ExtBtpInd.nextheader == '01'O) { //BTP A Header
      v_decodedPayload := 
          decodeBTPPayload(v_ExtBtpInd.rawPayload, 
                           v_ExtBtpInd.header.btpAHeader.destinationPort);
    } else if (v_ExtBtpInd.nextheader == '02'O) { //BTP B Header
      v_decodedPayload := 
          decodeBTPPayload(v_ExtBtpInd.rawPayload, 
                           v_ExtBtpInd.header.btpBHeader.destinationPort);
    }

    if (isbound(v_decodedPayload)) {
      v_BtpInd.msgIn.payload.decodedPayload := v_decodedPayload;
    } else {
      v_BtpInd.msgIn.payload.decodedPayload := omit;
    }
  } else
  {
    v_BtpInd.msgIn.payload := omit;
  }

  return v_BtpInd

}

function decodeBTPPayload(octetstring rawPayload, integer destinationPort) 
  return DecodedBtpPayload {
    var DecodedBtpPayload v_decodedPayload;
    if (destinationPort == 2001) 
    {
      v_decodedPayload := { camPacket := dec_CAM_PDU(rawPayload)}
    } else if (destinationPort == 2002) {
      v_decodedPayload := { denmPacket := dec_DENM_PDU(rawPayload)}
    } else if (destinationPort == 2003) {
      v_decodedPayload := { mapPacket := dec_MAP_PDU(rawPayload)}
    } else if (destinationPort == 2004) {
      v_decodedPayload := { spatPacket := dec_SPAT_PDU(rawPayload)}
    } //TODO: Handle destinationPort == 2005
    return v_decodedPayload;
}

function isWellKnownBTPPort(integer prt) return boolean {
  return ((prt >= 2001) and (prt <= 2005));

}



In our code we create overlay data structures (ExtBtp*) to be able to decode the actual message and then we copy the data fields to the original ETSI data structures in a function called by the testport. (This would not be needed should the original ETSI data types have the encoding specifications on them)

As stated in ETSI EN 302 636-5-1 V1.2.1 (BTP protocol description) the BTP header type can be identified by the NextHeader field in the CommonHeader in the GN headers, which always precedes a BTP header.

Regards,
Lenard Nagy
Re: TTCN-3 decoding hypothesis [message #1756036 is a reply to message #1755112] Fri, 10 March 2017 10:01 Go to previous message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Hello Elemer, Lenard,

Sorry for the delay.
Many thanks for your help,

Yann
Previous Topic:Using TLS/DTLS with Titan test ports part 4
Next Topic:CoAP, MQTT and LWM2M TTCN-3 test case examples
Goto Forum:
  


Current Time: Thu Apr 25 13:40:00 GMT 2024

Powered by FUDForum. Page generated in 0.03592 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top