ENET.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:7k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       ENET.h
  3.  
  4.      Contains:   Ethernet Interfaces.
  5.  
  6.      Version:    Technology: System 7.5
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1990-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ENET__
  18. #define __ENET__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __OSUTILS__
  23. #include "OSUtils.h"
  24. #endif
  25. #if PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #if PRAGMA_IMPORT
  32. #pragma import on
  33. #endif
  34. #if PRAGMA_STRUCT_ALIGN
  35.     #pragma options align=mac68k
  36. #elif PRAGMA_STRUCT_PACKPUSH
  37.     #pragma pack(push, 2)
  38. #elif PRAGMA_STRUCT_PACK
  39.     #pragma pack(2)
  40. #endif
  41. enum {
  42.     ENetSetGeneral              = 253,                          /*Set "general" mode*/
  43.     ENetGetInfo                 = 252,                          /*Get info*/
  44.     ENetRdCancel                = 251,                          /*Cancel read*/
  45.     ENetRead                    = 250,                          /*Read*/
  46.     ENetWrite                   = 249,                          /*Write*/
  47.     ENetDetachPH                = 248,                          /*Detach protocol handler*/
  48.     ENetAttachPH                = 247,                          /*Attach protocol handler*/
  49.     ENetAddMulti                = 246,                          /*Add a multicast address*/
  50.     ENetDelMulti                = 245                           /*Delete a multicast address*/
  51. };
  52. enum {
  53.     EAddrRType                  = FOUR_CHAR_CODE('eadr')        /*Alternate address resource type*/
  54. };
  55. typedef struct EParamBlock              EParamBlock;
  56. typedef EParamBlock *                   EParamBlkPtr;
  57. typedef CALLBACK_API( void , ENETCompletionProcPtr )(EParamBlkPtr thePBPtr);
  58. /*
  59.     WARNING: ENETCompletionProcPtr uses register based parameters under classic 68k
  60.              and cannot be written in a high-level language without 
  61.              the help of mixed mode or assembly glue.
  62. */
  63. typedef REGISTER_UPP_TYPE(ENETCompletionProcPtr)                ENETCompletionUPP;
  64. struct EParamBlock {
  65.     QElem *                         qLink;                      /*General EParams*/
  66.     short                           qType;                      /*queue type*/
  67.     short                           ioTrap;                     /*routine trap*/
  68.     Ptr                             ioCmdAddr;                  /*routine address*/
  69.     ENETCompletionUPP               ioCompletion;               /*completion routine*/
  70.     OSErr                           ioResult;                   /*result code*/
  71.     StringPtr                       ioNamePtr;                  /*->filename*/
  72.     short                           ioVRefNum;                  /*volume reference or drive number*/
  73.     short                           ioRefNum;                   /*driver reference number*/
  74.     short                           csCode;                     /*Call command code*/
  75.     union {
  76.         struct {
  77.             short                           eProtType;          /*Ethernet protocol type*/
  78.             Ptr                             ePointer;           /*No support for PowerPC code*/
  79.             short                           eBuffSize;          /*buffer size*/
  80.             short                           eDataSize;          /*number of bytes read*/
  81.         }                                 EParms1;
  82.         struct {
  83.             Byte                            eMultiAddr[6];      /*Multicast Address*/
  84.         }                                 EParms2;
  85.     }                                 u;
  86. };
  87. #if OPAQUE_UPP_TYPES
  88. #if CALL_NOT_IN_CARBON
  89.     EXTERN_API(ENETCompletionUPP)
  90.     NewENETCompletionUPP           (ENETCompletionProcPtr   userRoutine);
  91.     EXTERN_API(void)
  92.     DisposeENETCompletionUPP       (ENETCompletionUPP       userUPP);
  93.     EXTERN_API(void)
  94.     InvokeENETCompletionUPP        (EParamBlkPtr            thePBPtr,
  95.                                     ENETCompletionUPP       userUPP);
  96. #endif  /* CALL_NOT_IN_CARBON */
  97. #else
  98.     enum { uppENETCompletionProcInfo = 0x00009802 };                /* register no_return_value Func(4_bytes:A0) */
  99.     #define NewENETCompletionUPP(userRoutine)                       (ENETCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppENETCompletionProcInfo, GetCurrentArchitecture())
  100.     #define DisposeENETCompletionUPP(userUPP)                       DisposeRoutineDescriptor(userUPP)
  101.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  102.     #pragma parameter InvokeENETCompletionUPP(__A0, __A1)
  103.     void InvokeENETCompletionUPP(EParamBlkPtr thePBPtr, ENETCompletionUPP userUPP) = 0x4E91;
  104.     #else
  105.         #define InvokeENETCompletionUPP(thePBPtr, userUPP)              CALL_ONE_PARAMETER_UPP((userUPP), uppENETCompletionProcInfo, (thePBPtr))
  106.     #endif
  107. #endif
  108. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  109. #define NewENETCompletionProc(userRoutine)                      NewENETCompletionUPP(userRoutine)
  110. #define CallENETCompletionProc(userRoutine, thePBPtr)           InvokeENETCompletionUPP(thePBPtr, userRoutine)
  111. #if CALL_NOT_IN_CARBON
  112. EXTERN_API( OSErr )
  113. EWrite                          (EParamBlkPtr           thePBptr,
  114.                                  Boolean                async);
  115. EXTERN_API( OSErr )
  116. EAttachPH                       (EParamBlkPtr           thePBptr,
  117.                                  Boolean                async);
  118. EXTERN_API( OSErr )
  119. EDetachPH                       (EParamBlkPtr           thePBptr,
  120.                                  Boolean                async);
  121. EXTERN_API( OSErr )
  122. ERead                           (EParamBlkPtr           thePBptr,
  123.                                  Boolean                async);
  124. EXTERN_API( OSErr )
  125. ERdCancel                       (EParamBlkPtr           thePBptr,
  126.                                  Boolean                async);
  127. EXTERN_API( OSErr )
  128. EGetInfo                        (EParamBlkPtr           thePBptr,
  129.                                  Boolean                async);
  130. EXTERN_API( OSErr )
  131. ESetGeneral                     (EParamBlkPtr           thePBptr,
  132.                                  Boolean                async);
  133. EXTERN_API( OSErr )
  134. EAddMulti                       (EParamBlkPtr           thePBptr,
  135.                                  Boolean                async);
  136. EXTERN_API( OSErr )
  137. EDelMulti                       (EParamBlkPtr           thePBptr,
  138.                                  Boolean                async);
  139. #endif  /* CALL_NOT_IN_CARBON */
  140. #if PRAGMA_STRUCT_ALIGN
  141.     #pragma options align=reset
  142. #elif PRAGMA_STRUCT_PACKPUSH
  143.     #pragma pack(pop)
  144. #elif PRAGMA_STRUCT_PACK
  145.     #pragma pack()
  146. #endif
  147. #ifdef PRAGMA_IMPORT_OFF
  148. #pragma import off
  149. #elif PRAGMA_IMPORT
  150. #pragma import reset
  151. #endif
  152. #ifdef __cplusplus
  153. }
  154. #endif
  155. #endif /* __ENET__ */