I am using the NDK on a networked DM6435 device, which is an Ethernet/IP device. This protocol uses one-way multicast. On previous devices, we created a static multicast route in the routing table. So I believe I need to do the same thing again.
Here is the old VxWorks code:
/* Add route to route table, needed for UDP multicast transmission */
inAddr.s_addr = eips_usersock_getOurIPAddr();
mRouteAdd("224.0.0.0", inet_ntoa(inAddr), 0, 0, 0);
Here is my attempt with the NDK:
CI_ROUTE readbackRT;
// Add the multicast static route
bzero( &multicastRT, sizeof(multicastRT) );
multicastRT.IPDestAddr = inet_addr("224.0.0.0");
multicastRT.IPDestMask = 0;
multicastRT.IPGateAddr = inet_addr(LocalIPAddr);
ret = CfgAddEntry( hCfg, CFGTAG_ROUTE, 0, 0, sizeof(CI_ROUTE), (UINT8 *)&multicastRT, 0 );
This doesn't seem to work.
Here is my attempt to read the routing table, this doesn't work either (everything comes back zeros):
for(int i=0; i <= 2; i++ )
{
int tmp = CfgGetImmediate( 0, CFGTAG_ROUTE, 0, i,
sizeof(readbackRT), (UINT8 *)&readbackRT );
}
Does anybody know how to add a static route and how to read the routing table? Extra point for knowledge of a correct multicast entry. Thanks.