Solaris Bandwidth Manager 1.6 Developer Guide

Description

The function ba_set_event_mask() sets the event mask that defines which events are reported to the user process. The event mask is reset to its default value (0) when the driver file /dev/ipqos is closed by a call to ba_close().

The event mask is a bitwise OR of the possible events listed in Table 4-1.

Table 4-1 Setting the Event Mask

Bit Value 

Event Type 

Description 

1  

(00000001) 

BA_EVENT_CONFIG_STARTING

Generated when the policy agent starts to read a new configuration 

2  

(00000010) 

BA_EVENT_CONFIG_ENDING

Generated when the policy agent finishes reading a new configuration 

4  

(00000100) 

BA_EVENT_DAEMON_ENDING

Generated when the policy agent stops or is killed 

64 

(01000000) 

BA_EVENT_FLOW_ACCOUNTING

Generated when a flow has timed out or when the TOS field changes for a flow 

128 

(10000000) 

BA_EVENT_STATS_RESET

Generated when a class has been reset or remove 

For example:

Provided the relevant bit of the event mask is set, information about an event that occurs is written into a structure of type ba_event_t and queued in a FIFO buffer so that it can be retrieved by a call to ba_get_next_event().

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;

/* the following is for internal use only */
               ba_filter_event_t     ba_event_filter;
               ba_cl_filter_event_t  ba_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