I need to show in my C/C++ program Tx/Rx information about three network interfaces. One of them is a ppp interface but my code is not working with ppp0.
I am using the code example from the man page of getifaddrs (see man getifaddrs), which basically checks if the interface has AF_PACKET family and if so, then it retrieves the Tx/Rx information from the ifa->ifa_data member of the ifaddrs struct. But this code fails for the ppp0 interface. Searching the internet, i found the source code of pppstats, but i see the code somewhat cumbersome, because it has many ifdefs for conditional code compilation. I see that ioctl must be used but i do not know exactly how.
What would be the simplest code to get the Tx/Rx bytes information from ppp0 in a linux system ? Is it really needed to use ioctl ?
Thanks in advance