Mac OS 9
OpenTransport.h
Go to the documentation of this file.
1 
20 #ifndef __OPENTRANSPORT__
21 #define __OPENTRANSPORT__
22 
57 #ifndef __MACTYPES__
58 #include <MacTypes.h>
59 #endif
60 
61 #ifndef __MIXEDMODE__
62 #include <MixedMode.h>
63 #endif
64 
65 #ifndef __MACERRORS__
66 #include <MacErrors.h>
67 #endif
68 
69 #ifdef __cplusplus
70 #include <stddef.h>
71 #endif
72 
73 #if PRAGMA_ONCE
74 #pragma once
75 #endif
76 
77 #ifdef __cplusplus
78 extern "C"
79 {
80 #endif
81 
82 #if PRAGMA_IMPORT
83 #pragma import on
84 #endif
85 
86 #if PRAGMA_STRUCT_ALIGN
87 #pragma options align = mac68k
88 #elif PRAGMA_STRUCT_PACKPUSH
89 #pragma pack(push, 2)
90 #elif PRAGMA_STRUCT_PACK
91 #pragma pack(2)
92 #endif
93 
94 #if defined(__MWERKS__) && TARGET_CPU_68K
95 #pragma push
96 #pragma pointers_in_D0
97 #endif
98 
99  /* ***** Setup Default Compiler Variables ******/
100 
109 #ifndef OTKERNEL
110 #define OTKERNEL 0
111 #endif /* !defined(OTKERNEL) */
112 
130 #ifndef OTUNIXERRORS
131 #define OTUNIXERRORS 0
132 #endif /* !defined(OTUNIXERRORS) */
133 
154 #ifdef qDebug
155 #ifndef OTDEBUG
156 #define OTDebug qDebug
157 #endif /* !defined(OTDEBUG) */
158 
159 #endif /* defined(qDebug) */
160 
161 #ifndef OTDEBUG
162 #define OTDEBUG 0
163 #endif /* !defined(OTDEBUG) */
164 
165 /* Carbon Applications have some restrictions on using OT*/
166 #ifndef OTCARBONAPPLICATION
167 #define OTCARBONAPPLICATION 0
168 #endif /* !defined(OTCARBONAPPLICATION) */
169 
188 #if TARGET_CPU_68K
189  typedef UInt32 OTUInt8Param;
190  typedef UInt32 OTUInt16Param;
191  typedef SInt32 OTSInt16Param;
192  typedef SInt32 OTSInt8Param;
193  typedef SInt32 OTBooleanParam;
194 #else
195 typedef UInt8 OTUInt8Param;
196 typedef UInt16 OTUInt16Param;
197 typedef SInt16 OTSInt16Param;
198 typedef SInt8 OTSInt8Param;
199 typedef Boolean OTBooleanParam;
200 #endif /* TARGET_CPU_68K */
201 
202 #if defined(__MWERKS__) || defined(THINK_C) || defined(SYMANTEC_CPLUS) || \
203  defined(SYMANTEC_C) || defined(__xlc) || defined(__xlC) || \
204  defined(__xlC__)
205  typedef ByteCount OTByteCount;
206  typedef ItemCount OTItemCount;
207  typedef SInt32 OTInt32;
208  typedef UInt32 OTUInt32;
209 #else
210 typedef unsigned int OTByteCount;
211 typedef unsigned int OTItemCount;
212 typedef int OTInt32;
213 typedef unsigned int OTUInt32;
214 #endif
215 
216  /* ***** C++ Support ******/
217 
223 #define _MDECL
224 #if defined(__SC__) || defined(THINK_CPLUS) || defined(__MRC__)
225 #ifdef __cplusplus
226 #undef _MDECL
227 #define _MDECL _cdecl
228 #endif
229 #endif
230 
231  /* ***** Shared Library Prefixes ******/
232 
233 #define kOTLibraryVersion "1.1"
234 
235 #define kOTLibraryPrefix "OTLib$"
236 #define kOTModulePrefix "OTModl$"
237 #define kOTClientPrefix "OTClnt$"
238 #define kOTKernelPrefix "OTKrnl$"
239 
240  enum
241  {
242  kOTCFMClass = FOUR_CHAR_CODE('otan')
243  };
244 
245  /* ***** Miscellaneous Type Definitions ******/
246 
247  /* A millisecond timeout value*/
248  typedef UInt32 OTTimeout;
249  /* An ID number in connections/transactions */
250  typedef SInt32 OTSequence;
251  /* An ID number for registered names */
252  typedef SInt32 OTNameID;
257  typedef SInt32 OTReason;
258  /* Number of outstanding connection requests at a time.*/
259  typedef UInt32 OTQLen;
260  /* Will become internationalizeable shortly (yeah, right).*/
261  typedef UInt8 *OTClientName;
262  /* The command code in STREAMS messages.*/
263  typedef SInt32 OTCommand;
264  /* value describing a client*/
265  typedef struct OpaqueOTClient *OTClient;
266 
271 #define OTOffsetOf(structure, field) ((ByteCount) & ((structure *)0)->field)
272 
273  /* ***** Debugging Macros ******/
274 
275 #define kOTFatalErr "FB "
276 #define kOTNonfatalErr "NB "
277 #define kOTExtFatalErr "FX "
278 #define kOTExtNonfatalErr "NX "
279 #define kOTUserFatalErr "UF "
280 #define kOTUserErr "UE "
281 #define kOTUserNonfatalErr "UE "
282 #define kOTInfoErr "IE "
283 #define kOTInfoBreak "IN "
284 
285 #if CALL_NOT_IN_CARBON
294  void
295  OTDebugStr(const char *str);
296 
297 #if qDebug > 0
298 #define OTDebugBreak(str) OTDebugStr(str)
299 #define OTDebugTest(val, str) \
300  { \
301  if (val) \
302  OTDebugStr(str); \
303  }
304 #define OTAssert(name, cond) \
305  ((cond) ? ((void)0) : (OTDebugStr(__FILE__ ": " #name ": " #cond)))
306 #else
307 #define OTDebugBreak(str)
308 #define OTDebugTest(val, str)
309 #define OTAssert(name, cond)
310 #endif /* qDebug > 0 */
311 
312 #if qDebug > 1 || qDebug2 > 1
313 #define OTDebugBreak2(str) OTDebugStr(str)
314 #define OTDebugTest2(val, str) \
315  { \
316  if (val) \
317  OTDebugStr(str); \
318  }
319 #else
320 #define OTDebugBreak2(str)
321 #define OTDebugTest2(val, str)
322 #endif /* qDebug > 1 || qDebug2 > 1 */
323 
324 #endif /* CALL_NOT_IN_CARBON */
325 
334  typedef UInt32 OTOpenFlags;
335  enum
336  {
337  kO_ASYNC = 0x01,
338  kO_NDELAY = 0x04,
339  kO_NONBLOCK = 0x04
340  };
341 
342 #if CALL_NOT_IN_CARBON
348  enum
349  {
350  O_ASYNC = kO_ASYNC,
351  O_NDELAY = kO_NDELAY,
352  O_NONBLOCK = kO_NONBLOCK
353  };
354 
355 #endif /* CALL_NOT_IN_CARBON */
356 
357  /* ***** UNIX-Style Error Codes ******/
358 
359  typedef UInt16 OTUnixErr;
365 #if OTKERNEL || OTUNIXERRORS
376 #undef EPERM
377 #undef ENOENT
378 #undef ENORSRC
379 #undef EINTR
380 #undef EIO
381 #undef ENXIO
382 #undef E2BIG
383 #undef EBADF
384 #undef EAGAIN
385 #undef ENOMEM
386 #undef EACCES
387 #undef EFAULT
388 #undef EBUSY
389 #undef EEXIST
390 #undef ENODEV
391 #undef EINVAL
392 #undef ENOTTY
393 #undef ERANGE
394 #undef ESRCH
395 #undef EPIPE
396 
397  enum
398  {
399  EPERM = 1, /* Permission denied */
400  ENOENT = 2, /* No such file or directory */
401  ENORSRC = 3, /* No such resource */
402  EINTR = 4, /* Interrupted system service */
403  EIO = 5, /* I/O error */
404  ENXIO = 6, /* No such device or address */
405  EBADF = 9, /* Bad file number */
406  EAGAIN = 11, /* Try operation again later */
407  ENOMEM = 12, /* Not enough space */
408  EACCES = 13, /* Permission denied */
409  EFAULT = 14, /* Bad address */
410  EBUSY = 16, /* Device or resource busy */
411  EEXIST = 17, /* File exists */
412  ENODEV = 19, /* No such device */
413  EINVAL = 22, /* Invalid argument */
414  ENOTTY = 25, /* Not a character device */
415  EPIPE = 32, /* Broken pipe */
416  ERANGE = 34, /* Math result not representable */
417  EDEADLK = 35, /* Call would block so was aborted */
418  EWOULDBLOCK = 35, /* Or a deadlock would occur */
419  EALREADY = 37,
420  ENOTSOCK = 38, /* Socket operation on non-socket */
421  EDESTADDRREQ = 39, /* Destination address required */
422  EMSGSIZE = 40, /* Message too long */
423  EPROTOTYPE = 41, /* Protocol wrong type for socket */
424  ENOPROTOOPT = 42, /* Protocol not available */
425  EPROTONOSUPPORT = 43, /* Protocol not supported */
426  ESOCKTNOSUPPORT = 44, /* Socket type not supported */
427  EOPNOTSUPP = 45, /* Operation not supported on socket */
428  EADDRINUSE = 48, /* Address already in use */
429  EADDRNOTAVAIL = 49, /* Can't assign requested address */
430  ENETDOWN = 50, /* Network is down */
431  ENETUNREACH = 51, /* Network is unreachable */
432  ENETRESET = 52, /* Network dropped connection on reset */
433  ECONNABORTED = 53, /* Software caused connection abort */
434  ECONNRESET = 54, /* Connection reset by peer */
435  ENOBUFS = 55, /* No buffer space available */
436  EISCONN = 56, /* Socket is already connected */
437  ENOTCONN = 57, /* Socket is not connected */
438  ESHUTDOWN = 58, /* Can't send after socket shutdown */
439  ETOOMANYREFS = 59, /* Too many references: can't splice */
440  ETIMEDOUT = 60, /* Connection timed out */
441  ECONNREFUSED = 61, /* Connection refused */
442  EHOSTDOWN = 64, /* Host is down */
443  EHOSTUNREACH = 65, /* No route to host */
444  EPROTO = 70, /* STREAMS protocol error */
445  ETIME = 71,
446  ENOSR = 72,
447  EBADMSG = 73,
448  ECANCEL = 74,
449  ENOSTR = 75,
450  ENODATA = 76,
451  EINPROGRESS = 77,
452  ESRCH = 78,
453  ENOMSG = 79,
454  ELASTERRNO = 79
455  };
456 
457 #endif /* OTKERNEL || OTUNIXERRORS */
458 
459  /* ***** Open Transport/XTI Error codes ******/
460  typedef UInt16 OTXTIErr;
461  enum
462  {
463  TSUCCESS = 0, /* No Error occurred */
464  TBADADDR = 1, /* A Bad address was specified */
465  TBADOPT = 2, /* A Bad option was specified */
466  TACCES = 3, /* Missing access permission */
467  TBADF = 4, /* Bad provider reference */
468  TNOADDR = 5, /* No address was specified */
469  TOUTSTATE = 6, /* Call issued in wrong state */
470  TBADSEQ = 7, /* Sequence specified does not exist */
471  TSYSERR = 8, /* A system error occurred */
472  TLOOK = 9, /* An event occurred - call Look() */
473  TBADDATA = 10, /* An illegal amount of data was specified */
474  TBUFOVFLW = 11, /* Passed buffer not big enough */
475  TFLOW = 12, /* Provider is flow-controlled */
476  TNODATA = 13, /* No data available for reading */
477  TNODIS = 14, /* No disconnect indication available */
478  TNOUDERR = 15, /* No Unit Data Error indication available */
479  TBADFLAG = 16, /* A Bad flag value was supplied */
480  TNOREL = 17, /* No orderly release indication available */
481  TNOTSUPPORT = 18, /* Command is not supported */
482  TSTATECHNG = 19, /* State is changing - try again later */
483  TNOSTRUCTYPE = 20, /* Bad structure type requested for OTAlloc */
484  TBADNAME = 21, /* A bad endpoint name was supplied */
485  TBADQLEN = 22, /* A Bind to an in-use address with qlen > 0*/
486  TADDRBUSY = 23, /* Address requested is already in use */
487  TINDOUT = 24, /* Accept failed because of pending listen */
488  TPROVMISMATCH = 25, /* Tried to accept on incompatible endpoint */
489  TRESQLEN = 26,
490  TRESADDR = 27,
491  TQFULL = 28,
492  TPROTO = 29, /* An unspecified provider error occurred */
493  TBADSYNC = 30, /* A synchronous call at interrupt time */
494  TCANCELED = 31, /* The command was cancelled */
495  TLASTXTIERROR = 31
496  };
497 
510  typedef SInt32 OTResult;
511 
516 #define XTI2OSStatus(x) (-3149 - (x))
517 #define E2OSStatus(x) (-3199 - (x))
518 
519 #define OSStatus2XTI(x) ((OTXTIErr)(-3149 - (x)))
520 #define OSStatus2E(x) ((OTUnixErr)(-3199 - (x)))
521 
522 #define IsXTIError(x) ((x) < -3149 && (x) >= (-3149 - TLASTXTIERROR))
523 #define IsEError(x) ((x) < -3199 && (x) >= (-3199 - ELASTERRNO))
524 
525  /* ***** OTAddress ******/
526 
537  enum
538  {
539  kOTGenericName = 0 /* Protocol specific data is just a string, interpreted in
540  a protocol-specific fashion.*/
541  };
542 
543  typedef UInt16 OTAddressType;
544  struct OTAddress
545  {
546  OTAddressType fAddressType; /* The address format of this address...*/
547  UInt8 fAddress[1]; /* ... followed by protocol specific address information.*/
548  };
549  typedef struct OTAddress OTAddress;
561  enum
562  {
563  T_BIND = 1,
564  T_OPTMGMT = 2,
565  T_CALL = 3,
566  T_DIS = 4,
567  T_UNITDATA = 5,
568  T_UDERROR = 6,
569  T_INFO = 7,
570  T_REPLYDATA = 8,
571  T_REQUESTDATA = 9,
572  T_UNITREQUEST = 10,
573  T_UNITREPLY = 11
574  };
575 
576  typedef UInt32 OTStructType;
581  enum
582  {
583  T_ADDR = 0x01,
584  T_OPT = 0x02,
585  T_UDATA = 0x04,
586  T_ALL = 0xFFFF
587  };
588 
589  typedef UInt32 OTFieldsType;
590  /* ***** OTFlags ******/
597  typedef UInt32 OTFlags;
602  enum
603  {
604  T_MORE = 0x0001, /* More data to come in message */
605  T_EXPEDITED = 0x0002, /* Data is expedited, if possible */
606  T_ACKNOWLEDGED = 0x0004, /* Acknowledge transaction */
607  T_PARTIALDATA = 0x0008, /* Partial data - more coming */
608  T_NORECEIPT = 0x0010, /* No event on transaction done */
609  T_TIMEDOUT = 0x0020 /* Reply timed out */
610  };
611 
612  /* These flags are used in the TOptMgmt structure to request services.*/
613 
614  enum
615  {
616  T_NEGOTIATE = 0x0004,
617  T_CHECK = 0x0008,
618  T_DEFAULT = 0x0010,
619  T_CURRENT = 0x0080
620  };
621 
627  enum
628  {
629  T_SUCCESS = 0x0020,
630  T_FAILURE = 0x0040,
631  T_PARTSUCCESS = 0x0100,
632  T_READONLY = 0x0200,
633  T_NOTSUPPORT = 0x0400
634  };
635 
643  typedef UInt32 OTBand;
644 /* ***** Object References ******/
659 #ifdef __cplusplus
660  typedef class TProvider *ProviderRef;
661  typedef class TEndpoint *EndpointRef;
662  typedef class TMapper *MapperRef;
663 #else
664 typedef void *ProviderRef;
665 typedef void *EndpointRef;
666 typedef void *MapperRef;
667 #endif
668 #define kOTInvalidRef 0L
669 #define kOTInvalidProviderRef ((ProviderRef)0L)
670 #define kOTInvalidEndpointRef ((EndpointRef)0L)
671 #define kOTInvalidMapperRef ((MapperRef)0L)
672  /* ***** Event Codes ******/
678  typedef UInt32 OTEventCode;
708  enum
709  {
710  T_LISTEN = 0x0001, /* An connection request is available */
711  T_CONNECT = 0x0002, /* Confirmation of a connect request */
712  T_DATA = 0x0004, /* Standard data is available */
713  T_EXDATA = 0x0008, /* Expedited data is available */
714  T_DISCONNECT = 0x0010, /* A disconnect is available */
715  T_ERROR = 0x0020, /* obsolete/unused in library */
716  T_UDERR = 0x0040, /* A Unit Data Error has occurred */
717  T_ORDREL = 0x0080, /* An orderly release is available */
718  T_GODATA = 0x0100, /* Flow control lifted on standard data */
719  T_GOEXDATA = 0x0200, /* Flow control lifted on expedited data*/
720  T_REQUEST = 0x0400, /* An Incoming request is available */
721  T_REPLY = 0x0800, /* An Incoming reply is available */
722  T_PASSCON = 0x1000, /* State is now T_DATAXFER */
723  T_RESET = 0x2000, /* Protocol has been reset */
724  kPRIVATEEVENT = 0x10000000, /* Base of the private event range.*/
725  kCOMPLETEEVENT = 0x20000000, /* Base of the completion event range.*/
726  T_BINDCOMPLETE = 0x20000001, /* Bind call is complete */
727  T_UNBINDCOMPLETE = 0x20000002, /* Unbind call is complete */
728  T_ACCEPTCOMPLETE = 0x20000003, /* Accept call is complete */
729  T_REPLYCOMPLETE = 0x20000004, /* SendReply call is complete */
730  T_DISCONNECTCOMPLETE = 0x20000005, /* Disconnect call is complete */
731  T_OPTMGMTCOMPLETE = 0x20000006, /* OptMgmt call is complete */
732  T_OPENCOMPLETE = 0x20000007, /* An Open call is complete */
733  T_GETPROTADDRCOMPLETE = 0x20000008, /* GetProtAddress call is complete */
734  T_RESOLVEADDRCOMPLETE = 0x20000009, /* A ResolveAddress call is complet */
735  T_GETINFOCOMPLETE = 0x2000000A, /* A GetInfo call is complete */
736  T_SYNCCOMPLETE = 0x2000000B, /* A Sync call is complete */
737  T_MEMORYRELEASED = 0x2000000C, /* No-copy memory was released */
738  T_REGNAMECOMPLETE = 0x2000000D, /* A RegisterName call is complete */
739  T_DELNAMECOMPLETE = 0x2000000E, /* A DeleteName call is complete */
740  T_LKUPNAMECOMPLETE = 0x2000000F, /* A LookupName call is complete */
741  T_LKUPNAMERESULT = 0x20000010, /* A LookupName is returning a name */
742  kOTSyncIdleEvent = 0x20000011, /* Synchronous call Idle event */
743  kSTREAMEVENT = 0x21000000, /* Base of the raw stream event range.*/
744  kOTReservedEvent1 = 0x21000001, /* reserved for internal use by OT */
745  kGetmsgEvent = 0x21000002, /* A GetMessage call is complete */
746  kStreamReadEvent = 0x21000003, /* A Read call is complete */
747  kStreamWriteEvent = 0x21000004, /* A Write call is complete */
748  kStreamIoctlEvent = 0x21000005, /* An Ioctl call is complete */
749  kOTReservedEvent2 = 0x21000006, /* reserved for internal use by OT */
750  kStreamOpenEvent = 0x21000007, /* An OpenStream call is complete */
751  kPollEvent = 0x21000008, /* A Poll call is complete */
752  kOTReservedEvent3 = 0x21000009, /* reserved for internal use by OT */
753  kOTReservedEvent4 = 0x2100000A, /* reserved for internal use by OT */
754  kOTReservedEvent5 = 0x2100000B, /* reserved for internal use by OT */
755  kOTReservedEvent6 = 0x2100000C, /* reserved for internal use by OT */
756  kOTReservedEvent7 = 0x2100000D, /* reserved for internal use by OT */
757  kOTReservedEvent8 = 0x2100000E, /* reserved for internal use by OT */
758  kSIGNALEVENT = 0x22000000, /* A signal has arrived on a raw stream, see
759  "Signal Values" below.*/
760  kPROTOCOLEVENT = 0x23000000, /* Some event from the protocols */
761  kOTProviderIsDisconnected = 0x23000001, /* Provider is temporarily off-line */
762  kOTProviderIsReconnected = 0x23000002, /* Provider is now back on-line */
763  kOTProviderWillClose = 0x24000001, /* Provider will close immediately */
764  kOTProviderIsClosed = 0x24000002, /* Provider was closed */
765  kOTPortDisabled =
766  0x25000001, /* Port is now disabled, result is 0, cookie is port ref */
767  kOTPortEnabled =
768  0x25000002, /* Port is now enabled, result is 0, cookie is port ref */
769  kOTPortOffline =
770  0x25000003, /* Port is now offline, result is 0, cookie is port ref */
771  kOTPortOnline =
772  0x25000004, /* Port is now online, result is 0, cookie is port ref */
773  kOTClosePortRequest = 0x25000005, /* Request to close/yield, result is reason,
774  cookie is OTPortCloseStruct* */
775  kOTYieldPortRequest = 0x25000005, /* Request to close/yield, result is reason,
776  cookie is OTPortCloseStruct* */
777  kOTNewPortRegistered =
778  0x25000006, /* New port has been registered, cookie is port ref */
779  kOTPortNetworkChange = 0x25000007, /* Port may have moved to a new network,
780  result is 0, cookie is port ref */
781  kOTConfigurationChanged = 0x26000001, /* Protocol configuration changed */
782  kOTSystemSleep = 0x26000002,
783  kOTSystemShutdown = 0x26000003,
784  kOTSystemAwaken = 0x26000004,
785  kOTSystemIdle = 0x26000005,
786  kOTSystemSleepPrep = 0x26000006,
787  kOTSystemShutdownPrep = 0x26000007,
788  kOTSystemAwakenPrep = 0x26000008,
789  kOTStackIsLoading = 0x27000001, /* Sent before Open Transport attempts to load
790  the TCP/IP protocol stack.*/
791  kOTStackWasLoaded =
792  0x27000002, /* Sent after the TCP/IP stack has been successfully loaded.*/
793  kOTStackIsUnloading =
794  0x27000003 /* Sent before Open Transport unloads the TCP/IP stack.*/
795  };
796 
797  /* ***** Event Classification Macros ***** */
798 
799 #define IsOTPrivateEvent(x) (((x) & 0x70000000L) == kPRIVATEEVENT)
800 #define IsOTCompleteEvent(x) (((x) & 0x7f000000L) == kCOMPLETEEVENT)
801 #define IsOTProtocolEvent(x) (((x) & 0x7f000000L) == kPROTOCOLEVENT)
802 #define IsOTStreamEvent(x) (((x) & 0x7f000000L) == kSTREAMEVENT)
803 #define IsOTSignalEvent(x) (((x) & 0x7f000000L) == kSIGNALEVENT)
804 #define GetOTEventCode(x) (x)
805 
813  enum
814  {
815  kSIGHUP = 1,
816  kSIGURG = 16,
817  kSIGPOLL = 30
818  };
819 
820  enum
821  {
822  SIGHUP = kSIGHUP,
823  SIGURG = kSIGURG,
824  SIGPOLL = kSIGPOLL
825  };
826 
834  typedef CALLBACK_API(void, OTNotifyProcPtr)(void *contextPtr, OTEventCode code,
835  OTResult result, void *cookie);
836  typedef TVECTOR_UPP_TYPE(OTNotifyProcPtr) OTNotifyUPP;
845  OTNotifyUPP
846  NewOTNotifyUPP(OTNotifyProcPtr userRoutine);
847 #if !OPAQUE_UPP_TYPES
848  enum
849  {
850  uppOTNotifyProcInfo = 0x00003FC0
851  }; /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
852 #ifdef __cplusplus
853  inline OTNotifyUPP NewOTNotifyUPP(OTNotifyProcPtr userRoutine)
854  {
855  return userRoutine;
856  }
857 #else
858 #define NewOTNotifyUPP(userRoutine) (userRoutine)
859 #endif
860 #endif
861 
870  void
871  DisposeOTNotifyUPP(OTNotifyUPP userUPP);
872 #if !OPAQUE_UPP_TYPES
873 #ifdef __cplusplus
874  inline void DisposeOTNotifyUPP(OTNotifyUPP) {}
875 #else
876 #define DisposeOTNotifyUPP(userUPP)
877 #endif
878 #endif
879 
888  void
889  InvokeOTNotifyUPP(void *contextPtr, OTEventCode code, OTResult result,
890  void *cookie, OTNotifyUPP userUPP);
891 #if !OPAQUE_UPP_TYPES
892 #ifdef __cplusplus
893  inline void InvokeOTNotifyUPP(void *contextPtr, OTEventCode code,
894  OTResult result, void *cookie,
895  OTNotifyUPP userUPP)
896  {
897  (*userUPP)(contextPtr, code, result, cookie);
898  }
899 #else
900 #define InvokeOTNotifyUPP(contextPtr, code, result, cookie, userUPP) \
901  (*userUPP)(contextPtr, code, result, cookie)
902 #endif
903 #endif
904 
905  /* ***** Option Management Definitions ******/
906  /* The XTI Level number of a protocol.*/
907  enum
908  {
909  XTI_GENERIC = 0xFFFF /* level for XTI options */
910  };
911 
912  typedef UInt32 OTXTILevel;
913  /* The XTI name of a protocol option.*/
914  typedef UInt32 OTXTIName;
915  /* XTI names for options used with XTI_GENERIC above*/
916  enum
917  {
918  XTI_DEBUG = 0x0001,
919  XTI_LINGER = 0x0080,
920  XTI_RCVBUF = 0x1002,
921  XTI_RCVLOWAT = 0x1004,
922  XTI_SNDBUF = 0x1001,
923  XTI_SNDLOWAT = 0x1003,
924  XTI_PROTOTYPE = 0x1005,
925  OPT_CHECKSUM = 0x0600, /* Set checksumming = UInt32 - 0 or 1)*/
926  OPT_RETRYCNT = 0x0601, /* Set a retry counter = UInt32 (0 = infinite)*/
927  OPT_INTERVAL = 0x0602, /* Set a retry interval = UInt32 milliseconds*/
928  OPT_ENABLEEOM = 0x0603, /* Enable the EOM indication = UInt8 (0 or 1)*/
929  OPT_SELFSEND =
930  0x0604, /* Enable Self-sending on broadcasts = UInt32 (0 or 1)*/
931  OPT_SERVERSTATUS = 0x0605, /* Set Server Status (format is proto dependent)*/
932  OPT_ALERTENABLE = 0x0606, /* Enable/Disable protocol alerts*/
933  OPT_KEEPALIVE = 0x0008 /* See t_keepalive structure*/
934  };
935 
936 /* ***** Ioctl Definitions ******/
937 
946 #define MIOC_CMD(t, v) ((((t) & 0xFF) << 8) | ((v) & 0xFF))
947 
948  /* The following is a registry of the ioctls protocol spaces.*/
949 
950  enum
951  {
952  MIOC_STREAMIO = 'A', /* Basic Stream ioctl() cmds - I_PUSH, I_LOOK, etc. */
953  MIOC_TMOD = 'a', /* ioctl's for tmod test module */
954  MIOC_STRLOG = 'b', /* ioctl's for Mentat's log device */
955  MIOC_ND = 'c', /* ioctl's for Mentat's nd device */
956  MIOC_ECHO = 'd', /* ioctl's for Mentat's echo device */
957  MIOC_TLI = 'e', /* ioctl's for Mentat's timod module */
958  MIOC_RESERVEDf = 'f', /* reserved, used by SVR4 FIOxxx */
959  MIOC_SAD = 'g', /* ioctl's for Mentat's sad module */
960  MIOC_ARP = 'h', /* ioctl's for Mentat's arp module */
961  MIOC_HAVOC = 'H', /* Havoc module ioctls. */
962  MIOC_RESERVEDi = 'i', /* reserved, used by SVR4 SIOCxxx */
963  MIOC_SIOC = 'j', /* sockio.h socket ioctl's */
964  MIOC_TCP = 'k', /* tcp.h ioctl's */
965  MIOC_DLPI = 'l', /* dlpi.h additions */
966  MIOC_SOCKETS = 'm', /* Mentat sockmod ioctl's */
967  MIOC_IPX = 'o', /* ioctls for IPX */
968  MIOC_OT = 'O', /* ioctls for Open Transport */
969  MIOC_ATALK = 'T', /* ioctl's for AppleTalk */
970  MIOC_SRL = 'U', /* ioctl's for Serial */
971  MIOC_RESERVEDp = 'p', /* reserved, used by SVR4 */
972  MIOC_RESERVEDr = 'r', /* reserved, used by SVR4 */
973  MIOC_RESERVEDs = 's', /* reserved, used by SVR4 */
974  MIOC_CFIG = 'z' /* ioctl's for private configuration */
975  };
976 
977  /* OT specific ioctls.*/
978 
979  enum
980  {
981  I_OTGetMiscellaneousEvents =
982  ((MIOC_OT << 8) | 1), /* sign up for Misc Events */
983  I_OTSetFramingType = ((MIOC_OT << 8) | 2), /* Set framing option for link */
984  kOTGetFramingValue =
985  (unsigned long)0xFFFFFFFF, /* Use this value to read framing */
986  I_OTSetRawMode = ((MIOC_OT << 8) | 3), /* Set raw mode for link */
987  kOTSetRecvMode = 0x01,
988  kOTSendErrorPacket = 0x02,
989  I_OTConnect = ((MIOC_OT << 8) | 4), /* Generic connect request for links */
990  I_OTDisconnect =
991  ((MIOC_OT << 8) | 5), /* Generic disconnect request for links */
992  I_OTScript = ((MIOC_OT << 8) | 6) /* Send a script to a module */
993  };
994 
995  /* Structure for the I_OTScript Ioctl.*/
996 
998  {
999  UInt32 fScriptType;
1000  void *fTheScript;
1001  UInt32 fScriptLength;
1002  };
1003  typedef struct OTScriptInfo OTScriptInfo;
1009  typedef UInt32 OTXTIStates;
1010  enum
1011  {
1012  T_UNINIT = 0, /* addition to standard xti.h */
1013  T_UNBND = 1, /* unbound */
1014  T_IDLE = 2, /* idle */
1015  T_OUTCON = 3, /* outgoing connection pending */
1016  T_INCON = 4, /* incoming connection pending */
1017  T_DATAXFER = 5, /* data transfer */
1018  T_OUTREL = 6, /* outgoing orderly release */
1019  T_INREL = 7 /* incoming orderly release */
1020  };
1021 
1027  enum
1028  {
1029  T_YES = 1,
1030  T_NO = 0,
1031  T_UNUSED = (unsigned long)(-1),
1032  kT_NULL = 0,
1033  T_ABSREQ = 0x8000
1034  };
1035 
1036  enum
1037  {
1038  kT_UNSPEC = (unsigned long)0xFFFFFFFD,
1039  T_ALLOPT = 0
1040  };
1041 
1042  enum
1043  {
1044  T_NULL = kT_NULL,
1045  T_UNSPEC = kT_UNSPEC
1046  };
1047 
1056 #ifdef __cplusplus
1057  typedef class OTConfiguration *OTConfigurationRef;
1058 #else
1059 typedef struct OTConfiguration *OTConfigurationRef;
1060 #endif
1061 #define kOTNoMemoryConfigurationPtr ((OTConfigurationRef)0L)
1062 #define kOTInvalidConfigurationPtr ((OTConfigurationRef)-1L)
1063  /* ***** Option Management Structures ******/
1064 
1065  /* This structure describes the contents of a single option in a buffer.*/
1066 
1068  {
1069  ByteCount len; /* total length of option */
1070  /* = sizeof(TOptionHeader) + length */
1071  /* of option value in bytes */
1072  OTXTILevel level; /* protocol affected */
1073  OTXTIName name; /* option name */
1074  UInt32 status; /* status value */
1075  };
1076  typedef struct TOptionHeader TOptionHeader;
1082  struct TOption
1083  {
1084  ByteCount len; /* total length of option */
1085  /* = sizeof(TOption) + length */
1086  /* of option value in bytes */
1087  OTXTILevel level; /* protocol affected */
1088  OTXTIName name; /* option name */
1089  UInt32 status; /* status value */
1090  UInt32 value[1]; /* data goes here */
1091  };
1092  typedef struct TOption TOption;
1093  /* Some useful constants when manipulating option buffers.*/
1094  enum
1095  {
1096  kOTOptionHeaderSize = sizeof(TOptionHeader),
1097  kOTBooleanOptionDataSize = sizeof(UInt32),
1098  kOTBooleanOptionSize = kOTOptionHeaderSize + kOTBooleanOptionDataSize,
1099  kOTOneByteOptionSize = kOTOptionHeaderSize + 1,
1100  kOTTwoByteOptionSize = kOTOptionHeaderSize + 2,
1101  kOTFourByteOptionSize = kOTOptionHeaderSize + sizeof(UInt32)
1102  };
1103 
1109 #define T_ALIGN(len) \
1110  (((UInt32)(len) + (sizeof(SInt32) - 1)) & ~(sizeof(SInt32) - 1))
1111 
1119 #define OPT_NEXTHDR(theBuffer, theBufLen, prevOption) \
1120  (((char *)(prevOption) + T_ALIGN((prevOption)->len) < \
1121  (char *)(theBuffer) + (theBufLen)) \
1122  ? (TOption *)((char *)(prevOption) + T_ALIGN((prevOption)->len)) \
1123  : (TOption *)NULL)
1124 
1125  /* t_kpalive is used with OPT_KEEPALIVE option.*/
1126 
1127  struct t_kpalive
1128  {
1129  SInt32 kp_onoff; /* option on/off */
1130  SInt32 kp_timeout; /* timeout in minutes */
1131  };
1132  typedef struct t_kpalive t_kpalive;
1133  /* t_linger is used with XTI_LINGER option.*/
1134  struct t_linger
1135  {
1136  SInt32 l_onoff; /* option on/off */
1137  SInt32 l_linger; /* linger time */
1138  };
1139  typedef struct t_linger t_linger;
1145  /* Values returned in servtype field of TEndpointInfo.*/
1146 
1147  typedef UInt32 OTServiceType;
1148  enum
1149  {
1150  T_COTS = 1, /* Connection-mode service */
1151  T_COTS_ORD = 2, /* Connection service with orderly release */
1152  T_CLTS = 3, /* Connectionless-mode service */
1153  T_TRANS = 5, /* Connection-mode transaction service */
1154  T_TRANS_ORD = 6, /* Connection transaction service with orderly release */
1155  T_TRANS_CLTS = 7 /* Connectionless transaction service */
1156  };
1157 
1158  /* Masks for the flags field of TEndpointInfo.*/
1159 
1160  enum
1161  {
1162  T_SENDZERO = 0x0001, /* supports 0-length TSDU's */
1163  T_XPG4_1 = 0x0002, /* supports the GetProtAddress call */
1164  T_CAN_SUPPORT_MDATA = 0x10000000, /* support M_DATAs on packet protocols */
1165  T_CAN_RESOLVE_ADDR = 0x40000000, /* Supports ResolveAddress call */
1166  T_CAN_SUPPLY_MIB = 0x20000000 /* Supports SNMP MIB data */
1167  };
1168 
1174  enum
1175  {
1176  T_INFINITE = -1, /* supports infinit amounts of data */
1177  T_INVALID = -2 /* Does not support data transmission */
1178  };
1179 
1180  typedef SInt32 OTDataSize;
1181  /* Now the TEndpointInfo structure proper.*/
1183  {
1184  OTDataSize addr; /* Maximum size of an address */
1185  OTDataSize options; /* Maximum size of options */
1186  OTDataSize tsdu; /* Standard data transmit unit size */
1187  OTDataSize etsdu; /* Expedited data transmit unit size */
1188  OTDataSize connect; /* Maximum data size on connect */
1189  OTDataSize discon; /* Maximum data size on disconnect */
1190  OTServiceType servtype; /* service type */
1191  UInt32 flags; /* Flags (see above for values) */
1192  };
1193  typedef struct TEndpointInfo TEndpointInfo;
1199  /* ***** OTPortRecord ******/
1200 
1201  /* Unique identifier for a port.*/
1202 
1203  typedef UInt32 OTPortRef;
1204  typedef OTPortRef *OTPortRefPtr;
1205  enum
1206  {
1207  kOTInvalidPortRef = 0
1208  };
1209 
1210  /* Valid values for the bus type element of an OTPortRef.*/
1211 
1212  typedef UInt8 OTBusType;
1213  enum
1214  {
1215  kOTUnknownBusPort = 0,
1216  kOTMotherboardBus = 1,
1217  kOTNuBus = 2,
1218  kOTPCIBus = 3,
1219  kOTGeoPort = 4,
1220  kOTPCCardBus = 5,
1221  kOTFireWireBus = 6,
1222  kOTLastBusIndex = 15
1223  };
1224 
1230  typedef UInt16 OTDeviceType;
1231  enum
1232  {
1233  kOTNoDeviceType = 0,
1234  kOTADEVDevice = 1, /* An Atalk ADEV */
1235  kOTMDEVDevice = 2, /* A TCP/IP MDEV */
1236  kOTLocalTalkDevice = 3, /* LocalTalk */
1237  kOTIRTalkDevice = 4, /* IRTalk */
1238  kOTTokenRingDevice = 5, /* Token Ring */
1239  kOTISDNDevice = 6, /* ISDN */
1240  kOTATMDevice = 7, /* ATM */
1241  kOTSMDSDevice = 8, /* SMDS */
1242  kOTSerialDevice = 9, /* Serial */
1243  kOTEthernetDevice = 10, /* Ethernet */
1244  kOTSLIPDevice = 11, /* SLIP Pseudo-device */
1245  kOTPPPDevice = 12, /* PPP Pseudo-device */
1246  kOTModemDevice = 13, /* Modem Pseudo-Device */
1247  kOTFastEthernetDevice = 14, /* 100 MB Ethernet */
1248  kOTFDDIDevice = 15, /* FDDI */
1249  kOTIrDADevice = 16, /* IrDA Infrared */
1250  kOTATMSNAPDevice = 17, /* ATM SNAP emulation */
1251  kOTFibreChannelDevice = 18, /* Fibre Channel */
1252  kOTFireWireDevice = 19, /* FireWire link Device */
1253  kOTPseudoDevice = 1023, /* used where no other defined device type will work*/
1254  kOTLastDeviceIndex = 1022
1255  };
1256 
1257  /* Special case values for the slot number element of an OTPortRef.*/
1258 
1259  enum
1260  {
1261  kOTLastSlotNumber = 255,
1262  kOTLastOtherNumber = 255
1263  };
1264 
1265  typedef UInt16 OTSlotNumber;
1266  /* Accessor functions for the various elements of the OTPortRef.*/
1275  OTPortRef
1276  OTCreatePortRef(OTBusType busType, OTDeviceType devType, OTSlotNumber slot,
1277  UInt16 other);
1278 
1287  OTDeviceType
1289 
1298  UInt16
1300 
1309  OTSlotNumber
1310  OTGetSlotFromPortRef(OTPortRef ref, UInt16 *other);
1311 
1320  OTPortRef
1322 
1331  OTPortRef
1332  OTSetBusTypeInPortRef(OTPortRef ref, OTBusType busType);
1333 
1338 #define OTCreateNuBusPortRef(devType, slot, other) \
1339  OTCreatePortRef(kOTNuBus, devType, slot, other)
1340 
1341 #define OTCreatePCIPortRef(devType, slot, other) \
1342  OTCreatePortRef(kOTPCIBus, devType, slot, other)
1343 
1344 #define OTCreatePCCardPortRef(devType, slot, other) \
1345  OTCreatePortRef(kOTPCCardBus, devType, slot, other)
1346 
1347  /* Name length definitions for various fields in OTPortRecord.*/
1348 
1349  enum
1350  {
1351  kMaxModuleNameLength = 31, /* max length of a STREAMS module name*/
1352  kMaxModuleNameSize = kMaxModuleNameLength + 1,
1353  kMaxProviderNameLength = kMaxModuleNameLength +
1354  4, /* providers allow 4 characters for minor number*/
1355  kMaxProviderNameSize = kMaxProviderNameLength + 1,
1356  kMaxSlotIDLength = 7, /* PCI slot names tend to be short*/
1357  kMaxSlotIDSize = kMaxSlotIDLength + 1,
1358  kMaxResourceInfoLength = 31, /* max length of a configuration helper name*/
1359  kMaxResourceInfoSize = 32,
1360  kMaxPortNameLength =
1361  kMaxModuleNameLength + 4, /* max size allowed to define a port*/
1362  kMaxPortNameSize = kMaxPortNameLength + 1
1363  };
1364 
1370  enum
1371  {
1372  kOTPortIsActive = 0x00000001,
1373  kOTPortIsDisabled = 0x00000002,
1374  kOTPortIsUnavailable = 0x00000004,
1375  kOTPortIsOffline = 0x00000008
1376  };
1377 
1378  /* Masks for the fInfoFlags field of the OTPortRecord.*/
1379 
1380  enum
1381  {
1382  kOTPortIsDLPI = 0x00000001,
1383  kOTPortIsTPI = 0x00000002,
1384  kOTPortCanYield =
1385  0x00000004, /* will not be set until the port is used for the first time*/
1386  kOTPortCanArbitrate =
1387  0x00000008, /* will not be set until the port is used for the first time*/
1388  kOTPortIsTransitory = 0x00000010,
1389  kOTPortAutoConnects = 0x00000020,
1390  kOTPortIsSystemRegistered = 0x00004000,
1391  kOTPortIsPrivate = 0x00008000,
1392  kOTPortIsAlias = (unsigned long)0x80000000
1393  };
1394 
1404  {
1405  OTPortRef fRef;
1406  UInt32 fPortFlags;
1407  UInt32 fInfoFlags;
1408  UInt32 fCapabilities;
1409  ItemCount fNumChildPorts;
1410  OTPortRef *fChildPorts;
1411  char fPortName[36];
1412  char fModuleName[32];
1413  char fSlotID[8];
1414  char fResourceInfo[32];
1415  char fReserved[164];
1416  };
1417  typedef struct OTPortRecord OTPortRecord;
1424 #if !OTKERNEL
1433  Boolean
1434  OTGetIndexedPort(OTPortRecord *portRecord, OTItemCount index);
1435 
1436  /* Index through the ports in the system*/
1445  Boolean
1446  OTFindPort(OTPortRecord *portRecord, const char *portName);
1447 
1448  /* Find an OTPortRecord for a port using it's name*/
1457  Boolean
1459 
1460 /* Find an OTPortRecord for a port using it's OTPortRef*/
1461 #if CALL_NOT_IN_CARBON
1470  OSStatus
1471  OTRegisterPort(OTPortRecord *portRecord, void *ref);
1472 
1485  OSStatus
1486  OTUnregisterPort(const char *portName, void **ref);
1487 
1503  OSStatus
1505 
1506 /* Change the state of the port.*/
1507 #endif /* CALL_NOT_IN_CARBON */
1508 
1509 #endif /* !OTKERNEL */
1510 
1511  /* ***** Data Buffers ******/
1517  struct TNetbuf
1518  {
1519  ByteCount maxlen;
1520  ByteCount len;
1521  UInt8 *buf;
1522  };
1523  typedef struct TNetbuf TNetbuf;
1532  struct strbuf
1533  {
1534  SInt32 maxlen; /* max buffer length */
1535  SInt32 len; /* length of data */
1536  char *buf; /* pointer to buffer */
1537  };
1538  typedef struct strbuf strbuf;
1546  struct OTData
1547  {
1548  void *fNext;
1549  void *fData;
1550  ByteCount fLen;
1551  };
1552  typedef struct OTData OTData;
1553  enum
1554  {
1555  kNetbufDataIsOTData = (unsigned long)0xFFFFFFFE
1556  };
1557 
1571  struct OTBuffer
1572  {
1573  void *fLink; /* b_next*/
1574  void *fLink2; /* b_prev*/
1575  struct OTBuffer *fNext; /* b_cont*/
1576  UInt8 *fData; /* b_rptr*/
1577  ByteCount fLen; /* b_wptr*/
1578  void *fSave; /* b_datap*/
1579  UInt8 fBand; /* b_band*/
1580  UInt8 fType; /* b_pad1*/
1581  UInt8 fPad1;
1582  UInt8 fFlags; /* b_flag*/
1583  };
1584  typedef struct OTBuffer OTBuffer;
1585  enum
1586  {
1587  kOTNetbufDataIsOTBufferStar = (unsigned long)0xFFFFFFFD
1588  };
1589 
1594  /* Use the OTInitBuffer macro to initialise this structure from an OTBuffer
1595  * chain.*/
1597  {
1598  OTBuffer *fBuffer;
1599  ByteCount fOffset;
1600  UInt8 fPad;
1601  };
1602  typedef struct OTBufferInfo OTBufferInfo;
1603 
1604 #define OTInitBufferInfo(infoPtr, theBuffer) \
1605  (infoPtr)->fBuffer = theBuffer; \
1606  (infoPtr)->fPad = (theBuffer)->fPad1; \
1607  (infoPtr)->fOffset = 0
1608 
1617  enum
1618  {
1619  kOTNetbufIsRawMode = (unsigned long)0xFFFFFFFF
1620  };
1621 
1633  struct TBind
1634  {
1635  TNetbuf addr;
1636  OTQLen qlen;
1637  };
1638  typedef struct TBind TBind;
1643  struct TDiscon
1644  {
1645  TNetbuf udata;
1646  OTReason reason;
1647  OTSequence sequence;
1648  };
1649  typedef struct TDiscon TDiscon;
1654  struct TCall
1655  {
1656  TNetbuf addr;
1657  TNetbuf opt;
1658  TNetbuf udata;
1659  OTSequence sequence;
1660  };
1661  typedef struct TCall TCall;
1662  /* TUnitData describes a datagram in calls to OTSndUData and OTRcvUData.*/
1663  struct TUnitData
1664  {
1665  TNetbuf addr;
1666  TNetbuf opt;
1667  TNetbuf udata;
1668  };
1669  typedef struct TUnitData TUnitData;
1674  struct TUDErr
1675  {
1676  TNetbuf addr;
1677  TNetbuf opt;
1678  SInt32 error;
1679  };
1680  typedef struct TUDErr TUDErr;
1681  /* TOptMgmt is passed to the OTOptionManagement call to read or set protocol*/
1682  struct TOptMgmt
1683  {
1684  TNetbuf opt;
1685  OTFlags flags;
1686  };
1687  typedef struct TOptMgmt TOptMgmt;
1698  struct TRequest
1699  {
1700  TNetbuf data;
1701  TNetbuf opt;
1702  OTSequence sequence;
1703  };
1704  typedef struct TRequest TRequest;
1705  /* TReply is passed to OTSndReply to send a reply to an incoming request.*/
1706  struct TReply
1707  {
1708  TNetbuf data;
1709  TNetbuf opt;
1710  OTSequence sequence;
1711  };
1712  typedef struct TReply TReply;
1718  {
1719  TNetbuf addr;
1720  TNetbuf opt;
1721  TNetbuf udata;
1722  OTSequence sequence;
1723  };
1724  typedef struct TUnitRequest TUnitRequest;
1725  /* TUnitReply is passed to OTSndUReply to send a reply to an incoming request.*/
1726  struct TUnitReply
1727  {
1728  TNetbuf opt;
1729  TNetbuf udata;
1730  OTSequence sequence;
1731  };
1732  typedef struct TUnitReply TUnitReply;
1738  /* TRegisterRequest holds the name to register in a call to OTRegisterName.*/
1739 
1741  {
1742  TNetbuf name;
1743  TNetbuf addr;
1744  OTFlags flags;
1745  };
1746  typedef struct TRegisterRequest TRegisterRequest;
1752  {
1753  TNetbuf addr;
1754  OTNameID nameid;
1755  };
1756  typedef struct TRegisterReply TRegisterReply;
1757  /* TLookupRequest holds the name to look up in a call to OTLookupName.*/
1759  {
1760  TNetbuf name;
1761  TNetbuf addr;
1762  UInt32 maxcnt;
1763  OTTimeout timeout;
1764  OTFlags flags;
1765  };
1766  typedef struct TLookupRequest TLookupRequest;
1772  {
1773  TNetbuf names;
1774  UInt32 rspcount;
1775  };
1776  typedef struct TLookupReply TLookupReply;
1782  {
1783  UInt16 fAddressLength;
1784  UInt16 fNameLength;
1785  UInt8 fAddressBuffer[1];
1786  };
1787  typedef struct TLookupBuffer TLookupBuffer;
1788 
1794 #define OTNextLookupBuffer(buf) \
1795  ((TLookupBuffer *)((char *)buf + \
1796  ((OTOffsetOf(TLookupBuffer, fAddressBuffer) + \
1797  buf->fAddressLength + buf->fNameLength + 3) & \
1798  ~3)))
1799 
1800  /* ***** Initializing and Shutting Down Open Transport ******/
1801 
1802 #if !OTKERNEL
1803  typedef struct OpaqueOTClientContextPtr *OTClientContextPtr;
1813  typedef UInt32 OTInitializationFlags;
1814  enum
1815  {
1816  kInitOTForApplicationMask = 1,
1817  kInitOTForExtensionMask = 2
1818  };
1819 
1828  OSStatus
1830  OTInitializationFlags flags,
1831  OTClientContextPtr *outClientContext); /* can be NULL */
1832 
1846  void
1847  CloseOpenTransportInContext(OTClientContextPtr clientContext);
1848 
1849 #if CALL_NOT_IN_CARBON
1858  OSStatus
1860 
1869  OSStatus
1871 
1880  void
1882 
1891  OSStatus
1892  OTRegisterAsClient(OTClientName name, OTNotifyUPP proc);
1893 
1907  OSStatus
1909 
1910 #endif /* CALL_NOT_IN_CARBON */
1911 
1920  OSStatus
1921  OTRegisterAsClientInContext(OTClientName name, OTNotifyUPP proc,
1922  OTClientContextPtr clientContext); /* can be NULL */
1923 
1932  OSStatus
1933  OTUnregisterAsClientInContext(OTClientContextPtr clientContext);
1934 
1935 #if OTCARBONAPPLICATION
1936 /* The following macro may be used by applications only.*/
1937 #define InitOpenTransport() \
1938  InitOpenTransportInContext(kInitOTForApplicationMask, NULL)
1939 #define CloseOpenTransport() CloseOpenTransportInContext(NULL)
1940 #define OTRegisterAsClient(name, proc) \
1941  OTRegisterAsClientInContext(name, proc, NULL)
1942 #define OTUnregisterAsClient() OTUnregisterAsClientInContext(NULL)
1943 #endif /* OTCARBONAPPLICATION */
1944 
1945 #endif /* !OTKERNEL */
1946 
1947  /* ***** Tasking Model ******/
1954 #if CALL_NOT_IN_CARBON
1963  void
1965 
1974  void
1976 
1985  Boolean
1987 
1996  Boolean
1998 
2004 #endif /* CALL_NOT_IN_CARBON */
2005 
2006  typedef CALLBACK_API(void, OTProcessProcPtr)(void *arg);
2007  typedef TVECTOR_UPP_TYPE(OTProcessProcPtr) OTProcessUPP;
2016  OTProcessUPP
2017  NewOTProcessUPP(OTProcessProcPtr userRoutine);
2018 #if !OPAQUE_UPP_TYPES
2019  enum
2020  {
2021  uppOTProcessProcInfo = 0x000000C0
2022  }; /* pascal no_return_value Func(4_bytes) */
2023 #ifdef __cplusplus
2024  inline OTProcessUPP NewOTProcessUPP(OTProcessProcPtr userRoutine)
2025  {
2026  return userRoutine;
2027  }
2028 #else
2029 #define NewOTProcessUPP(userRoutine) (userRoutine)
2030 #endif
2031 #endif
2032 
2041  void
2042  DisposeOTProcessUPP(OTProcessUPP userUPP);
2043 #if !OPAQUE_UPP_TYPES
2044 #ifdef __cplusplus
2045  inline void DisposeOTProcessUPP(OTProcessUPP) {}
2046 #else
2047 #define DisposeOTProcessUPP(userUPP)
2048 #endif
2049 #endif
2050 
2059  void
2060  InvokeOTProcessUPP(void *arg, OTProcessUPP userUPP);
2061 #if !OPAQUE_UPP_TYPES
2062 #ifdef __cplusplus
2063  inline void InvokeOTProcessUPP(void *arg, OTProcessUPP userUPP)
2064  {
2065  (*userUPP)(arg);
2066  }
2067 #else
2068 #define InvokeOTProcessUPP(arg, userUPP) (*userUPP)(arg)
2069 #endif
2070 #endif
2071 
2072 #if !OTKERNEL
2087  long
2089  OTProcessUPP upp, void *arg,
2090  OTClientContextPtr clientContext); /* can be NULL */
2091 
2092 #endif /* !OTKERNEL */
2093 
2099  typedef long OTDeferredTaskRef;
2100 #if CALL_NOT_IN_CARBON
2110  OTCreateDeferredTask(OTProcessUPP proc, void *arg);
2111 
2112 #endif /* CALL_NOT_IN_CARBON */
2113 
2122  Boolean
2124 
2125 #if CALL_NOT_IN_CARBON
2134  Boolean
2136 
2137 #endif /* CALL_NOT_IN_CARBON */
2138 
2147  OSStatus
2149 
2150 #if OTCARBONAPPLICATION
2151 /* The following macro may be used by applications only.*/
2152 #define OTCreateDeferredTask(upp, arg) \
2153  OTCreateDeferredTaskInContext(upp, arg, NULL)
2154 #endif /* OTCARBONAPPLICATION */
2155 
2156 #if !OTKERNEL
2164  typedef long OTSystemTaskRef;
2165 #if CALL_NOT_IN_CARBON
2175  OTCreateSystemTask(OTProcessUPP proc, void *arg);
2176 
2185  OSStatus
2187 
2196  Boolean
2198 
2207  Boolean
2209 
2210 #endif /* CALL_NOT_IN_CARBON */
2211 
2220  Boolean
2222 
2223 #endif /* !OTKERNEL */
2224 
2225 /* ***** Interface to Providers ******/
2226 #if !OTKERNEL
2227 #if CALL_NOT_IN_CARBON
2236  OSStatus
2238  OTNotifyUPP proc, void *contextPtr);
2239 
2248  ProviderRef
2249  OTOpenProvider(OTConfigurationRef cfig, OTOpenFlags flags, OSStatus *errPtr);
2250 
2251 #endif /* CALL_NOT_IN_CARBON */
2252 
2261  OSStatus
2263 
2264 #if CALL_NOT_IN_CARBON
2273  ProviderRef
2274  OTTransferProviderOwnership(ProviderRef ref, OTClient prevOwner,
2275  OSStatus *errPtr);
2276 
2285  OTClient
2286  OTWhoAmI(void);
2287 
2296  OTPortRef
2298 
2299 #endif /* CALL_NOT_IN_CARBON */
2300 
2309  SInt32
2310  OTIoctl(ProviderRef ref, UInt32 cmd, void *data);
2311 
2312 #if CALL_NOT_IN_CARBON
2321  OTResult
2322  OTGetMessage(ProviderRef ref, strbuf *ctlbuf, strbuf *databuf,
2323  OTFlags *flagsPtr);
2324 
2333  OTResult
2335  OTBand *bandPtr, OTFlags *flagsPtr);
2336 
2345  OSStatus
2346  OTPutMessage(ProviderRef ref, const strbuf *ctlbuf, const strbuf *databuf,
2347  OTFlags flags);
2348 
2357  OSStatus
2359  const strbuf *databuf, OTBand band, OTFlags flags);
2360 
2361 #endif /* CALL_NOT_IN_CARBON */
2362 
2371  OSStatus
2373 
2382  OSStatus
2384 
2393  Boolean
2395 
2404  OSStatus
2406 
2415  OSStatus
2417 
2426  Boolean
2428 
2437  OSStatus
2438  OTInstallNotifier(ProviderRef ref, OTNotifyUPP proc, void *contextPtr);
2439 
2448  OSStatus
2450 
2459  void
2461 
2470  void
2472 
2481  Boolean
2483 
2492  OSStatus
2494 
2503  OSStatus
2505 
2514  Boolean
2516 
2525  OSStatus
2527 
2528 #define OTIsNonBlocking(ref) (!OTIsBlocking(ref))
2529 #define OTIsAsynchronous(ref) (!OTIsSynchronous(ref))
2530 
2531 #endif /* !OTKERNEL */
2532 
2533 /* ***** Interface to Endpoints ******/
2534 #if !OTKERNEL
2535  /* Open/Close*/
2550  EndpointRef
2552  TEndpointInfo *info, /* can be NULL */
2553  OSStatus *err,
2554  OTClientContextPtr clientContext); /* can be NULL */
2555 
2564  OSStatus
2566  OTConfigurationRef config, OTOpenFlags oflag,
2567  TEndpointInfo *info, /* can be NULL */
2568  OTNotifyUPP upp, void *contextPtr,
2569  OTClientContextPtr clientContext); /* can be NULL */
2570 
2571 #if CALL_NOT_IN_CARBON
2580  EndpointRef
2582  TEndpointInfo *info, /* can be NULL */
2583  OSStatus *err);
2584 
2593  OSStatus
2595  TEndpointInfo *info, /* can be NULL */
2596  OTNotifyUPP proc, void *contextPtr);
2597 
2598 #endif /* CALL_NOT_IN_CARBON */
2599 
2600 #if OTCARBONAPPLICATION
2601 /* The following macros may be used by applications only.*/
2602 #define OTOpenEndpoint(config, oflag, info, err) \
2603  OTOpenEndpointInContext(config, oflag, info, err, NULL)
2604 #define OTAsyncOpenEndpoint(config, oflag, info, proc, contextPtr) \
2605  OTAsyncOpenEndpointInContext(config, oflag, info, proc, contextPtr, NULL)
2606 #endif /* OTCARBONAPPLICATION */
2607 
2608  /* Misc Information*/
2609 
2618  OSStatus
2619  OTGetEndpointInfo(EndpointRef ref, TEndpointInfo *info);
2620 
2629  OTResult
2630  OTGetEndpointState(EndpointRef ref);
2631 
2640  OTResult
2641  OTLook(EndpointRef ref);
2642 
2643 #if CALL_NOT_IN_CARBON
2652  OTResult
2653  OTSync(EndpointRef ref);
2654 
2655 #endif /* CALL_NOT_IN_CARBON */
2656 
2665  OTResult
2666  OTCountDataBytes(EndpointRef ref, OTByteCount *countPtr);
2667 
2676  OSStatus
2677  OTGetProtAddress(EndpointRef ref, TBind *boundAddr, /* can be NULL */
2678  TBind *peerAddr); /* can be NULL */
2679 
2688  OSStatus
2689  OTResolveAddress(EndpointRef ref, TBind *reqAddr, TBind *retAddr,
2690  OTTimeout timeOut);
2691 
2692  /* Allocating structures*/
2693 
2714  void *
2715  OTAllocInContext(EndpointRef ref, OTStructType structType, UInt32 fields,
2716  OSStatus *err,
2717  OTClientContextPtr clientContext); /* can be NULL */
2718 
2719 #if CALL_NOT_IN_CARBON
2728  void *
2729  OTAlloc(EndpointRef ref, OTStructType structType, OTFieldsType fields,
2730  OSStatus *err);
2731 
2732 #endif /* CALL_NOT_IN_CARBON */
2733 
2734 #if OTCARBONAPPLICATION
2735 /* The following macro may be used by applications only.*/
2736 #define OTAlloc(ref, structType, fields, err) \
2737  OTAllocInContext(ref, structType, fields, err, NULL)
2738 #endif /* OTCARBONAPPLICATION */
2739 
2748  OTResult
2749  OTFree(void *ptr, OTStructType structType);
2750 
2751  /* Option management*/
2752 
2753  /* It looks simple enough...*/
2754 
2763  OSStatus
2764  OTOptionManagement(EndpointRef ref, TOptMgmt *req, TOptMgmt *ret);
2765 
2766  /* ... but then the hidden complexity emerges.*/
2767 
2768 #if CALL_NOT_IN_CARBON
2777  OSStatus
2778  OTCreateOptions(const char *endPtName, char **strPtr, TNetbuf *buf);
2779 
2788  OSStatus
2789  OTCreateOptionString(const char *endPtName, TOption **opt, void *bufEnd,
2790  char *str, OTByteCount stringSize);
2791 
2792 #endif /* CALL_NOT_IN_CARBON */
2793 
2802  OSStatus
2803  OTNextOption(UInt8 *buffer, UInt32 buflen, TOption **prevOptPtr);
2804 
2813  TOption *
2814  OTFindOption(UInt8 *buffer, UInt32 buflen, OTXTILevel level, OTXTIName name);
2815 
2816  /* Bind/Unbind*/
2817 
2826  OSStatus
2827  OTBind(EndpointRef ref, TBind *reqAddr, /* can be NULL */
2828  TBind *retAddr); /* can be NULL */
2829 
2838  OSStatus
2839  OTUnbind(EndpointRef ref);
2840 
2841  /* Connection creation/tear-down*/
2842 
2851  OSStatus
2852  OTConnect(EndpointRef ref, TCall *sndCall, TCall *rcvCall); /* can be NULL */
2853 
2862  OSStatus
2863  OTRcvConnect(EndpointRef ref, TCall *call); /* can be NULL */
2864 
2873  OSStatus
2874  OTListen(EndpointRef ref, TCall *call);
2875 
2884  OSStatus
2885  OTAccept(EndpointRef listener, EndpointRef worker, TCall *call);
2886 
2895  OSStatus
2896  OTSndDisconnect(EndpointRef ref, TCall *call); /* can be NULL */
2897 
2906  OSStatus
2907  OTSndOrderlyDisconnect(EndpointRef ref);
2908 
2917  OSStatus
2918  OTRcvDisconnect(EndpointRef ref, TDiscon *discon); /* can be NULL */
2919 
2928  OSStatus
2929  OTRcvOrderlyDisconnect(EndpointRef ref);
2930 
2931  /* Connection-oriented send/receive*/
2932 
2941  OTResult
2942  OTRcv(EndpointRef ref, void *buf, OTByteCount nbytes, OTFlags *flags);
2943 
2952  OTResult
2953  OTSnd(EndpointRef ref, void *buf, OTByteCount nbytes, OTFlags flags);
2954 
2955  /* Connectionless send/receive*/
2956 
2965  OSStatus
2966  OTSndUData(EndpointRef ref, TUnitData *udata);
2967 
2976  OSStatus
2977  OTRcvUData(EndpointRef ref, TUnitData *udata, OTFlags *flags);
2978 
2987  OSStatus
2988  OTRcvUDErr(EndpointRef ref, TUDErr *uderr); /* can be NULL */
2989 
2990  /* Connection-oriented transactions*/
2991 
2992 #if CALL_NOT_IN_CARBON
3001  OSStatus
3002  OTSndRequest(EndpointRef ref, TRequest *req, OTFlags reqFlags);
3003 
3012  OSStatus
3013  OTRcvReply(EndpointRef ref, TReply *reply, OTFlags *replyFlags);
3014 
3023  OSStatus
3024  OTSndReply(EndpointRef ref, TReply *reply, OTFlags replyFlags);
3025 
3034  OSStatus
3035  OTRcvRequest(EndpointRef ref, TRequest *req, OTFlags *reqFlags);
3036 
3045  OSStatus
3046  OTCancelRequest(EndpointRef ref, OTSequence sequence);
3047 
3056  OSStatus
3057  OTCancelReply(EndpointRef ref, OTSequence sequence);
3058 
3059  /* Connectionless transactions*/
3060 
3069  OSStatus
3070  OTSndURequest(EndpointRef ref, TUnitRequest *req, OTFlags reqFlags);
3071 
3080  OSStatus
3081  OTRcvUReply(EndpointRef ref, TUnitReply *reply, OTFlags *replyFlags);
3082 
3091  OSStatus
3092  OTSndUReply(EndpointRef ref, TUnitReply *reply, OTFlags replyFlags);
3093 
3102  OSStatus
3103  OTRcvURequest(EndpointRef ref, TUnitRequest *req, OTFlags *reqFlags);
3104 
3113  OSStatus
3114  OTCancelURequest(EndpointRef ref, OTSequence seq);
3115 
3124  OSStatus
3125  OTCancelUReply(EndpointRef ref, OTSequence seq);
3126 
3127 /* Interface to Mappers*/
3128 
3135 #endif /* CALL_NOT_IN_CARBON */
3136 
3145  OSStatus
3147  OTNotifyUPP upp, void *contextPtr,
3148  OTClientContextPtr clientContext); /* can be NULL */
3149 
3158  MapperRef
3160  OSStatus *err,
3161  OTClientContextPtr clientContext); /* can be NULL */
3162 
3163 #if CALL_NOT_IN_CARBON
3172  OSStatus
3173  OTAsyncOpenMapper(OTConfigurationRef cfig, OTOpenFlags oflag, OTNotifyUPP proc,
3174  void *contextPtr);
3175 
3184  MapperRef
3185  OTOpenMapper(OTConfigurationRef cfig, OTOpenFlags oflag, OSStatus *err);
3186 
3187 #endif /* CALL_NOT_IN_CARBON */
3188 
3189 #if OTCARBONAPPLICATION
3190 /* The following macros may be used by applications only.*/
3191 #define OTAsyncOpenMapper(config, oflag, proc, contextPtr) \
3192  OTAsyncOpenMapperInContext(config, oflag, proc, contextPtr, NULL)
3193 #define OTOpenMapper(config, oflag, err) \
3194  OTOpenMapperInContext(config, oflag, err, NULL)
3195 #endif /* OTCARBONAPPLICATION */
3196 
3205  OSStatus
3207 
3216  OSStatus
3217  OTDeleteName(MapperRef ref, TNetbuf *name);
3218 
3227  OSStatus
3228  OTDeleteNameByID(MapperRef ref, OTNameID nameID);
3229 
3238  OSStatus
3240 
3241  /* Basic configuration manipulation*/
3242 
3252  OTCreateConfiguration(const char *path);
3253 
3264 
3273  void
3275 
3282  /* Interrupt-safe memory allocators*/
3283 
3297  void *
3298  OTAllocMemInContext(OTByteCount size,
3299  OTClientContextPtr clientContext); /* can be NULL */
3300 
3301 #if CALL_NOT_IN_CARBON
3310  void *
3311  OTAllocMem(OTByteCount size);
3312 
3313 #endif /* CALL_NOT_IN_CARBON */
3314 
3323  void
3324  OTFreeMem(void *mem);
3325 
3326 #if OTCARBONAPPLICATION
3327 /* The following macros may be used by applications only.*/
3328 #define OTAllocMem(s) OTAllocMemInContext(s, NULL)
3329 #endif /* OTCARBONAPPLICATION */
3330 
3331  /* Miscellaneous and Generic Routines*/
3332 
3346  void
3347  OTDelay(UInt32 seconds);
3348 
3357  void
3358  OTIdle(void);
3359 
3360 #endif /* !OTKERNEL */
3361 
3366  /* Memory and String Routines*/
3367 
3381  void
3382  OTMemcpy(void *dest, const void *src, OTByteCount nBytes);
3383 
3392  Boolean
3393  OTMemcmp(const void *mem1, const void *mem2, OTByteCount nBytes);
3394 
3403  void
3404  OTMemmove(void *dest, const void *src, OTByteCount nBytes);
3405 
3414  void
3415  OTMemzero(void *dest, OTByteCount nBytes);
3416 
3425  void
3426  OTMemset(void *dest, OTUInt8Param toSet, OTByteCount nBytes);
3427 
3436  OTByteCount
3437  OTStrLength(const char *str);
3438 
3447  void
3448  OTStrCopy(char *dest, const char *src);
3449 
3458  void
3459  OTStrCat(char *dest, const char *src);
3460 
3469  Boolean
3470  OTStrEqual(const char *src1, const char *src2);
3471 
3472  /* Timer Utilities*/
3473 
3493  void
3495 
3504  OTTimeStamp *
3506  OTTimeStamp *endEnd);
3507 
3516  UInt32
3518 
3527  UInt32
3529 
3538  UInt32
3540 
3549  UInt32
3551 
3560  UInt32
3562 
3563  /* ***** OT Link Element ******/
3564 
3572  struct OTLink
3573  {
3574  struct OTLink *fNext;
3575 
3576 #ifdef __cplusplus
3577 
3578  // C++ inline methods on this structure.
3579 
3580  void Init() { fNext = NULL; }
3581 #endif
3582  };
3583  typedef struct OTLink OTLink;
3584 
3589 #define OTGetLinkObject(link, struc, field) \
3590  ((struc *)((char *)(link)-OTOffsetOf(struc, field)))
3591 
3592  /* OTLIFO*/
3593 
3602  struct OTLIFO
3603  {
3604  OTLink *fHead;
3605 
3606 #ifdef __cplusplus
3607 
3608  // C++ inline methods on this structure.
3609 
3610  void Init();
3611  void Enqueue(OTLink *link);
3612  OTLink *Dequeue();
3613  OTLink *StealList();
3614  Boolean IsEmpty();
3615 #endif
3616  };
3617  typedef struct OTLIFO OTLIFO;
3630  void
3632 
3645  OTLink *
3647 
3660  OTLink *
3662 
3676  OTLink *
3678 
3679 #ifdef __cplusplus
3680 
3681  // C++ inline methods on this structure.
3682 
3683  inline void OTLIFO::Init() { fHead = NULL; }
3684  inline void OTLIFO::Enqueue(OTLink *link) { OTLIFOEnqueue(this, link); }
3685  inline OTLink *OTLIFO::Dequeue() { return OTLIFODequeue(this); }
3686  inline OTLink *OTLIFO::StealList() { return OTLIFOStealList(this); }
3687  inline Boolean OTLIFO::IsEmpty() { return fHead == NULL; }
3688 #endif
3689 
3690  /* OTList*/
3691 
3704  typedef CALLBACK_API_C(Boolean, OTListSearchProcPtr)(const void *ref,
3705  OTLink *linkToCheck);
3706  typedef TVECTOR_UPP_TYPE(OTListSearchProcPtr) OTListSearchUPP;
3715  OTListSearchUPP
3716  NewOTListSearchUPP(OTListSearchProcPtr userRoutine);
3717 #if !OPAQUE_UPP_TYPES
3718  enum
3719  {
3720  uppOTListSearchProcInfo = 0x000003D1
3721  }; /* 1_byte Func(4_bytes, 4_bytes) */
3722 #ifdef __cplusplus
3723  inline OTListSearchUPP NewOTListSearchUPP(OTListSearchProcPtr userRoutine)
3724  {
3725  return userRoutine;
3726  }
3727 #else
3728 #define NewOTListSearchUPP(userRoutine) (userRoutine)
3729 #endif
3730 #endif
3731 
3740  void
3741  DisposeOTListSearchUPP(OTListSearchUPP userUPP);
3742 #if !OPAQUE_UPP_TYPES
3743 #ifdef __cplusplus
3744  inline void DisposeOTListSearchUPP(OTListSearchUPP) {}
3745 #else
3746 #define DisposeOTListSearchUPP(userUPP)
3747 #endif
3748 #endif
3749 
3758  Boolean
3760  OTListSearchUPP userUPP);
3761 #if !OPAQUE_UPP_TYPES
3762 #ifdef __cplusplus
3763  inline Boolean InvokeOTListSearchUPP(const void *ref, OTLink *linkToCheck,
3764  OTListSearchUPP userUPP)
3765  {
3766  return (*userUPP)(ref, linkToCheck);
3767  }
3768 #else
3769 #define InvokeOTListSearchUPP(ref, linkToCheck, userUPP) \
3770  (*userUPP)(ref, linkToCheck)
3771 #endif
3772 #endif
3773 
3774  struct OTList
3775  {
3776  OTLink *fHead;
3777 
3778 #ifdef __cplusplus
3779  // C++ inline methods on this structure.
3780 
3781  void Init();
3782  Boolean IsEmpty();
3783  void AddFirst(OTLink *link);
3784  void AddLast(OTLink *link);
3785  OTLink *GetFirst();
3786  OTLink *GetLast();
3787  OTLink *RemoveFirst();
3788  OTLink *RemoveLast();
3789  Boolean IsInList(OTLink *link);
3790  OTLink *FindLink(OTListSearchUPP proc, const void *ref);
3791  Boolean RemoveLink(OTLink *link);
3792  OTLink *FindAndRemoveLink(OTListSearchUPP proc, const void *ref);
3793  OTLink *GetIndexedLink(OTItemCount index);
3794 #endif
3795  };
3796  typedef struct OTList OTList;
3797  /* Add the link to the list at the front*/
3806  void
3808 
3809  /* Add the link to the list at the end*/
3818  void
3820 
3821  /* Remove the first link from the list*/
3830  OTLink *
3832 
3833  /* Remove the last link from the list*/
3842  OTLink *
3844 
3845  /* Return the first link from the list*/
3854  OTLink *
3856 
3857  /* Return the last link from the list*/
3866  OTLink *
3868 
3869  /* Return true if the link is present in the list*/
3878  Boolean
3880 
3896  OTLink *
3897  OTFindLink(OTList *list, OTListSearchUPP proc, const void *ref);
3898 
3899  /* Remove the specified link from the list, returning true if it was found*/
3908  Boolean
3910 
3911  /* Similar to OTFindLink, but it also removes it from the list.*/
3920  OTLink *
3921  OTFindAndRemoveLink(OTList *list, OTListSearchUPP proc, const void *ref);
3922 
3923  /* Return the "index"th link in the list*/
3932  OTLink *
3933  OTGetIndexedLink(OTList *list, OTItemCount index);
3934 
3935  /* OTEnqueue/OTDequeue*/
3936 
3956  void
3957  OTEnqueue(void **listHead, void *object, OTByteCount linkOffset);
3958 
3971  void *
3972  OTDequeue(void **listHead, OTByteCount linkOffset);
3973 
3974 #ifdef __cplusplus
3975  // C++ inline methods on this structure.
3976 
3977  inline void OTList::Init() { fHead = NULL; }
3978  inline Boolean OTList::IsEmpty() { return fHead == NULL; }
3979  inline void OTList::AddFirst(OTLink *link) { OTAddFirst(this, link); }
3980  inline void OTList::AddLast(OTLink *link) { OTAddLast(this, link); }
3981  inline OTLink *OTList::GetFirst() { return OTGetFirst(this); }
3982  inline OTLink *OTList::GetLast() { return OTGetLast(this); }
3983  inline OTLink *OTList::RemoveFirst() { return OTRemoveFirst(this); }
3984  inline OTLink *OTList::RemoveLast() { return OTRemoveLast(this); }
3985  inline Boolean OTList::IsInList(OTLink *link) { return OTIsInList(this, link); }
3986  inline OTLink *OTList::FindLink(OTListSearchUPP proc, const void *ref)
3987  {
3988  return OTFindLink(this, proc, ref);
3989  }
3990  inline Boolean OTList::RemoveLink(OTLink *link)
3991  {
3992  return OTRemoveLink(this, link);
3993  }
3994  inline OTLink *OTList::FindAndRemoveLink(OTListSearchUPP proc,
3995  const void *ref)
3996  {
3997  return OTFindAndRemoveLink(this, proc, ref);
3998  }
3999  inline OTLink *OTList::GetIndexedLink(OTItemCount index)
4000  {
4001  return OTGetIndexedLink(this, index);
4002  }
4003 #endif
4004 
4005 /* Atomic Operations*/
4006 
4028 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
4029 #pragma parameter __D0 OTAtomicSetBit(__A0, __D0)
4030 #endif
4031  Boolean
4032  OTAtomicSetBit(UInt8 *bytePtr, OTByteCount bitNumber);
4033 
4048 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
4049 #pragma parameter __D0 OTAtomicClearBit(__A0, __D0)
4050 #endif
4051  Boolean
4052  OTAtomicClearBit(UInt8 *bytePtr, OTByteCount bitNumber);
4053 
4068 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
4069 #pragma parameter __D0 OTAtomicTestBit(__A0, __D0)
4070 #endif
4071  Boolean
4072  OTAtomicTestBit(UInt8 *bytePtr, OTByteCount bitNumber);
4073 
4088 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
4089 #pragma parameter __D0 OTCompareAndSwapPtr(__D0, __D1, __A0)
4090 #endif
4091  Boolean
4092  OTCompareAndSwapPtr(void *oldValue, void *newValue, void **dest);
4093 
4107 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
4108 #pragma parameter __D0 OTCompareAndSwap32(__D0, __D1, __A0)
4109 #endif
4110  Boolean
4111  OTCompareAndSwap32(UInt32 oldValue, UInt32 newValue, UInt32 *dest);
4112 
4126 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
4127 #pragma parameter __D0 OTCompareAndSwap16(__D0, __D1, __A0)
4128 #endif
4129  Boolean
4130  OTCompareAndSwap16(UInt32 oldValue, UInt32 newValue, UInt16 *dest);
4131 
4145 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
4146 #pragma parameter __D0 OTCompareAndSwap8(__D0, __D1, __A0)
4147 #endif
4148  Boolean
4149  OTCompareAndSwap8(UInt32 oldValue, UInt32 newValue, UInt8 *dest);
4150 
4164 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
4165 #pragma parameter __D0 OTAtomicAdd32(__D0, __A0)
4166 #endif
4167  SInt32
4168  OTAtomicAdd32(SInt32 toAdd, SInt32 *dest);
4169 
4186  SInt16
4187  OTAtomicAdd16(SInt32 toAdd, SInt16 *dest);
4188 
4189  /* Not used frequently enough to justify inlining.*/
4198  SInt8
4199  OTAtomicAdd8(SInt32 toAdd, SInt8 *dest);
4200 
4201  /* Not used frequently enough to justify inlining.*/
4202  /* OTLock is just a convenience type with some convenient macros.*/
4203 
4204  typedef UInt8 OTLock;
4205 
4206 #define OTClearLock(lockPtr) *(lockPtr) = 0
4207 #define OTAcquireLock(lockPtr) (OTAtomicSetBit(lockPtr, 0) == 0)
4208 
4209  /*******************************************************************************
4210  **
4211  ** FROM HERE ON DOWN ARE THE C++ Interfaces to Open Transport
4212  **
4213  ********************************************************************************/
4214 
4215 #ifdef __cplusplus
4216 } // Terminate C definitions
4217 
4218 /* -------------------------------------------------------------------------
4219  CLASS TProvider
4220 
4221  This class provides the client interface to a Stream. Typically, clients
4222  talk to an object (or glue code in front of the object) that is a subclass
4223  of TProvider.
4224  ------------------------------------------------------------------------- */
4225 
4226 #if !OTKERNEL
4227 
4228 class TProvider
4229 {
4230 private:
4231  void *operator new(size_t);
4232  void operator delete(void *) {}
4233 
4234  //
4235  // This is the public interface to a TProvider. All other public
4236  // methods normally come from the subclass.
4237  //
4238 public:
4239  OSStatus Close() { return OTCloseProvider(this); }
4240 
4241  OSStatus SetNonBlocking() { return OTSetNonBlocking(this); }
4242  OSStatus SetBlocking() { return OTSetBlocking(this); }
4243  Boolean IsBlocking() { return OTIsBlocking(this); }
4244  Boolean IsNonBlocking() { return !OTIsBlocking(this); }
4245  OSStatus SetSynchronous() { return OTSetSynchronous(this); }
4246  OSStatus SetAsynchronous() { return OTSetAsynchronous(this); }
4247  Boolean IsSynchronous() { return OTIsSynchronous(this); }
4248  Boolean IsAsynchronous() { return !OTIsSynchronous(this); }
4249 
4250  OSStatus AckSends() { return OTAckSends(this); }
4251  OSStatus DontAckSends() { return OTDontAckSends(this); }
4252  Boolean IsAckingSends() { return OTIsAckingSends(this); }
4253 
4254  void CancelSynchronousCalls(OSStatus err)
4255  {
4256  (void)OTCancelSynchronousCalls(this, err);
4257  }
4258 
4259  OSStatus InstallNotifier(OTNotifyUPP proc, void *ptr)
4260  {
4261  return OTInstallNotifier(this, proc, ptr);
4262  }
4263 
4264  OSStatus UseSyncIdleEvents() { return OTUseSyncIdleEvents(this, true); }
4265 
4266  OSStatus DontUseSyncIdleEvents() { return OTUseSyncIdleEvents(this, false); }
4267 
4268  void RemoveNotifier() { OTRemoveNotifier(this); }
4269 
4270  Boolean EnterNotifier() { return OTEnterNotifier(this); }
4271 
4272  void LeaveNotifier() { OTLeaveNotifier(this); }
4273 
4274 #if CALL_NOT_IN_CARBON
4275  OTPortRef GetOTPortRef() { return OTGetProviderPortRef(this); }
4276 
4277  ProviderRef TransferOwnership(OTClient prevOwner, OSStatus *errPtr)
4278  {
4279  return OTTransferProviderOwnership(this, prevOwner, errPtr);
4280  }
4281 #endif
4282 
4283  SInt32 Ioctl(UInt32 cmd, void *data) { return OTIoctl(this, cmd, data); }
4284  SInt32 Ioctl(UInt32 cmd, long data)
4285  {
4286  return OTIoctl(this, cmd, (void *)data);
4287  }
4288 
4289 #if CALL_NOT_IN_CARBON
4290  OTResult GetMessage(strbuf *ctlbuf, strbuf *databuf, OTFlags *flagPtr)
4291  {
4292  return OTGetMessage(this, ctlbuf, databuf, flagPtr);
4293  }
4294  OTResult GetPriorityMessage(strbuf *ctlbuf, strbuf *databuf, OTBand *bandPtr,
4295  OTFlags *flagPtr)
4296  {
4297  return OTGetPriorityMessage(this, ctlbuf, databuf, bandPtr, flagPtr);
4298  }
4299  OSStatus PutMessage(const strbuf *ctlbuf, const strbuf *databuf,
4300  OTFlags flags)
4301  {
4302  return OTPutMessage(this, ctlbuf, databuf, flags);
4303  }
4304  OSStatus PutPriorityMessage(const strbuf *ctlbuf, const strbuf *databuf,
4305  OTBand band, OTFlags flags)
4306  {
4307  return OTPutPriorityMessage(this, ctlbuf, databuf, band, flags);
4308  }
4309 #endif
4310 };
4311 
4312 /* -------------------------------------------------------------------------
4313  Class TEndpoint
4314 
4315  This class is the interface to all TPI modules, which constitute the
4316  vast majority of protocols, with the exception of link-layer protocols.
4317  ------------------------------------------------------------------------- */
4318 
4319 class TEndpoint : public TProvider
4320 {
4321 public:
4322  //
4323  // Miscellaneous informative functions
4324  //
4325  OSStatus GetEndpointInfo(TEndpointInfo *info)
4326  {
4327  return OTGetEndpointInfo(this, info);
4328  }
4329 
4330  OSStatus GetProtAddress(TBind *boundAddr, TBind *peerAddr)
4331  {
4332  return OTGetProtAddress(this, boundAddr, peerAddr);
4333  }
4334 
4335  OSStatus ResolveAddress(TBind *reqAddr, TBind *retAddr, OTTimeout timeout)
4336  {
4337  return OTResolveAddress(this, reqAddr, retAddr, timeout);
4338  }
4339 
4340  OTResult GetEndpointState() { return OTGetEndpointState(this); }
4341 
4342  OTResult Look() { return OTLook(this); }
4343 
4344 #if CALL_NOT_IN_CARBON
4345  OTResult Sync() { return OTSync(this); }
4346 #endif
4347  //
4348  // Allocating structures
4349  //
4350  void *AllocInContext(OTStructType structType, UInt32 fields,
4351  OSStatus *err = NULL,
4352  OTClientContextPtr clientContext = NULL)
4353  {
4354  return OTAllocInContext(this, structType, fields, err, clientContext);
4355  }
4356 
4357  void *Alloc(OTStructType structType, UInt32 fields, OSStatus *err = NULL)
4358  {
4359 #if TARGET_API_MAC_CARBON
4360  return OTAllocInContext(this, structType, fields, err, NULL);
4361 #else
4362  return OTAlloc(this, structType, fields, err);
4363 #endif
4364  };
4365 
4366  OTResult Free(void *ptr, OTStructType structType)
4367  {
4368  return OTFree(ptr, structType);
4369  }
4370  //
4371  // Option Management
4372  //
4373  OSStatus OptionManagement(TOptMgmt *req, TOptMgmt *ret)
4374  {
4375  return OTOptionManagement(this, req, ret);
4376  }
4377  //
4378  // Bind/Unbind
4379  //
4380  OSStatus Bind(TBind *reqAddr, TBind *retAddr)
4381  {
4382  return OTBind(this, reqAddr, retAddr);
4383  }
4384 
4385  OSStatus Unbind() { return OTUnbind(this); }
4386  //
4387  // Connection creation and tear-down
4388  //
4389  OSStatus Connect(TCall *sndCall, TCall *rcvCall)
4390  {
4391  return OTConnect(this, sndCall, rcvCall);
4392  }
4393 
4394  OSStatus RcvConnect(TCall *call) { return OTRcvConnect(this, call); }
4395 
4396  OSStatus Listen(TCall *call) { return OTListen(this, call); }
4397 
4398  OSStatus Accept(EndpointRef resRef, TCall *call)
4399  {
4400  return OTAccept(this, resRef, call);
4401  }
4402 
4403  OSStatus SndDisconnect(TCall *call) { return OTSndDisconnect(this, call); }
4404 
4405  OSStatus SndOrderlyDisconnect() { return OTSndOrderlyDisconnect(this); }
4406 
4407  OSStatus RcvDisconnect(TDiscon *discon)
4408  {
4409  return OTRcvDisconnect(this, discon);
4410  }
4411 
4412  OSStatus RcvOrderlyDisconnect() { return OTRcvOrderlyDisconnect(this); }
4413  //
4414  // Connection-oriented data transfer
4415  //
4416  OTResult Snd(void *buf, OTByteCount nbytes, OTFlags flags)
4417  {
4418  return OTSnd(this, buf, nbytes, flags);
4419  }
4420 
4421  OTResult Rcv(void *buf, OTByteCount nbytes, OTFlags *flagP)
4422  {
4423  return OTRcv(this, buf, nbytes, flagP);
4424  }
4425  //
4426  // Non-connection-oriented data transfer
4427  //
4428  OSStatus SndUData(TUnitData *udata) { return OTSndUData(this, udata); }
4429 
4430  OSStatus RcvUData(TUnitData *udata, OTFlags *flagP)
4431  {
4432  return OTRcvUData(this, udata, flagP);
4433  }
4434 
4435  OSStatus RcvUDErr(TUDErr *uderr) { return OTRcvUDErr(this, uderr); }
4436 
4437 #if CALL_NOT_IN_CARBON
4438  //
4439  // Connection-oriented transactions
4440  //
4441  OSStatus SndRequest(TRequest *req, OTFlags reqFlags)
4442  {
4443  return OTSndRequest(this, req, reqFlags);
4444  }
4445 
4446  OSStatus RcvReply(TReply *reply, OTFlags *replyFlags)
4447  {
4448  return OTRcvReply(this, reply, replyFlags);
4449  }
4450 
4451  OSStatus SndReply(TReply *reply, OTFlags flags)
4452  {
4453  return OTSndReply(this, reply, flags);
4454  }
4455 
4456  OSStatus RcvRequest(TRequest *req, OTFlags *flags)
4457  {
4458  return OTRcvRequest(this, req, flags);
4459  }
4460 
4461  OSStatus CancelRequest(OTSequence seq) { return OTCancelRequest(this, seq); }
4462 
4463  OSStatus CancelReply(OTSequence seq) { return OTCancelReply(this, seq); }
4464  //
4465  // Non-connection-oriented transactions
4466  //
4467  OSStatus SndURequest(TUnitRequest *req, OTFlags reqFlags)
4468  {
4469  return OTSndURequest(this, req, reqFlags);
4470  }
4471 
4472  OSStatus RcvUReply(TUnitReply *reply, OTFlags *replyFlags)
4473  {
4474  return OTRcvUReply(this, reply, replyFlags);
4475  }
4476 
4477  OSStatus SndUReply(TUnitReply *reply, OTFlags flags)
4478  {
4479  return OTSndUReply(this, reply, flags);
4480  }
4481 
4482  OSStatus RcvURequest(TUnitRequest *req, OTFlags *flags)
4483  {
4484  return OTRcvURequest(this, req, flags);
4485  }
4486 
4487  OSStatus CancelURequest(OTSequence seq)
4488  {
4489  return OTCancelURequest(this, seq);
4490  }
4491 
4492  OSStatus CancelUReply(OTSequence seq) { return OTCancelUReply(this, seq); }
4493 #endif
4494  //
4495  // Miscellaneous functions
4496  //
4497  OTResult CountDataBytes(OTByteCount *countPtr)
4498  {
4499  return OTCountDataBytes(this, countPtr);
4500  }
4501 };
4502 
4503 /* -------------------------------------------------------------------------
4504  CLASS TMapper
4505 
4506  This class is the interface to naming protocols.
4507  ------------------------------------------------------------------------- */
4508 
4509 class TMapper : public TProvider
4510 {
4511 public:
4512  OSStatus RegisterName(TRegisterRequest *req, TRegisterReply *reply)
4513  {
4514  return OTRegisterName(this, req, reply);
4515  }
4516 
4517  OSStatus DeleteName(TNetbuf *name) { return OTDeleteName(this, name); }
4518 
4519  OSStatus DeleteName(OTNameID theID) { return OTDeleteNameByID(this, theID); }
4520 
4521  OSStatus LookupName(TLookupRequest *req, TLookupReply *reply)
4522  {
4523  return OTLookupName(this, req, reply);
4524  }
4525 };
4526 
4527 #endif /* !OTKERNEL */
4528 
4529 extern "C"
4530 { // resume C definitions
4531 #endif /* __cplusplus */
4532 
4533 #if defined(__MWERKS__) && TARGET_CPU_68K
4534 #pragma pop
4535 #endif
4536 
4537 #if PRAGMA_STRUCT_ALIGN
4538 #pragma options align = reset
4539 #elif PRAGMA_STRUCT_PACKPUSH
4540 #pragma pack(pop)
4541 #elif PRAGMA_STRUCT_PACK
4542 #pragma pack()
4543 #endif
4544 
4545 #ifdef PRAGMA_IMPORT_OFF
4546 #pragma import off
4547 #elif PRAGMA_IMPORT
4548 #pragma import reset
4549 #endif
4550 
4551 #ifdef __cplusplus
4552 }
4553 #endif
4554 
4555 #endif /* __OPENTRANSPORT__ */
OSErr codes.
Basic Macintosh data types.
#define NULL
Definition: MacTypes.h:61
unsigned char Boolean
Definition: MacTypes.h:318
Mixed Mode Manager Interfaces.
OSErr Dequeue(QElemPtr qElement, QHdrPtr qHeader)
Remove an element from a queue.
void Enqueue(QElemPtr qElement, QHdrPtr qHeader)
Add an element to the end of a queue.
EndpointRef OTOpenEndpointInContext(OTConfigurationRef config, OTOpenFlags oflag, TEndpointInfo *info, OSStatus *err, OTClientContextPtr clientContext)
Boolean OTIsAckingSends(ProviderRef ref)
UInt32 OTElapsedMilliseconds(OTTimeStamp *startTime)
void * OTAllocMem(OTByteCount size)
OSStatus InitOpenTransportUtilities(void)
OSStatus OTCreateOptionString(const char *endPtName, TOption **opt, void *bufEnd, char *str, OTByteCount stringSize)
OTResult OTRcv(EndpointRef ref, void *buf, OTByteCount nbytes, OTFlags *flags)
OTPortRef OTGetProviderPortRef(ProviderRef ref)
void OTLeaveInterrupt(void)
void InvokeOTNotifyUPP(void *contextPtr, OTEventCode code, OTResult result, void *cookie, OTNotifyUPP userUPP)
OTDeviceType OTGetDeviceTypeFromPortRef(OTPortRef ref)
Boolean OTIsBlocking(ProviderRef ref)
OSStatus OTCancelUReply(EndpointRef ref, OTSequence seq)
OTResult OTSync(EndpointRef ref)
void OTMemset(void *dest, OTUInt8Param toSet, OTByteCount nBytes)
void InvokeOTProcessUPP(void *arg, OTProcessUPP userUPP)
OSStatus OTDontAckSends(ProviderRef ref)
OSStatus OTDeleteNameByID(MapperRef ref, OTNameID nameID)
UnsignedWide OTTimeStamp
Definition: OpenTransport.h:3484
Boolean OTCompareAndSwap16(UInt32 oldValue, UInt32 newValue, UInt16 *dest)
void OTAddFirst(OTList *list, OTLink *link)
EndpointRef OTOpenEndpoint(OTConfigurationRef cfig, OTOpenFlags oflag, TEndpointInfo *info, OSStatus *err)
OTLink * OTRemoveFirst(OTList *list)
OSStatus OTCancelReply(EndpointRef ref, OTSequence sequence)
UInt32 OTTimeStampInMicroseconds(OTTimeStamp *delta)
OSStatus OTSndRequest(EndpointRef ref, TRequest *req, OTFlags reqFlags)
Boolean OTCanLoadLibraries(void)
void OTRemoveNotifier(ProviderRef ref)
long OTDeferredTaskRef
Definition: OpenTransport.h:2099
Boolean OTRemoveLink(OTList *list, OTLink *link)
void * OTAlloc(EndpointRef ref, OTStructType structType, OTFieldsType fields, OSStatus *err)
struct OTConfiguration * OTConfigurationRef
Definition: OpenTransport.h:1059
Boolean OTScheduleInterruptTask(OTDeferredTaskRef dtCookie)
OSStatus OTBind(EndpointRef ref, TBind *reqAddr, TBind *retAddr)
OTResult OTFree(void *ptr, OTStructType structType)
void OTMemmove(void *dest, const void *src, OTByteCount nBytes)
OTLink * OTLIFODequeue(OTLIFO *list)
OSStatus OTSndReply(EndpointRef ref, TReply *reply, OTFlags replyFlags)
OSStatus OTRcvReply(EndpointRef ref, TReply *reply, OTFlags *replyFlags)
MapperRef OTOpenMapperInContext(OTConfigurationRef config, OTOpenFlags oflag, OSStatus *err, OTClientContextPtr clientContext)
OSStatus OTUnregisterAsClientInContext(OTClientContextPtr clientContext)
SInt32 OTReason
Definition: OpenTransport.h:257
OSStatus OTRegisterAsClientInContext(OTClientName name, OTNotifyUPP proc, OTClientContextPtr clientContext)
Boolean OTStrEqual(const char *src1, const char *src2)
OTPortRef OTSetBusTypeInPortRef(OTPortRef ref, OTBusType busType)
OTLink * OTLIFOStealList(OTLIFO *list)
Boolean OTAtomicClearBit(UInt8 *bytePtr, OTByteCount bitNumber)
OSStatus OTDeleteName(MapperRef ref, TNetbuf *name)
OSStatus OTUseSyncIdleEvents(ProviderRef ref, Boolean useEvents)
OSStatus OTRcvUData(EndpointRef ref, TUnitData *udata, OTFlags *flags)
SInt16 OTAtomicAdd16(SInt32 toAdd, SInt16 *dest)
Boolean OTIsInList(OTList *list, OTLink *link)
OSStatus OTPutPriorityMessage(ProviderRef ref, const strbuf *ctlbuf, const strbuf *databuf, OTBand band, OTFlags flags)
OSStatus OTCancelURequest(EndpointRef ref, OTSequence seq)
OTTimeStamp * OTSubtractTimeStamps(OTTimeStamp *result, OTTimeStamp *startTime, OTTimeStamp *endEnd)
UInt16 OTDeviceType
Definition: OpenTransport.h:1230
OSStatus OTCancelSynchronousCalls(ProviderRef ref, OSStatus err)
void OTLeaveNotifier(ProviderRef ref)
OTResult OTGetPriorityMessage(ProviderRef ref, strbuf *ctlbuf, strbuf *databuf, OTBand *bandPtr, OTFlags *flagsPtr)
UInt16 OTGetBusTypeFromPortRef(OTPortRef ref)
Boolean OTAtomicTestBit(UInt8 *bytePtr, OTByteCount bitNumber)
OSStatus OTRcvDisconnect(EndpointRef ref, TDiscon *discon)
OSStatus OTPutMessage(ProviderRef ref, const strbuf *ctlbuf, const strbuf *databuf, OTFlags flags)
OSStatus OTSndUReply(EndpointRef ref, TUnitReply *reply, OTFlags replyFlags)
void CloseOpenTransport(void)
OSStatus InitOpenTransportInContext(OTInitializationFlags flags, OTClientContextPtr *outClientContext)
OTLink * OTGetLast(OTList *list)
OSStatus OTCloseProvider(ProviderRef ref)
OTNotifyUPP NewOTNotifyUPP(OTNotifyProcPtr userRoutine)
OSStatus OTInstallNotifier(ProviderRef ref, OTNotifyUPP proc, void *contextPtr)
OSStatus OTUnbind(EndpointRef ref)
void OTLIFOEnqueue(OTLIFO *list, OTLink *link)
void OTMemzero(void *dest, OTByteCount nBytes)
void DisposeOTProcessUPP(OTProcessUPP userUPP)
UInt32 OTServiceType
Definition: OpenTransport.h:1147
void CloseOpenTransportInContext(OTClientContextPtr clientContext)
UInt32 OTXTIStates
Definition: OpenTransport.h:1009
OSStatus OTAsyncOpenEndpointInContext(OTConfigurationRef config, OTOpenFlags oflag, TEndpointInfo *info, OTNotifyUPP upp, void *contextPtr, OTClientContextPtr clientContext)
long OTCreateDeferredTaskInContext(OTProcessUPP upp, void *arg, OTClientContextPtr clientContext)
OTResult OTSnd(EndpointRef ref, void *buf, OTByteCount nbytes, OTFlags flags)
OSStatus OTSndUData(EndpointRef ref, TUnitData *udata)
OTProcessUPP NewOTProcessUPP(OTProcessProcPtr userRoutine)
UInt32 OTFlags
Definition: OpenTransport.h:597
SInt8 OTAtomicAdd8(SInt32 toAdd, SInt8 *dest)
TOption * OTFindOption(UInt8 *buffer, UInt32 buflen, OTXTILevel level, OTXTIName name)
Boolean OTFindPortByRef(OTPortRecord *portRecord, OTPortRef ref)
UInt32 OTPortRef
Definition: OpenTransport.h:1203
void * OTAllocMemInContext(OTByteCount size, OTClientContextPtr clientContext)
UInt32 OTTimeStampInMilliseconds(OTTimeStamp *delta)
void OTStrCopy(char *dest, const char *src)
SInt32 OTAtomicAdd32(SInt32 toAdd, SInt32 *dest)
OTPortRef OTCreatePortRef(OTBusType busType, OTDeviceType devType, OTSlotNumber slot, UInt16 other)
OSStatus OTAsyncOpenMapper(OTConfigurationRef cfig, OTOpenFlags oflag, OTNotifyUPP proc, void *contextPtr)
void * OTAllocInContext(EndpointRef ref, OTStructType structType, UInt32 fields, OSStatus *err, OTClientContextPtr clientContext)
OSStatus OTRcvRequest(EndpointRef ref, TRequest *req, OTFlags *reqFlags)
OTLink * OTGetFirst(OTList *list)
UInt32 OTOpenFlags
Definition: OpenTransport.h:334
OSStatus OTGetProtAddress(EndpointRef ref, TBind *boundAddr, TBind *peerAddr)
OSStatus OTRcvUDErr(EndpointRef ref, TUDErr *uderr)
OSStatus OTUnregisterAsClient(void)
void OTDebugStr(const char *str)
Boolean OTMemcmp(const void *mem1, const void *mem2, OTByteCount nBytes)
OTPortRef OTSetDeviceTypeInPortRef(OTPortRef ref, OTDeviceType devType)
OTResult OTCountDataBytes(EndpointRef ref, OTByteCount *countPtr)
OTListSearchUPP NewOTListSearchUPP(OTListSearchProcPtr userRoutine)
OSStatus OTAsyncOpenEndpoint(OTConfigurationRef cfig, OTOpenFlags oflag, TEndpointInfo *info, OTNotifyUPP proc, void *contextPtr)
OSStatus OTSndOrderlyDisconnect(EndpointRef ref)
OSStatus OTSetSynchronous(ProviderRef ref)
OSStatus OTRcvConnect(EndpointRef ref, TCall *call)
Boolean OTScheduleDeferredTask(OTDeferredTaskRef dtCookie)
UInt32 OTElapsedMicroseconds(OTTimeStamp *startTime)
void OTAddLast(OTList *list, OTLink *link)
OTConfigurationRef OTCreateConfiguration(const char *path)
OSStatus OTAsyncOpenProvider(OTConfigurationRef cfig, OTOpenFlags flags, OTNotifyUPP proc, void *contextPtr)
OSStatus OTDestroyDeferredTask(OTDeferredTaskRef dtCookie)
UInt16 OTXTIErr
Definition: OpenTransport.h:460
void DisposeOTNotifyUPP(OTNotifyUPP userUPP)
OTResult OTLook(EndpointRef ref)
Boolean OTAtomicSetBit(UInt8 *bytePtr, OTByteCount bitNumber)
OSStatus OTRegisterAsClient(OTClientName name, OTNotifyUPP proc)
Boolean OTIsSynchronous(ProviderRef ref)
OSStatus OTAckSends(ProviderRef ref)
MapperRef OTOpenMapper(OTConfigurationRef cfig, OTOpenFlags oflag, OSStatus *err)
OSStatus OTGetEndpointInfo(EndpointRef ref, TEndpointInfo *info)
OSStatus OTDestroySystemTask(OTSystemTaskRef stCookie)
Boolean OTCancelSystemTask(OTSystemTaskRef stCookie)
OSStatus InitOpenTransport(void)
OSStatus OTAccept(EndpointRef listener, EndpointRef worker, TCall *call)
OTSlotNumber OTGetSlotFromPortRef(OTPortRef ref, UInt16 *other)
OTByteCount OTStrLength(const char *str)
void OTEnqueue(void **listHead, void *object, OTByteCount linkOffset)
OSStatus OTSetAsynchronous(ProviderRef ref)
OSStatus OTRcvUReply(EndpointRef ref, TUnitReply *reply, OTFlags *replyFlags)
OSStatus OTSndDisconnect(EndpointRef ref, TCall *call)
OSStatus OTRcvURequest(EndpointRef ref, TUnitRequest *req, OTFlags *reqFlags)
Boolean OTCanMakeSyncCall(void)
OSStatus OTRegisterName(MapperRef ref, TRegisterRequest *req, TRegisterReply *reply)
Boolean OTFindPort(OTPortRecord *portRecord, const char *portName)
Boolean OTEnterNotifier(ProviderRef ref)
ProviderRef OTTransferProviderOwnership(ProviderRef ref, OTClient prevOwner, OSStatus *errPtr)
UInt32 OTGetClockTimeInSecs(void)
OSStatus OTNextOption(UInt8 *buffer, UInt32 buflen, TOption **prevOptPtr)
OSStatus OTCancelRequest(EndpointRef ref, OTSequence sequence)
Boolean OTCompareAndSwap8(UInt32 oldValue, UInt32 newValue, UInt8 *dest)
OSStatus OTConnect(EndpointRef ref, TCall *sndCall, TCall *rcvCall)
ProviderRef OTOpenProvider(OTConfigurationRef cfig, OTOpenFlags flags, OSStatus *errPtr)
Boolean OTCompareAndSwapPtr(void *oldValue, void *newValue, void **dest)
Boolean OTIsAtInterruptLevel(void)
void OTDestroyConfiguration(OTConfigurationRef cfig)
Boolean OTScheduleSystemTask(OTSystemTaskRef stCookie)
OSStatus OTSetNonBlocking(ProviderRef ref)
Boolean OTCompareAndSwap32(UInt32 oldValue, UInt32 newValue, UInt32 *dest)
OTDeferredTaskRef OTCreateDeferredTask(OTProcessUPP proc, void *arg)
OTClient OTWhoAmI(void)
OTSystemTaskRef OTCreateSystemTask(OTProcessUPP proc, void *arg)
void OTFreeMem(void *mem)
OSStatus OTAsyncOpenMapperInContext(OTConfigurationRef config, OTOpenFlags oflag, OTNotifyUPP upp, void *contextPtr, OTClientContextPtr clientContext)
OSStatus OTUnregisterPort(const char *portName, void **ref)
UInt32 OTBand
Definition: OpenTransport.h:643
SInt32 OTIoctl(ProviderRef ref, UInt32 cmd, void *data)
OSStatus OTRcvOrderlyDisconnect(EndpointRef ref)
OSStatus OTCreateOptions(const char *endPtName, char **strPtr, TNetbuf *buf)
OSStatus OTLookupName(MapperRef ref, TLookupRequest *req, TLookupReply *reply)
OTResult OTGetEndpointState(EndpointRef ref)
UInt8 OTUInt8Param
Definition: OpenTransport.h:195
void OTEnterInterrupt(void)
OTLink * OTReverseList(OTLink *list)
OTResult OTGetMessage(ProviderRef ref, strbuf *ctlbuf, strbuf *databuf, OTFlags *flagsPtr)
typedef CALLBACK_API_C(Boolean, OTListSearchProcPtr)(const void *ref
typedef CALLBACK_API(void, OTNotifyProcPtr)(void *contextPtr
long OTSystemTaskRef
Definition: OpenTransport.h:2164
void * ProviderRef
Definition: OpenTransport.h:664
void DisposeOTListSearchUPP(OTListSearchUPP userUPP)
Boolean InvokeOTListSearchUPP(const void *ref, OTLink *linkToCheck, OTListSearchUPP userUPP)
UInt32 OTEventCode
Definition: OpenTransport.h:678
OSStatus OTListen(EndpointRef ref, TCall *call)
OTConfigurationRef OTCloneConfiguration(OTConfigurationRef cfig)
OSStatus OTOptionManagement(EndpointRef ref, TOptMgmt *req, TOptMgmt *ret)
OTLink * OTFindAndRemoveLink(OTList *list, OTListSearchUPP proc, const void *ref)
OSStatus OTChangePortState(OTPortRef portRef, OTEventCode theChange, OTResult why)
OTLink * OTRemoveLast(OTList *list)
OSStatus OTResolveAddress(EndpointRef ref, TBind *reqAddr, TBind *retAddr, OTTimeout timeOut)
void OTIdle(void)
void OTStrCat(char *dest, const char *src)
Boolean OTGetIndexedPort(OTPortRecord *portRecord, OTItemCount index)
void OTGetTimeStamp(OTTimeStamp *currentTime)
OSStatus OTRegisterPort(OTPortRecord *portRecord, void *ref)
void * OTDequeue(void **listHead, OTByteCount linkOffset)
OTLink * OTFindLink(OTList *list, OTListSearchUPP proc, const void *ref)
UInt32 OTInitializationFlags
Definition: OpenTransport.h:1813
OTLink * OTGetIndexedLink(OTList *list, OTItemCount index)
void OTMemcpy(void *dest, const void *src, OTByteCount nBytes)
SInt32 OTResult
Definition: OpenTransport.h:510
void OTDelay(UInt32 seconds)
OSStatus OTSndURequest(EndpointRef ref, TUnitRequest *req, OTFlags reqFlags)
OSStatus OTSetBlocking(ProviderRef ref)
Definition: AEDataModel.h:175
Definition: OpenTransport.h:545
Definition: OpenTransport.h:1597
Definition: OpenTransport.h:1572
Definition: OpenTransport.h:1547
Definition: OpenTransport.h:3603
Definition: OpenTransport.h:3775
Definition: OpenTransport.h:1404
Definition: OpenTransport.h:998
Definition: TranslationExtensions.h:114
Definition: Sound.h:748
Definition: OpenTransport.h:1634
Definition: OpenTransport.h:1655
Definition: OpenTransport.h:1644
Definition: OpenTransport.h:1183
Definition: OpenTransport.h:1782
Definition: OpenTransport.h:1772
Definition: OpenTransport.h:1759
Definition: OpenTransport.h:1518
Definition: OpenTransport.h:1683
Definition: OpenTransport.h:1068
Definition: OpenTransport.h:1083
Definition: OpenTransport.h:1752
Definition: OpenTransport.h:1741
Definition: OpenTransport.h:1707
Definition: OpenTransport.h:1699
Definition: OpenTransport.h:1675
Definition: OpenTransport.h:1664
Definition: OpenTransport.h:1727
Definition: OpenTransport.h:1718
Definition: MacTypes.h:110
Definition: OpenTransport.h:1533
Definition: OpenTransport.h:1128
Definition: OpenTransport.h:1135