Solaris Bandwidth Manager 1.6 Developer Guide

ba_get_flow_stats()

Name

ba_get_flow_stats() -- retrieve statistics for flows in a given class

Synopsis

#include <netinet/ba_stat.h>

int ba_get_flow_stats (
	const char *interface,
	const char *classname,
	ba_flow_stats_t **flow_stats
);

Description

The function ba_get_flow_stats() retrieves statistics information about the flows associated with a given class for a given managed interface.

Arguments

The function ba_get_flow_stats() is passed the following arguments:

interface

Pointer to a character string that contains the name of the managed interface. For example, le0, hme0. To specify the direction for which you want class information, append _in or _out to the interface name. If you do not specify the direction, it is assumed to be _out.

classname

Pointer to a character string that contains the class name. 

flow_stats

Pointer to a structure of type ba_flow_stats_t. This is the buffer into which statistics for the flows are written.

Structures of type ba_flow_stats_t are defined as follows:

typedef struct {
	 ba_name_t   interface; /* name and direction of the interface */
	 ba_name_t   classname; /* name of the class */
	 struct      in_addrip_local; /* local IP address */
	 struct      in_addrip_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 */
	 union {
         uchar_t        *url;
         u_longlong_t   url_pad;
} url_union;
  hrtime_t    firstseen /* timestamp of first packet sent */
  hrtime_t    lastseen /* timestamp of last packet sent */

} ba_flow_stats_t;
#define   ba_flow_url   url_union.url

Returns

The function ba_get_flow_stats() returns 0 on success, and -1 on error.

Errors

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