#ifndef __zl_rmon_h__
#define __zl_rmon_h__

typedef struct {
  unsigned int bytesSent;
  unsigned int unicastFrameSent;
  unsigned int frameSentFail;
  unsigned int flowCtrlSent;
  unsigned int nonUnicastFrameSent;
  unsigned int bytesReceived;
  unsigned int frameReceived;
  unsigned int totalBytesReceived;
  unsigned int totalFramesReceived;
  unsigned int flowCtrlFramesReceived;
  unsigned int mcastFramesReceived;
  unsigned int bcastFramesReceived;
  unsigned int len64Frames;
  unsigned int jabberFrames;
  unsigned int len65To127Frames;
  unsigned int oversizeFrames;
  unsigned int len128To255Frames;
  unsigned int len256To511Frames;
  unsigned int len512To1023Frames;
  unsigned int len1024To1522Frames;
  unsigned int fragment;
  unsigned int alignError;
  unsigned int runtFrames;
  unsigned int crcErrors;
  unsigned int shortEvent;
  unsigned int collision;
  unsigned int droppedFrames;
  unsigned int filteringCounter;
  unsigned int delayExceedDiscardCounter;
  unsigned int lateCollision;
  } zarlinkPortStats_t;



/*
 * NOTE: for representing hardware with struct for hwdiags data
 *
 * union {
 *   unsigned char blah[6];
 *   struct S sss;
 *   } u;
 *
 * use the 'packed' struct attribute of gcc to ensure that the
 * compiler doesn't add padding and packs all members in the 
 * least number of bytes possible:
 * 
 * struct S { short f[3]; } __attribute__ ((packed));
 */


typedef struct {
  unsigned int bytesSent : 32;
  unsigned int unicastFrameSent : 24;
  unsigned int frameSentFail : 8;
  } octet0;

typedef struct {
  unsigned int flowCtrlSent : 16;
  unsigned int nonUnicastFrameSent : 16;
  unsigned int bytesReceived : 32;
  } octet1;

typedef struct {
  unsigned int frameReceived : 32;
  unsigned int totalBytesReceived : 32;
  } octet2;

typedef struct {
  unsigned int totalFramesReceived : 24;
  unsigned int flowCtrlFramesReceived : 8;
  unsigned int mcastFramesReceived : 16;
  unsigned int bcastFramesReceived : 16;
  } octet3;

typedef struct {
  unsigned int len64Frames : 24;
  unsigned int jabberFrames : 8;
  unsigned int len65To127Frames : 24;
  unsigned int oversizeFrames : 8;
  } octet4;

typedef struct {
  unsigned int len128To255Frames : 16;
  unsigned int len256To511Frames : 16;
  unsigned int len512To1023Frames : 16;
  unsigned int len1024To1522Frames : 16;
  } octet5;

typedef struct {
  unsigned int fragment : 16;
  unsigned int alignError : 8;
  unsigned int runtFrames : 8;
  unsigned int crcErrors : 16;
  unsigned int shortEvent : 16;
  } octet6;

typedef struct {
  unsigned int collision : 16;
  unsigned int droppedFrames : 16;
  unsigned int filteringCounter : 16;
  unsigned int delayExceedDiscardCounter : 8;
  unsigned int lateCollision : 8;
  } octet7;

#ifdef __cplusplus
extern "C" {
#endif

void zarlinkRmonCounterOverflow(unsigned char intPort, unsigned long rmonOverflowBits);
int zarlinkRmonUpdateStats(unsigned char * pRmonData);

#ifdef __cplusplus
}
#endif


#endif /* __zl_rmon_h__ */
