Solaris Bandwidth Manager 1.6 Developer Guide

ba_encode_ifname()

Name

ba_encode_ifname() -- build a Solaris Bandwidth Manager interface name

Synopsis

#include <netinet/ba_stat.h>

int ba_encode_ifname(
   const char *interface; /*interface name*/
   const uint_t direction; /*traffic direction*/
   char *ifname;
);

Description

The function ba_encode_ifname() builds the interface name ifname from the physical interface name interface and the direction of traffic handled by the interface. For example, if interface is leo and direction is BA_DIR_INCOMING, ifname contains le0_in.

Arguments

The function ba_encode_ifname() is passed the following arguments:

interface

Pointer to a character string that contains the name of the managed interface. For example, le0, hme0.

direction

An integer indicating the interfaces direction- one of BA_DIR_INCOMING or BA_DIR_OUTGOING.

ifname

Pointer to the encoded interface name. Be sure to allocate sufficient memory. 

Returns

The function ba_encode_ifname() returns the number of characters written on success, and -1 on error.

Errors

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