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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       OpenTransportUNIX.h
  3.  
  4.      Contains:   Open Transport client interface file for UNIX compatibility clients.
  5.  
  6.      Version:    Technology: 2.5
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1993-2001 by Apple Computer, Inc. and Mentat 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 __OPENTRANSPORTUNIX__
  18. #define __OPENTRANSPORTUNIX__
  19. #include "stddef.h"
  20. #ifndef __OPENTRANSPORTPROTOCOL__
  21. #include "OpenTransportProtocol.h"
  22. #endif
  23. #if PRAGMA_ONCE
  24. #pragma once
  25. #endif
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. #if PRAGMA_IMPORT
  30. #pragma import on
  31. #endif
  32. #if PRAGMA_STRUCT_ALIGN
  33.     #pragma options align=mac68k
  34. #elif PRAGMA_STRUCT_PACKPUSH
  35.     #pragma pack(push, 2)
  36. #elif PRAGMA_STRUCT_PACK
  37.     #pragma pack(2)
  38. #endif
  39. #if defined(__MWERKS__) && TARGET_CPU_68K
  40.     #pragma push
  41.     #pragma pointers_in_D0
  42. #endif
  43. /* ***** Global Variables ******/
  44. extern int t_errno;
  45. /* ***** XTI Structures ******/
  46. /*
  47.    WARNING:
  48.    These structures will only work if "int"s are the
  49.    same size as "size_t", "long", and "UInt32".  We left
  50.    them this way for maximum UNIX compatibility.
  51. */
  52. struct netbuf {
  53.     unsigned int                    maxlen;
  54.     unsigned int                    len;
  55.     char *                          buf;
  56. };
  57. typedef struct netbuf                   netbuf;
  58. struct t_info {
  59.     int                             addr;                       /* Maximum size of an address        */
  60.     int                             options;                    /* Maximum size of options          */
  61.     int                             tsdu;                       /* Standard data transmit unit size     */
  62.     int                             etsdu;                      /* Expedited data transmit unit size  */
  63.     int                             connect;                    /* Maximum data size on connect      */
  64.     int                             discon;                     /* Maximum data size on disconnect       */
  65.     unsigned int                    servtype;                   /* service type                */
  66.     unsigned int                    flags;                      /* Flags (see "OpenTransport.h")   */
  67. };
  68. typedef struct t_info                   t_info;
  69. struct t_bind
  70. {
  71.     netbuf              addr;
  72.     unsigned int        qlen;
  73. };
  74. struct t_optmgmt
  75. {
  76.     netbuf          opt;
  77.     long            flags;
  78. };
  79. struct t_discon {
  80.     netbuf                          udata;
  81.     int                             reason;
  82.     int                             sequence;
  83. };
  84. typedef struct t_discon                 t_discon;
  85. struct t_call {
  86.     netbuf                          addr;
  87.     netbuf                          opt;
  88.     netbuf                          udata;
  89.     int                             sequence;
  90. };
  91. typedef struct t_call                   t_call;
  92. struct t_unitdata {
  93.     netbuf                          addr;
  94.     netbuf                          opt;
  95.     netbuf                          udata;
  96. };
  97. typedef struct t_unitdata               t_unitdata;
  98. struct t_uderr {
  99.     netbuf                          addr;
  100.     netbuf                          opt;
  101.     long                            error;
  102. };
  103. typedef struct t_uderr                  t_uderr;
  104. /*    -------------------------------------------------------------------------
  105.     Transaction data structures
  106.     ------------------------------------------------------------------------- */
  107. struct t_request {
  108.     netbuf                          data;
  109.     netbuf                          opt;
  110.     long                            sequence;
  111. };
  112. typedef struct t_request                t_request;
  113. struct t_reply {
  114.     netbuf                          data;
  115.     netbuf                          opt;
  116.     long                            sequence;
  117. };
  118. typedef struct t_reply                  t_reply;
  119. struct t_unitrequest {
  120.     netbuf                          addr;
  121.     netbuf                          opt;
  122.     netbuf                          udata;
  123.     long                            sequence;
  124. };
  125. typedef struct t_unitrequest            t_unitrequest;
  126. struct t_unitreply {
  127.     netbuf                          opt;
  128.     netbuf                          udata;
  129.     long                            sequence;
  130. };
  131. typedef struct t_unitreply              t_unitreply;
  132. struct t_opthdr {
  133.     unsigned long                   len;                        /* total length of option = sizeof(struct t_opthdr) + */
  134.                                                                 /*                 length of option value in bytes   */
  135.     unsigned long                   level;                      /* protocol affected */
  136.     unsigned long                   name;                       /* option name */
  137.     unsigned long                   status;                     /* status value */
  138.                                                                 /* followed by the option value */
  139. };
  140. typedef struct t_opthdr                 t_opthdr;
  141. /* ***** XTI Interfaces ******/
  142. #if !OTKERNEL
  143. #if CALL_NOT_IN_CARBON
  144. EXTERN_API( int )
  145. t_accept                        (int                    fd,
  146.                                  int                    resfd,
  147.                                  t_call *               call);
  148. EXTERN_API( char *)
  149. t_alloc                         (int                    fd,
  150.                                  int                    struct_type,
  151.                                  int                    fields);
  152. #endif  /* CALL_NOT_IN_CARBON */
  153. EXTERN_API( int ) t_bind(int fd, struct t_bind* req, struct t_bind* ret);
  154. EXTERN_API( int )t_optmgmt(int fd, struct t_optmgmt* req, struct t_optmgmt* ret);
  155. EXTERN_API( int ) t_getprotaddr(int fd, struct t_bind* boundaddr, struct t_bind* peeraddr);
  156. EXTERN_API( int ) t_resolveaddr(int fd, struct t_bind* reqAddr, struct t_bind* retAddr, OTTimeout timeout);
  157. #if CALL_NOT_IN_CARBON
  158. EXTERN_API( int )
  159. t_close                         (int                    fd);
  160. EXTERN_API( int )
  161. t_connect                       (int                    fd,
  162.                                  t_call *               sndcall,
  163.                                  t_call *               rcvcall);
  164. EXTERN_API( int )
  165. t_free                          (char *                 ptr,
  166.                                  int                    struct_type);
  167. EXTERN_API( int )
  168. t_getinfo                       (int                    fd,
  169.                                  t_info *               info);
  170. EXTERN_API( int )
  171. t_getstate                      (int                    fd);
  172. EXTERN_API( int )
  173. t_listen                        (int                    fd,
  174.                                  t_call *               call);
  175. EXTERN_API( int )
  176. t_look                          (int                    fd);
  177. EXTERN_API( int )
  178. t_open                          (char *                 path,
  179.                                  int                    oflag,
  180.                                  t_info *               info);
  181. EXTERN_API( int )
  182. t_blocking                      (int                    fd);
  183. EXTERN_API( int )
  184. t_nonblocking                   (int                    fd);
  185. EXTERN_API( int )
  186. t_rcv                           (int                    fd,
  187.                                  char *                 buf,
  188.                                  size_t                 nbytes,
  189.                                  int *                  flags);
  190. EXTERN_API( int )
  191. t_rcvconnect                    (int                    fd,
  192.                                  t_call *               call);
  193. EXTERN_API( int )
  194. t_rcvdis                        (int                    fd,
  195.                                  t_discon *             discon);
  196. EXTERN_API( int )
  197. t_rcvrel                        (int                    fd);
  198. EXTERN_API( int )
  199. t_rcvudata                      (int                    fd,
  200.                                  t_unitdata *           unitdata,
  201.                                  int *                  flags);
  202. EXTERN_API( int )
  203. t_rcvuderr                      (int                    fd,
  204.                                  t_uderr *              uderr);
  205. EXTERN_API( int )
  206. t_snd                           (int                    fd,
  207.                                  char *                 buf,
  208.                                  size_t                 nbytes,
  209.                                  int                    flags);
  210. EXTERN_API( int )
  211. t_snddis                        (int                    fd,
  212.                                  t_call *               call);
  213. EXTERN_API( int )
  214. t_sndrel                        (int                    fd);
  215. EXTERN_API( int )
  216. t_sndudata                      (int                    fd,
  217.                                  t_unitdata *           unitdata);
  218. EXTERN_API( int )
  219. t_sync                          (int                    fd);
  220. EXTERN_API( int )
  221. t_unbind                        (int                    fd);
  222. EXTERN_API( int )
  223. t_error                         (char *                 errmsg);
  224. /* Apple extensions*/
  225. EXTERN_API( int )
  226. t_isnonblocking                 (int                    fd);
  227. EXTERN_API( int )
  228. t_asynchronous                  (int                    fd);
  229. EXTERN_API( int )
  230. t_synchronous                   (int                    fd);
  231. EXTERN_API( int )
  232. t_issynchronous                 (int                    fd);
  233. EXTERN_API( int )
  234. t_usesyncidleevents             (int                    fd,
  235.                                  int                    useEvents);
  236. /* Not XTI standard functions, but extensions for transaction endpoints */
  237. EXTERN_API( int )
  238. t_sndrequest                    (int                    fd,
  239.                                  t_request *            req,
  240.                                  int                    flags);
  241. EXTERN_API( int )
  242. t_rcvreply                      (int                    fd,
  243.                                  t_reply *              rep,
  244.                                  int *                  flags);
  245. EXTERN_API( int )
  246. t_rcvrequest                    (int                    fd,
  247.                                  t_request *            req,
  248.                                  int *                  flags);
  249. EXTERN_API( int )
  250. t_sndreply                      (int                    fd,
  251.                                  t_reply *              rep,
  252.                                  int                    flags);
  253. EXTERN_API( int )
  254. t_cancelrequest                 (int                    fd,
  255.                                  long                   sequence);
  256. EXTERN_API( int )
  257. t_cancelreply                   (int                    fd,
  258.                                  long                   sequence);
  259. EXTERN_API( int )
  260. t_sndurequest                   (int                    fd,
  261.                                  t_unitrequest *        ureq,
  262.                                  int                    flags);
  263. EXTERN_API( int )
  264. t_rcvureply                     (int                    fd,
  265.                                  t_unitreply *          urep,
  266.                                  int *                  flags);
  267. EXTERN_API( int )
  268. t_rcvurequest                   (int                    fd,
  269.                                  t_unitrequest *        ureq,
  270.                                  int *                  flags);
  271. EXTERN_API( int )
  272. t_sndureply                     (int                    fd,
  273.                                  t_unitreply *          urep,
  274.                                  int                    flags);
  275. EXTERN_API( int )
  276. t_cancelurequest                (int                    fd,
  277.                                  long                   sequence);
  278. EXTERN_API( int )
  279. t_cancelureply                  (int                    fd,
  280.                                  long                   sequence);
  281. EXTERN_API( int )
  282. t_cancelsynchronouscalls        (int                    fd);
  283. EXTERN_API( int )
  284. t_installnotifier               (int                    fd,
  285.                                  OTNotifyProcPtr        proc,
  286.                                  void *                 contextPtr);
  287. EXTERN_API( void )
  288. t_removenotifier                (int                    fd);
  289. /* STREAMS Primitives*/
  290. EXTERN_API( int )
  291. getmsg                          (int                    fd,
  292.                                  strbuf *               ctlbuf,
  293.                                  strbuf *               databuf,
  294.                                  int *                  flagsp);
  295. EXTERN_API( int )
  296. putmsg                          (int                    fd,
  297.                                  const strbuf *         ctlbuf,
  298.                                  const strbuf *         databuf,
  299.                                  int                    flags);
  300. EXTERN_API( int )
  301. getpmsg                         (int                    fd,
  302.                                  strbuf *               ctlbuf,
  303.                                  strbuf *               databuf,
  304.                                  int *                  bandp,
  305.                                  int *                  flagsp);
  306. EXTERN_API( int )
  307. putpmsg                         (int                    fd,
  308.                                  const strbuf *         ctlbuf,
  309.                                  const strbuf *         databuf,
  310.                                  int                    band,
  311.                                  int                    flags);
  312. /* Raw streams operations.*/
  313. EXTERN_API( int )
  314. stream_installnotifier          (int                    fd,
  315.                                  OTNotifyProcPtr        proc,
  316.                                  void *                 contextPtr);
  317. EXTERN_API( int )
  318. stream_blocking                 (int                    fd);
  319. EXTERN_API( int )
  320. stream_nonblocking              (int                    fd);
  321. EXTERN_API( int )
  322. stream_isblocking               (int                    fd);
  323. EXTERN_API( int )
  324. stream_synchronous              (int                    fd);
  325. EXTERN_API( int )
  326. stream_asynchronous             (int                    fd);
  327. EXTERN_API( int )
  328. stream_issynchronous            (int                    fd);
  329. EXTERN_API( int )
  330. stream_open                     (char *                 path,
  331.                                  unsigned long          flags);
  332. EXTERN_API( int )
  333. stream_close                    (int                    fd);
  334. EXTERN_API( int )
  335. stream_read                     (int                    fd,
  336.                                  void *                 buf,
  337.                                  size_t                 len);
  338. EXTERN_API( int )
  339. stream_write                    (int                    fd,
  340.                                  void *                 buf,
  341.                                  size_t                 len);
  342. EXTERN_API_C( int )
  343. stream_ioctl                    (int                    fd,
  344.                                  unsigned long          cmd,
  345.                                  ...);
  346. EXTERN_API( int )
  347. stream_pipe                     (int *                  fds);
  348. #endif  /* CALL_NOT_IN_CARBON */
  349. struct pollfd {
  350.     SInt32                          fd;
  351.     short                           events;
  352.     short                           revents;
  353.     long                            _ifd;                       /* Internal "fd" for the benefit of the kernel */
  354. };
  355. typedef struct pollfd                   pollfd;
  356. #if CALL_NOT_IN_CARBON
  357. EXTERN_API( int )
  358. poll                            (pollfd *               fds,
  359.                                  size_t                 nfds,
  360.                                  unsigned long          timeout);
  361. #endif  /* CALL_NOT_IN_CARBON */
  362. #endif  /* !OTKERNEL */
  363. #if defined(__MWERKS__) && TARGET_CPU_68K
  364.     #pragma pop
  365. #endif
  366. #if PRAGMA_STRUCT_ALIGN
  367.     #pragma options align=reset
  368. #elif PRAGMA_STRUCT_PACKPUSH
  369.     #pragma pack(pop)
  370. #elif PRAGMA_STRUCT_PACK
  371.     #pragma pack()
  372. #endif
  373. #ifdef PRAGMA_IMPORT_OFF
  374. #pragma import off
  375. #elif PRAGMA_IMPORT
  376. #pragma import reset
  377. #endif
  378. #ifdef __cplusplus
  379. }
  380. #endif
  381. #endif /* __OPENTRANSPORTUNIX__ */