Sean Boudreau(deleted)
|
Re: pppstats information in qnx 6.4
|
Sean Boudreau(deleted)
02/09/2009 10:40 AM
post21765
|
Re: pppstats information in qnx 6.4
On Mon, Feb 09, 2009 at 10:35:47AM -0500, ravi varma wrote:
> > On Fri, Feb 06, 2009 at 09:18:50AM -0500, ravi varma wrote:
> > > We are looking to know the link statistics like :
> > > No.of frames/bytes tranmistted /Received Etc over ppp link
> > >
> >
> > You can get number of bytes from 'netstat -inv'. You can
> > get bytes, frames and a lot of other info from the
> > SIOCGIFDATA ioctl which populates a struct ifdatareq.
> >
> > -seanb
>
>
> Hi
>
> I tried the way you suggested, first of all thank you as i got introduced to different structures over the process.
>
> code i am using is, every time ioctl call is failing i tried "/dev/ser2" assuming that my ppp0 interface runs on ser2,
i am not getting what i should attach as file i.e /dev/PPP0 or /dev/(process id of ppp0) etc... the error code suggests
"Inappropriate I/O control operation", so let me know wher ei am going wrong.
>
>
> struct ifdata
> {
> char ifdr_name[IFNAMSIZ];
> struct if_data ifdr_data;
> }ifdatareq;
>
>
>
> int main()
> {
>
> struct ifdatareq ifdr;
> struct if_data *ifi;
> unsigned char ifi_type;
> int fd;
> fd = open("/dev/ser2", O_RDWR | O_NOCTTY | O_NDELAY);
/* A socket is needed here */
fd = socket(AF_INET, SOCK_DGRAM, 0);
> while(1)
> {
memset(&ifdr, 0x00, sizeof(ifdr));
strlcpy(ifdr.ifdr_name, "ppp0", sizeof(ifdr.ifdr_name));
/* where "ppp0" above is as reported by (for example), the ifconfig utility */
> if (ioctl(fd, SIOCGIFDATA, &ifdr) == -1)
> {
> perror("Socket Bind failed\n");
> printf( "That means(%d): %s\n",errno, strerror(errno) );
> return -1;
> }
> ifi = &ifdr.ifdr_data;
> ifi_type = ifi->ifi_type;
> printf("%c is number\n",ifi_type);
> }
> }
>
> Thnaks
> RAVI
>
>
>
>
> _______________________________________________
> io-net migration
> http://community.qnx.com/sf/go/post21763
>
|
|
|