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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       OpenTransportProviders.h
  3.  
  4.      Contains:   This file contains provider-specific definitions for various built-in providers.
  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 __OPENTRANSPORTPROVIDERS__
  18. #define __OPENTRANSPORTPROVIDERS__
  19. #ifndef __OPENTRANSPORT__
  20. #include "OpenTransport.h"
  21. #endif
  22. #if PRAGMA_ONCE
  23. #pragma once
  24. #endif
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. #if PRAGMA_IMPORT
  29. #pragma import on
  30. #endif
  31. #if PRAGMA_STRUCT_ALIGN
  32.     #pragma options align=mac68k
  33. #elif PRAGMA_STRUCT_PACKPUSH
  34.     #pragma pack(push, 2)
  35. #elif PRAGMA_STRUCT_PACK
  36.     #pragma pack(2)
  37. #endif
  38. #if defined(__MWERKS__) && TARGET_CPU_68K
  39.     #pragma push
  40.     #pragma pointers_in_D0
  41. #endif
  42. /* ***** TCP/IP ******/
  43. /* Basic types*/
  44. typedef UInt16                          InetPort;
  45. typedef UInt32                          InetHost;
  46. /*  Enums used as address type designations.*/
  47. #ifndef AF_INET /* might conflict with BSD headers */ 
  48. enum {
  49.     AF_INET                     = 2,                            /* Traditonal*/
  50.     AF_DNS                      = 42                            /* Obviously, the answer to...*/
  51. };
  52. #else
  53. enum {
  54.     AF_DNS              = 42    // Obviously, the answer to...
  55. };
  56. #endif
  57. /*
  58.     Enum which can be used to bind to all IP interfaces
  59.     rather than a specific one.
  60. */
  61. enum {
  62.     kOTAnyInetAddress           = 0                             /* Wildcard*/
  63. };
  64. /*
  65.    Define the InetSvcRef type.  This type needs special
  66.    processing because in C++ it's a subclass of TProvider.
  67.    See the definition of TEndpointRef in "OpenTransport.h"
  68.    for the logic behind this definition.
  69. */
  70. #ifdef __cplusplus
  71.  typedef class TInternetServices*   InetSvcRef;
  72. #else
  73.  typedef void*                      InetSvcRef;
  74. #endif
  75. #define kDefaultInternetServicesPath        ((OTConfigurationRef)-3L)
  76. /* Shared library prefixes*/
  77. #define kInetVersion   "3.1.1"
  78. #define kInetPrefix     "ot:inet$"
  79. /* Module Names*/
  80. #define kDNRName       "dnr"
  81. #define kTCPName      "tcp"
  82. #define kUDPName      "udp"
  83. #define kRawIPName        "rawip"
  84. /* XTI Options*/
  85. /* Protocol levels*/
  86. enum {
  87.     INET_IP                     = 0x00,
  88.     INET_TCP                    = 0x06,
  89.     INET_UDP                    = 0x11
  90. };
  91. /* TCP Level Options*/
  92. enum {
  93.     TCP_NODELAY                 = 0x01,
  94.     TCP_MAXSEG                  = 0x02,
  95.     TCP_NOTIFY_THRESHOLD        = 0x10,                         /** not a real XTI option */
  96.     TCP_ABORT_THRESHOLD         = 0x11,                         /** not a real XTI option */
  97.     TCP_CONN_NOTIFY_THRESHOLD   = 0x12,                         /** not a real XTI option */
  98.     TCP_CONN_ABORT_THRESHOLD    = 0x13,                         /** not a real XTI option */
  99.     TCP_OOBINLINE               = 0x14,                         /** not a real XTI option */
  100.     TCP_URGENT_PTR_TYPE         = 0x15,                         /** not a real XTI option */
  101.     TCP_KEEPALIVE               = 0x0008                        /* keepalive defined in OpenTransport.h */
  102. };
  103. enum {
  104.     T_GARBAGE                   = 2
  105. };
  106. /* UDP Level Options*/
  107. enum {
  108.     UDP_CHECKSUM                = 0x0600,
  109.     UDP_RX_ICMP                 = 0x02
  110. };
  111. /* IP Level Options*/
  112. enum {
  113.     kIP_OPTIONS                 = 0x01,
  114.     kIP_TOS                     = 0x02,
  115.     kIP_TTL                     = 0x03,
  116.     kIP_REUSEADDR               = 0x04,
  117.     kIP_DONTROUTE               = 0x10,
  118.     kIP_BROADCAST               = 0x20,
  119.     kIP_REUSEPORT               = 0x0200,
  120.     kIP_HDRINCL                 = 0x1002,
  121.     kIP_RCVOPTS                 = 0x1005,
  122.     kIP_RCVDSTADDR              = 0x1007,
  123.     kIP_MULTICAST_IF            = 0x1010,                       /* set/get IP multicast interface */
  124.     kIP_MULTICAST_TTL           = 0x1011,                       /* set/get IP multicast timetolive    */
  125.     kIP_MULTICAST_LOOP          = 0x1012,                       /* set/get IP multicast loopback  */
  126.     kIP_ADD_MEMBERSHIP          = 0x1013,                       /* add an IP group membership     */
  127.     kIP_DROP_MEMBERSHIP         = 0x1014,                       /* drop an IP group membership       */
  128.     kIP_BROADCAST_IFNAME        = 0x1015,                       /* Set interface for broadcasts   */
  129.     kIP_RCVIFADDR               = 0x1016                        /* Set interface for broadcasts   */
  130. };
  131. /*
  132.  * The value of some of the following constants may conflict with 
  133.  * the values found in the BSD header netinet/in.h.
  134.  * Use instead the constant defined in the enum, for example use 
  135.  * kIP_OPTIONS instead of IP_OPTIONS.
  136.  */
  137. #ifndef IP_OPTIONS
  138. enum {
  139.     IP_OPTIONS                  = kIP_OPTIONS,
  140.     IP_TOS                      = kIP_TOS,
  141.     IP_TTL                      = kIP_TTL,
  142.     IP_REUSEADDR                = kIP_REUSEADDR,
  143.     IP_DONTROUTE                = kIP_DONTROUTE,
  144.     IP_BROADCAST                = kIP_BROADCAST,
  145.     IP_REUSEPORT                = kIP_REUSEPORT,
  146.     IP_HDRINCL                  = kIP_HDRINCL,
  147.     IP_RCVOPTS                  = kIP_RCVOPTS,
  148.     IP_RCVDSTADDR               = kIP_RCVDSTADDR,
  149.     IP_MULTICAST_IF             = kIP_MULTICAST_IF,             /* set/get IP multicast interface */
  150.     IP_MULTICAST_TTL            = kIP_MULTICAST_TTL,            /* set/get IP multicast timetolive    */
  151.     IP_MULTICAST_LOOP           = kIP_MULTICAST_LOOP,           /* set/get IP multicast loopback  */
  152.     IP_ADD_MEMBERSHIP           = kIP_ADD_MEMBERSHIP,           /* add an IP group membership     */
  153.     IP_DROP_MEMBERSHIP          = kIP_DROP_MEMBERSHIP,          /* drop an IP group membership       */
  154.     IP_BROADCAST_IFNAME         = kIP_BROADCAST_IFNAME,         /* Set interface for broadcasts   */
  155.     IP_RCVIFADDR                = kIP_RCVIFADDR                 /* Set interface for broadcasts   */
  156. };
  157. #endif
  158. enum {
  159.     DVMRP_INIT                  = 100,                          /* DVMRP-specific setsockopt commands, from ip_mroute.h*/
  160.     DVMRP_DONE                  = 101,
  161.     DVMRP_ADD_VIF               = 102,
  162.     DVMRP_DEL_VIF               = 103,
  163.     DVMRP_ADD_LGRP              = 104,
  164.     DVMRP_DEL_LGRP              = 105,
  165.     DVMRP_ADD_MRT               = 106,
  166.     DVMRP_DEL_MRT               = 107
  167. };
  168. /* IP_TOS precdence levels*/
  169. enum {
  170.     T_ROUTINE                   = 0,
  171.     T_PRIORITY                  = 1,
  172.     T_IMMEDIATE                 = 2,
  173.     T_FLASH                     = 3,
  174.     T_OVERRIDEFLASH             = 4,
  175.     T_CRITIC_ECP                = 5,
  176.     T_INETCONTROL               = 6,
  177.     T_NETCONTROL                = 7
  178. };
  179. /*  IP_TOS type of service*/
  180. enum {
  181.     T_NOTOS                     = 0x00,
  182.     T_LDELAY                    = (1 << 4),
  183.     T_HITHRPT                   = (1 << 3),
  184.     T_HIREL                     = (1 << 2)
  185. };
  186. #define SET_TOS(prec,tos)   (((0x7 & (prec)) << 5) | (0x1c & (tos)))
  187. /* IP Multicast option structures*/
  188. struct TIPAddMulticast {
  189.     InetHost                        multicastGroupAddress;
  190.     InetHost                        interfaceAddress;
  191. };
  192. typedef struct TIPAddMulticast          TIPAddMulticast;
  193. /* Protocol-specific events*/
  194. enum {
  195.     T_DNRSTRINGTOADDRCOMPLETE   = kPRIVATEEVENT + 1,
  196.     T_DNRADDRTONAMECOMPLETE     = kPRIVATEEVENT + 2,
  197.     T_DNRSYSINFOCOMPLETE        = kPRIVATEEVENT + 3,
  198.     T_DNRMAILEXCHANGECOMPLETE   = kPRIVATEEVENT + 4,
  199.     T_DNRQUERYCOMPLETE          = kPRIVATEEVENT + 5
  200. };
  201. /* InetAddress*/
  202. struct InetAddress {
  203.     OTAddressType                   fAddressType;               /* always AF_INET*/
  204.     InetPort                        fPort;                      /* Port number */
  205.     InetHost                        fHost;                      /* Host address in net byte order*/
  206.     UInt8                           fUnused[8];                 /* Traditional unused bytes*/
  207. };
  208. typedef struct InetAddress              InetAddress;
  209. /* Domain Name Resolver (DNR) */
  210. enum {
  211.     kMaxHostAddrs               = 10,
  212.     kMaxSysStringLen            = 32,
  213.     kMaxHostNameLen             = 255
  214. };
  215. typedef char                            InetDomainName[256];
  216. struct InetHostInfo {
  217.     InetDomainName                  name;
  218.     InetHost                        addrs[10];
  219. };
  220. typedef struct InetHostInfo             InetHostInfo;
  221. struct InetSysInfo {
  222.     char                            cpuType[32];
  223.     char                            osType[32];
  224. };
  225. typedef struct InetSysInfo              InetSysInfo;
  226. struct InetMailExchange {
  227.     UInt16                          preference;
  228.     InetDomainName                  exchange;
  229. };
  230. typedef struct InetMailExchange         InetMailExchange;
  231. struct DNSQueryInfo {
  232.     UInt16                          qType;
  233.     UInt16                          qClass;
  234.     UInt32                          ttl;
  235.     InetDomainName                  name;
  236.     UInt16                          responseType;               /* answer, authority, or additional*/
  237.     UInt16                          resourceLen;                /* actual length of array which follows*/
  238.     char                            resourceData[4];            /* size varies*/
  239. };
  240. typedef struct DNSQueryInfo             DNSQueryInfo;
  241. /* DNSAddress*/
  242. /*
  243.    The DNSAddress format is optional and may be used in connects,
  244.    datagram sends, and resolve address calls.   The name takes the 
  245.    format "somewhere.com" or "somewhere.com:portnumber" where
  246.    the ":portnumber" is optional.   The length of this structure
  247.    is arbitrarily limited to the overall max length of a domain
  248.    name (255 chars), although a longer one can be use successfully
  249.    if you use this as a template for doing so.   However, the domain name 
  250.    is still limited to 255 characters.
  251. */
  252. struct DNSAddress {
  253.     OTAddressType                   fAddressType;               /* always AF_DNS*/
  254.     InetDomainName                  fName;
  255. };
  256. typedef struct DNSAddress               DNSAddress;
  257. /* InetInterfaceInfo*/
  258. enum {
  259.     kDefaultInetInterface       = -1
  260. };
  261. enum {
  262.     kInetInterfaceInfoVersion   = 3
  263. };
  264. struct InetInterfaceInfo {
  265.     InetHost                        fAddress;
  266.     InetHost                        fNetmask;
  267.     InetHost                        fBroadcastAddr;
  268.     InetHost                        fDefaultGatewayAddr;
  269.     InetHost                        fDNSAddr;
  270.     UInt16                          fVersion;
  271.     UInt16                          fHWAddrLen;
  272.     UInt8 *                         fHWAddr;
  273.     UInt32                          fIfMTU;
  274.     UInt8 *                         fReservedPtrs[2];
  275.     InetDomainName                  fDomainName;
  276.     UInt32                          fIPSecondaryCount;
  277.     UInt8                           fReserved[252];
  278. };
  279. typedef struct InetInterfaceInfo        InetInterfaceInfo;
  280. /* InetDHCPOption*/
  281. enum {
  282.     kAllDHCPOptions             = -1,
  283.     kDHCPLongOption             = 126,
  284.     kDHCPLongOptionReq          = 127
  285. };
  286. struct InetDHCPOption {
  287.     UInt8                           fOptionTag;
  288.     UInt8                           fOptionLen;
  289.     UInt8                           fOptionValue;
  290. };
  291. typedef struct InetDHCPOption           InetDHCPOption;
  292. /* TCP/IP Utility Routines*/
  293. EXTERN_API( void )
  294. OTInitInetAddress               (InetAddress *          addr,
  295.                                  InetPort               port,
  296.                                  InetHost               host);
  297. EXTERN_API( OTByteCount )
  298. OTInitDNSAddress                (DNSAddress *           addr,
  299.                                  char *                 str);
  300. EXTERN_API( OSStatus )
  301. OTInetStringToHost              (char *                 str,
  302.                                  InetHost *             host);
  303. EXTERN_API( void )
  304. OTInetHostToString              (InetHost               host,
  305.                                  char *                 str);
  306. EXTERN_API( OSStatus )
  307. OTInetGetInterfaceInfo          (InetInterfaceInfo *    info,
  308.                                  SInt32                 val);
  309. EXTERN_API( OSStatus )
  310. OTInetGetSecondaryAddresses     (InetHost *             addr,
  311.                                  UInt32 *               count,
  312.                                  SInt32                 val);
  313. #if CALL_NOT_IN_CARBON
  314. EXTERN_API( OSStatus )
  315. OTInetGetDHCPConfigInfo         (InetDHCPOption *       buf,
  316.                                  UInt32                 bufSize,
  317.                                  SInt32                 index,
  318.                                  SInt32                 opt);
  319. /* InetServices & DNR Calls*/
  320. #endif  /* CALL_NOT_IN_CARBON */
  321. #if !OTKERNEL
  322. /*
  323.    Under Carbon, OTOpenInternetServices routines take a client context pointer.  Applications may pass NULL
  324.    after calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
  325.    valid client context.
  326. */
  327. EXTERN_API( InetSvcRef )
  328. OTOpenInternetServicesInContext (OTConfigurationRef     cfig,
  329.                                  OTOpenFlags            oflag,
  330.                                  OSStatus *             err,
  331.                                  OTClientContextPtr     clientContext);
  332. EXTERN_API( OSStatus )
  333. OTAsyncOpenInternetServicesInContext (OTConfigurationRef  cfig,
  334.                                  OTOpenFlags            oflag,
  335.                                  OTNotifyUPP            upp,
  336.                                  void *                 contextPtr,
  337.                                  OTClientContextPtr     clientContext);
  338. #if CALL_NOT_IN_CARBON
  339. EXTERN_API( InetSvcRef )
  340. OTOpenInternetServices          (OTConfigurationRef     cfig,
  341.                                  OTOpenFlags            oflag,
  342.                                  OSStatus *             err);
  343. EXTERN_API( OSStatus )
  344. OTAsyncOpenInternetServices     (OTConfigurationRef     cfig,
  345.                                  OTOpenFlags            oflag,
  346.                                  OTNotifyProcPtr        proc,
  347.                                  void *                 contextPtr);
  348. #endif  /* CALL_NOT_IN_CARBON */
  349. #if TARGET_API_MAC_CARBON
  350. /* The following macro may be used by applications only.*/
  351. #define OTOpenInternetServices(cfig, oflags, err) OTOpenInternetServicesInContext(cfig, oflags, err, NULL)
  352. #define OTAsyncOpenInternetServices(cfig, oflags, proc, contextPtr)  OTAsyncOpenInternetServicesInContext(cfig, oflags, proc, contextPtr, NULL)
  353. #endif  /* TARGET_API_MAC_CARBON */
  354. EXTERN_API( OSStatus )
  355. OTInetStringToAddress           (InetSvcRef             ref,
  356.                                  char *                 name,
  357.                                  InetHostInfo *         hinfo);
  358. EXTERN_API( OSStatus )
  359. OTInetAddressToName             (InetSvcRef             ref,
  360.                                  InetHost               addr,
  361.                                  InetDomainName         name);
  362. EXTERN_API( OSStatus )
  363. OTInetSysInfo                   (InetSvcRef             ref,
  364.                                  char *                 name,
  365.                                  InetSysInfo *          sysinfo);
  366. EXTERN_API( OSStatus )
  367. OTInetMailExchange              (InetSvcRef             ref,
  368.                                  char *                 name,
  369.                                  UInt16 *               num,
  370.                                  InetMailExchange *     mx);
  371. EXTERN_API( OSStatus )
  372. OTInetQuery                     (InetSvcRef             ref,
  373.                                  char *                 name,
  374.                                  UInt16                 qClass,
  375.                                  UInt16                 qType,
  376.                                  char *                 buf,
  377.                                  OTByteCount            buflen,
  378.                                  void **                argv,
  379.                                  OTByteCount            argvlen,
  380.                                  OTFlags                flags);
  381. #ifdef __cplusplus
  382. }                   // Terminate C definitions
  383. class TInternetServices : public TProvider
  384. {
  385.     public:
  386.             OSStatus    StringToAddress(char* name, InetHostInfo* hinfo)
  387.                         { return OTInetStringToAddress(this, name, hinfo); }
  388.                     
  389.             OSStatus    AddressToName(InetHost addr, InetDomainName name)
  390.                         { return OTInetAddressToName(this, addr, name); }
  391.                     
  392.             OSStatus    SysInfo(char* name, InetSysInfo* sysinfo )
  393.                         { return OTInetSysInfo(this, name, sysinfo); }
  394.                     
  395.             OSStatus    MailExchange(char* name, UInt16* num, InetMailExchange* mx)
  396.                         { return OTInetMailExchange(this, name, num, mx); }
  397.                         
  398.             OSStatus    Query(char* name, UInt16 qClass, UInt16 qType, 
  399.                               char* buf, OTByteCount buflen, 
  400.                               void** argv, OTByteCount argvlen,
  401.                               OTFlags flags)
  402.                         { return OTInetQuery(this, name, qClass, qType, buf, buflen, argv, argvlen, flags); }
  403. };
  404. extern "C" {        /* resume C definitions */
  405. #endif
  406. #endif  /* !OTKERNEL */
  407. /* ***** AppleTalk ******/
  408. /* Shared library prefixes*/
  409. #define kATalkVersion  "1.1"
  410. #define kATalkPrefix  "ot:atlk$"
  411. #define kATBinderID      "ot:atbd$"
  412. /*******************************************************************************
  413. ** Module definitions
  414. ********************************************************************************/
  415. /* XTI Levels*/
  416. enum {
  417.     ATK_DDP                     = FOUR_CHAR_CODE('DDP '),
  418.     ATK_AARP                    = FOUR_CHAR_CODE('AARP'),
  419.     ATK_ATP                     = FOUR_CHAR_CODE('ATP '),
  420.     ATK_ADSP                    = FOUR_CHAR_CODE('ADSP'),
  421.     ATK_ASP                     = FOUR_CHAR_CODE('ASP '),
  422.     ATK_PAP                     = FOUR_CHAR_CODE('PAP '),
  423.     ATK_NBP                     = FOUR_CHAR_CODE('NBP '),
  424.     ATK_ZIP                     = FOUR_CHAR_CODE('ZIP ')
  425. };
  426. /* Module Names*/
  427. #define kDDPName       "ddp"
  428. #define   kATPName        "atp"
  429. #define kADSPName     "adsp"
  430. #define  kASPName        "asp"
  431. #define kPAPName      "pap"
  432. #define kNBPName      "nbp"
  433. #define kZIPName      "zip"
  434. #define kLTalkName        "ltlk"
  435. #define kLTalkAName      "ltlkA"
  436. #define kLTalkBName     "ltlkB"
  437. /*
  438.    Protocol-specific Options
  439.    NOTE:
  440.    All Protocols support OPT_CHECKSUM (Value is (unsigned long)T_YES/T_NO)
  441.    ATP supports OPT_RETRYCNT (# Retries, 0 = try once) and
  442.                 OPT_INTERVAL (# Milliseconds to wait)
  443. */
  444. enum {
  445.     DDP_OPT_CHECKSUM            = 0x0600,
  446.     DDP_OPT_SRCADDR             = 0x2101,                       /* DDP UnitDataReq Only - set src address, Value is DDPAddress */
  447.     ATP_OPT_REPLYCNT            = 0x2110,                       /* AppleTalk - ATP Resp Pkt Ct Type, Value is (unsigned long)  pkt count */
  448.     ATP_OPT_DATALEN             = 0x2111,                       /* AppleTalk - ATP Pkt Data Len Type, Value is (unsigned long) length */
  449.     ATP_OPT_RELTIMER            = 0x2112,                       /* AppleTalk - ATP Release Timer Type, Value is (unsigned long) timer, (See Inside AppleTalk, second edition */
  450.     ATP_OPT_TRANID              = 0x2113,                       /* Value is (unsigned long) Boolean, Used to request Transaction ID, Returned with Transaction ID on requests */
  451.     PAP_OPT_OPENRETRY           = 0x2120                        /* AppleTalk - PAP OpenConn Retry count, Value is (unsigned long) T_YES/T_NO */
  452. };
  453. /* Protocol-Specific Events*/
  454. /*
  455.    If you send the IOCTL: OTIoctl(I_OTGetMiscellaneousEvents, 1),
  456.    you will receive the T_ATALKxxx events on your endpoint.
  457.    NOTE: The endpoint does not need to be bound.
  458. */
  459. enum {
  460.     kAppleTalkEvent             = kPROTOCOLEVENT | 0x00010000,
  461.     T_GETMYZONECOMPLETE         = kAppleTalkEvent + 1,
  462.     T_GETLOCALZONESCOMPLETE     = kAppleTalkEvent + 2,
  463.     T_GETZONELISTCOMPLETE       = kAppleTalkEvent + 3,
  464.     T_GETATALKINFOCOMPLETE      = kAppleTalkEvent + 4,
  465.     T_ATALKROUTERDOWNEVENT      = kAppleTalkEvent + 51,         /* No routers have been seen for a while.  If the cookie is NULL, all routers are gone.  Otherwise, there is still an ARA router hanging around being used, and only the local cable has been  timed out.*/
  466.     T_ATALKROUTERUPEVENT        = kAppleTalkEvent + 52,         /* We didn't have a router, but now one has come up. Cookie is NULL for a normal router coming up, non-NULL for an ARA router coming on-line*/
  467.     T_ATALKZONENAMECHANGEDEVENT = kAppleTalkEvent + 53,         /* A Zone name change was issued from the router, so our AppleTalk Zone has changed.*/
  468.     T_ATALKCONNECTIVITYCHANGEDEVENT = kAppleTalkEvent + 54,     /* An ARA connection was established (cookie != NULL), or was disconnected (cookie == NULL)*/
  469.     T_ATALKINTERNETAVAILABLEEVENT = kAppleTalkEvent + 55,       /* A router has appeared, and our address is in the startup range.  Cookie is hi/lo of new cable range.*/
  470.     T_ATALKCABLERANGECHANGEDEVENT = kAppleTalkEvent + 56        /* A router has appeared, and it's incompatible with our current address.  Cookie is hi/lo of new cable range.*/
  471. };
  472. enum {
  473.     kAllATalkRoutersDown        = 0,                            /* This indicates that all routers are offline*/
  474.     kLocalATalkRoutersDown      = -1L,                          /* This indicates that all local routers went offline, but an ARA router is still active*/
  475.     kARARouterDisconnected      = -2L                           /* This indicates that ARA was disconnected, do it's router went offline, and we have no local routers to fall back onto.*/
  476. };
  477. enum {
  478.     kARARouterOnline            = -1L,                          /* We had no local routers, but an ARA router is now online.*/
  479.     kATalkRouterOnline          = 0,                            /* We had no routers, but a local router is now online*/
  480.     kLocalATalkRouterOnline     = -2L                           /* We have an ARA router, but now we've seen a local router as well*/
  481. };
  482. #define IsAppleTalkEvent(x)         ((x) & 0xffff0000) == kAppleTalkEvent)
  483. /* Protocol-specific IOCTLs*/
  484. enum {
  485.     ATALK_IOC_FULLSELFSEND      = ((MIOC_ATALK << 8) | 47),     /* Turn on/off full self-send (it's automatic for non-backward-compatible links)*/
  486.     ADSP_IOC_FORWARDRESET       = ((MIOC_ATALK << 8) | 60)      /* ADSP Forward Reset*/
  487. };
  488. /* Protocol-specific constants*/
  489. /* ECHO*/
  490. enum {
  491.     kECHO_TSDU                  = 585                           /* Max. # of data bytes.*/
  492. };
  493. /* NBP*/
  494. enum {
  495.     kNBPMaxNameLength           = 32,
  496.     kNBPMaxTypeLength           = 32,
  497.     kNBPMaxZoneLength           = 32,
  498.     kNBPSlushLength             = 9,                            /* Extra space for @, : and a few escape chars*/
  499.     kNBPMaxEntityLength         = (kNBPMaxNameLength + kNBPMaxTypeLength + kNBPMaxZoneLength + 3),
  500.     kNBPEntityBufferSize        = (kNBPMaxNameLength + kNBPMaxTypeLength + kNBPMaxZoneLength + kNBPSlushLength),
  501.     kNBPWildCard                = 0x3D,                         /* NBP name and type match anything '='*/
  502.     kNBPImbeddedWildCard        = 0xC5,                         /* NBP name and type match some '*'*/
  503.     kNBPDefaultZone             = 0x2A                          /* NBP default zone '*'*/
  504. };
  505. /* ZIP*/
  506. enum {
  507.     kZIPMaxZoneLength           = kNBPMaxZoneLength
  508. };
  509. enum {
  510.     kDDPAddressLength           = 8,                            /* value to use in netbuf.len field, Maximum length of AppleTalk address*/
  511.     kNBPAddressLength           = kNBPEntityBufferSize,
  512.     kAppleTalkAddressLength     = kDDPAddressLength + kNBPEntityBufferSize
  513. };
  514. #define OTCopyDDPAddress(addr, dest)               
  515.   {                                               
  516.       ((UInt32*)(dest))[0] = ((UInt32*)(addr))[0];    
  517.       ((UInt32*)(dest))[1] = ((UInt32*)(addr))[1];    
  518.   }
  519. /*******************************************************************************
  520. ** CLASS TAppleTalkServices
  521. ********************************************************************************/
  522. #if !OTKERNEL
  523. /*
  524.    Define the ATSvcRef type.  This type needs special
  525.    processing because in C++ it's a subclass of TProvider.
  526.    See the definition of TEndpointRef in "OpenTransport.h"
  527.    for the logic behind this definition.
  528. */
  529. #ifdef __cplusplus
  530.     typedef class TAppleTalkServices*   ATSvcRef;
  531. #else
  532.     typedef void*   ATSvcRef;
  533. #endif
  534. #define kDefaultAppleTalkServicesPath       ((OTConfigurationRef)-3L)
  535. /*
  536.    Under Carbon, OpenAppleTalkServices routines take a client context pointer.  Applications may pass NULL
  537.    after calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
  538.    valid client context.
  539. */
  540. EXTERN_API( OSStatus )
  541. OTAsyncOpenAppleTalkServicesInContext (OTConfigurationRef  cfig,
  542.                                  OTOpenFlags            flags,
  543.                                  OTNotifyUPP            proc,
  544.                                  void *                 contextPtr,
  545.                                  OTClientContextPtr     clientContext);
  546. EXTERN_API( ATSvcRef )
  547. OTOpenAppleTalkServicesInContext (OTConfigurationRef    cfig,
  548.                                  OTOpenFlags            flags,
  549.                                  OSStatus *             err,
  550.                                  OTClientContextPtr     clientContext);
  551. #if CALL_NOT_IN_CARBON
  552. EXTERN_API( OSStatus )
  553. OTAsyncOpenAppleTalkServices    (OTConfigurationRef     cfig,
  554.                                  OTOpenFlags            flags,
  555.                                  OTNotifyProcPtr        proc,
  556.                                  void *                 contextPtr);
  557. EXTERN_API( ATSvcRef )
  558. OTOpenAppleTalkServices         (OTConfigurationRef     cfig,
  559.                                  OTOpenFlags            flags,
  560.                                  OSStatus *             err);
  561. #endif  /* CALL_NOT_IN_CARBON */
  562. #if TARGET_API_MAC_CARBON
  563. /* The following macro may be used by applications only.*/
  564. #define OTOpenAppleTalkServices(cfig, oflags, err) OTOpenAppleTalkServicesInContext(cfig, oflags, err, NULL)
  565. #define OTAsyncOpenAppleTalkServices(cfig, oflags, proc, contextPtr) OTAsyncOpenAppleTalkServicesInContext(cfig, oflags, proc, contextPtr, NULL)
  566. #endif  /* TARGET_API_MAC_CARBON */
  567. /* Get the zone associated with the ATSvcRef*/
  568. EXTERN_API( OSStatus )
  569. OTATalkGetMyZone                (ATSvcRef               ref,
  570.                                  TNetbuf *              zone);
  571. /*
  572.    Get the list of available zones associated with the local cable
  573.    of the ATSvcRef
  574. */
  575. EXTERN_API( OSStatus )
  576. OTATalkGetLocalZones            (ATSvcRef               ref,
  577.                                  TNetbuf *              zones);
  578. /* Get the list of all zones on the internet specified by the ATSvcRef*/
  579. EXTERN_API( OSStatus )
  580. OTATalkGetZoneList              (ATSvcRef               ref,
  581.                                  TNetbuf *              zones);
  582. /* Stores an AppleTalkInfo structure into the TNetbuf (see later in this file)*/
  583. EXTERN_API( OSStatus )
  584. OTATalkGetInfo                  (ATSvcRef               ref,
  585.                                  TNetbuf *              info);
  586. #ifdef __cplusplus
  587. }                   // Terminate C definitions
  588. class TAppleTalkServices : public TProvider
  589. {
  590.     public:
  591.             OSStatus    GetMyZone(TNetbuf* zone)        { return OTATalkGetMyZone(this, zone); }
  592.             OSStatus    GetLocalZones(TNetbuf* zones)   { return OTATalkGetLocalZones(this, zones); }
  593.             OSStatus    GetZoneList(TNetbuf* zones)     { return OTATalkGetZoneList(this, zones); }
  594.             OSStatus    GetInfo(TNetbuf* info)          { return OTATalkGetInfo(this, info); }
  595. };
  596. extern "C" {        /* resume C definitions */
  597. #endif  /* _cplus */
  598. #endif  /* !OTKERNEL */
  599. /* AppleTalk Addressing*/
  600. /*
  601.    The NBPEntity structure is used to manipulate NBP names without regard
  602.    to issues of what kind of "special" characters are in the name.
  603.    
  604.    When stored as an address in an NBPAddress or DDPNBPAddress, they are 
  605.    stored as a character string, which is currently just ASCII, but in the
  606.    future may be UniChar, or some other internationalizable scripting set.
  607.    The string following an NBPAddress or DDPNBPAddress is intended to be
  608.    suitable for showing to users, whereas NBPEntity is not.
  609.    WARNING: NBPAddress and DDPNBPAddress structures do not "know" the length
  610.    of the address.  That must have been obtained as part of a Lookup or
  611.    ResolveAddress call.
  612. */
  613. enum {
  614.     AF_ATALK_FAMILY             = 0x0100,
  615.     AF_ATALK_DDP                = 0x0100,
  616.     AF_ATALK_DDPNBP             = AF_ATALK_FAMILY + 1,
  617.     AF_ATALK_NBP                = AF_ATALK_FAMILY + 2,
  618.     AF_ATALK_MNODE              = AF_ATALK_FAMILY + 3
  619. };
  620. struct NBPEntity {
  621.     UInt8                           fEntity[99];
  622. };
  623. typedef struct NBPEntity                NBPEntity;
  624. struct DDPAddress {
  625.     OTAddressType                   fAddressType;               /* One of the enums above*/
  626.     UInt16                          fNetwork;
  627.     UInt8                           fNodeID;
  628.     UInt8                           fSocket;
  629.     UInt8                           fDDPType;
  630.     UInt8                           fPad;
  631. #ifdef __cplusplus
  632.     // C++ inline methods on this structure.
  633.   void            Init(const DDPAddress&);
  634.    void            Init(UInt16 net, UInt8 node, UInt8 socket);
  635.     void            Init(UInt16 net, UInt8 node, UInt8 socket, UInt8 type);
  636.    void            SetSocket(UInt8);
  637.   void            SetType(UInt8);
  638.     void            SetNode(UInt8);
  639.     void            SetNetwork(UInt16);
  640.    OTByteCount     GetAddressLength() const;
  641.   OTAddressType   GetAddressType() const;
  642.     UInt8           GetSocket() const;
  643.  UInt8           GetType() const;
  644.    UInt8           GetNode() const;
  645.    UInt16          GetNetwork() const;
  646.    Boolean         operator==(const DDPAddress&) const;
  647.    Boolean         operator!=(const DDPAddress&) const;
  648.    void            operator=(const DDPAddress&);
  649. #endif
  650. };
  651. typedef struct DDPAddress               DDPAddress;
  652. struct NBPAddress {
  653.     OTAddressType                   fAddressType;               /* One of the enums above*/
  654.     UInt8                           fNBPNameBuffer[105];
  655. #ifdef __cplusplus
  656.     // C++ inline methods on this structure.
  657.   OTByteCount     Init();
  658.     OTByteCount     Init(const NBPEntity&);
  659.     OTByteCount     Init(const char*);
  660.  OTByteCount     Init(const char*, OTByteCount len);
  661.     Boolean         ExtractEntity(NBPEntity&, OTByteCount len);
  662.    OTAddressType   GetAddressType() const;
  663. #endif
  664. };
  665. typedef struct NBPAddress               NBPAddress;
  666. struct DDPNBPAddress {
  667.     OTAddressType                   fAddressType;               /* One of the enums above*/
  668.     UInt16                          fNetwork;
  669.     UInt8                           fNodeID;
  670.     UInt8                           fSocket;
  671.     UInt8                           fDDPType;
  672.     UInt8                           fPad;
  673.     UInt8                           fNBPNameBuffer[105];
  674. #ifdef __cplusplus
  675.     // C++ inline methods on this structure.
  676.   void            Init(const DDPAddress&);
  677.    void            Init(UInt16 net, UInt8 node, UInt8 socket);
  678.     void            Init(UInt16 net, UInt8 node, UInt8 socket, UInt8 type);
  679.    void            SetSocket(UInt8);
  680.   void            SetType(UInt8);
  681.     void            SetNode(UInt8);
  682.     void            SetNetwork(UInt16);
  683.     
  684.    OTAddressType   GetAddressType() const;
  685.     UInt8           GetSocket() const;
  686.  UInt8           GetType() const;
  687.    UInt8           GetNode() const;
  688.    UInt16          GetNetwork() const;
  689.     
  690.    Boolean         ExtractEntity(NBPEntity&, OTByteCount len);
  691.     OTByteCount     SetNBPEntity(const NBPEntity&);
  692.     OTByteCount     SetNBPEntity(const char*);
  693.  OTByteCount     SetNBPEntity(const char*, OTByteCount len);
  694.     
  695.    Boolean         operator==(const DDPAddress&) const;
  696. #endif
  697. };
  698. typedef struct DDPNBPAddress            DDPNBPAddress;
  699. /* These are some utility routines for dealing with NBP and DDP addresses. */
  700. /* Functions to initialize the various AppleTalk Address types*/
  701. EXTERN_API( void )
  702. OTInitDDPAddress                (DDPAddress *           addr,
  703.                                  UInt16                 net,
  704.                                  UInt8                  node,
  705.                                  UInt8                  socket,
  706.                                  UInt8                  ddpType);
  707. EXTERN_API( OTByteCount )
  708. OTInitNBPAddress                (NBPAddress *           addr,
  709.                                  const char *           name);
  710. EXTERN_API( OTByteCount )
  711. OTInitDDPNBPAddress             (DDPNBPAddress *        addr,
  712.                                  const char *           name,
  713.                                  UInt16                 net,
  714.                                  UInt8                  node,
  715.                                  UInt8                  socket,
  716.                                  UInt8                  ddpType);
  717. /* Compare 2 DDP addresses for equality*/
  718. EXTERN_API( Boolean )
  719. OTCompareDDPAddresses           (const DDPAddress *     addr1,
  720.                                  const DDPAddress *     addr2);
  721. /* Init an NBPEntity to a NULL name*/
  722. EXTERN_API( void )
  723. OTInitNBPEntity                 (NBPEntity *            entity);
  724. /* Get the length an NBPEntity would have when stored as an address*/
  725. EXTERN_API( OTByteCount )
  726. OTGetNBPEntityLengthAsAddress   (const NBPEntity *      entity);
  727. /* Store an NBPEntity into an address buffer*/
  728. EXTERN_API( OTByteCount )
  729. OTSetAddressFromNBPEntity       (UInt8 *                nameBuf,
  730.                                  const NBPEntity *      entity);
  731. /* Create an address buffer from a string (use -1 for len to use strlen)*/
  732. EXTERN_API( OTByteCount )
  733. OTSetAddressFromNBPString       (UInt8 *                addrBuf,
  734.                                  const char *           name,
  735.                                  SInt32                 len);
  736. /*
  737.    Create an NBPEntity from an address buffer. False is returned if
  738.      the address was truncated.
  739. */
  740. EXTERN_API( Boolean )
  741. OTSetNBPEntityFromAddress       (NBPEntity *            entity,
  742.                                  const UInt8 *          addrBuf,
  743.                                  OTByteCount            len);
  744. /* Routines to set a piece of an NBP entity from a character string*/
  745. EXTERN_API( Boolean )
  746. OTSetNBPName                    (NBPEntity *            entity,
  747.                                  const char *           name);
  748. EXTERN_API( Boolean )
  749. OTSetNBPType                    (NBPEntity *            entity,
  750.                                  const char *           typeVal);
  751. EXTERN_API( Boolean )
  752. OTSetNBPZone                    (NBPEntity *            entity,
  753.                                  const char *           zone);
  754. /* Routines to extract pieces of an NBP entity*/
  755. EXTERN_API( void )
  756. OTExtractNBPName                (const NBPEntity *      entity,
  757.                                  char *                 name);
  758. EXTERN_API( void )
  759. OTExtractNBPType                (const NBPEntity *      entity,
  760.                                  char *                 typeVal);
  761. EXTERN_API( void )
  762. OTExtractNBPZone                (const NBPEntity *      entity,
  763.                                  char *                 zone);
  764. #ifdef __cplusplus
  765. // Inline methods for DDPAddress
  766. inline void DDPAddress::operator=(const DDPAddress& addr)
  767. {
  768.     *(UInt32*)&fAddressType = *(UInt32*)&addr.fAddressType;
  769.     *(UInt32*)&fNodeID = *(UInt32*)&addr.fNodeID;
  770. }
  771. inline Boolean DDPAddress::operator==(const DDPAddress& addr) const
  772. {
  773.     return OTCompareDDPAddresses(&addr, this);
  774. }
  775. inline Boolean DDPAddress::operator!=(const DDPAddress& addr) const
  776. {
  777.     return !OTCompareDDPAddresses(&addr, this);
  778. }
  779. inline void DDPAddress::SetSocket(UInt8 socket)
  780. {
  781.     fSocket = socket;
  782. }
  783. inline void DDPAddress::SetNode(UInt8 node)
  784. {
  785.     fNodeID = node;
  786. }
  787. inline void DDPAddress::SetType(UInt8 type)
  788. {
  789.     fDDPType = type;
  790. }
  791. inline void DDPAddress::SetNetwork(UInt16 net)
  792. {
  793.     fNetwork = net;
  794. }
  795. inline OTByteCount DDPAddress::GetAddressLength() const
  796. {
  797.     return kDDPAddressLength;
  798. }
  799. inline OTAddressType DDPAddress::GetAddressType() const
  800. {
  801.     return fAddressType;
  802. }
  803. inline UInt8 DDPAddress::GetSocket() const
  804. {
  805.     return fSocket;
  806. }
  807. inline UInt8 DDPAddress::GetNode() const
  808. {
  809.     return fNodeID;
  810. }
  811. inline UInt8 DDPAddress::GetType() const
  812. {
  813.     return fDDPType;
  814. }
  815. inline UInt16 DDPAddress::GetNetwork() const
  816. {
  817.     return fNetwork;
  818. }
  819. inline void  DDPAddress::Init(UInt16 net, UInt8 node,
  820.                               UInt8 socket)
  821. {
  822.     fAddressType = AF_ATALK_DDP;
  823.     SetNetwork(net);
  824.     SetNode(node);
  825.     SetSocket(socket);
  826.     SetType(0);
  827. }
  828. inline void  DDPAddress::Init(UInt16 net, UInt8 node,
  829.                               UInt8 socket, UInt8 type)
  830. {
  831.     fAddressType = AF_ATALK_DDP;
  832.     SetNetwork(net);
  833.     SetNode(node);
  834.     SetSocket(socket);
  835.     SetType(type);
  836. }
  837. inline void DDPAddress::Init(const DDPAddress& addr)
  838. {
  839.     *(UInt32*)&fAddressType = *(UInt32*)&addr.fAddressType;
  840.     *(UInt32*)&fNodeID = *(UInt32*)&addr.fNodeID;
  841. }
  842. // Inline methods for NBPAddress
  843. inline OTByteCount NBPAddress::Init()
  844. {
  845.     fAddressType = AF_ATALK_NBP;
  846.     return sizeof(OTAddressType);
  847. }
  848. inline OTByteCount NBPAddress::Init(const NBPEntity& addr)
  849. {
  850.     fAddressType = AF_ATALK_NBP;
  851.     return sizeof(OTAddressType) + OTSetAddressFromNBPEntity(fNBPNameBuffer, &addr);
  852. }
  853. inline OTByteCount NBPAddress::Init(const char* name)
  854. {
  855.     fAddressType = AF_ATALK_NBP;
  856.     return sizeof(OTAddressType) + OTSetAddressFromNBPString(fNBPNameBuffer, name, -1);
  857. }
  858. inline OTByteCount NBPAddress::Init(const char* name, OTByteCount len)
  859. {
  860.     fAddressType = AF_ATALK_NBP;
  861.     return sizeof(OTAddressType) + OTSetAddressFromNBPString(fNBPNameBuffer, name, (SInt32)len);
  862. }
  863. inline Boolean NBPAddress::ExtractEntity(NBPEntity& entity, OTByteCount len)
  864. {
  865.     return OTSetNBPEntityFromAddress(&entity, fNBPNameBuffer, len);
  866. }
  867.     
  868. inline OTAddressType NBPAddress::GetAddressType() const
  869. {
  870.     return fAddressType;
  871. }
  872.     
  873. // Inline methods for DDPNBPAddress
  874. inline Boolean DDPNBPAddress::operator==(const DDPAddress& addr) const
  875. {
  876.     return OTCompareDDPAddresses((const DDPAddress*)this, &addr);
  877. }
  878. inline void DDPNBPAddress::SetSocket(UInt8 socket)
  879. {
  880.     fSocket = socket;
  881. }
  882. inline void DDPNBPAddress::SetNode(UInt8 node)
  883. {
  884.     fNodeID = node;
  885. }
  886. inline void DDPNBPAddress::SetType(UInt8 type)
  887. {
  888.     fDDPType = type;
  889. }
  890. inline void DDPNBPAddress::SetNetwork(UInt16 net)
  891. {
  892.     fNetwork = net;
  893. }
  894. inline OTAddressType DDPNBPAddress::GetAddressType() const
  895. {
  896.     return fAddressType;
  897. }
  898. inline UInt8 DDPNBPAddress::GetSocket() const
  899. {
  900.     return fSocket;
  901. }
  902. inline UInt8 DDPNBPAddress::GetNode() const
  903. {
  904.     return fNodeID;
  905. }
  906. inline UInt8 DDPNBPAddress::GetType() const
  907. {
  908.     return fDDPType;
  909. }
  910. inline UInt16 DDPNBPAddress::GetNetwork() const
  911. {
  912.     return fNetwork;
  913. }
  914. inline void DDPNBPAddress::Init(UInt16 net, UInt8 node,
  915.                                 UInt8 socket)
  916. {
  917.     fAddressType = AF_ATALK_DDPNBP;
  918.     SetNetwork(net);
  919.     SetNode(node);
  920.     SetSocket(socket);
  921.     SetType(0);
  922. }
  923. inline void DDPNBPAddress::Init(UInt16 net, UInt8 node,
  924.                                 UInt8 socket, UInt8 type)
  925. {
  926.     fAddressType = AF_ATALK_DDPNBP;
  927.     SetNetwork(net);
  928.     SetNode(node);
  929.     SetSocket(socket);
  930.     SetType(type);
  931. }
  932. inline void DDPNBPAddress::Init(const DDPAddress& addr)
  933. {
  934.     fAddressType = AF_ATALK_DDPNBP;
  935.     SetNetwork(addr.GetNetwork());
  936.     SetNode(addr.GetNode());
  937.     SetSocket(addr.GetSocket());
  938.     SetType(addr.GetType());
  939.     fNBPNameBuffer[0] = 0;
  940. }
  941. inline OTByteCount DDPNBPAddress::SetNBPEntity(const NBPEntity& entity)
  942. {
  943.     return OTSetAddressFromNBPEntity(fNBPNameBuffer, &entity) + kDDPAddressLength;
  944. }
  945. inline OTByteCount DDPNBPAddress::SetNBPEntity(const char* name)
  946. {
  947.     return OTSetAddressFromNBPString(fNBPNameBuffer, name, -1) + kDDPAddressLength;
  948. }
  949. inline OTByteCount DDPNBPAddress::SetNBPEntity(const char* name, OTByteCount len)
  950. {
  951.     return OTSetAddressFromNBPString(fNBPNameBuffer, name, (SInt32)len) + kDDPAddressLength;
  952. }
  953. inline Boolean DDPNBPAddress::ExtractEntity(NBPEntity& entity, OTByteCount len)
  954. {
  955.     return OTSetNBPEntityFromAddress(&entity, fNBPNameBuffer, len);
  956. }
  957. #endif  /* __cplusplus */
  958. /* AppleTalkInfo as used by the OTGetATalkInfo function*/
  959. struct AppleTalkInfo {
  960.     DDPAddress                      fOurAddress;                /* Our DDP address (network # & node)*/
  961.     DDPAddress                      fRouterAddress;             /* The address of a router on our cable*/
  962.     UInt16                          fCableRange[2];             /* The current cable range*/
  963.     UInt16                          fFlags;                     /* See below*/
  964. };
  965. typedef struct AppleTalkInfo            AppleTalkInfo;
  966. /* For the fFlags field in AppleTalkInfo*/
  967. enum {
  968.     kATalkInfoIsExtended        = 0x0001,                       /* This is an extended (phase 2) network*/
  969.     kATalkInfoHasRouter         = 0x0002,                       /* This cable has a router*/
  970.     kATalkInfoOneZone           = 0x0004                        /* This cable has only one zone*/
  971. };
  972. /* ***** Ethernet ******/
  973. /* Interface option flags*/
  974. /* Ethernet framing options*/
  975. enum {
  976.     kOTFramingEthernet          = 0x01,
  977.     kOTFramingEthernetIPX       = 0x02,
  978.     kOTFraming8023              = 0x04,
  979.     kOTFraming8022              = 0x08
  980. };
  981. /*
  982.    These are obsolete and will be going away in OT 1.5.
  983.    Hmmm, OT 1.5 got cancelled.  The status of these options
  984.    is uncertain.
  985. */
  986. /* RawMode options*/
  987. enum {
  988.     kOTRawRcvOn                 = 0,
  989.     kOTRawRcvOff                = 1,
  990.     kOTRawRcvOnWithTimeStamp    = 2
  991. };
  992. enum {
  993.     DL_PROMISC_OFF              = 0                             /* OPT_SETPROMISCUOUS value*/
  994. };
  995. /* Module definitions*/
  996. /* Module IDs*/
  997. enum {
  998.     kT8022ModuleID              = 7100,
  999.     kEnetModuleID               = 7101,
  1000.     kTokenRingModuleID          = 7102,
  1001.     kFDDIModuleID               = 7103
  1002. };
  1003. /* Module Names*/
  1004. #define kEnet8022Name      "enet8022x"
  1005. #define kEnetName           "enet"
  1006. #define kFastEnetName        "fenet"
  1007. #define kTokenRingName      "tokn"
  1008. #define kFDDIName            "fddi"
  1009. #define kIRTalkName          "irtlk"
  1010. #define kSMDSName           "smds"
  1011. #define kATMName         "atm"
  1012. #define kT8022Name            "tpi8022x"
  1013. #define kATMSNAPName     "atmsnap"
  1014. #define kFireWireName     "firewire"
  1015. #define kFibreChannelName    "fibre"
  1016. /* Address Family*/
  1017. enum {
  1018.     AF_8022                     = 8200                          /* Our 802.2 generic address family*/
  1019. };
  1020. /* XTI Levels*/
  1021. enum {
  1022.     LNK_ENET                    = FOUR_CHAR_CODE('ENET'),
  1023.     LNK_TOKN                    = FOUR_CHAR_CODE('TOKN'),
  1024.     LNK_FDDI                    = FOUR_CHAR_CODE('FDDI'),
  1025.     LNK_TPI                     = FOUR_CHAR_CODE('LTPI')
  1026. };
  1027. /* Options*/
  1028. enum {
  1029.     OPT_ADDMCAST                = 0x1000,
  1030.     OPT_DELMCAST                = 0x1001,
  1031.     OPT_RCVPACKETTYPE           = 0x1002,
  1032.     OPT_RCVDESTADDR             = 0x1003,
  1033.     OPT_SETRAWMODE              = 0x1004,
  1034.     OPT_SETPROMISCUOUS          = 0x1005
  1035. };
  1036. typedef UInt32 OTPacketType;
  1037. enum {
  1038.     kETypeStandard              = 0,
  1039.     kETypeMulticast             = 1,
  1040.     kETypeBroadcast             = 2,
  1041.     kETRawPacketBit             = (unsigned long)0x80000000,
  1042.     kETTimeStampBit             = 0x40000000
  1043. };
  1044. /* Link related constants*/
  1045. enum {
  1046.     kMulticastLength            = 6,                            /* length of an ENET hardware addressaddress*/
  1047.     k48BitAddrLength            = 6,
  1048.     k8022DLSAPLength            = 2,                            /* The protocol type is our DLSAP*/
  1049.     k8022SNAPLength             = 5,
  1050.     kEnetAddressLength          = k48BitAddrLength + k8022DLSAPLength, /* length of an address field used by the ENET enpoint*/
  1051.                                                                 /*    = k48BitAddrLength + sizeof(protocol type)*/
  1052.     kSNAPSAP                    = 0x00AA,                       /* Special DLSAPS for ENET*/
  1053.     kIPXSAP                     = 0x00FF,
  1054.     kMax8022SAP                 = 0x00FE,
  1055.     k8022GlobalSAP              = 0x00FF,
  1056.     kMinDIXSAP                  = 1501,
  1057.     kMaxDIXSAP                  = 0xFFFF
  1058. };
  1059. /* Generic Address Structure*/
  1060. struct T8022Address {
  1061.     OTAddressType                   fAddrFamily;
  1062.     UInt8                           fHWAddr[6];
  1063.     UInt16                          fSAP;
  1064.     UInt8                           fSNAP[5];
  1065. };
  1066. typedef struct T8022Address             T8022Address;
  1067. enum {
  1068.     k8022BasicAddressLength     = sizeof(OTAddressType) + k48BitAddrLength + sizeof(UInt16),
  1069.     k8022SNAPAddressLength      = sizeof(OTAddressType) + k48BitAddrLength + sizeof(UInt16) + k8022SNAPLength
  1070. };
  1071. /* Some helpful stuff for dealing with 48 bit addresses*/
  1072. #define OTCompare48BitAddresses(p1, p2)                                                        
  1073.   (*(const UInt32*)((const UInt8*)(p1)) == *(const UInt32*)((const UInt8*)(p2)) &&        
  1074.    *(const UInt16*)(((const UInt8*)(p1))+4) == *(const UInt16*)(((const UInt8*)(p2))+4) )
  1075. #define OTCopy48BitAddress(p1, p2)                                             
  1076.   (*(UInt32*)((UInt8*)(p2)) = *(const UInt32*)((const UInt8*)(p1)),           
  1077.    *(UInt16*)(((UInt8*)(p2))+4) = *(const UInt16*)(((const UInt8*)(p1))+4) )
  1078. #define OTClear48BitAddress(p1)                                                 
  1079.   (*(UInt32*)((UInt8*)(p1)) = 0,                                              
  1080.    *(UInt16*)(((UInt8*)(p1))+4) = 0 )
  1081. #define OTCompare8022SNAP(p1, p2)                                                      
  1082.   (*(const UInt32*)((const UInt8*)(p1)) == *(const UInt32*)((const UInt8*)(p2)) &&    
  1083.    *(((const UInt8*)(p1))+4) == *(((const UInt8*)(p2))+4) )
  1084. #define OTCopy8022SNAP(p1, p2)                                               
  1085.   (*(UInt32*)((UInt8*)(p2)) = *(const UInt32*)((const UInt8*)(p1)),       
  1086.    *(((UInt8*)(p2))+4) = *(((const UInt8*)(p1))+4) )
  1087. #define OTIs48BitBroadcastAddress(p1)                   
  1088.   (*(UInt32*)((UInt8*)(p1)) == 0xffffffff &&          
  1089.    *(UInt16*)(((UInt8*)(p1))+4) == 0xffff )
  1090. #define OTSet48BitBroadcastAddress(p1)                   
  1091.   (*(UInt32*)((UInt8*)(p1)) = 0xffffffff,             
  1092.    *(UInt16*)(((UInt8*)(p1))+4) = 0xffff )
  1093. #define OTIs48BitZeroAddress(p1)              
  1094.   (*(UInt32*)((UInt8*)(p1)) == 0 &&           
  1095.    *(UInt16*)(((UInt8*)(p1))+4) == 0 )
  1096. /* Link related constants*/
  1097. enum {
  1098.     kEnetPacketHeaderLength     = (2 * k48BitAddrLength) + k8022DLSAPLength,
  1099.     kEnetTSDU                   = 1514,                         /* The TSDU for ethernet.*/
  1100.     kTokenRingTSDU              = 4458,                         /* The TSDU for TokenRing.*/
  1101.     kFDDITSDU                   = 4458,                         /* The TSDU for FDDI. */
  1102.     k8022SAPLength              = 1,
  1103.     k8022BasicHeaderLength      = 3,                            /* define the length of the header portion of an 802.2 packet.*/
  1104.                                                                 /* = SSAP+DSAP+ControlByte*/
  1105.     k8022SNAPHeaderLength       = k8022SNAPLength + k8022BasicHeaderLength
  1106. };
  1107. /*******************************************************************************
  1108. ** Address Types recognized by the Enet DLPI
  1109. ********************************************************************************/
  1110. typedef UInt32 EAddrType;
  1111. enum {
  1112.     keaStandardAddress          = 0,
  1113.     keaMulticast                = 1,
  1114.     keaBroadcast                = 2,
  1115.     keaBadAddress               = 3,
  1116.     keaRawPacketBit             = (unsigned long)0x80000000,
  1117.     keaTimeStampBit             = 0x40000000
  1118. };
  1119. /* Packet Header Structures*/
  1120. struct EnetPacketHeader {
  1121.     UInt8                           fDestAddr[6];
  1122.     UInt8                           fSourceAddr[6];
  1123.     UInt16                          fProto;
  1124. };
  1125. typedef struct EnetPacketHeader         EnetPacketHeader;
  1126. struct T8022Header {
  1127.     UInt8                           fDSAP;
  1128.     UInt8                           fSSAP;
  1129.     UInt8                           fCtrl;
  1130. };
  1131. typedef struct T8022Header              T8022Header;
  1132. struct T8022SNAPHeader {
  1133.     UInt8                           fDSAP;
  1134.     UInt8                           fSSAP;
  1135.     UInt8                           fCtrl;
  1136.     UInt8                           fSNAP[5];
  1137. };
  1138. typedef struct T8022SNAPHeader          T8022SNAPHeader;
  1139. struct T8022FullPacketHeader {
  1140.     EnetPacketHeader                fEnetPart;
  1141.     T8022SNAPHeader                 f8022Part;
  1142. };
  1143. typedef struct T8022FullPacketHeader    T8022FullPacketHeader;
  1144. /* Define the lengths of the structures above*/
  1145. enum {
  1146.     kT8022HeaderLength          = 3,
  1147.     kT8022SNAPHeaderLength      = 3 + k8022SNAPLength,
  1148.     kT8022FullPacketHeaderLength = kEnetPacketHeaderLength + kT8022SNAPHeaderLength
  1149. };
  1150. /* ***** Serial ******/
  1151. /* Module Definitions*/
  1152. /* XTI Level*/
  1153. enum {
  1154.     COM_SERIAL                  = FOUR_CHAR_CODE('SERL')
  1155. };
  1156. /* Version Number*/
  1157. #define kSerialABVersion   "1.1.1"
  1158. /* Module Names*/
  1159. #define kSerialABName      "serialAB"
  1160. #define kSerialName          "serial"
  1161. #define kSerialPortAName   "serialA"
  1162. #define kSerialPortBName  "serialB"
  1163. enum {
  1164.     kSerialABModuleID           = 7200
  1165. };
  1166. enum {
  1167.     kOTSerialFramingAsync       = 0x01,                         /* Support Async serial mode         */
  1168.     kOTSerialFramingHDLC        = 0x02,                         /* Support HDLC synchronous serial mode   */
  1169.     kOTSerialFramingSDLC        = 0x04,                         /* Support SDLC synchronous serial mode   */
  1170.     kOTSerialFramingAsyncPackets = 0x08                         /* Support Async "packet" serial mode */
  1171. };
  1172. /* IOCTL Calls for Serial Drivers*/
  1173. enum {
  1174.     I_SetSerialDTR              = ((MIOC_SRL << 8) | 0),        /* Set DTR (0 = off, 1 = on)*/
  1175.     kOTSerialSetDTROff          = 0,
  1176.     kOTSerialSetDTROn           = 1,
  1177.     I_SetSerialBreak            = ((MIOC_SRL << 8) | 1),        /* Send a break on the line - kOTSerialSetBreakOff = off, kOTSerialSetBreakOn = on,*/
  1178.                                                                 /* Any other number is the number of milliseconds to leave break on, then*/
  1179.                                                                 /* auto shutoff*/
  1180.     kOTSerialSetBreakOn         = (unsigned long)0xFFFFFFFF,
  1181.     kOTSerialSetBreakOff        = 0,
  1182.     I_SetSerialXOffState        = ((MIOC_SRL << 8) | 2),        /* Force XOFF state - 0 = Unconditionally clear XOFF state, 1 = unconditionally set it*/
  1183.     kOTSerialForceXOffTrue      = 1,
  1184.     kOTSerialForceXOffFalse     = 0,
  1185.     I_SetSerialXOn              = ((MIOC_SRL << 8) | 3),        /* Send an XON character, 0 = send only if in XOFF state, 1 = send always*/
  1186.     kOTSerialSendXOnAlways      = 1,
  1187.     kOTSerialSendXOnIfXOffTrue  = 0,
  1188.     I_SetSerialXOff             = ((MIOC_SRL << 8) | 4),        /* Send an XOFF character, 0 = send only if in XON state, 1 = send always*/
  1189.     kOTSerialSendXOffAlways     = 1,
  1190.     kOTSerialSendXOffIfXOnTrue  = 0
  1191. };
  1192. /* Option Management for Serial Drivers*/
  1193. /*
  1194.    These options are all 4-byte values.
  1195.    BaudRate is the baud rate.
  1196.    DataBits is the number of data bits.
  1197.    StopBits is the number of stop bits times 10.
  1198.    Parity is an enum
  1199. */
  1200. enum {
  1201.     SERIAL_OPT_BAUDRATE         = 0x0100,                       /* UInt32 */
  1202.     SERIAL_OPT_DATABITS         = 0x0101,                       /* UInt32 */
  1203.     SERIAL_OPT_STOPBITS         = 0x0102,                       /* UInt32 10, 15 or 20 for 1, 1.5 or 2    */
  1204.     SERIAL_OPT_PARITY           = 0x0103,                       /* UInt32 */
  1205.     SERIAL_OPT_STATUS           = 0x0104,                       /* UInt32 */
  1206.                                                                 /* The "Status" option is a 4-byte value option that is ReadOnly*/
  1207.                                                                 /* It returns a bitmap of the current serial status*/
  1208.     SERIAL_OPT_HANDSHAKE        = 0x0105,                       /* UInt32 */
  1209.                                                                 /* The "Handshake" option defines what kind of handshaking the serial port*/
  1210.                                                                 /* will do for line flow control.  The value is a 32-bit value defined by*/
  1211.                                                                 /* the function or macro SerialHandshakeData below.*/
  1212.                                                                 /* For no handshake, or CTS handshake, the onChar and offChar parameters*/
  1213.                                                                 /* are ignored.*/
  1214.     SERIAL_OPT_RCVTIMEOUT       = 0x0106,                       /* The "RcvTimeout" option defines how long the receiver should wait before delivering*/
  1215.                                                                 /* less than the RcvLoWat number of characters.  If RcvLoWat is 0, then the RcvTimeout*/
  1216.                                                                 /* is how long a gap to wait for before delivering characters.  This parameter is advisory,*/
  1217.                                                                 /* and serial drivers are free to deliver data whenever they deem it convenient.  For instance,*/
  1218.                                                                 /* many serial drivers will deliver data whenever 64 bytes have been received, since 64 bytes*/
  1219.                                                                 /* is the smallest STREAMS buffer size. Keep in mind that timeouts are quantized, so be sure to*/
  1220.                                                                 /* look at the return value of the option to determine what it was negotiated to.*/
  1221.     SERIAL_OPT_ERRORCHARACTER   = 0x0107,                       /* This option defines how characters with parity errors are handled.*/
  1222.                                                                 /* A 0 value will disable all replacement.  A single character value in the low*/
  1223.                                                                 /* byte designates the replacement character.  When characters are received with a */
  1224.                                                                 /* parity error, they are replaced by this specified character.  If a valid incoming*/
  1225.                                                                 /* character matches the replacement character, then the received character's msb is*/
  1226.                                                                 /* cleared. For this situation, the alternate character is used, if specified in bits*/
  1227.                                                                 /* 8 through 15 of the option long, with 0xff being place in bits 16 through 23.*/
  1228.                                                                 /* Whenever a valid character is received that matches the first replacement character,*/
  1229.                                                                 /* it is replaced with this alternate character.*/
  1230.     SERIAL_OPT_EXTCLOCK         = 0x0108,                       /* The "ExtClock" requests an external clock.  A 0-value turns off external clocking.*/
  1231.                                                                 /* Any other value is a requested divisor for the external clock.  Be aware that*/
  1232.                                                                 /* not all serial implementations support an external clock, and that not all*/
  1233.                                                                 /* requested divisors will be supported if it does support an external clock.*/
  1234.     SERIAL_OPT_BURSTMODE        = 0x0109,                       /* The "BurstMode" option informs the serial driver that it should continue looping,*/
  1235.                                                                 /* reading incoming characters, rather than waiting for an interrupt for each character.*/
  1236.                                                                 /* This option may not be supported by all Serial driver*/
  1237.     SERIAL_OPT_DUMMY            = 0x010A                        /* placeholder*/
  1238. };
  1239. typedef UInt32 ParityOptionValues;
  1240. enum {
  1241.     kOTSerialNoParity           = 0,
  1242.     kOTSerialOddParity          = 1,
  1243.     kOTSerialEvenParity         = 2
  1244. };
  1245. enum {
  1246.     kOTSerialSwOverRunErr       = 0x01,
  1247.     kOTSerialBreakOn            = 0x08,
  1248.     kOTSerialParityErr          = 0x10,
  1249.     kOTSerialOverrunErr         = 0x20,
  1250.     kOTSerialFramingErr         = 0x40,
  1251.     kOTSerialXOffSent           = 0x00010000,
  1252.     kOTSerialDTRNegated         = 0x00020000,
  1253.     kOTSerialCTLHold            = 0x00040000,
  1254.     kOTSerialXOffHold           = 0x00080000,
  1255.     kOTSerialOutputBreakOn      = 0x01000000
  1256. };
  1257. enum {
  1258.     kOTSerialXOnOffInputHandshake = 1,                          /* Want XOn/XOff handshake for incoming characters    */
  1259.     kOTSerialXOnOffOutputHandshake = 2,                         /* Want XOn/XOff handshake for outgoing characters    */
  1260.     kOTSerialCTSInputHandshake  = 4,                            /* Want CTS handshake for incoming characters     */
  1261.     kOTSerialDTROutputHandshake = 8                             /* Want DTR handshake for outoing characters   */
  1262. };
  1263. #ifdef __cplusplus
  1264.    inline UInt32 OTSerialHandshakeData(UInt16 type, UInt8 onChar, UInt8 offChar)
  1265.   {
  1266.       return (((UInt32)type) << 16) | (((UInt32)onChar) << 8) | offChar;
  1267.  }
  1268. #else
  1269.   #define OTSerialHandshakeData(type, onChar, offChar)    
  1270.       ((((UInt32)type) << 16) | (((UInt32)onChar) << 8) | offChar)
  1271.    
  1272. #endif
  1273. #ifdef __cplusplus
  1274. inline UInt32 OTSerialSetErrorCharacter(UInt8 rep)
  1275. {
  1276.   return (UInt32)rep & 0x000000ff;
  1277. }
  1278. inline UInt32 OTSerialSetErrorCharacterWithAlternate(UInt8 rep, UInt8 alternate)
  1279. {
  1280.  return (((rep & 0xff) | ((alternate & 0xff) << 8)) | 0x80000000L);
  1281. }
  1282. #else
  1283. #define OTSerialSetErrorCharacter(rep) 
  1284.   ((rep) & 0xff)
  1285. #define OTSerialSetErrorCharacterWithAlternate(rep, alternate)  
  1286.   ((((rep) & 0xff) | (((alternate) & 0xff) << 8)) | 0x80000000L)
  1287. #endif
  1288. /* Default attributes for the serial ports*/
  1289. enum {
  1290.     kOTSerialDefaultBaudRate    = 19200,
  1291.     kOTSerialDefaultDataBits    = 8,
  1292.     kOTSerialDefaultStopBits    = 10,
  1293.     kOTSerialDefaultParity      = kOTSerialNoParity,
  1294.     kOTSerialDefaultHandshake   = 0,
  1295.     kOTSerialDefaultOnChar      = ('Q' & 0xFFFFFFBF),
  1296.     kOTSerialDefaultOffChar     = ('S' & 0xFFFFFFBF),
  1297.     kOTSerialDefaultSndBufSize  = 1024,
  1298.     kOTSerialDefaultRcvBufSize  = 1024,
  1299.     kOTSerialDefaultSndLoWat    = 96,
  1300.     kOTSerialDefaultRcvLoWat    = 1,
  1301.     kOTSerialDefaultRcvTimeout  = 10
  1302. };
  1303. /* ***** ISDN ******/
  1304. /* Module Definitions*/
  1305. /* XTI Level*/
  1306. enum {
  1307.     COM_ISDN                    = FOUR_CHAR_CODE('ISDN')
  1308. };
  1309. /* Module Names*/
  1310. #define kISDNName       "isdn"
  1311. enum {
  1312.     kISDNModuleID               = 7300
  1313. };
  1314. /* ISDN framing methods, set using the I_OTSetFramingType IOCTL*/
  1315. enum {
  1316.     kOTISDNFramingTransparentSupported = 0x0010,                /* Support Transparent mode    */
  1317.     kOTISDNFramingHDLCSupported = 0x0020,                       /* Support HDLC Synchronous mode  */
  1318.     kOTISDNFramingV110Supported = 0x0040,                       /* Support V.110 Asynchronous mode    */
  1319.     kOTISDNFramingV14ESupported = 0x0080                        /* Support V.14 Asynchronous mode     */
  1320. };
  1321. /* Miscellaneous equates*/
  1322. /* Disconnect reason codes (from Q.931)*/
  1323. enum {
  1324.     kOTISDNUnallocatedNumber    = 1,
  1325.     kOTISDNNoRouteToSpecifiedTransitNetwork = 2,
  1326.     kOTISDNNoRouteToDestination = 3,
  1327.     kOTISDNChannelUnacceptable  = 6,
  1328.     kOTISDNNormal               = 16,
  1329.     kOTISDNUserBusy             = 17,
  1330.     kOTISDNNoUserResponding     = 18,
  1331.     kOTISDNNoAnswerFromUser     = 19,
  1332.     kOTISDNCallRejected         = 21,
  1333.     kOTISDNNumberChanged        = 22,
  1334.     kOTISDNNonSelectedUserClearing = 26,
  1335.     kOTISDNDestinationOutOfOrder = 27,
  1336.     kOTISDNInvalidNumberFormat  = 28,
  1337.     kOTISDNFacilityRejected     = 29,
  1338.     kOTISDNNormalUnspecified    = 31,
  1339.     kOTISDNNoCircuitChannelAvailable = 34,
  1340.     kOTISDNNetworkOutOfOrder    = 41,
  1341.     kOTISDNSwitchingEquipmentCongestion = 42,
  1342.     kOTISDNAccessInformationDiscarded = 43,
  1343.     kOTISDNRequestedCircuitChannelNotAvailable = 44,
  1344.     kOTISDNResourceUnavailableUnspecified = 45,
  1345.     kOTISDNQualityOfServiceUnvailable = 49,
  1346.     kOTISDNRequestedFacilityNotSubscribed = 50,
  1347.     kOTISDNBearerCapabilityNotAuthorized = 57,
  1348.     kOTISDNBearerCapabilityNotPresentlyAvailable = 58,
  1349.     kOTISDNCallRestricted       = 59,
  1350.     kOTISDNServiceOrOptionNotAvilableUnspecified = 63,
  1351.     kOTISDNBearerCapabilityNotImplemented = 65,
  1352.     kOTISDNRequestedFacilityNotImplemented = 69,
  1353.     kOTISDNOnlyRestrictedDigitalBearer = 70,
  1354.     kOTISDNServiceOrOptionNotImplementedUnspecified = 79,
  1355.     kOTISDNCallIdentityNotUsed  = 83,
  1356.     kOTISDNCallIdentityInUse    = 84,
  1357.     kOTISDNNoCallSuspended      = 85,
  1358.     kOTISDNCallIdentityCleared  = 86,
  1359.     kOTISDNIncompatibleDestination = 88,
  1360.     kOTISDNInvalidTransitNetworkSelection = 91,
  1361.     kOTISDNInvalidMessageUnspecified = 95,
  1362.     kOTISDNMandatoryInformationElementIsMissing = 96,
  1363.     kOTISDNMessageTypeNonExistentOrNotImplemented = 97,
  1364.     kOTISDNInterworkingUnspecified = 127
  1365. };
  1366. /* OTISDNAddress*/
  1367. /*
  1368.    The OTISDNAddress has the following format:
  1369.    "xxxxxx*yy"
  1370.    where 'x' is the phone number and 'y' is the sub address (if available
  1371.    in the network. The characters are coded in ASCII (IA5), and valid
  1372.    characters are: '0'-'9','#','*'.
  1373.    The max length of the each phone number is 21 characters (?) and the max
  1374.    subaddress length is network dependent.
  1375.    When using bonded channels the phone numbers are separated by '&'.
  1376.    The X.25 user data is preceded by '@'.
  1377. */
  1378. #ifndef AF_ISDN /* might conflict with BSD headers */ 
  1379. enum {
  1380.     AF_ISDN                     = 0x2000
  1381. };
  1382. #endif
  1383. enum {
  1384.     kOTISDNMaxPhoneSize         = 32,
  1385.     kOTISDNMaxSubSize           = 4
  1386. };
  1387. struct OTISDNAddress {
  1388.     OTAddressType                   fAddressType;
  1389.     UInt16                          fPhoneLength;
  1390.     char                            fPhoneNumber[37];
  1391. };
  1392. typedef struct OTISDNAddress            OTISDNAddress;
  1393. /* IOCTL Calls for ISDN*/
  1394. /* ISDN shares the same ioctl space as serial.*/
  1395. enum {
  1396.     MIOC_ISDN                   = 'U'                           /* ISDN ioctl() cmds */
  1397. };
  1398. enum {
  1399.     I_OTISDNAlerting            = ((MIOC_ISDN << 8) | 100),     /* Send or receive an ALERTING message*/
  1400.     I_OTISDNSuspend             = ((MIOC_ISDN << 8) | 101),     /* Send a SUSPEND message*/
  1401.                                                                 /* The parameter is the Call Identity (Maximum 8 octets)*/
  1402.     I_OTISDNSuspendAcknowledge  = ((MIOC_ISDN << 8) | 102),     /* Receive a SUSPEND ACKNOWLEDGE message*/
  1403.     I_OTISDNSuspendReject       = ((MIOC_ISDN << 8) | 103),     /* Receive a SUSPEND REJECT message*/
  1404.     I_OTISDNResume              = ((MIOC_ISDN << 8) | 104),     /* Send a RESUME message*/
  1405.                                                                 /* The parameter is the Call Identity (Maximum 8 octets)*/
  1406.     I_OTISDNResumeAcknowledge   = ((MIOC_ISDN << 8) | 105),     /* Receive a RESUME ACKNOWLEDGE message*/
  1407.     I_OTISDNResumeReject        = ((MIOC_ISDN << 8) | 106),     /* Receive a RESUME REJECT message*/
  1408.     I_OTISDNFaciltity           = ((MIOC_ISDN << 8) | 107)      /* Send or receive a FACILITY message*/
  1409. };
  1410. /* Connect user data size*/
  1411. enum {
  1412.     kOTISDNMaxUserDataSize      = 32
  1413. };
  1414. /* Option management calls for ISDN*/
  1415. enum {
  1416.     ISDN_OPT_COMMTYPE           = 0x0200,
  1417.     ISDN_OPT_FRAMINGTYPE        = 0x0201,
  1418.     ISDN_OPT_56KADAPTATION      = 0x0202
  1419. };
  1420. /* For ISDN_OPT_COMMTYPE...*/
  1421. enum {
  1422.     kOTISDNTelephoneALaw        = 1,                            /* G.711 A-law                */
  1423.     kOTISDNTelephoneMuLaw       = 26,                           /* G.711 .-law                */
  1424.     kOTISDNDigital64k           = 13,                           /* unrestricted digital (default)     */
  1425.     kOTISDNDigital56k           = 37,                           /* user rate 56Kb/s           */
  1426.     kOTISDNVideo64k             = 41,                           /* video terminal at 64Kb/s    */
  1427.     kOTISDNVideo56k             = 42                            /* video terminal at 56Kb/s    */
  1428. };
  1429. /* For ISDN_OPT_FRAMINGTYPE...*/
  1430. enum {
  1431.     kOTISDNFramingTransparent   = 0x0010,                       /* Transparent mode           */
  1432.     kOTISDNFramingHDLC          = 0x0020,                       /* HDLC synchronous mode (default)    */
  1433.     kOTISDNFramingV110          = 0x0040,                       /* V.110 asynchronous mode       */
  1434.     kOTISDNFramingV14E          = 0x0080                        /* V.14E asynchronous mode         */
  1435. };
  1436. /* For ISDN_OPT_56KADAPTATION...*/
  1437. enum {
  1438.     kOTISDNNot56KAdaptation     = false,                        /* not 56K Adaptation (default)     */
  1439.     kOTISDN56KAdaptation        = true                          /* 56K Adaptation           */
  1440. };
  1441. /* Default options, you do not need to set these*/
  1442. enum {
  1443.     kOTISDNDefaultCommType      = kOTISDNDigital64k,
  1444.     kOTISDNDefaultFramingType   = kOTISDNFramingHDLC,
  1445.     kOTISDNDefault56KAdaptation = kOTISDNNot56KAdaptation
  1446. };
  1447. #if defined(__MWERKS__) && TARGET_CPU_68K
  1448.     #pragma pop
  1449. #endif
  1450. #if PRAGMA_STRUCT_ALIGN
  1451.     #pragma options align=reset
  1452. #elif PRAGMA_STRUCT_PACKPUSH
  1453.     #pragma pack(pop)
  1454. #elif PRAGMA_STRUCT_PACK
  1455.     #pragma pack()
  1456. #endif
  1457. #ifdef PRAGMA_IMPORT_OFF
  1458. #pragma import off
  1459. #elif PRAGMA_IMPORT
  1460. #pragma import reset
  1461. #endif
  1462. #ifdef __cplusplus
  1463. }
  1464. #endif
  1465. #endif /* __OPENTRANSPORTPROVIDERS__ */