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

VxWorks

开发平台:

C/C++

  1. /* muxLibP.h - private definitions for the MUX library */
  2. /* Copyright 1984-2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01r,10oct01,rae  merge from truestack (update copyright)
  7. 01q,25oct00,niq  Merge RFC2233 changes from open_stack-p1-r1 branch
  8.                  01q,18oct00,ann  insterting Siemens bug #25 for 0 mac addresses
  9. 01p,05oct99,pul  removing rtRequest and mCastMap
  10. 01o,29apr99,pul  Upgraded NPT phase3 code to tor2.0.0
  11. 01n,24mar99,sj   changed tkFlag field in muxBindEntry to flags; added defines
  12. 01m,24mar99,sj   added defines for flags field of NET_PROTOCOL structure
  13. 01l,18mar99,sj   cleaned up: completed the cleanup postponed in 01j,05mar99,sj
  14. 01k,08mar99,sj   added place holder for stackrcv routine in BIB entry
  15. 01j,05mar99,sj   eliminated hooks; not cleanly though. next version will do that
  16. 01i,24feb99,sj   added netSvcType and netDrvType fields to the BIB entry
  17. 01h,26jan99,sj   moved BIB entry definition from muxTkLib.c to here
  18. 01g,05nov98,sj   PCOOKIE_TO_ENDOBJ must check if pCookie is NULL
  19. 01f,03nov98,pul  modified IPPROTO_MCAST_MAP_GET 
  20. 01e,03nov98,sj   doc update
  21. 01d,20oct98,pul  don't return ERROR if hook is not valid
  22. 01c,15oct98,pul  added ipProto Hooks 
  23. 01b,12oct98,sj   changed MUX_TK_ADDR_RES_FUNC_UPDATE, added WRS_*_MODULE 
  24. 01a,06oct98,sj   written.
  25. */
  26.  
  27. /*
  28. DESCRIPTION
  29. This file includes macros used by muxLib to avail features of the NPT
  30. architecture if it is installed.
  31. INCLUDE FILES:
  32. */
  33. #ifndef __INCmuxLibPh
  34. #define __INCmuxLibPh
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. #include "vxWorks.h"
  39. #include "muxLib.h"
  40. /* we steal these defines from a END driver */
  41. #define END_HADDR(pEnd)                                                 
  42.                 ((pEnd)->mib2Tbl.ifPhysAddress.phyAddress)
  43. #define END_HADDR_LEN(pEnd)                                             
  44.                 ((pEnd)->mib2Tbl.ifPhysAddress.addrLength)
  45. /* Alternate defines for the above till all drivers have been changed 
  46.  * to follow rfc2233 implementation
  47.  */
  48. #define END_ALT_HADDR(pEnd) 
  49.                 ((pEnd)->pMib2Tbl->m2Data.mibIfTbl.ifPhysAddress.phyAddress)
  50. #define END_ALT_HADDR_LEN(pEnd) 
  51.                 ((pEnd)->pMib2Tbl->m2Data.mibIfTbl.ifPhysAddress.addrLength)
  52.                     
  53. #define END_MIB2_TYPE(pEnd)                                             
  54.                 ((pEnd)->mib2Tbl.ifType)
  55. #define END_IOCTL(pEnd)                                             
  56. (pEnd->pFuncTable->ioctl)
  57. /*
  58.  * we define these flag bits for the flags field in the NET_PROTOCOL structure
  59.  * that is allocated for each protocol bound to an END
  60.  */
  61. #define MUX_TK_DEV  0x1  /* protocol is bound to a toolkit device */
  62. #define MUX_BIND    0x2 /* END is bound to using muxBind() */
  63. #define MUX_TK_BIND 0x4 /* END is bound to using muxTkBind() */
  64. /*
  65.  * we define these flag bits for the flags field in the muxBindEntry defined
  66.  * below
  67.  */
  68. #define BIB_DRV_ENTRY      0x1 /* driver loaded at this entry */
  69. #define BIB_TK_DRV         0x2 /* driver is a toolkit(NPT) driver */
  70. #define BIB_PROTO_ENTRY    0x4 /* a protocol has this BIB entry */
  71. /*
  72.  * This defines the structure of the entry in the MUX information base(BIB).
  73.  * There is one such entry for every protocol/network device binding instance
  74.  */
  75. typedef struct muxBindEntry
  76.     {
  77.     int unitNo;                 /* unit number of the device */
  78.     char devName[END_NAME_MAX]; /* device name */
  79.     long netSvcType; /* network service type */
  80.     long netDrvType; /* network Driver type */
  81.     UINT32 flags;               /* BIB entry flags */
  82.     END_OBJ* pEnd;              /* reference to the END object */
  83.     void* pNetCallbackId;       /* network service callback Id given at bind */
  84.     FUNCPTR addrResFunc;        /* reference to Address resolution function */
  85.     FUNCPTR netStackRcvRtn;     /* reference to network service stackRcvRtn */
  86.     }MUX_BIND_ENTRY, *MUX_ID;
  87. /* convert from a void * cookie(which is a MUX_ID) to a END_OBJ pointer */
  88. #define PCOOKIE_TO_ENDOBJ(pCookie) ((pCookie) ? ((MUX_ID)pCookie)->pEnd : NULL)
  89. /*
  90.  * These macros are used by muxAddrRecFuncXXX functions
  91.  */
  92.  #define TK_ADDR_RES_GET 1
  93.  #define TK_ADDR_RES_ADD 2
  94.  #define TK_ADDR_RES_DEL 3
  95. /* prototypes */
  96. /* 
  97.  * these functions are used by the SENS MUX API implementations to avail
  98.  * NPT features
  99.  */
  100. extern STATUS muxTkBibInit (void);
  101. extern void * muxTkDevLoadUpdate (END_OBJ * pEnd);
  102. extern void * muxTkBindUpdate (END_OBJ * pEnd, NET_PROTOCOL * pProto);
  103. extern void muxTkUnbindUpdate (void * pCookie);
  104. extern STATUS muxTkUnloadUpdate (END_OBJ * pEnd);
  105. extern void * muxTkAddrFuncUpdate (long netDrvType, long netProtoType, 
  106.    FUNCPTR pAddrResFunc, int update);
  107. #ifdef __cplusplus
  108. }
  109. #endif
  110. #endif /* __INCmuxLibPh */