ba_get_flow_stats() 関数には次の引数を渡します。
interface |
管理されるインタフェース名を含む文字列を指すポインタ (le0、hme0 など)。クラス情報を取得する通信方向を指定するには、インタフェース名に _in または _out を追加する。通信方向を省略した場合には、_out が追加されたと見なされる |
classname |
クラス名が入った文字列を指すポインタ |
flow_stats |
ba_flow_stats_t 型の構造体を指すポインタ。これは、フローの統計情報が書き込まれるバッファーである |
ba_flow_stats_t 型の構造体は次のように定義されています。
typedef struct { ba_name_t interface; /* name of the interface */ /* suffixed with _in or _out */ ba_name_t classname; /* name of the class */ struct in_addr ip_local; /* local IP address */ struct in_addr ip_remote; /* remote IP address */ uchar_t protocol; /* protocol */ ushort_t port_local; /* localport number */ ushort_t port_remote; /* remoteport number */ uchar_t tos_sent; /* TOS value */ uint_t npackets; /* number of incoming packets */ uint_t nbytes; /* number of incoming bytes */ uint_t url_length; /* length of the URL string */ union { uchar_t *url; u_longlong_t url_pad; } url_union; hrtime_t firstseen; /* timestamp of first packet sent (ns)*/ hrtime_t lastseen; /* timestamp of last packet sent (ns) */ } ba_flow_stats_t; |