Solaris Bandwidth Manager 1.5 Developing Guide

ba_list_interfaces()

Name

ba_list_interfaces() -- retrieve the names of the managed interfaces

Synopsis

#include <netinet/ba_stat.h>

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

Description

The function ba_list_interfaces() retrieves a list of the names of the interfaces that the policy agent has been configured to manage.

Arguments

The function ba_list_interfaces() is passed the following argument:

interfaces

Pointer to an array of structures of type ba_name_t, which is the buffer into which the names of the interfaces are written. There is one structure per name.

Structures of type ba_name_t are defined as follows:

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

You must always allocate sufficient memory for the buffer, the size of which is dependent on the number of classes. For example:

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);
}

Returns

The function ba_list_interfaces() returns the number of interfaces on success, and -1 on error.

Errors

If an error occurs during a call to ba_list_interfaces(), the variable ba_errno is set to one of the error codes listed in Table 4-2.