Solaris Bandwidth Manager 1.6 の開発

ba_list_interfaces()

名前

ba_list_interfaces() - 管理されているインタフェース名を取得します。

形式

#include <netinet/ba_stat.h>

int ba_list_interfaces (
	 ba_name_t *interfaces /* allocate buffer */
);

説明

ba_list_interfaces() 関数は、ポリシーエージェントに管理対象として設定されているインタフェース名のリストを取得します。

引数

ba_list_interfaces() 関数には次の引数を渡します。

interfaces

ba_name_t 型の構造体の配列を指すポインタ。これは、インタフェース名が書き込まれるバッファーである。名前ごとに構造体が 1 つ存在する

ba_name_t 型の構造体は次のように定義されています。


typedef struct {
	char    name[BA_NAMES_LEN + 1];
	char    padding[3];
	u_short namelen;
	char    padding2[2];
} ba_name_t;

バッファーには、常にクラスの数に応じた十分なメモリーを割り当てる必要があります。次に例を示します。


nintface = ba_get_num_interfaces();
if (nintface > 0) {
	interfaces = (ba_name_t *) calloc(nintface, sizeof ba_name_t);
	if (ba_list_interfaces(interfaces) != -1) {
	/* process interfaces .. */
} else {
	/* error handling */
}
	free(interfaces);
}

戻り値

ba_list_interfaces() 関数は、正常に終了した場合にはインタフェース数、エラー時には -1 を返します。

エラー

ba_list_interfaces() 呼び出しの際にエラーが発生すると、変数 ba_errno表 4-2 に示したエラーコードの 1 つに設定されます。