registerProtocol and registerService API

91 views
Skip to first unread message

Dragos Ilie

unread,
Oct 6, 2021, 9:13:16 AM10/6/21
to omn...@googlegroups.com
Hi,

In inet-4.2.5 the calls to registerProtocol and registerService for MANET protocols used a nullptr for one of the arguments (2nd arg for registerService and 3rd arg for registerProtocol):

src/inet/routing/gpsr/Gpsr.cc: registerService(Protocol::manet, nullptr, gate("ipIn"));
src/inet/routing/gpsr/Gpsr.cc: registerProtocol(Protocol::manet, gate("ipOut"), nullptr);
src/inet/routing/dsdv/Dsdv.cc: registerService(Protocol::manet, nullptr, gate("ipIn"));
src/inet/routing/dsdv/Dsdv.cc: registerProtocol(Protocol::manet, gate("ipOut"), nullptr);
src/inet/routing/dymo/Dymo.cc: registerService(Protocol::manet, nullptr, gate("ipIn"));
src/inet/routing/dymo/Dymo.cc: registerProtocol(Protocol::manet, gate("ipOut"), nullptr);

In inet-4.3.2 the calls to registerService are not used anymore and the nullptr in registerProtocol has been replaced with a specific gate.

src/inet/routing/gpsr/Gpsr.cc: registerProtocol(Protocol::manet, gate("ipOut"), gate("ipIn"));
src/inet/routing/dsdv/Dsdv.cc: registerProtocol(Protocol::manet, gate("ipOut"), gate("ipIn"));
src/inet/routing/dymo/Dymo.cc: registerProtocol(Protocol::manet, gate("ipOut"), gate("ipIn"));

I had older code based on the APIs from v4.2.5 (with nullptr) that worked under v4.3.2. When I switched from Ieee80211ScalarRadio/Ieee80211MgmtAdhoc to AckingWirelessInterface the dispatcher could not forward incoming packets to IP layer because it could no find a manet handler.

I had to change the code from:

registerService(Protocol::manet, nullptr, gate("ipIn"));
registerProtocol(Protocol::manet, gate("ipOut"), nullptr);

to

registerService(Protocol::manet, gate("ipOut"), gate("ipIn"));
registerProtocol(Protocol::manet, gate("ipOut"), gate("ipIn"));

to make it work again.


Q1: Is the use of nullptr still valid under v4.3.2? If yes, what are the cases when the use of nullptr is desired for registerProtocol and registerService, respectively?

Q2: Why have the calls to registerService been removed from v4.3.2 fro MANET protocols? Does it make sense to use them in a MANET routing protocol?

Q3: Is Ieee80211ScalarRadio/Ieee80211MgmtAdhoc doing something special (in v4.3.2) that keeps the dispatcher happy when nullptr is used in the register* calls (unlike AckingWirelessInterface)?

DISCLAIMER: I have to admit that I don’t quite understand the register* API and I am mostly replicating what I see in existing examples. If there is more information available, please point me in the right direction.

Thanks,
Dragos

Levente Mészáros

unread,
Oct 6, 2021, 9:36:21 AM10/6/21
to OMNeT++ Discussion List
1. Passing in nullptr just means that the corresponding service/protocol primitive is not registered.
2. MANET protocols such as GPSR or DYMO do not provide any service for higher layers. They produce PDUs so they register towards lower layers.
3. Nothing special, see 1.

There is some documentation in https://github.com/inet-framework/inet/blob/master/src/inet/common/IProtocolRegistrationListener.h but none in the User's Guide. This isn't ideal to say the least. I must also admit that this API was incorrectly used in several protocol modules in the past.

Basically the idea is that modules must register what kind of services they are providing and what kind of protocols they are producing. For example, IP offers IP protocol services for higher layers and produces IP protocol packets towards lower layers. There are the usual request, confirmation, indication, and response primitives between N and N+1 protocol layers. The service and protocol terms are used as usual. This information is used to dispatch packets and commands internally between the modules.

Best regards,
levy

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/omnetpp/A315A10D-84DB-4CF2-9DEA-3653D6FA46FF%40gmail.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages