junos_stat.h File Reference

junos_stat.h Contains type definitions and function prototypes to fetch interface statistics, such as traffic and error. More...


Data Structures

struct  stat_if_traff_s
 Type definition for generic traffic statistics. More...
struct  stat_ifd_error_s
 Type definition for generic error statistics. More...

Defines

#define STAT_IFD_ERR_FLD_IS_VALID(dest, dfield)   bit_test(dest->elem_relevant, STAT_IFD_ERR ## _ ## dfield)
 Macro to check whether an error field is valid.

Typedefs

typedef stat_if_traff_s stat_if_traff_t
 Type definition for generic traffic statistics.
typedef stat_ifd_error_s stat_ifd_error_t
 Type definition for generic error statistics.

Enumerations

enum  stat_ifd_error_elem_t {
  STAT_IFD_ERR_igeneric = 0, STAT_IFD_ERR_iresource, STAT_IFD_ERR_iframe, STAT_IFD_ERR_iqdrops,
  STAT_IFD_ERR_irunts, STAT_IFD_ERR_igiants, STAT_IFD_ERR_idiscards, STAT_IFD_ERR_ogeneric,
  STAT_IFD_ERR_oresource, STAT_IFD_ERR_carriertrans, STAT_IFD_ERR_oqdrops, STAT_IFD_ERR_mtu,
  STAT_IFD_ERR_ihslink_crc, STAT_IFD_ERR_ihslink_fifo_overflows, STAT_IFD_ERR_ohslink_fifo_underflows, STAT_IFD_ERR_ohslink_crc,
  STAT_IFD_ERR_il3_incomplete, STAT_IFD_ERR_il2_chan, STAT_IFD_ERR_il2_mismatch_timeout, STAT_IFD_ERR_novc,
  STAT_IFD_ERR_oaged, STAT_IFD_ERR_collisions, STAT_IFD_ERR_bucket_drops, STAT_IFD_ERR_sram,
  STAT_IFD_ERR_ififo, STAT_IFD_ERR_ofifo, STAT_IFD_ERR_END_ELEM
}

Functions

int junos_stat_session_init (void)
 Initialize the JUNOS statistics communication subsystem.
void junos_stat_session_shutdown (void)
 Terminate the JUNOS statistics communication subsystem.
int junos_stat_ifd_get_traff_by_name (char *ifd_name, stat_if_traff_t *ifd_trs)
 Get traffic statistics for a physical interface since last cleared based on name.
int junos_stat_ifd_get_traff_by_index (u_int16_t ifd_index, stat_if_traff_t *ifd_trs)
 Get traffic statistics for a physical interface since last cleared based on the index.
int junos_stat_ifd_get_traff_by_snmp_index (ifl_idx_t ifd_sindex, stat_if_traff_t *ifd_trs)
 Get traffic statistics for a physical interface since last cleared based on the snmp index.
int junos_stat_ifd_get_abs_traff_by_name (char *ifd_name, stat_if_traff_t *ifd_trs)
 Get absolute traffic statistics for a physical interface based on the name.
int junos_stat_ifd_get_abs_traff_by_index (u_int16_t ifd_index, stat_if_traff_t *ifd_trs)
 Get absolute traffic statistics for a physical interface based on the index.
int junos_stat_ifd_get_abs_traff_by_snmp_index (ifl_idx_t ifd_sindex, stat_if_traff_t *ifd_trs)
 Get absolute traffic statistics for a physical interface based on the snmp index.
int junos_stat_ifl_get_local_traff_by_name (char *ifl_name, if_subunit_t subunit, stat_if_traff_t *ifl_trs)
 Get local traffic statistics for a logical interface since last cleared based on the name.
int junos_stat_ifl_get_local_traff_by_index (ifl_idx_t ifl_index, stat_if_traff_t *ifl_trs)
 Get local traffic statistics for a logical interface since last cleared based on the index.
int junos_stat_ifl_get_local_traff_by_snmp_index (ifl_idx_t ifl_sindex, stat_if_traff_t *ifl_trs)
 Get local traffic statistics for a logical interface since last cleared based on the SNMP index.
int junos_stat_ifl_get_abs_local_traff_by_name (char *ifl_name, if_subunit_t subunit, stat_if_traff_t *ifl_trs)
 Get absolute local traffic statistics for a logical interface based on the name.
int junos_stat_ifl_get_abs_local_traff_by_index (ifl_idx_t ifl_index, stat_if_traff_t *ifl_trs)
 Get absolute local traffic statistics for a logical interface based on the index.
int junos_stat_ifl_get_abs_local_traff_by_snmp_index (ifl_idx_t ifl_sindex, stat_if_traff_t *ifl_trs)
 Get absolute local traffic statistics for a logical interface based on the SNMP index.
int junos_stat_ifl_get_remote_traff_by_name (char *ifl_name, if_subunit_t subunit, stat_if_traff_t *ifl_trs)
 Get remote traffic statistics for a logical interface since last cleared based on the name.
int junos_stat_ifl_get_remote_traff_by_index (ifl_idx_t ifl_index, stat_if_traff_t *ifl_trs)
 Get remote traffic statistics for a logical interface since last cleared based on the index.
int junos_stat_ifl_get_remote_traff_by_snmp_index (ifl_idx_t ifl_sindex, stat_if_traff_t *ifl_trs)
 Get remote traffic statistics for a logical interface since last cleared based on the SNMP index.
int junos_stat_ifl_get_abs_remote_traff_by_name (char *ifl_name, if_subunit_t subunit, stat_if_traff_t *ifl_trs)
 Get absolute remote traffic statistics for a logical interface based on the name.
int junos_stat_ifl_get_abs_remote_traff_by_index (ifl_idx_t ifl_index, stat_if_traff_t *ifl_trs)
 Get absolute remote traffic statistics for a logical interface based on the index.
int junos_stat_ifl_get_abs_remote_traff_by_snmp_index (ifl_idx_t ifl_sindex, stat_if_traff_t *ifl_trs)
 Get remote traffic statistics for a logical interface since last cleared based on the SNMP index.
int junos_stat_ifd_get_error_by_name (char *ifd_name, stat_ifd_error_t *errs)
 Get error statistics collected over a physical interface since last cleared based on the name.
int junos_stat_ifd_get_error_by_index (u_int16_t ifd_index, stat_ifd_error_t *errs)
 Get error statistics collected over a physical interface since last cleared based on the index.
int junos_stat_ifd_get_error_by_snmp_index (ifl_idx_t ifd_sindex, stat_ifd_error_t *errs)
 Get error statistics collected over a physical interface since last cleared based on the SNMP index.
int junos_stat_ifd_get_abs_error_by_name (char *ifd_name, stat_ifd_error_t *errs)
 Get absolute error statistics collected over a physical interface based on the name.
int junos_stat_ifd_get_abs_error_by_index (u_int16_t ifd_index, stat_ifd_error_t *errs)
 Get absolute error statistics collected over a physical interface based on the index.
int junos_stat_ifd_get_abs_error_by_snmp_index (ifl_idx_t ifd_sindex, stat_ifd_error_t *errs)
 Get absolute error statistics collected over a physical interface based on the SNMP index.


Detailed Description

junos_stat.h Contains type definitions and function prototypes to fetch interface statistics, such as traffic and error.

Different functions are provided to fetch either absolute or "since last cleared" statistics.


Define Documentation

#define STAT_IFD_ERR_FLD_IS_VALID dest,
dfield   )     bit_test(dest->elem_relevant, STAT_IFD_ERR ## _ ## dfield)
 

Macro to check whether an error field is valid.

Check whether a particular error field is relevant for the interface for which the error statistics have been retrieved.


Typedef Documentation

typedef struct stat_if_traff_s stat_if_traff_t
 

Type definition for generic traffic statistics.

This structure holds the traffic statistics collected on an interface: physical or logical.

Note:
Statistics for multicast packets are only valid for physical interfaces.

typedef struct stat_ifd_error_s stat_ifd_error_t
 

Type definition for generic error statistics.

This structure holds the error statistics collected on a physical interface. Some fields are not relevant to some physical interfaces. Use STAT_IFD_ERR_FLD_IS_VALID to check the validity of the following error fields.

The following abbreviations are used:

  • HS High Speed
  • CRC Cyclic Redundancy Check
  • CSMA Carrier Sense Multiple Access
  • VCI Virtual Channel Identifier
  • DLCI Data Link Connection Identifier


Function Documentation

int junos_stat_ifd_get_abs_error_by_index u_int16_t  ifd_index,
stat_ifd_error_t errs
 

Get absolute error statistics collected over a physical interface based on the index.

The caller must provide memory for the errs structure that will contain the error statistics.

Parameters:
[in] ifd_index Index of the physical interface
[out] errs Pointer to where error statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_abs_error_by_name char *  ifd_name,
stat_ifd_error_t errs
 

Get absolute error statistics collected over a physical interface based on the name.

The caller must provide memory for the errs structure that will contain the error statistics.

Parameters:
[in] ifd_name Name of the physical interface
[out] errs Pointer to where error statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_abs_error_by_snmp_index ifl_idx_t  ifd_sindex,
stat_ifd_error_t errs
 

Get absolute error statistics collected over a physical interface based on the SNMP index.

The caller must provide memory for the errs structure that will contain the error statistics.

Parameters:
[in] ifd_sindex SNMP index of the physical interface
[out] errs Pointer to where error statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_abs_traff_by_index u_int16_t  ifd_index,
stat_if_traff_t ifd_trs
 

Get absolute traffic statistics for a physical interface based on the index.

The caller must provide memory for the ifd_trs structure that will contain the traffic statistics.

Parameters:
[in] ifd_index Index of the physical interface
[out] ifd_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_abs_traff_by_name char *  ifd_name,
stat_if_traff_t ifd_trs
 

Get absolute traffic statistics for a physical interface based on the name.

The caller must provide memory for the ifd_trs structure that will contain the traffic statistics.

Parameters:
[in] ifd_name Name of the physical interface
[out] ifd_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_abs_traff_by_snmp_index ifl_idx_t  ifd_sindex,
stat_if_traff_t ifd_trs
 

Get absolute traffic statistics for a physical interface based on the snmp index.

The caller must provide memory for the ifd_trs structure that will contain the traffic statistics.

Parameters:
[in] ifd_sindex SNMP index of the physical interface
[out] ifd_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_error_by_index u_int16_t  ifd_index,
stat_ifd_error_t errs
 

Get error statistics collected over a physical interface since last cleared based on the index.

The caller must provide memory for the errs structure that will contain the error statistics.

Parameters:
[in] ifd_index Index of the physical interface
[out] errs Pointer to where error statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_error_by_name char *  ifd_name,
stat_ifd_error_t errs
 

Get error statistics collected over a physical interface since last cleared based on the name.

The caller must provide memory for the errs structure that will contain the error statistics.

Parameters:
[in] ifd_name Name of the physical interface
[out] errs Pointer to where error statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_error_by_snmp_index ifl_idx_t  ifd_sindex,
stat_ifd_error_t errs
 

Get error statistics collected over a physical interface since last cleared based on the SNMP index.

The caller must provide memory for the errs structure that will contain the error statistics.

Parameters:
[in] ifd_sindex SNMP index of the physical interface
[out] errs Pointer to where error statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_traff_by_index u_int16_t  ifd_index,
stat_if_traff_t ifd_trs
 

Get traffic statistics for a physical interface since last cleared based on the index.

The caller must provide memory for the ifd_trs structure that will contain the traffic statistics.

Parameters:
[in] ifd_index Index of the physical interface
[out] ifd_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_traff_by_name char *  ifd_name,
stat_if_traff_t ifd_trs
 

Get traffic statistics for a physical interface since last cleared based on name.

The caller must provide memory for the ifd_trs structure that will contain the traffic statistics.

Parameters:
[in] ifd_name Name of the physical interface
[out] ifd_trs Pointer to where traffic statistics should be stored
Returns:
Status of query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifd_get_traff_by_snmp_index ifl_idx_t  ifd_sindex,
stat_if_traff_t ifd_trs
 

Get traffic statistics for a physical interface since last cleared based on the snmp index.

The caller must provide memory for the ifd_trs structure that will contain the traffic statistics.

Parameters:
[in] ifd_sindex SNMP index of the physical interface
[out] ifd_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_abs_local_traff_by_index ifl_idx_t  ifl_index,
stat_if_traff_t ifl_trs
 

Get absolute local traffic statistics for a logical interface based on the index.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_index Name of the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_abs_local_traff_by_name char *  ifl_name,
if_subunit_t  subunit,
stat_if_traff_t ifl_trs
 

Get absolute local traffic statistics for a logical interface based on the name.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_name Name of the interface
[in] subunit Subunit for the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_abs_local_traff_by_snmp_index ifl_idx_t  ifl_sindex,
stat_if_traff_t ifl_trs
 

Get absolute local traffic statistics for a logical interface based on the SNMP index.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_sindex SNMP index of the interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_abs_remote_traff_by_index ifl_idx_t  ifl_index,
stat_if_traff_t ifl_trs
 

Get absolute remote traffic statistics for a logical interface based on the index.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_index Index of the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_abs_remote_traff_by_name char *  ifl_name,
if_subunit_t  subunit,
stat_if_traff_t ifl_trs
 

Get absolute remote traffic statistics for a logical interface based on the name.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_name Name of the logical interface
[in] subunit Subunit for the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_abs_remote_traff_by_snmp_index ifl_idx_t  ifl_sindex,
stat_if_traff_t ifl_trs
 

Get remote traffic statistics for a logical interface since last cleared based on the SNMP index.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_sindex SNMP index of the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_local_traff_by_index ifl_idx_t  ifl_index,
stat_if_traff_t ifl_trs
 

Get local traffic statistics for a logical interface since last cleared based on the index.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_index Index of the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_local_traff_by_name char *  ifl_name,
if_subunit_t  subunit,
stat_if_traff_t ifl_trs
 

Get local traffic statistics for a logical interface since last cleared based on the name.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_name Name of the logical interface
[in] subunit Subunit for the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_local_traff_by_snmp_index ifl_idx_t  ifl_sindex,
stat_if_traff_t ifl_trs
 

Get local traffic statistics for a logical interface since last cleared based on the SNMP index.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_sindex SNMP index of the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_remote_traff_by_index ifl_idx_t  ifl_index,
stat_if_traff_t ifl_trs
 

Get remote traffic statistics for a logical interface since last cleared based on the index.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_index Index of the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_remote_traff_by_name char *  ifl_name,
if_subunit_t  subunit,
stat_if_traff_t ifl_trs
 

Get remote traffic statistics for a logical interface since last cleared based on the name.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_name Name of the logical interface
[in] subunit Subunit for the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_ifl_get_remote_traff_by_snmp_index ifl_idx_t  ifl_sindex,
stat_if_traff_t ifl_trs
 

Get remote traffic statistics for a logical interface since last cleared based on the SNMP index.

The caller must provide memory for the ifl_trs structure that will contain the traffic statistics.

Parameters:
[in] ifl_sindex SNMP index of the logical interface
[out] ifl_trs Pointer to where traffic statistics should be stored
Returns:
Status of the query, errno has the appropriate error code
  • 0 success
  • -1 error

int junos_stat_session_init void   ) 
 

Initialize the JUNOS statistics communication subsystem.

This API opens and initializes a synchronous connection between the application and the kernel to fetch statistical data. It should not be called more than once.

Returns:
Status of the query, errno is set accordingly.
  • 0 success
  • -1 error

void junos_stat_session_shutdown void   ) 
 

Terminate the JUNOS statistics communication subsystem.

This API terminates the JUNOS statistics communication subsystem between the application and the kernel. It should not be called more than once.


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:23:52 2010 for libjunos-stat by Doxygen 1.4.5