Hi everyone, At last I found it "/proc/net/dev" is what I need. This file consists of some counters for each interface, each one counts the number of packets (and bytes). ifconfig uses this file too, but after parsing it.The parser can be found here:
The other tool that can be used is, sysctl. It can be used on every Free-BSD based systems.