sppStats()

PROTOTYPE

#include <spp.h>

int sppStats(int print, SppStats *lp);

DESCRIPTION

sppStats() gets TargetSPP channel statistics. If print is not 0, a report on the operating statistics is written to stdout. If lp is not NULL, the SppStats structure is written to *lp. The SppStats definition is in “spp.h” and reproduced below:

/*
** SPP Statistics Structure
*/
typedef struct
{
  ui32 syns_sent;       /* number of SYN frames sent */
  ui32 syns_rcvd;       /* number of SYN frames received */
  ui32 iframes_sent;    /* number of I frames sent */
  ui32 num_resent;      /* number of I-frames re-sent */
  ui32 iframes_rcvd;    /* number of I frames received */
  ui32 acks_sent;       /* number of ACK frames sent */
  ui32 acks_rcvd;       /* number of ACK frames received */
  ui32 naks_sent;       /* number of NAK frames sent */
  ui32 naks_rcvd;       /* number of NAK frames received */
  ui32 dup_acks;        /* number of duplicate ACKs */
  ui32 rx_drops;        /* number of dropped rx frames */
  ui32 rsts_sent;       /* number of RST frames sent */
  ui32 rsts_rcvd;       /* number of RST frames received */
  ui32 bad_ack;         /* number of implausible ACKs */
  ui32 num_connects;    /* number of completed connections */
  ui32 conn_resets;     /* number of connection resets */
  ui32 no_rbufs;        /* number of failed rbuf requests */
  ui32 rbuf_max_used;   /* recv buffer max used */
  ui32 resend_timer_exp;/* number of resend_timer expirations */
  ui32 ack_del_exp;     /* number of ack_del_timer expirations */
} SppStats;

If successful, sppStats() returns 0. Otherwise, it sets errno and returns -1.

ERROR CODES

SPP_UNINITIALIZED The initialization routine sppInit() has not been called.

EXAMPLE

/***********************************************************************/
/*   stats_cmd: Display SPP statistics                                 */
/*                                                                     */
/*       Input: command = command line input                           */
/*                                                                     */
/***********************************************************************/
static void stats_cmd(char *command)
{
#if SPP_DIAG_INC
  if (sppStats(SPP_STATS_PRINT, NULL))
    error("sppStats()");
#endif
  printf("  NumDataErrs = %u\n", NumDataErrs);
  fflush(stdout);
}