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

TOPIC: question about triEnqueueReply

question about triEnqueueReply 01 Feb 2008 17:14 #7279

  • Jason Zhan
  • Jason Zhan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
Hey, folks



I had a problem about the triEnqueueReply(), which is called by SA after it
has received a reply from the SUT.



In the ttcn file, I intend to use the call method to invoke a function in
the SUT, and wait for its return value. Therefore, in the TRI layer, I have
to implement the triEnqueueReply to transmit the return value to the TE.



However, the arguments of the triEnqueueReply puzzled me a lot. Its API is
as follows:



void TriEnqueueReply

( const TriPortId* tsiPortId,

const TriAddress* sutAddress,

const TriComponentId* componentId,

const TriSignatureId* signatureId,

const TriParameterList* parameterList,

const TriParameter* returnValue);





Just wondering how to acquire these values, since the triCall method
provides the similar arguments, which is shown as follows:



TriStatus triCall

(const TriComponentId* componentId,

const TriPortId* tsiPortId,

const TriAddress* sutAddress,

const TriSignatureId* signatureId,

const TriParameterList* parameterList);



Can I define global pointers to store the values which pass into triCall,
and import them when triEnqueueReply is called? Or, any other more efficient
way to implement the TriEnqueueReply.



Many thanks,
Jason
The administrator has disabled public write access.

question about triEnqueueReply 04 Feb 2008 07:15 #7280

Hello Jason,

the triEnqueueReply has to follow a preceeding triCall. Therefore you
can pick tsiPortId, componentId, and signatureId from the triCall. If
used at all, sutAddress should actually correspond to the entity on the
SUT that issued the reply. And parameterList and returnValue is
something that has to be constructed specifically for the reply.

Whether you store this via global pointers or in local variables is not
restricted by the standard. This is your choice how you implement it. If
you plan to use global pointers/variables you have to be aware of the
situation, that different test components can have procedure calls
simultaneously. Even, on a single test component there can be
simultaneous procedure calls if 'nowait' is used in the call statement.

Hope this helps you further.

Best regards

Thomas





________________________________

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 Jason Zhan
Sent: Friday, 01. February 2008 18:15
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: question about triEnqueueReply





Hey, folks



I had a problem about the triEnqueueReply(), which is called by
SA after it has received a reply from the SUT.



In the ttcn file, I intend to use the call method to invoke a
function in the SUT, and wait for its return value. Therefore, in the
TRI layer, I have to implement the triEnqueueReply to transmit the
return value to the TE.



However, the arguments of the triEnqueueReply puzzled me a lot.
Its API is as follows:



void TriEnqueueReply

( const TriPortId* tsiPortId,

const TriAddress* sutAddress,

const TriComponentId* componentId,

const TriSignatureId* signatureId,

const TriParameterList* parameterList,

const TriParameter* returnValue);





Just wondering how to acquire these values, since the triCall
method provides the similar arguments, which is shown as follows:



TriStatus triCall

(const TriComponentId* componentId,

const TriPortId* tsiPortId,

const TriAddress* sutAddress,

const TriSignatureId* signatureId,

const TriParameterList* parameterList);



Can I define global pointers to store the values which pass into
triCall, and import them when triEnqueueReply is called? Or, any other
more efficient way to implement the TriEnqueueReply.



Many thanks,


Jason
The administrator has disabled public write access.

question about triEnqueueReply 05 Feb 2008 15:23 #7281

  • Jason Zhan
  • Jason Zhan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
Hey, Thomas

Thank you for your kindly reply.

Currently, I used mutex to protect global pointers. Thus, only one procedure
call can modify them. However, I have no idea where I can free them, in the
TriStatus triEndTestcase () or other methods.

triCall also provides the parameterlist pointer, I think we can use it when
invoking the triEnqueueReply method. How do you reacon?

Thank you for your help.
Regards,
Jason



On 04/02/2008, Thomas Deiss <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote:
>
> Hello Jason,
>
> the triEnqueueReply has to follow a preceeding triCall. Therefore you can
> pick tsiPortId, componentId, and signatureId from the triCall. If used at
> all, sutAddress should actually correspond to the entity on the SUT that
> issued the reply. And parameterList and returnValue is something that has to
> be constructed specifically for the reply.
>
> Whether you store this via global pointers or in local variables is not
> restricted by the standard. This is your choice how you implement it. If you
> plan to use global pointers/variables you have to be aware of the situation,
> that different test components can have procedure calls simultaneously.
> Even, on a single test component there can be simultaneous procedure calls
> if 'nowait' is used in the call statement.
>
> Hope this helps you further.
>
> Best regards
>
> Thomas
>
>
>
>
>
> *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 Jason Zhan
> *Sent:* Friday, 01. February 2008 18:15
> *To:* This email address is being protected from spambots. You need JavaScript enabled to view it.
> *Subject:* question about triEnqueueReply
>
>
>
> Hey, folks
>
>
>
> I had a problem about the triEnqueueReply(), which is called by SA after
> it has received a reply from the SUT.
>
>
>
> In the ttcn file, I intend to use the call method to invoke a function in
> the SUT, and wait for its return value. Therefore, in the TRI layer, I have
> to implement the triEnqueueReply to transmit the return value to the TE.
>
>
>
> However, the arguments of the triEnqueueReply puzzled me a lot. Its API is
> as follows:
>
>
>
> void TriEnqueueReply
>
> ( const TriPortId* tsiPortId,
>
> const TriAddress* sutAddress,
>
> const TriComponentId* componentId,
>
> const TriSignatureId* signatureId,
>
> const TriParameterList* parameterList,
>
> const TriParameter* returnValue);
>
>
>
>
>
> Just wondering how to acquire these values, since the triCall method
> provides the similar arguments, which is shown as follows:
>
>
>
> TriStatus triCall
>
> (const TriComponentId* componentId,
>
> const TriPortId* tsiPortId,
>
> const TriAddress* sutAddress,
>
> const TriSignatureId* signatureId,
>
> const TriParameterList* parameterList);
>
>
>
> Can I define global pointers to store the values which pass into triCall,
> and import them when triEnqueueReply is called? Or, any other more efficient
> way to implement the TriEnqueueReply.
>
>
>
> Many thanks,
> Jason
>
>
>
The administrator has disabled public write access.

question about triEnqueueReply 05 Feb 2008 15:48 #7282

Hello Jason,

I would have expected that you free the pointers after each
triEnqueueReply. When triEntTestcase is called you might not know
whether there has been a call before or not. In the latter case you
might free unused memory, which might cause problem.

About the parameterList, I do not know. Personally, I would create a new
parameterlist for the reply, but this might be superfluous.

Best regards

Thomas



________________________________

From: ext Jason Zhan [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: Tuesday, 05. February 2008 16:24
To: active_ttcn3 : mts stf133 ttcn version 3 - active members
only
Cc: Deiss Thomas (NSN - DE/Bochum)
Subject: Re: question about triEnqueueReply


Hey, Thomas

Thank you for your kindly reply.

Currently, I used mutex to protect global pointers. Thus, only
one procedure call can modify them. However, I have no idea where I can
free them, in the TriStatus triEndTestcase () or other methods.

triCall also provides the parameterlist pointer, I think we can
use it when invoking the triEnqueueReply method. How do you reacon?

Thank you for your help.
Regards,
Jason




On 04/02/2008, Thomas Deiss <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote:

Hello Jason,

the triEnqueueReply has to follow a preceeding triCall.
Therefore you can pick tsiPortId, componentId, and signatureId from the
triCall. If used at all, sutAddress should actually correspond to the
entity on the SUT that issued the reply. And parameterList and
returnValue is something that has to be constructed specifically for the
reply.

Whether you store this via global pointers or in local
variables is not restricted by the standard. This is your choice how you
implement it. If you plan to use global pointers/variables you have to
be aware of the situation, that different test components can have
procedure calls simultaneously. Even, on a single test component there
can be simultaneous procedure calls if 'nowait' is used in the call
statement.

Hope this helps you further.

Best regards

Thomas





________________________________

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 Jason
Zhan
Sent: Friday, 01. February 2008 18:15
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: question about triEnqueueReply




Hey, folks



I had a problem about the triEnqueueReply(),
which is called by SA after it has received a reply from the SUT.



In the ttcn file, I intend to use the call
method to invoke a function in the SUT, and wait for its return value.
Therefore, in the TRI layer, I have to implement the triEnqueueReply to
transmit the return value to the TE.



However, the arguments of the triEnqueueReply
puzzled me a lot. Its API is as follows:



void TriEnqueueReply

( const TriPortId* tsiPortId,

const TriAddress* sutAddress,

const TriComponentId* componentId,

const TriSignatureId* signatureId,

const TriParameterList* parameterList,

const TriParameter* returnValue);





Just wondering how to acquire these values,
since the triCall method provides the similar arguments, which is shown
as follows:



TriStatus triCall

(const TriComponentId* componentId,

const TriPortId* tsiPortId,

const TriAddress* sutAddress,

const TriSignatureId* signatureId,

const TriParameterList* parameterList);



Can I define global pointers to store the values
which pass into triCall, and import them when triEnqueueReply is called?
Or, any other more efficient way to implement the TriEnqueueReply.



Many thanks,


Jason
The administrator has disabled public write access.

question about triEnqueueReply 06 Feb 2008 08:51 #7283

  • Antti Hyrkk
  • Antti Hyrkk's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 43
  • Karma: 0
Hello



Correct me if this goes wrong...



I cannot remember where it is stated in the standards, but I have a feeling that all the abstract TRI parameters are passed from caller to the callee as pass by value/copy, so the callee gets a private copy of the value. The C language mapping starts talking about pointers. Since the actual parameter data is behind the pointer, and since it should be passed by value/copy, the callee is responsible for taking a private copy of the value, if a) it is going to modify it or b) if it is going to use the value after the TRI function call returns, and callee is also responsible for freeing the memory allocations it has done, if it has done such thing.



Now when thinking more about this. it might not be a wrong interpretation to expect that caller dynamically allocates the parameter values on behalf of callee, and callee would be responsible for freeing the memory after it does not need the values anymore...but I've always assumed what I wrote in the first paragraph.



If you implement your triCall() function, I think you should take a deep copy of the data structures you receive as pointers. The pointers point into some memory region allocated by the caller TE of triCall() and the pointer might be invalid after the triCall() returns as there is no guarantee that the TE allocated dynamically the memory for the parameters. The pointer could point into some local variable of the TE and be invalid when after triCall() returns (or more precisely after enough many function calls return within TE).



Similarly when triEnqueueReplyl() is called by the SA, the pointer parameters can point at some local variables of the SA, so I would expect the TE to take a deep copy of the data structures, if it needs to use the after the triEnqueueReplyl () returns, as your SA might after triEnqueueReplyl () free the memory pointed by the parameter pointers or it might overwrite the memory content.

// Antti Hyrkkänen @ Plenware
// www.plenware.fi/en <www.plenware.fi/en>

________________________________

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 Thomas Deiss
Sent: 5. helmikuuta 2008 17:48
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: question about triEnqueueReply



Hello Jason,



I would have expected that you free the pointers after each triEnqueueReply. When triEntTestcase is called you might not know whether there has been a call before or not. In the latter case you might free unused memory, which might cause problem.



About the parameterList, I do not know. Personally, I would create a new parameterlist for the reply, but this might be superfluous.



Best regards



Thomas






________________________________


From: ext Jason Zhan [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: Tuesday, 05. February 2008 16:24
To: active_ttcn3 : mts stf133 ttcn version 3 - active members only
Cc: Deiss Thomas (NSN - DE/Bochum)
Subject: Re: question about triEnqueueReply

Hey, Thomas

Thank you for your kindly reply.

Currently, I used mutex to protect global pointers. Thus, only one procedure call can modify them. However, I have no idea where I can free them, in the TriStatus triEndTestcase () or other methods.

triCall also provides the parameterlist pointer, I think we can use it when invoking the triEnqueueReply method. How do you reacon?

Thank you for your help.
Regards,
Jason




On 04/02/2008, Thomas Deiss <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote:

Hello Jason,



the triEnqueueReply has to follow a preceeding triCall. Therefore you can pick tsiPortId, componentId, and signatureId from the triCall. If used at all, sutAddress should actually correspond to the entity on the SUT that issued the reply. And parameterList and returnValue is something that has to be constructed specifically for the reply.



Whether you store this via global pointers or in local variables is not restricted by the standard. This is your choice how you implement it. If you plan to use global pointers/variables you have to be aware of the situation, that different test components can have procedure calls simultaneously. Even, on a single test component there can be simultaneous procedure calls if 'nowait' is used in the call statement.



Hope this helps you further.



Best regards



Thomas










________________________________


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 Jason Zhan
Sent: Friday, 01. February 2008 18:15
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: question about triEnqueueReply



Hey, folks



I had a problem about the triEnqueueReply(), which is called by SA after it has received a reply from the SUT.



In the ttcn file, I intend to use the call method to invoke a
function in the SUT, and wait for its return value. Therefore, in the TRI layer, I have to implement the triEnqueueReply to transmit the return value to the TE.



However, the arguments of the triEnqueueReply puzzled me a lot. Its
API is as follows:



void TriEnqueueReply

( const TriPortId* tsiPortId,

const TriAddress* sutAddress,

const TriComponentId* componentId,

const TriSignatureId* signatureId,

const TriParameterList* parameterList,

const TriParameter* returnValue);





Just wondering how to acquire these values, since the triCall method
provides the similar arguments, which is shown as follows:



TriStatus triCall

(const TriComponentId* componentId,

const TriPortId* tsiPortId,

const TriAddress* sutAddress,

const TriSignatureId* signatureId,

const TriParameterList* parameterList);



Can I define global pointers to store the values which pass into triCall, and import them when triEnqueueReply is called? Or, any other more efficient way to implement the TriEnqueueReply.



Many thanks,

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

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin