Overview
Features
Download
Documentation
Community
Add-Ons & Services

NetworkInterface support for QNX6

Discussion of ideas for features and new projects based on POCO.

NetworkInterface support for QNX6

Postby cx500tc » 23 Apr 2008, 19:42

The following is a "new NewtorkInterface::list()" member function that fills in info about netmask and broadcast addresses under QNX6. I didn't do the IP6 variant though.

Code: Select all

NetworkInterface::NetworkInterfaceList NetworkInterface::list()
{
   FastMutex::ScopedLock lock(_mutex);
   NetworkInterfaceList result;

   struct ifaddrs* ifaphead;
   int rc = getifaddrs(&ifaphead);
   if (rc) throw NetException("cannot get network adapter list");

   for (int index = 0 ,struct ifaddrs* ifap = ifaphead; ifap; ifap = ifap->ifa_next, ++index)
   {
      if (ifap->ifa_addr)
      {
         if (ifap->ifa_addr->sa_family == AF_INET)
         {
            IPAddress addr(&reinterpret_cast(ifap->ifa_addr)->sin_addr, sizeof(struct in_addr));
            IPAddress subnetMask(&reinterpret_cast(ifap->ifa_netmask)->sin_addr, sizeof(struct in_addr));
            IPAddress broadcastAddress(&reinterpret_cast(ifap->ifa_dstaddr)->sin_addr, sizeof(struct in_addr));

            result.push_back(NetworkInterface(std::string(ifap->ifa_name), addr, subnetMask, broadcastAddress), index);
         }
      }
   }
   freeifaddrs(ifaphead);
   return result;
}
cx500tc
 
Posts: 26
Joined: 24 Sep 2007, 17:48

Re: NetworkInterface support for QNX6

Postby guenter » 25 Apr 2008, 10:57

Thanks. I have filed a bug report. Fix will be in the trunk soon.


guenter
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Re: NetworkInterface support for QNX6

Postby cx500tc » 28 Apr 2008, 17:18

> Thanks. I have filed a bug report. Fix will be in the trunk soon.

I forgot to mention that Linux code seems to have the same issue. I don't use Linux so I can't test if the same fix could apply.
cx500tc
 
Posts: 26
Joined: 24 Sep 2007, 17:48

Re: NetworkInterface support for QNX6

Postby guenter » 29 Apr 2008, 11:29

I have looked at this again: Normally, the constructor of NetworkInterfaceImpl should take care of setting netmask and broadcast address. Why doesn't this work on QNX? Unfortunately, I currently don't have a QNX system available to test, but I'll look into this.
guenter
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: NetworkInterface support for QNX6

Postby cx500tc » 09 Sep 2008, 20:14

Just check and I can't find the fix in the trunk or in 1.3.3
cx500tc
 
Posts: 26
Joined: 24 Sep 2007, 17:48

Re: NetworkInterface support for QNX6

Postby guenter » 10 Sep 2008, 15:44

It's still on the list for 1.3.3 (end of September)
guenter
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to Wishlist

Who is online

Users browsing this forum: No registered users and 1 guest

cron