ba_get_flow_stats() - 指定されたクラス内のフローの統計情報を取得します。
#include <netinet/ba_stat.h> int ba_get_flow_stats ( const char *interface, const char *classname, ba_flow_stats_t **flow_stats );
ba_get_flow_stats() 関数は、指定された管理対象インタフェースの指定されたクラスに関連付けられたフローについての統計情報を取得します。
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;
|
ba_get_flow_stats() 関数は、正常に終了した場合には 0、エラー時には -1 を返します。
ba_get_flow_stats() 呼び出しの際にエラーが発生すると、変数 ba_errno は表 4-2 に示したエラーコードの 1 つに設定されます。