The current state of TRDP stack implementation does not include the feature required from the standard (A.7.7.2):
"All incoming messages shall be checked against registered listeners. Any message to a not registered listener or to a listener expecting another value of the topography counters shall be discarded. In case of a unicast request message to a not registered listener an error message (MsgType = ‘Me’) shall be sent indicating the error."
If, due to the lack of resources, a reply session can’t be opened, the received message shall be discarded and an error message (MsgType = ‘Me’) shall be sent, indicating the error with replyStatus == -4 (no memory (at replier side)).
Further the function tlm_replyErr shall get deleted, as generation of error telegrams is an internal/integral functionality of the TRDP SW.
Diff:
As a first commit the two small testapps are extended to offer the calling to non nonlistener replier scenario in [r1359]
Related
Commit: [r1359]
Pushed in major changes in trdp_mdcom.c plus some other stuff along the way in [r1360]. Basically the function trdp_commonSend got extinct and replaced by the smaller functions trdp_mdCall (for Mr and Mn), trdp_mdReply (for Mq and Mp) as well as trdp_mdConfirm (for the Mc).
The error indicator Me is realized as private MD layer TRDP function trdp_mdSendME, implemented to get called from trdp_mdHandleRequest in case of appHandle->mdDefault.maxNumSessions <= numOfReceivers or at the very bottom of the function, where there is no listener found. This is a straighforward task to get accomplished (though overall error handling may get discussed a little bit). On receiver side (here the caller, which gets an Me "error" response) the difficulty left open from the standard is the mapping for the application. Essentially Me comes like Mc without a ComID carrying only a sessionID. Based on the various application examples it seems not reasonable to have the application sorting out the sessionID and match the relevant caller. Therefore the TRDP layer tries to match the sessionID of the Me message against a known caller comID and in case of a positive match replaces the zero by this comID and invokes the callback function with the error value TRDP_NOLIST_ERR.
Having some code like
case TRDP_NOLIST_ERR:
if (pMsg->comId == CALLTEST_MR_NOLISTENER_COMID)
{
/ this is the routine to deal with the Me /
if (pMsg->msgType == TRDP_MSG_ME )
{
would then deal with the "no listener" kind of messages.
Basically the replyStatus may get evaluated, which may hold either TRDP_REPLY_NO_REPLIER_INST for simply no listener encountered at replier side or TRDP_REPLY_NO_MEM_REPL if the replier had no listener available due to memory/configuration constraints.
Related
Commit: [r1360]