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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       ADSPSecure.h
  3.  
  4.      Contains:   Secure AppleTalk Data Stream Protocol Interfaces.
  5.  
  6.      Version:    Technology: AOCE Toolbox 1.02
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1994-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 __ADSPSECURE__
  18. #define __ADSPSECURE__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __ADSP__
  23. #include "ADSP.h"
  24. #endif
  25. #ifndef __OCEAUTHDIR__
  26. #include "OCEAuthDir.h"
  27. #endif
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38.     #pragma options align=mac68k
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40.     #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42.     #pragma pack(2)
  43. #endif
  44. /* New ADSP control codes
  45.  * open a secure connection */
  46. enum {
  47.     sdspOpen                    = 229
  48. };
  49. /*
  50. For secure connections, the eom field of ioParams contains two single-bit flags
  51. (instead of a zero/non-zero byte). They are an encrypt flag (see below), and an
  52. eom flag.  All other bits in that field should be zero.
  53. To write an encrypted message, you must set an encrypt bit in the eom field of
  54. the ioParams of your write call. Note: this flag is only checked on the first
  55. write of a message (the first write on a connection, or the first write following
  56. a write with eom set.
  57. */
  58. enum {
  59.     dspEOMBit                   = 0,                            /* set if EOM at end of write */
  60.     dspEncryptBit               = 1                             /* set to encrypt message */
  61. };
  62. enum {
  63.     dspEOMMask                  = 1 << dspEOMBit,
  64.     dspEncryptMask              = 1 << dspEncryptBit
  65. };
  66. /*
  67. Define an ADSPSecure parameter block, as used for the secure Open call.
  68.  * size of ADSPSecure workspace */
  69. enum {
  70.     sdspWorkSize                = 2048
  71. };
  72. struct TRSecureParams {
  73.     unsigned short                  localCID;                   /* local connection id */
  74.     unsigned short                  remoteCID;                  /* remote connection id */
  75.     AddrBlock                       remoteAddress;              /* address of remote end */
  76.     AddrBlock                       filterAddress;              /* address filter */
  77.     unsigned long                   sendSeq;                    /* local send sequence number */
  78.     unsigned short                  sendWindow;                 /* send window size */
  79.     unsigned long                   recvSeq;                    /* receive sequence number */
  80.     unsigned long                   attnSendSeq;                /* attention send sequence number */
  81.     unsigned long                   attnRecvSeq;                /* attention receive sequence number */
  82.     unsigned char                   ocMode;                     /* open connection mode */
  83.     unsigned char                   ocInterval;                 /* open connection request retry interval */
  84.     unsigned char                   ocMaximum;                  /* open connection request retry maximum */
  85.     Boolean                         secure;                     /*  --> TRUE if session was authenticated */
  86.     AuthKeyPtr                      sessionKey;                 /* <--> encryption key for session */
  87.     unsigned long                   credentialsSize;            /*  --> length of credentials */
  88.     void *                          credentials;                /*  --> pointer to credentials */
  89.     void *                          workspace;                  /*  --> pointer to workspace for connection align on even boundary and length = sdspWorkSize */
  90.     AuthIdentity                    recipient;                  /*  --> identity of recipient (or initiator if active mode */
  91.     UTCTime                         issueTime;                  /*  --> when credentials were issued */
  92.     UTCTime                         expiry;                     /*  --> when credentials expiry */
  93.     RecordIDPtr                     initiator;                  /* <--  RecordID of initiator returned here. Must give appropriate Buffer to hold RecordID (Only for passive or accept mode) */
  94.     Boolean                         hasIntermediary;            /* <--  will be set if credentials has an intermediary */
  95.     Boolean                         filler1;
  96.     RecordIDPtr                     intermediary;               /* <--  RecordID of intermediary returned here. (If intermediary is found in credentials Must give appropriate Buffer to hold RecordID (Only for passive or accept mode) */
  97. };
  98. typedef struct TRSecureParams           TRSecureParams;
  99. typedef struct SDSPParamBlock           SDSPParamBlock;
  100. typedef SDSPParamBlock *                SDSPPBPtr;
  101. typedef CALLBACK_API( void , SDSPIOCompletionProcPtr )(SDSPPBPtr paramBlock);
  102. /*
  103.     WARNING: SDSPIOCompletionProcPtr uses register based parameters under classic 68k
  104.              and cannot be written in a high-level language without 
  105.              the help of mixed mode or assembly glue.
  106. */
  107. typedef REGISTER_UPP_TYPE(SDSPIOCompletionProcPtr)              SDSPIOCompletionUPP;
  108. struct SDSPParamBlock {
  109.     QElem *                         qLink;
  110.     short                           qType;
  111.     short                           ioTrap;
  112.     Ptr                             ioCmdAddr;
  113.     SDSPIOCompletionUPP             ioCompletion;
  114.     OSErr                           ioResult;
  115.     StringPtr                       ioNamePtr;
  116.     short                           ioVRefNum;
  117.     short                           ioCRefNum;                  /* adsp driver refNum */
  118.     short                           csCode;                     /* adsp driver control code */
  119.     long                            qStatus;                    /* adsp internal use */
  120.     short                           ccbRefNum;
  121.     union {
  122.         TRinitParams                    initParams;             /* dspInit, dspCLInit */
  123.         TRopenParams                    openParams;             /* dspOpen, dspCLListen, dspCLDeny */
  124.         TRcloseParams                   closeParams;            /*dspClose, dspRemove*/
  125.         TRioParams                      ioParams;               /*dspRead, dspWrite*/
  126.         TRattnParams                    attnParams;             /*dspAttention*/
  127.         TRstatusParams                  statusParams;           /*dspStatus*/
  128.         TRoptionParams                  optionParams;           /*dspOptions*/
  129.         TRnewcidParams                  newCIDParams;           /*dspNewCID*/
  130.         TRSecureParams                  secureParams;           /* dspOpenSecure */
  131.     }                                 u;
  132. };
  133. #if OPAQUE_UPP_TYPES
  134. #if CALL_NOT_IN_CARBON
  135.     EXTERN_API(SDSPIOCompletionUPP)
  136.     NewSDSPIOCompletionUPP         (SDSPIOCompletionProcPtr userRoutine);
  137.     EXTERN_API(void)
  138.     DisposeSDSPIOCompletionUPP     (SDSPIOCompletionUPP     userUPP);
  139.     EXTERN_API(void)
  140.     InvokeSDSPIOCompletionUPP      (SDSPPBPtr               paramBlock,
  141.                                     SDSPIOCompletionUPP     userUPP);
  142. #endif  /* CALL_NOT_IN_CARBON */
  143. #else
  144.     enum { uppSDSPIOCompletionProcInfo = 0x00009802 };              /* register no_return_value Func(4_bytes:A0) */
  145.     #define NewSDSPIOCompletionUPP(userRoutine)                     (SDSPIOCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSDSPIOCompletionProcInfo, GetCurrentArchitecture())
  146.     #define DisposeSDSPIOCompletionUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  147.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  148.     #pragma parameter InvokeSDSPIOCompletionUPP(__A0, __A1)
  149.     void InvokeSDSPIOCompletionUPP(SDSPPBPtr paramBlock, SDSPIOCompletionUPP userUPP) = 0x4E91;
  150.     #else
  151.         #define InvokeSDSPIOCompletionUPP(paramBlock, userUPP)          CALL_ONE_PARAMETER_UPP((userUPP), uppSDSPIOCompletionProcInfo, (paramBlock))
  152.     #endif
  153. #endif
  154. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  155. #define NewSDSPIOCompletionProc(userRoutine)                    NewSDSPIOCompletionUPP(userRoutine)
  156. #define CallSDSPIOCompletionProc(userRoutine, paramBlock)       InvokeSDSPIOCompletionUPP(paramBlock, userRoutine)
  157. #if PRAGMA_STRUCT_ALIGN
  158.     #pragma options align=reset
  159. #elif PRAGMA_STRUCT_PACKPUSH
  160.     #pragma pack(pop)
  161. #elif PRAGMA_STRUCT_PACK
  162.     #pragma pack()
  163. #endif
  164. #ifdef PRAGMA_IMPORT_OFF
  165. #pragma import off
  166. #elif PRAGMA_IMPORT
  167. #pragma import reset
  168. #endif
  169. #ifdef __cplusplus
  170. }
  171. #endif
  172. #endif /* __ADSPSECURE__ */