Solaris Bandwidth Manager 1.6 Developer Guide

ba_get_next_event()

Name

ba_get_next_event() -- retrieve information about events

Synopsis

#include <netinet/ba_stat.h>

int ba_get_next_event (
	ba_event_t *event,
	int blocking
);

Description

The function ba_get_next_event() retrieves information about the next event queued in the FIFO buffer. It can be called in either blocking or non-blocking mode:

Arguments

The function ba_get_next_event() is passed the following arguments:

event

Pointer to a structure of type ba_event_t, which contains information about the next event in the FIFO buffer.

blocking

Integer that sets blocking or non-blocking mode. A zero value enables blocking; any non-zero value enables non-blocking. 

Structures of type ba_event_t are defined as follows:

typedef struct {
	u_int           ba_event_type;
	u_int           ba_event_drops;

union {
      	ba_name_t       ba_event_iface;
      ba_name_t       ba_event_info;
      } ba_event_config;
      struct {
             ba_name_t     ba_flow_iface; /* no suffix */
             uint_t        ba_num_flows;
             ba_flow_event_t
ba_event_flows[BA_EVENT_MAX_FLOWS];
               } ba_event_flow;
               ba_class_stats_t   ba_event_stats;
               ba_filter_event_t  ba_event_filter;
               ba_cl_filter_event_tba_event_cl_filter;
       } ba_event_union;
} ba_event_t;

The elements of structures of type ba_event_t are set as follows:

ba_event_type

Set to identify the event type that has occurred. See Table 3-1 for possible values.

ba_event_iface

Set to identify the interface on which the event has occurred. It is set to the name of the reconfigured interface for events of type BA_EVENT_CONFIG_STARTING and BA_EVENT_CONFIG_ENDING. It is left blank for events of type BA_EVENT_DAEMON_ENDING.

ba_event_info

Reserved for future use. 

Structures of type ba_flow_event_t are defined as follows:

typedef struct {
     ba_name_t       classname_in; 
     ba_name_t       classname_out;
     struct in_addr  ip_local;
     struct in_addr  ip_remote;
     uchar_t         protocol;
     ushort_t        port_local;
     ushort_t        port_remote;
     uchar_t         tos_sent_in;
     uchar_t         tos_sent_out;
     uint_t          npackets_in;
     uint_t          nbytes_in;
     uint_t          npackets_out;
     uint_t          nbytes_out;
     uint_t          url_length;
     union {
             uchar_t         *url;
             u_longlong_t    url_pad;} url_union;
     hrtime_t   firstseen_in; /* timestamp of first packet sent (ns)*/
     hrtime_t   lastseen_in;  /* timestamp of last packet sent (ns) */
     hrtime_t   firstseen_out;/* timestamp of first packet sent (ns)*/
     hrtime_t   lastseen_out; /* timestamp of last packet sent (ns) */
} ba_flow_event_t;

#define ba_flow_url     url_union.url

Returns

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

Errors

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