m2LibP.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:4k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* m2LibP.h - VxWorks MIB-II interface to SNMP Agent */
  2. /* Copyright 1984 - 2002 Wind River Systems, Inc. */
  3. #include "copyright_wrs.h"
  4. /*
  5. modification history
  6. --------------------
  7. 01d,25apr02,vvv  removed unused ifAttachChange (SPR #74391)
  8. 01c,10oct01,rae  merge from truestack (VIRTUAL)
  9. 01b,25oct00,niq  Merge RFC2233 changes from open_stack-p1-r1 branch
  10. 01a,08dec93,jag  written
  11. */
  12. #ifndef __INCm2LibPh
  13. #define __INCm2LibPh
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #include "socket.h"
  18. #include "net/if_arp.h"
  19. #include "net/if.h"
  20. #include "netinet/if_ether.h"
  21. #include "avlLib.h"
  22. #ifdef VIRTUAL_STACK
  23. #include "netinet/vsLib.h"
  24. #endif    /* VIRTUAL_STACK */
  25. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  26. #pragma align 1                 /* tell gcc960 not to optimize alignments */
  27. #endif  /* CPU_FAMILY==I960 */
  28. /* This structure is used to keep track of the  Network Interfaces */
  29. typedef struct
  30.     {
  31.     int              netIfIndex;      /* I/F index returned to SNMP */
  32.     long             netIfType;       /* I/F type from MIB-II specifications */
  33.     unsigned long    netIfSpeed;      /* I/F Speed from MIB-II specifications */
  34.     unsigned long    netIfAdminStatus;  /* I/F old status used for traps */
  35.     unsigned long    netIfLastChange;   /* I/F Time of Interface last change */
  36.     M2_OBJECTID      netIfOid;          /* I/F Object ID */
  37.     struct arpcom  * pNetIfDrv;         /* Pointer to BSD Network Driver I/F */
  38.  
  39.     } NET_IF_TBL;
  40. /*
  41.  *  These IOCTL commands are used exclusively by the mib2Lib.c module to retrive
  42.  *  MIB-II parameters from network drivers.
  43.  */
  44.  
  45. #define SIOCGMIB2CNFG   _IOR('m',  0, int)            /* Get Configuration */
  46. #define SIOCGMIB2CNTRS  _IOR('m',  1, int)            /* Get driver counters */
  47. #define SIOCGMIB2233    _IOR('m',  2, M2_ID **)       /* Get rfc2233 data */
  48. #define SIOCSMIB2233    _IOW('m',  3, IF_SETENTRY)    /* Set rfc2233 data */
  49. #define SIOCGMCASTLIST  _IOR('m',  4, LIST **)        /* Get mcast list */
  50. /*
  51.  * This structure is used to obtain the configuration information from the
  52.  * network drivers.  This information is static and does not change through the
  53.  * life time of the driver. 
  54.  */
  55.  
  56. typedef struct
  57.     {
  58.     long            ifType;
  59.     M2_OBJECTID     ifSpecific;
  60.  
  61.     } M2_NETDRVCNFG;
  62.  
  63. /*
  64.  * This structure is used to retrive counters from the network driver.  The
  65.  * variable ifSpeed is included here to support devices that can compute the
  66.  * nominal bandwidth.
  67.  */
  68.  
  69. typedef struct
  70.     {
  71.     unsigned long   ifSpeed;
  72.     unsigned long   ifInOctets;
  73.     unsigned long   ifInNUcastPkts;
  74.     unsigned long   ifInDiscards;
  75.     unsigned long   ifInUnknownProtos;
  76.     unsigned long   ifOutOctets;
  77.     unsigned long   ifOutNUcastPkts;
  78.     unsigned long   ifOutDiscards;
  79.  
  80.     } M2_NETDRVCNTRS;
  81.   
  82.  
  83. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  84. #pragma align 0                 /* turn off alignment requirement */
  85. #endif  /* CPU_FAMILY==I960 */
  86.  
  87. /* extern NET_IF_TBL * pm2IfTable;  Network I/F table (Allocated Dynamically) */
  88. #ifndef VIRTUAL_STACK
  89. extern int       m2IfCount;
  90. extern AVL_TREE     pM2IfRoot;    /* The root node of the if tree */
  91. extern M2_IFINDEX * pm2IfTable;  /* Network I/F table (Allocated Dynamically) */
  92. extern int          m2IfCount; 
  93. #endif    /* VIRTUAL_STACK */
  94. extern M2_OBJECTID zeroObjectId;
  95. #if defined(__STDC__) || defined(__cplusplus)
  96. extern int m2NetIfTableRead (void);
  97. extern int nextIndex (void *, GENERIC_ARGUMENT);
  98. extern void ifWalk (int);
  99. extern void testTree (void);
  100. #else   /* __STDC__ */
  101. extern int m2NetIfTableRead ();
  102. #endif  /* __STDC__ */
  103. #ifdef __cplusplus
  104. }
  105. #endif
  106. #endif /* __INCm2LibPh */