summaryrefslogtreecommitdiff
path: root/packages/extra/univint/OpenTransportProviders.pas
blob: 90b5653a3a56067b88d89eaef0ba9b331c4d9c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
{
     File:       OT/OpenTransportProviders.h
 
     Contains:   This file contains provider-specific definitions for various built-in providers.
 
     Version:    OpenTransport-97~544
 
     Copyright:  © 1993-2005 by Apple Computer, Inc. and Mentat Inc., all rights reserved.
 
     Bugs?:      For bug reports, consult the following page on
                 the World Wide Web:
 
                     http://www.freepascal.org/bugs.html
 
}
{      Pascal Translation Updated:  Peter N Lewis, <peter@stairways.com.au>, November 2005 }
{
    Modified for use with Free Pascal
    Version 200
    Please report any bugs to <gpc@microbizz.nl>
}

{$mode macpas}
{$packenum 1}
{$macro on}
{$inline on}
{$CALLING MWPASCAL}

unit OpenTransportProviders;
interface
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
{$setc GAP_INTERFACES_VERSION := $0200}

{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
{$endc}

{$ifc defined CPUPOWERPC and defined CPUI386}
	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
{$endc}
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
{$endc}

{$ifc not defined __ppc__ and defined CPUPOWERPC}
	{$setc __ppc__ := 1}
{$elsec}
	{$setc __ppc__ := 0}
{$endc}
{$ifc not defined __i386__ and defined CPUI386}
	{$setc __i386__ := 1}
{$elsec}
	{$setc __i386__ := 0}
{$endc}

{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
	{$error Conflicting definitions for __ppc__ and __i386__}
{$endc}

{$ifc defined __ppc__ and __ppc__}
	{$setc TARGET_CPU_PPC := TRUE}
	{$setc TARGET_CPU_X86 := FALSE}
{$elifc defined __i386__ and __i386__}
	{$setc TARGET_CPU_PPC := FALSE}
	{$setc TARGET_CPU_X86 := TRUE}
{$elsec}
	{$error Neither __ppc__ nor __i386__ is defined.}
{$endc}
{$setc TARGET_CPU_PPC_64 := FALSE}

{$ifc defined FPC_BIG_ENDIAN}
	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
{$elifc defined FPC_LITTLE_ENDIAN}
	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
{$elsec}
	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
{$endc}
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
{$setc CALL_NOT_IN_CARBON := FALSE}
{$setc OLDROUTINENAMES := FALSE}
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
{$setc OPAQUE_UPP_TYPES := TRUE}
{$setc OTCARBONAPPLICATION := TRUE}
{$setc OTKERNEL := FALSE}
{$setc PM_USE_SESSION_APIS := TRUE}
{$setc TARGET_API_MAC_CARBON := TRUE}
{$setc TARGET_API_MAC_OS8 := FALSE}
{$setc TARGET_API_MAC_OSX := TRUE}
{$setc TARGET_CARBON := TRUE}
{$setc TARGET_CPU_68K := FALSE}
{$setc TARGET_CPU_MIPS := FALSE}
{$setc TARGET_CPU_SPARC := FALSE}
{$setc TARGET_OS_MAC := TRUE}
{$setc TARGET_OS_UNIX := FALSE}
{$setc TARGET_OS_WIN32 := FALSE}
{$setc TARGET_RT_MAC_68881 := FALSE}
{$setc TARGET_RT_MAC_CFM := FALSE}
{$setc TARGET_RT_MAC_MACHO := TRUE}
{$setc TYPED_FUNCTION_POINTERS := TRUE}
{$setc TYPE_BOOL := FALSE}
{$setc TYPE_EXTENDED := FALSE}
{$setc TYPE_LONGLONG := TRUE}
uses MacTypes,OpenTransport;


{$ALIGN MAC68K}

{
    All OpenTransport Manager APIs are deprecated in MacOSX 10.4, instead of using OpenTransport,
    consider using CFNetwork or socket library.
}
{ ***** TCP/IP *****}

{ Basic types}

type
	InetPort = UInt16;
	InetHost = UInt32;
{  Enums used as address type designations.}
const
	AF_INET = 2;
const
	AF_DNS = 42;


{
    Enum which can be used to bind to all IP interfaces
    rather than a specific one.
}

const
	kOTAnyInetAddress = 0;     { Wildcard }

{
   Define the InetSvcRef type.  This type needs special
   processing because in C++ it's a subclass of TProvider.
   See the definition of TEndpointRef in "OpenTransport.h"
   for the logic behind this definition.
}

type
	InetSvcRef = ProviderRef; { an opaque 32-bit type }
	InetSvcRefPtr = ^InetSvcRef;

const
	kDefaultInternetServicesPath = -3;
{ Shared library prefixes}


const
	kInetVersion = '3.1.1';
const
	kInetPrefix = 'ot:inet$';

{ Module Names}


const
	kDNRName = 'dnr';
const
	kTCPName = 'tcp';
const
	kUDPName = 'udp';
const
	kRawIPName = 'rawip';

{ XTI Options}

{ Protocol levels}

const
	INET_IP = $00;
	INET_TCP = $06;
	INET_UDP = $11;

{ TCP Level Options}

const
	TCP_NODELAY = $01;
	TCP_MAXSEG = $02;
	TCP_NOTIFY_THRESHOLD = $10; {* not a real XTI option }
	TCP_ABORT_THRESHOLD = $11; {* not a real XTI option }
	TCP_CONN_NOTIFY_THRESHOLD = $12; {* not a real XTI option }
	TCP_CONN_ABORT_THRESHOLD = $13; {* not a real XTI option }
	TCP_OOBINLINE = $14; {* not a real XTI option }
	TCP_URGENT_PTR_TYPE = $15; {* not a real XTI option }
	TCP_KEEPALIVE = $0008; { keepalive defined in OpenTransport.h }

const
	T_GARBAGE = 2;

{ UDP Level Options}

const
	UDP_CHECKSUM = $0600;
	UDP_RX_ICMP = $02;

{ IP Level Options}
const
	kIP_OPTIONS = $01;
	kIP_TOS = $02;
	kIP_TTL = $03;
	kIP_REUSEADDR = $04;
	kIP_DONTROUTE = $10;
	kIP_BROADCAST = $20;
	kIP_REUSEPORT = $0200;
	kIP_HDRINCL = $1002;
	kIP_RCVOPTS = $1005;
	kIP_RCVDSTADDR = $1007;
	kIP_MULTICAST_IF = $1010; { set/get IP multicast interface }
	kIP_MULTICAST_TTL = $1011; { set/get IP multicast timetolive    }
	kIP_MULTICAST_LOOP = $1012; { set/get IP multicast loopback  }
	kIP_ADD_MEMBERSHIP = $1013; { add an IP group membership     }
	kIP_DROP_MEMBERSHIP = $1014; { drop an IP group membership       }
	kIP_BROADCAST_IFNAME = $1015; { Set interface for broadcasts   }
	kIP_RCVIFADDR = $1016; { Set interface for broadcasts   }

const
	IP_OPTIONS = 1;
{
   BSD's netinet/in.h uses different values for the same IP_ logical constants.
   If you are using OT and want those values, prefix your use with k
   e.g. change IP_TTL to kIP_TTL in your source code
}
const
	DVMRP_INIT = 100;  { DVMRP-specific setsockopt commands, from ip_mroute.h}
	DVMRP_DONE = 101;
	DVMRP_ADD_VIF = 102;
	DVMRP_DEL_VIF = 103;
	DVMRP_ADD_LGRP = 104;
	DVMRP_DEL_LGRP = 105;
	DVMRP_ADD_MRT = 106;
	DVMRP_DEL_MRT = 107;


{ IP_TOS precdence levels}

const
	T_ROUTINE = 0;
	T_PRIORITY = 1;
	T_IMMEDIATE = 2;
	T_FLASH = 3;
	T_OVERRIDEFLASH = 4;
	T_CRITIC_ECP = 5;
	T_INETCONTROL = 6;
	T_NETCONTROL = 7;

{  IP_TOS type of service}

const
	T_NOTOS = $00;
	T_LDELAY = 1 shl 4;
	T_HITHRPT = 1 shl 3;
	T_HIREL = 1 shl 2;

// #define SET_TOS(prec,tos)   (((0x7 & (prec)) << 5) | (0x1c & (tos)))
{ IP Multicast option structures}

type
	TIPAddMulticastPtr = ^TIPAddMulticast;
	TIPAddMulticast = record
		multicastGroupAddress: InetHost;
		interfaceAddress: InetHost;
	end;
{ Protocol-specific events}
const
	T_DNRSTRINGTOADDRCOMPLETE = kPRIVATEEVENT + 1;
	T_DNRADDRTONAMECOMPLETE = kPRIVATEEVENT + 2;
	T_DNRSYSINFOCOMPLETE = kPRIVATEEVENT + 3;
	T_DNRMAILEXCHANGECOMPLETE = kPRIVATEEVENT + 4;
	T_DNRQUERYCOMPLETE = kPRIVATEEVENT + 5;

{ InetAddress}

type
	InetAddressPtr = ^InetAddress;
	InetAddress = record
		fAddressType: OTAddressType;           { always AF_INET}
		fPort: InetPort;                  { Port number }
		fHost: InetHost;                  { Host address in net byte order}
		fUnused: packed array [0..7] of UInt8;			{  Traditional unused bytes }
	end;
{ Domain Name Resolver (DNR) }
const
	kMaxHostAddrs = 10;
	kMaxSysStringLen = 32;
	kMaxHostNameLen = 255;


type
	InetDomainName = packed array [0..255] of char;
	InetHostInfoPtr = ^InetHostInfo;
	InetHostInfo = record
		name: InetDomainName;
		addrs: array [0..9] of InetHost;
	end;
type
	InetSysInfoPtr = ^InetSysInfo;
	InetSysInfo = record
		cpuType: packed array [0..31] of char;
		osType: packed array [0..31] of char;
	end;
type
	InetMailExchangePtr = ^InetMailExchange;
	InetMailExchange = record
		preference: UInt16;
		exchange: InetDomainName;
	end;
type
	DNSQueryInfoPtr = ^DNSQueryInfo;
	DNSQueryInfo = record
		qType: UInt16;
		qClass: UInt16;
		ttl: UInt32;
		name: InetDomainName;
		responseType: UInt16;           { answer, authority, or additional}
		resourceLen: UInt16;            { actual length of array which follows}
		resourceData: packed array [0..3] of char;			{  size varies }
	end;
{ DNSAddress}
{
   The DNSAddress format is optional and may be used in connects,
   datagram sends, and resolve address calls.   The name takes the 
   format "somewhere.com" or "somewhere.com:portnumber" where
   the ":portnumber" is optional.   The length of this structure
   is arbitrarily limited to the overall max length of a domain
   name (255 chars), although a longer one can be use successfully
   if you use this as a template for doing so.   However, the domain name 
   is still limited to 255 characters.
}

type
	DNSAddressPtr = ^DNSAddress;
	DNSAddress = record
		fAddressType: OTAddressType;           { always AF_DNS}
		fName: InetDomainName;
	end;
{ InetInterfaceInfo}
const
	kDefaultInetInterface = -1;

const
	kInetInterfaceInfoVersion = 3;

type
	InetInterfaceInfoPtr = ^InetInterfaceInfo;
	InetInterfaceInfo = record
		fAddress: InetHost;
		fNetmask: InetHost;
		fBroadcastAddr: InetHost;
		fDefaultGatewayAddr: InetHost;
		fDNSAddr: InetHost;
		fVersion: UInt16;
		fHWAddrLen: UInt16;
		fHWAddr: UInt8Ptr;
		fIfMTU: UInt32;
		fReservedPtrs: array [0..1] of Ptr;
		fDomainName: InetDomainName;
		fIPSecondaryCount: UInt32;
		fReserved: packed array [0..251] of UInt8;
	end;
{ InetDHCPOption}
const
	kAllDHCPOptions = -1;
	kDHCPLongOption = 126;
	kDHCPLongOptionReq = 127;

type
	InetDHCPOptionPtr = ^InetDHCPOption;
	InetDHCPOption = record
		fOptionTag: SInt8;
		fOptionLen: SInt8;
		fOptionValue: SInt8;
		pad: SInt8
	end;
{ TCP/IP Utility Routines}

{
 *  OTInitInetAddress()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
procedure OTInitInetAddress( var addr: InetAddress; port: InetPort; host: InetHost ); external name '_OTInitInetAddress';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInitDNSAddress()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInitDNSAddress( var addr: DNSAddress; str: CStringPtr ): OTByteCount; external name '_OTInitDNSAddress';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInetStringToHost()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInetStringToHost( str: ConstCStringPtr; var host: InetHost ): OSStatus; external name '_OTInetStringToHost';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInetHostToString()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
procedure OTInetHostToString( host: InetHost; str: CStringPtr ); external name '_OTInetHostToString';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInetGetInterfaceInfo()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInetGetInterfaceInfo( var info: InetInterfaceInfo; val: SInt32 ): OSStatus; external name '_OTInetGetInterfaceInfo';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInetGetSecondaryAddresses()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInetGetSecondaryAddresses( var addr: InetHost; var count: UInt32; val: SInt32 ): OSStatus; external name '_OTInetGetSecondaryAddresses';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInetGetDHCPConfigInfo()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }


{ InetServices & DNR Calls}

{$ifc NOT OTKERNEL}
{
   Under Carbon, OTOpenInternetServices routines take a client context pointer.  Applications may pass NULL
   after calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
   valid client context.
}
{
 *  OTOpenInternetServicesInContext()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTOpenInternetServicesInContext( cfig: OTConfigurationRef; oflag: OTOpenFlags; var err: OSStatus; clientContext: OTClientContextPtr ): InetSvcRef; external name '_OTOpenInternetServicesInContext';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTAsyncOpenInternetServicesInContext()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTAsyncOpenInternetServicesInContext( cfig: OTConfigurationRef; oflag: OTOpenFlags; upp: OTNotifyUPP; contextPtr: UnivPtr; clientContext: OTClientContextPtr ): OSStatus; external name '_OTAsyncOpenInternetServicesInContext';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTOpenInternetServices()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }


{
 *  OTAsyncOpenInternetServices()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }


{ The following macro may be used by applications only.}
// #define OTOpenInternetServices(cfig, oflags, err) OTOpenInternetServicesInContext(cfig, oflags, err, NULL)
// #define OTAsyncOpenInternetServices(cfig, oflags, proc, contextPtr)  OTAsyncOpenInternetServicesInContext(cfig, oflags, proc, contextPtr, NULL)

{
 *  OTInetStringToAddress()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInetStringToAddress( ref: InetSvcRef; name: CStringPtr; var hinfo: InetHostInfo ): OSStatus; external name '_OTInetStringToAddress';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInetAddressToName()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInetAddressToName( ref: InetSvcRef; addr: InetHost; var name: InetDomainName ): OSStatus; external name '_OTInetAddressToName';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInetSysInfo()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInetSysInfo( ref: InetSvcRef; name: CStringPtr; var sysinfo: InetSysInfo ): OSStatus; external name '_OTInetSysInfo';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInetMailExchange()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInetMailExchange( ref: InetSvcRef; name: CStringPtr; var num: UInt16; mx: InetMailExchangePtr ): OSStatus; external name '_OTInetMailExchange';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInetQuery()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInetQuery( ref: InetSvcRef; name: CStringPtr; qClass: UInt16; qType: UInt16; buf: CStringPtr; buflen: OTByteCount; var argv: UnivPtr; argvlen: OTByteCount; flags: OTFlags ): OSStatus; external name '_OTInetQuery';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{$endc}  { !OTKERNEL }

{ ***** AppleTalk *****}
{ Shared library prefixes}


const
	kATalkVersion = '1.1';
const
	kATalkPrefix = 'ot:atlk$';
const
	kATBinderID = 'ot:atbd$';

{******************************************************************************
** Module definitions
*******************************************************************************}
{ XTI Levels}

const
	ATK_DDP = $44445020 (* 'DDP ' *);
	ATK_AARP = $41415250 (* 'AARP' *);
	ATK_ATP = $41545020 (* 'ATP ' *);
	ATK_ADSP = $41445350 (* 'ADSP' *);
	ATK_ASP = $41535020 (* 'ASP ' *);
	ATK_PAP = $50415020 (* 'PAP ' *);
	ATK_NBP = $4E425020 (* 'NBP ' *);
	ATK_ZIP = $5A495020 (* 'ZIP ' *);

{ Module Names}


const
	kDDPName = 'ddp';
const
	kATPName = 'atp';
const
	kADSPName = 'adsp';
const
	kASPName = 'asp';
const
	kPAPName = 'pap';
const
	kNBPName = 'nbp';
const
	kZIPName = 'zip';
const
	kLTalkName = 'ltlk';
const
	kLTalkAName = 'ltlkA';
const
	kLTalkBName = 'ltlkB';

{
   Protocol-specific Options
   NOTE:
   All Protocols support OPT_CHECKSUM (Value is (unsigned long)T_YES/T_NO)
   ATP supports OPT_RETRYCNT (# Retries, 0 = try once) and
                OPT_INTERVAL (# Milliseconds to wait)
}

const
	DDP_OPT_HOPCOUNT = $2100; { DDP UnitDataReq Only - set hop count, Value is (unsigned long)  hop count   }

const
	DDP_OPT_CHECKSUM = $0600;
	DDP_OPT_SRCADDR = $2101; { DDP UnitDataReq Only - set src address, Value is DDPAddress }
	ATP_OPT_REPLYCNT = $2110; { AppleTalk - ATP Resp Pkt Ct Type, Value is (unsigned long)  pkt count }
	ATP_OPT_DATALEN = $2111; { AppleTalk - ATP Pkt Data Len Type, Value is (unsigned long) length }
	ATP_OPT_RELTIMER = $2112; { AppleTalk - ATP Release Timer Type, Value is (unsigned long) timer, (See Inside AppleTalk, second edition }
	ATP_OPT_TRANID = $2113; { Value is (unsigned long) Boolean, Used to request Transaction ID, Returned with Transaction ID on requests }
	PAP_OPT_OPENRETRY = $2120; { AppleTalk - PAP OpenConn Retry count, Value is (unsigned long) T_YES/T_NO }

{ Protocol-Specific Events}

{
   If you send the IOCTL: OTIoctl(I_OTGetMiscellaneousEvents, 1),
   you will receive the T_ATALKxxx events on your endpoint.
   NOTE: The endpoint does not need to be bound.
}

const
	kAppleTalkEvent = kPROTOCOLEVENT or $00010000;
	T_GETMYZONECOMPLETE = kAppleTalkEvent + 1;
	T_GETLOCALZONESCOMPLETE = kAppleTalkEvent + 2;
	T_GETZONELISTCOMPLETE = kAppleTalkEvent + 3;
	T_GETATALKINFOCOMPLETE = kAppleTalkEvent + 4;
	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.}
	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}
	T_ATALKZONENAMECHANGEDEVENT = kAppleTalkEvent + 53; { A Zone name change was issued from the router, so our AppleTalk Zone has changed.}
	T_ATALKCONNECTIVITYCHANGEDEVENT = kAppleTalkEvent + 54; { An ARA connection was established (cookie != NULL), or was disconnected (cookie == NULL)}
	T_ATALKINTERNETAVAILABLEEVENT = kAppleTalkEvent + 55; { A router has appeared, and our address is in the startup range.  Cookie is hi/lo of new cable range.}
	T_ATALKCABLERANGECHANGEDEVENT = kAppleTalkEvent + 56; { A router has appeared, and it's incompatible with our current address.  Cookie is hi/lo of new cable range.}

const
	T_ATALKBADROUTEREVENT = kAppleTalkEvent + 70; { A bad router has appeared/disappeared on our network.}
	T_ALLNODESTAKENEVENT = kAppleTalkEvent + 71;
	T_FIXEDNODETAKENEVENT = kAppleTalkEvent + 72;
	T_MPPCOMPATCFIGEVENT = kAppleTalkEvent + 73;
	T_FIXEDNODEBADEVENT = kAppleTalkEvent + 74;

const
	kAllATalkRoutersDown = 0;    { This indicates that all routers are offline}
	kLocalATalkRoutersDown = -1;  { This indicates that all local routers went offline, but an ARA router is still active}
	kARARouterDisconnected = -2;   { This indicates that ARA was disconnected, do it's router went offline, and we have no local routers to fall back onto.}

const
	kARARouterOnline = -1;  { We had no local routers, but an ARA router is now online.}
	kATalkRouterOnline = 0;    { We had no routers, but a local router is now online}
	kLocalATalkRouterOnline = -2;   { We have an ARA router, but now we've seen a local router as well}

// #define IsAppleTalkEvent(x)         ((x) & 0xffff0000) == kAppleTalkEvent)
{ Protocol-specific IOCTLs}

const
	ATALK_IOC_FULLSELFSEND		= $542F;						{  Turn on/off full self-send (it's automatic for non-backward-compatible links) }
	ADSP_IOC_FORWARDRESET		= $543C;						{  ADSP Forward Reset }

{ Protocol-specific constants}

{ ECHO}

const
	kECHO_TSDU = 585;   { Max. # of data bytes.}

{ NBP}

const
	kNBPMaxNameLength = 32;
	kNBPMaxTypeLength = 32;
	kNBPMaxZoneLength = 32;
	kNBPSlushLength = 9;    { Extra space for @, : and a few escape chars}
	kNBPMaxEntityLength = kNBPMaxNameLength + kNBPMaxTypeLength + kNBPMaxZoneLength + 3;
	kNBPEntityBufferSize = kNBPMaxNameLength + kNBPMaxTypeLength + kNBPMaxZoneLength + kNBPSlushLength;
	kNBPWildCard = $3D; { NBP name and type match anything '='}
	kNBPImbeddedWildCard = $C5; { NBP name and type match some 'Å'}
	kNBPDefaultZone = $2A;  { NBP default zone '*'}

{ ZIP}

const
	kZIPMaxZoneLength = kNBPMaxZoneLength;

const
	kDDPAddressLength = 8;    { value to use in netbuf.len field, Maximum length of AppleTalk address}
	kNBPAddressLength = kNBPEntityBufferSize;
	kAppleTalkAddressLength = kDDPAddressLength + kNBPEntityBufferSize;


// #define OTCopyDDPAddress(addr, dest)               \
//   {                                               \
//       ((UInt32*)(dest))[0] = ((UInt32*)(addr))[0];    \
//       ((UInt32*)(dest))[1] = ((UInt32*)(addr))[1];    \
//   }

{******************************************************************************
** CLASS TAppleTalkServices
*******************************************************************************}
{$ifc NOT OTKERNEL}
{
   Define the ATSvcRef type.  This type needs special
   processing because in C++ it's a subclass of TProvider.
   See the definition of TEndpointRef in "OpenTransport.h"
   for the logic behind this definition.
}
type
	ATSvcRef = ^SInt32; { an opaque 32-bit type }
	ATSvcRefPtr = ^ATSvcRef;

const
	kDefaultAppleTalkServicesPath = -3;
{
   Under Carbon, OpenAppleTalkServices routines take a client context pointer.  Applications may pass NULL
   after calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
   valid client context.
}
{
 *  OTAsyncOpenAppleTalkServicesInContext()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTAsyncOpenAppleTalkServicesInContext( cfig: OTConfigurationRef; flags: OTOpenFlags; proc: OTNotifyUPP; contextPtr: UnivPtr; clientContext: OTClientContextPtr ): OSStatus; external name '_OTAsyncOpenAppleTalkServicesInContext';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTOpenAppleTalkServicesInContext()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTOpenAppleTalkServicesInContext( cfig: OTConfigurationRef; flags: OTOpenFlags; var err: OSStatus; clientContext: OTClientContextPtr ): ATSvcRef; external name '_OTOpenAppleTalkServicesInContext';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTAsyncOpenAppleTalkServices()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }


{
 *  OTOpenAppleTalkServices()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }


{ The following macro may be used by applications only.}
// #define OTOpenAppleTalkServices(cfig, oflags, err) OTOpenAppleTalkServicesInContext(cfig, oflags, err, NULL)
// #define OTAsyncOpenAppleTalkServices(cfig, oflags, proc, contextPtr) OTAsyncOpenAppleTalkServicesInContext(cfig, oflags, proc, contextPtr, NULL)

{ Get the zone associated with the ATSvcRef}
{
 *  OTATalkGetMyZone()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Non-Carbon CFM:   not available
 }
function OTATalkGetMyZone( ref: ATSvcRef; var zone: TNetbuf ): OSStatus; external name '_OTATalkGetMyZone';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
   Get the list of available zones associated with the local cable
   of the ATSvcRef
}
{
 *  OTATalkGetLocalZones()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Non-Carbon CFM:   not available
 }
function OTATalkGetLocalZones( ref: ATSvcRef; var zones: TNetbuf ): OSStatus; external name '_OTATalkGetLocalZones';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{ Get the list of all zones on the internet specified by the ATSvcRef}
{
 *  OTATalkGetZoneList()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Non-Carbon CFM:   not available
 }
function OTATalkGetZoneList( ref: ATSvcRef; var zones: TNetbuf ): OSStatus; external name '_OTATalkGetZoneList';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{ Stores an AppleTalkInfo structure into the TNetbuf (see later in this file)}
{
 *  OTATalkGetInfo()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Non-Carbon CFM:   not available
 }
function OTATalkGetInfo( ref: ATSvcRef; var info: TNetbuf ): OSStatus; external name '_OTATalkGetInfo';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{$endc}  { !OTKERNEL }

{ AppleTalk Addressing}
{
   The NBPEntity structure is used to manipulate NBP names without regard
   to issues of what kind of "special" characters are in the name.
   
   When stored as an address in an NBPAddress or DDPNBPAddress, they are 
   stored as a character string, which is currently just ASCII, but in the
   future may be UniChar, or some other internationalizable scripting set.
   The string following an NBPAddress or DDPNBPAddress is intended to be
   suitable for showing to users, whereas NBPEntity is not.
   WARNING: NBPAddress and DDPNBPAddress structures do not "know" the length
   of the address.  That must have been obtained as part of a Lookup or
   ResolveAddress call.
}

const
	AF_ATALK_FAMILY = $0100;
	AF_ATALK_DDP = $0100;
	AF_ATALK_DDPNBP = AF_ATALK_FAMILY + 1;
	AF_ATALK_NBP = AF_ATALK_FAMILY + 2;
	AF_ATALK_MNODE = AF_ATALK_FAMILY + 3;

type
	NBPEntityPtr = ^NBPEntity;
	NBPEntity = record
		fEntity: packed array [0..99] of UInt8; {one extra pad byte}
	end;
type
	DDPAddressPtr = ^DDPAddress;
	DDPAddress = record
		fAddressType: OTAddressType;           { One of the enums above}
		fNetwork: UInt16;
		fNodeID: SInt8;
		fSocket: SInt8;
		fDDPType: SInt8;
		fPad: SInt8;
	end;
type
	NBPAddressPtr = ^NBPAddress;
	NBPAddress = record
		fAddressType: OTAddressType;           { One of the enums above}
		fNBPNameBuffer: packed array [0..104] of UInt8;
	end;
type
	DDPNBPAddressPtr = ^DDPNBPAddress;
	DDPNBPAddress = record
		fAddressType: OTAddressType;           { One of the enums above}
		fNetwork: UInt16;
		fNodeID: SInt8;
		fSocket: SInt8;
		fDDPType: SInt8;
		fPad: SInt8;
		fNBPNameBuffer: packed array [0..104] of UInt8;
	end;
{ These are some utility routines for dealing with NBP and DDP addresses. }

{ Functions to initialize the various AppleTalk Address types}
{
 *  OTInitDDPAddress()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
procedure OTInitDDPAddress( var addr: DDPAddress; net: UInt16; node: ByteParameter; socket: ByteParameter; ddpType: ByteParameter ); external name '_OTInitDDPAddress';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInitNBPAddress()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInitNBPAddress( var addr: NBPAddress; name: ConstCStringPtr ): OTByteCount; external name '_OTInitNBPAddress';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTInitDDPNBPAddress()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTInitDDPNBPAddress( var addr: DDPNBPAddress; name: ConstCStringPtr; net: UInt16; node: ByteParameter; socket: ByteParameter; ddpType: ByteParameter ): OTByteCount; external name '_OTInitDDPNBPAddress';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{ Compare 2 DDP addresses for equality}
{
 *  OTCompareDDPAddresses()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTCompareDDPAddresses( const (*var*) addr1: DDPAddress; const (*var*) addr2: DDPAddress ): Boolean; external name '_OTCompareDDPAddresses';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{ Init an NBPEntity to a NULL name}
{
 *  OTInitNBPEntity()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
procedure OTInitNBPEntity( var entity: NBPEntity ); external name '_OTInitNBPEntity';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{ Get the length an NBPEntity would have when stored as an address}
{
 *  OTGetNBPEntityLengthAsAddress()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTGetNBPEntityLengthAsAddress( const (*var*) entity: NBPEntity ): OTByteCount; external name '_OTGetNBPEntityLengthAsAddress';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{ Store an NBPEntity into an address buffer}
{
 *  OTSetAddressFromNBPEntity()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTSetAddressFromNBPEntity( nameBuf: UInt8Ptr; const (*var*) entity: NBPEntity ): OTByteCount; external name '_OTSetAddressFromNBPEntity';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{ Create an address buffer from a string (use -1 for len to use strlen)}
{
 *  OTSetAddressFromNBPString()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTSetAddressFromNBPString( addrBuf: UInt8Ptr; name: ConstCStringPtr; len: SInt32 ): OTByteCount; external name '_OTSetAddressFromNBPString';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
   Create an NBPEntity from an address buffer. False is returned if
     the address was truncated.
}
{
 *  OTSetNBPEntityFromAddress()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTSetNBPEntityFromAddress( var entity: NBPEntity; addrBuf: UInt8Ptr; len: OTByteCount ): Boolean; external name '_OTSetNBPEntityFromAddress';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{ Routines to set a piece of an NBP entity from a character string}
{
 *  OTSetNBPName()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTSetNBPName( var entity: NBPEntity; name: ConstCStringPtr ): Boolean; external name '_OTSetNBPName';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTSetNBPType()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTSetNBPType( var entity: NBPEntity; typeVal: ConstCStringPtr ): Boolean; external name '_OTSetNBPType';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTSetNBPZone()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
function OTSetNBPZone( var entity: NBPEntity; zone: ConstCStringPtr ): Boolean; external name '_OTSetNBPZone';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{ Routines to extract pieces of an NBP entity}
{
 *  OTExtractNBPName()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
procedure OTExtractNBPName( const (*var*) entity: NBPEntity; name: CStringPtr ); external name '_OTExtractNBPName';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTExtractNBPType()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
procedure OTExtractNBPType( const (*var*) entity: NBPEntity; typeVal: CStringPtr ); external name '_OTExtractNBPType';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{
 *  OTExtractNBPZone()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in CoreServices.framework but deprecated in 10.4
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   not available
 }
procedure OTExtractNBPZone( const (*var*) entity: NBPEntity; zone: CStringPtr ); external name '_OTExtractNBPZone';
(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4 *)


{ AppleTalkInfo as used by the OTGetATalkInfo function}

type
	AppleTalkInfoPtr = ^AppleTalkInfo;
	AppleTalkInfo = record
		fOurAddress: DDPAddress;            { Our DDP address (network # & node)}
		fRouterAddress: DDPAddress;         { The address of a router on our cable}
		fCableRange: array [0..1] of UInt16;					{  The current cable range }
		fFlags: UInt16;                 { See below}
	end;
{ For the fFlags field in AppleTalkInfo}
const
	kATalkInfoIsExtended = $0001; { This is an extended (phase 2) network}
	kATalkInfoHasRouter = $0002; { This cable has a router}
	kATalkInfoOneZone = $0004; { This cable has only one zone}

{ ***** Ethernet *****}

{ Interface option flags}

{ Ethernet framing options}

const
	kOTFramingEthernet = $01;
	kOTFramingEthernetIPX = $02;
	kOTFraming8023 = $04;
	kOTFraming8022 = $08;

{
   These are obsolete and will be going away in OT 1.5.
   Hmmm, OT 1.5 got cancelled.  The status of these options
   is uncertain.
}

{ RawMode options}

const
	kOTRawRcvOn = 0;
	kOTRawRcvOff = 1;
	kOTRawRcvOnWithTimeStamp = 2;

const
	DL_PROMISC_OFF = 0;     { OPT_SETPROMISCUOUS value}

{ Module definitions}

{ Module IDs}

const
	kT8022ModuleID = 7100;
	kEnetModuleID = 7101;
	kTokenRingModuleID = 7102;
	kFDDIModuleID = 7103;

{ Module Names}


const
	kEnet8022Name = 'enet8022x';
const
	kEnetName = 'enet';
const
	kFastEnetName = 'fenet';
const
	kTokenRingName = 'tokn';
const
	kFDDIName = 'fddi';
const
	kIRTalkName = 'irtlk';
const
	kSMDSName = 'smds';
const
	kATMName = 'atm';
const
	kT8022Name = 'tpi8022x';
const
	kATMSNAPName = 'atmsnap';
const
	kFireWireName = 'firewire';
const
	kFibreChannelName = 'fibre';

{ Address Family}

const
	AF_8022 = 8200;  { Our 802.2 generic address family}

{ XTI Levels}

const
	LNK_ENET = $454E4554 (* 'ENET' *);
	LNK_TOKN = $544F4B4E (* 'TOKN' *);
	LNK_FDDI = $46444449 (* 'FDDI' *);
	LNK_TPI = $4C545049 (* 'LTPI' *);

{ Options}

const
	OPT_ADDMCAST = $1000;
	OPT_DELMCAST = $1001;
	OPT_RCVPACKETTYPE = $1002;
	OPT_RCVDESTADDR = $1003;
	OPT_SETRAWMODE = $1004;
	OPT_SETPROMISCUOUS = $1005;

type
	OTPacketType = UInt32;
const
	kETypeStandard = 0;
	kETypeMulticast = 1;
	kETypeBroadcast = 2;
	kETRawPacketBit = $80000000;
	kETTimeStampBit = $40000000;

{ Link related constants}

const
	kMulticastLength = 6;    { length of an ENET hardware addressaddress}
	k48BitAddrLength = 6;
	k8022DLSAPLength = 2;    { The protocol type is our DLSAP}
	k8022SNAPLength = 5;
	kEnetAddressLength = k48BitAddrLength + k8022DLSAPLength; { length of an address field used by the ENET enpoint}
                                        {    = k48BitAddrLength + sizeof(protocol type)}
	kSNAPSAP = $00AA; { Special DLSAPS for ENET}
	kIPXSAP = $00FF;
	kMax8022SAP = $00FE;
	k8022GlobalSAP = $00FF;
	kMinDIXSAP = 1501;
	kMaxDIXSAP = $FFFF;

{ Generic Address Structure}

type
	T8022AddressPtr = ^T8022Address;
	T8022Address = record
		fAddrFamily: OTAddressType;
		fHWAddr: packed array [0..5] of UInt8;
		fSAP: UInt16;
		fSNAP: packed array [0..4] of UInt8;
	end;
const
	k8022BasicAddressLength = SizeOf(OTAddressType) + k48BitAddrLength + sizeof(UInt16);
	k8022SNAPAddressLength = SizeOf(OTAddressType) + k48BitAddrLength + sizeof(UInt16) + k8022SNAPLength;

{ Some helpful stuff for dealing with 48 bit addresses}


// #define OTCompare48BitAddresses(p1, p2)                                                        \
//   (*(const UInt32*)((const UInt8*)(p1)) == *(const UInt32*)((const UInt8*)(p2)) &&        \
//    *(const UInt16*)(((const UInt8*)(p1))+4) == *(const UInt16*)(((const UInt8*)(p2))+4) )
// 
// #define OTCopy48BitAddress(p1, p2)                                             \
//   (*(UInt32*)((UInt8*)(p2)) = *(const UInt32*)((const UInt8*)(p1)),           \
//    *(UInt16*)(((UInt8*)(p2))+4) = *(const UInt16*)(((const UInt8*)(p1))+4) )
// 
// #define OTClear48BitAddress(p1)                                                 \
//   (*(UInt32*)((UInt8*)(p1)) = 0,                                              \
//    *(UInt16*)(((UInt8*)(p1))+4) = 0 )
// 
// #define OTCompare8022SNAP(p1, p2)                                                      \
//   (*(const UInt32*)((const UInt8*)(p1)) == *(const UInt32*)((const UInt8*)(p2)) &&    \
//    *(((const UInt8*)(p1))+4) == *(((const UInt8*)(p2))+4) )
// 
// #define OTCopy8022SNAP(p1, p2)                                               \
//   (*(UInt32*)((UInt8*)(p2)) = *(const UInt32*)((const UInt8*)(p1)),       \
//    *(((UInt8*)(p2))+4) = *(((const UInt8*)(p1))+4) )
// 
// #define OTIs48BitBroadcastAddress(p1)                   \
//   (*(UInt32*)((UInt8*)(p1)) == 0xffffffff &&          \
//    *(UInt16*)(((UInt8*)(p1))+4) == 0xffff )
// 
// #define OTSet48BitBroadcastAddress(p1)                   \
//   (*(UInt32*)((UInt8*)(p1)) = 0xffffffff,             \
//    *(UInt16*)(((UInt8*)(p1))+4) = 0xffff )
// 
// #define OTIs48BitZeroAddress(p1)              \
//   (*(UInt32*)((UInt8*)(p1)) == 0 &&           \
//    *(UInt16*)(((UInt8*)(p1))+4) == 0 )

{ Link related constants}

const
	kEnetPacketHeaderLength = (2 * k48BitAddrLength) + k8022DLSAPLength;
	kEnetTSDU = 1514; { The TSDU for ethernet.}
	kTokenRingTSDU = 4458; { The TSDU for TokenRing.}
	kFDDITSDU = 4458; { The TSDU for FDDI. }
	k8022SAPLength = 1;
	k8022BasicHeaderLength = 3;    { define the length of the header portion of an 802.2 packet.}
                                        { = SSAP+DSAP+ControlByte}
	k8022SNAPHeaderLength = k8022SNAPLength + k8022BasicHeaderLength;

{******************************************************************************
** Address Types recognized by the Enet DLPI
*******************************************************************************}
type
	EAddrType = UInt32;
const
	keaStandardAddress = 0;
	keaMulticast = 1;
	keaBroadcast = 2;
	keaBadAddress = 3;
	keaRawPacketBit = $80000000;
	keaTimeStampBit = $40000000;

{ Packet Header Structures}

type
	EnetPacketHeaderPtr = ^EnetPacketHeader;
	EnetPacketHeader = packed record
		fDestAddr: packed array [0..5] of UInt8;
		fSourceAddr: packed array [0..5] of UInt8;
		fProto: UInt16;
	end;
type
	T8022HeaderPtr = ^T8022Header;
	T8022Header = record
		fDSAP: SInt8;
		fSSAP: SInt8;
		fCtrl: SInt8;
		pad: SInt8
	end;
type
	T8022SNAPHeaderPtr = ^T8022SNAPHeader;
	T8022SNAPHeader = record
		fDSAP: SInt8;
		fSSAP: SInt8;
		fCtrl: SInt8;
		fSNAP0: SInt8;
		fSNAP1: SInt8;
		fSNAP2: SInt8;
		fSNAP3: SInt8;
		fSNAP4: SInt8;
	end;
type
	T8022FullPacketHeaderPtr = ^T8022FullPacketHeader;
	T8022FullPacketHeader = record
		fEnetPart: EnetPacketHeader;
		f8022Part: T8022SNAPHeader;
	end;
{ Define the lengths of the structures above}
const
	kT8022HeaderLength = 3;
	kT8022SNAPHeaderLength = 3 + k8022SNAPLength;
	kT8022FullPacketHeaderLength = kEnetPacketHeaderLength + kT8022SNAPHeaderLength;

{ ***** Serial *****}

{ Module Definitions}

{ XTI Level}

const
	COM_SERIAL = $5345524C (* 'SERL' *);

{ Version Number}


const
	kSerialABVersion = '1.1.1';

{ Module Names}


const
	kSerialABName = 'serialAB';
const
	kSerialName = 'serial';
const
	kSerialPortAName = 'serialA';
const
	kSerialPortBName = 'serialB';

const
	kSerialABModuleID = 7200;

const
	kOTSerialFramingAsync = $01; { Support Async serial mode         }
	kOTSerialFramingHDLC = $02; { Support HDLC synchronous serial mode   }
	kOTSerialFramingSDLC = $04; { Support SDLC synchronous serial mode   }
	kOTSerialFramingAsyncPackets = $08; { Support Async "packet" serial mode }
	kOTSerialFramingPPP = $10;  { Port does its own PPP framing - wants unframed packets from PPP }

{ IOCTL Calls for Serial Drivers}

const
	I_SetSerialDTR = $5500;						{  Set DTR (0 = off, 1 = on) }
	kOTSerialSetDTROff = 0;
	kOTSerialSetDTROn = 1;
	I_SetSerialBreak = $5501; { Send a break on the line - kOTSerialSetBreakOff = off, kOTSerialSetBreakOn = on,}
                                        { Any other number is the number of milliseconds to leave break on, then}
                                        { auto shutoff}
	kOTSerialSetBreakOn = $FFFFFFFF;
	kOTSerialSetBreakOff = 0;
	I_SetSerialXOffState = $5502; { Force XOFF state - 0 = Unconditionally clear XOFF state, 1 = unconditionally set it}
	kOTSerialForceXOffTrue = 1;
	kOTSerialForceXOffFalse = 0;
	I_SetSerialXOn = $5503; { Send an XON character, 0 = send only if in XOFF state, 1 = send always}
	kOTSerialSendXOnAlways = 1;
	kOTSerialSendXOnIfXOffTrue = 0;
	I_SetSerialXOff = $5504; { Send an XOFF character, 0 = send only if in XON state, 1 = send always}
	kOTSerialSendXOffAlways = 1;
	kOTSerialSendXOffIfXOnTrue = 0;

{ Option Management for Serial Drivers}

{
   These options are all 4-byte values.
   BaudRate is the baud rate.
   DataBits is the number of data bits.
   StopBits is the number of stop bits times 10.
   Parity is an enum
}

const
	SERIAL_OPT_BAUDRATE = $0100; { UInt32 }
	SERIAL_OPT_DATABITS = $0101; { UInt32 }
	SERIAL_OPT_STOPBITS = $0102; { UInt32 10, 15 or 20 for 1, 1.5 or 2    }
	SERIAL_OPT_PARITY = $0103; { UInt32 }
	SERIAL_OPT_STATUS = $0104; { UInt32 }
                                        { The "Status" option is a 4-byte value option that is ReadOnly}
                                        { It returns a bitmap of the current serial status}
	SERIAL_OPT_HANDSHAKE = $0105; { UInt32 }
                                        { The "Handshake" option defines what kind of handshaking the serial port}
                                        { will do for line flow control.  The value is a 32-bit value defined by}
                                        { the function or macro SerialHandshakeData below.}
                                        { For no handshake, or CTS handshake, the onChar and offChar parameters}
                                        { are ignored.}
	SERIAL_OPT_RCVTIMEOUT = $0106; { The "RcvTimeout" option defines how long the receiver should wait before delivering}
                                        { less than the RcvLoWat number of characters.  If RcvLoWat is 0, then the RcvTimeout}
                                        { is how long a gap to wait for before delivering characters.  This parameter is advisory,}
                                        { and serial drivers are free to deliver data whenever they deem it convenient.  For instance,}
                                        { many serial drivers will deliver data whenever 64 bytes have been received, since 64 bytes}
                                        { is the smallest STREAMS buffer size. Keep in mind that timeouts are quantized, so be sure to}
                                        { look at the return value of the option to determine what it was negotiated to.}
	SERIAL_OPT_ERRORCHARACTER = $0107; { This option defines how characters with parity errors are handled.}
                                        { A 0 value will disable all replacement.  A single character value in the low}
                                        { byte designates the replacement character.  When characters are received with a }
                                        { parity error, they are replaced by this specified character.  If a valid incoming}
                                        { character matches the replacement character, then the received character's msb is}
                                        { cleared. For this situation, the alternate character is used, if specified in bits}
                                        { 8 through 15 of the option long, with 0xff being place in bits 16 through 23.}
                                        { Whenever a valid character is received that matches the first replacement character,}
                                        { it is replaced with this alternate character.}
	SERIAL_OPT_EXTCLOCK = $0108; { The "ExtClock" requests an external clock.  A 0-value turns off external clocking.}
                                        { Any other value is a requested divisor for the external clock.  Be aware that}
                                        { not all serial implementations support an external clock, and that not all}
                                        { requested divisors will be supported if it does support an external clock.}
	SERIAL_OPT_BURSTMODE = $0109; { The "BurstMode" option informs the serial driver that it should continue looping,}
                                        { reading incoming characters, rather than waiting for an interrupt for each character.}
                                        { This option may not be supported by all Serial driver}
	SERIAL_OPT_DUMMY = $010A; { placeholder}

type
	ParityOptionValues = UInt32;
const
	kOTSerialNoParity = 0;
	kOTSerialOddParity = 1;
	kOTSerialEvenParity = 2;

const
	kOTSerialSwOverRunErr = $01;
	kOTSerialBreakOn = $08;
	kOTSerialParityErr = $10;
	kOTSerialOverrunErr = $20;
	kOTSerialFramingErr = $40;
	kOTSerialXOffSent = $00010000;
	kOTSerialDTRNegated = $00020000;
	kOTSerialCTLHold = $00040000;
	kOTSerialXOffHold = $00080000;
	kOTSerialOutputBreakOn = $01000000;

const
	kOTSerialXOnOffInputHandshake = 1;    { Want XOn/XOff handshake for incoming characters    }
	kOTSerialXOnOffOutputHandshake = 2;   { Want XOn/XOff handshake for outgoing characters    }
	kOTSerialCTSInputHandshake = 4;    { Want CTS handshake for incoming characters     }
	kOTSerialDTROutputHandshake = 8;     { Want DTR handshake for outoing characters   }


// #define OTSerialHandshakeData(type, onChar, offChar)    \
//       ((((UInt32)type) << 16) | (((UInt32)onChar) << 8) | offChar)
// 
// #define OTSerialSetErrorCharacter(rep) \
//   ((rep) & 0xff)
// 
// #define OTSerialSetErrorCharacterWithAlternate(rep, alternate)  \
//   ((((rep) & 0xff) | (((alternate) & 0xff) << 8)) | 0x80000000L)


{ Default attributes for the serial ports}

const
	kOTSerialDefaultBaudRate = 19200;
	kOTSerialDefaultDataBits = 8;
	kOTSerialDefaultStopBits = 10;
	kOTSerialDefaultParity = kOTSerialNoParity;
	kOTSerialDefaultHandshake = 0;
	kOTSerialDefaultOnChar = 17;
	kOTSerialDefaultOffChar = 19;
	kOTSerialDefaultSndBufSize = 1024;
	kOTSerialDefaultRcvBufSize = 1024;
	kOTSerialDefaultSndLoWat = 96;
	kOTSerialDefaultRcvLoWat = 1;
	kOTSerialDefaultRcvTimeout = 10;

{ ***** ISDN *****}

{ Module Definitions}

{ XTI Level}

const
	COM_ISDN = $4953444E (* 'ISDN' *);

{ Module Names}

const
	kISDNName = 'isdn';
const
	kISDNModuleID = 7300;


{ ISDN framing methods, set using the I_OTSetFramingType IOCTL}

const
	kOTISDNFramingTransparentSupported = $0010; { Support Transparent mode    }
	kOTISDNFramingHDLCSupported = $0020; { Support HDLC Synchronous mode  }
	kOTISDNFramingV110Supported = $0040; { Support V.110 Asynchronous mode    }
	kOTISDNFramingV14ESupported = $0080; { Support V.14 Asynchronous mode     }

{ Miscellaneous equates}

{ Disconnect reason codes (from Q.931)}

const
	kOTISDNUnallocatedNumber = 1;
	kOTISDNNoRouteToSpecifiedTransitNetwork = 2;
	kOTISDNNoRouteToDestination = 3;
	kOTISDNChannelUnacceptable = 6;
	kOTISDNNormal = 16;
	kOTISDNUserBusy = 17;
	kOTISDNNoUserResponding = 18;
	kOTISDNNoAnswerFromUser = 19;
	kOTISDNCallRejected = 21;
	kOTISDNNumberChanged = 22;
	kOTISDNNonSelectedUserClearing = 26;
	kOTISDNDestinationOutOfOrder = 27;
	kOTISDNInvalidNumberFormat = 28;
	kOTISDNFacilityRejected = 29;
	kOTISDNNormalUnspecified = 31;
	kOTISDNNoCircuitChannelAvailable = 34;
	kOTISDNNetworkOutOfOrder = 41;
	kOTISDNSwitchingEquipmentCongestion = 42;
	kOTISDNAccessInformationDiscarded = 43;
	kOTISDNRequestedCircuitChannelNotAvailable = 44;
	kOTISDNResourceUnavailableUnspecified = 45;
	kOTISDNQualityOfServiceUnvailable = 49;
	kOTISDNRequestedFacilityNotSubscribed = 50;
	kOTISDNBearerCapabilityNotAuthorized = 57;
	kOTISDNBearerCapabilityNotPresentlyAvailable = 58;
	kOTISDNCallRestricted = 59;
	kOTISDNServiceOrOptionNotAvilableUnspecified = 63;
	kOTISDNBearerCapabilityNotImplemented = 65;
	kOTISDNRequestedFacilityNotImplemented = 69;
	kOTISDNOnlyRestrictedDigitalBearer = 70;
	kOTISDNServiceOrOptionNotImplementedUnspecified = 79;
	kOTISDNCallIdentityNotUsed = 83;
	kOTISDNCallIdentityInUse = 84;
	kOTISDNNoCallSuspended = 85;
	kOTISDNCallIdentityCleared = 86;
	kOTISDNIncompatibleDestination = 88;
	kOTISDNInvalidTransitNetworkSelection = 91;
	kOTISDNInvalidMessageUnspecified = 95;
	kOTISDNMandatoryInformationElementIsMissing = 96;
	kOTISDNMessageTypeNonExistentOrNotImplemented = 97;
	kOTISDNInterworkingUnspecified = 127;

{ OTISDNAddress}

{
   The OTISDNAddress has the following format:
   "xxxxxx*yy"
   where 'x' is the phone number and 'y' is the sub address (if available
   in the network. The characters are coded in ASCII (IA5), and valid
   characters are: '0'-'9','#','*'.
   The max length of the each phone number is 21 characters (?) and the max
   subaddress length is network dependent.
   When using bonded channels the phone numbers are separated by '&'.
   The X.25 user data is preceded by '@'.
}

const
	kAF_ISDN = $2000;

{ BSD value for AF_ISDN conflicts, so OT Carbon clients must use kAF_ISDN}
const
	kOTISDNMaxPhoneSize = 32;
	kOTISDNMaxSubSize = 4;

type
	OTISDNAddressPtr = ^OTISDNAddress;
	OTISDNAddress = record
		fAddressType: OTAddressType;
		fPhoneLength: UInt16;
		fPhoneNumber: packed array [0..36] of char;
	end;
{ IOCTL Calls for ISDN}
{ ISDN shares the same ioctl space as serial.}

const
	MIOC_ISDN = 85;							{  ISDN ioctl() cmds  }

	I_OTISDNAlerting = $5564;						{  Send or receive an ALERTING message }
	I_OTISDNSuspend = $5565;						{  Send a SUSPEND message }
																{  The parameter is the Call Identity (Maximum 8 octets) }
	I_OTISDNSuspendAcknowledge = $5566;						{  Receive a SUSPEND ACKNOWLEDGE message }
	I_OTISDNSuspendReject = $5567;						{  Receive a SUSPEND REJECT message }
	I_OTISDNResume = $5568;						{  Send a RESUME message }
																{  The parameter is the Call Identity (Maximum 8 octets) }
	I_OTISDNResumeAcknowledge = $5569;						{  Receive a RESUME ACKNOWLEDGE message }
	I_OTISDNResumeReject = $556A;						{  Receive a RESUME REJECT message }
	I_OTISDNFaciltity = $556B;						{  Send or receive a FACILITY message }

	{  Connect user data size }

	kOTISDNMaxUserDataSize = 32;

{ Option management calls for ISDN}

const
	ISDN_OPT_COMMTYPE = $0200;
	ISDN_OPT_FRAMINGTYPE = $0201;
	ISDN_OPT_56KADAPTATION = $0202;

{ For ISDN_OPT_COMMTYPE...}

const
	kOTISDNTelephoneALaw = 1;    { G.711 A-law                }
	kOTISDNTelephoneMuLaw = 26;   { G.711 µ-law                }
	kOTISDNDigital64k = 13;   { unrestricted digital (default)     }
	kOTISDNDigital56k = 37;   { user rate 56Kb/s           }
	kOTISDNVideo64k = 41;   { video terminal at 64Kb/s    }
	kOTISDNVideo56k = 42;    { video terminal at 56Kb/s    }

{ For ISDN_OPT_FRAMINGTYPE...}

const
	kOTISDNFramingTransparent = $0010; { Transparent mode           }
	kOTISDNFramingHDLC = $0020; { HDLC synchronous mode (default)    }
	kOTISDNFramingV110 = $0040; { V.110 asynchronous mode       }
	kOTISDNFramingV14E = $0080; { V.14E asynchronous mode         }

{ For ISDN_OPT_56KADAPTATION...}

const
	kOTISDNNot56KAdaptation = false; { not 56K Adaptation (default)     }
	kOTISDN56KAdaptation = true;  { 56K Adaptation           }

{ Default options, you do not need to set these}

const
	kOTISDNDefaultCommType = kOTISDNDigital64k;
	kOTISDNDefaultFramingType = kOTISDNFramingHDLC;
	kOTISDNDefault56KAdaptation = kOTISDNNot56KAdaptation;


{******************************************************************************
*   Constants for Open Transport-based Remote Access/PPP API
*******************************************************************************}

{ OTCreateConfiguration name for PPP control endpoint}

const
	kPPPControlName = 'ppp';

{ XTI Level}

const
	COM_PPP = $50505043 (* 'PPPC' *);

{ Options limits}

const
	kPPPMaxIDLength = 255;
	kPPPMaxPasswordLength = 255;
	kPPPMaxDTEAddressLength = 127;
	kPPPMaxCallInfoLength = 255;


{ Various XTI option value constants}

const
	kPPPStateInitial = 1;
	kPPPStateClosed = 2;
	kPPPStateClosing = 3;
	kPPPStateOpening = 4;
	kPPPStateOpened = 5;

const
	kPPPConnectionStatusIdle = 1;
	kPPPConnectionStatusConnecting = 2;
	kPPPConnectionStatusConnected = 3;
	kPPPConnectionStatusDisconnecting = 4;

const
	kPPPMinMRU = 0;
	kPPPMaxMRU = 4500;

const
	kIPCPTCPHdrCompressionDisabled = 0;
	kIPCPTCPHdrCompressionEnabled = 1;

const
	kPPPCompressionDisabled = $00000000;
	kPPPProtoCompression = $00000001;
	kPPPAddrCompression = $00000002;

const
	kPPPNoOutAuthentication = 0;
	kPPPCHAPOrPAPOutAuthentication = 1;

const
	kCCReminderTimerDisabled = 0;
	kCCIPIdleTimerDisabled = 0;

const
	kPPPScriptTypeModem = 1;
	kPPPScriptTypeConnect = 2;
	kPPPMaxScriptSize = 32000;

const
	kE164Address = 1;
	kPhoneAddress = 1;
	kCompoundPhoneAddress = 2;
	kX121Address = 3;

const
	kPPPConnectionStatusDialogsFlag = $00000001;
	kPPPConnectionRemindersFlag = $00000002;
	kPPPConnectionFlashingIconFlag = $00000004;
	kPPPOutPasswordDialogsFlag = $00000008;
	kPPPAllAlertsDisabledFlag = $00000000;
	kPPPAllAlertsEnabledFlag = $0000000F;

const
	kPPPAsyncMapCharsNone = $00000000;
	kPPPAsyncMapCharsXOnXOff = $000A0000;
	kPPPAsyncMapCharsAll = $FFFFFFFF;


{ Option names}

const
	IPCP_OPT_GETREMOTEPROTOADDR = $00007000;
	IPCP_OPT_GETLOCALPROTOADDR = $00007001;
	IPCP_OPT_TCPHDRCOMPRESSION = $00007002;
	LCP_OPT_PPPCOMPRESSION = $00007003;
	LCP_OPT_MRU = $00007004;
	LCP_OPT_RCACCMAP = $00007005;
	LCP_OPT_TXACCMAP = $00007006;
	SEC_OPT_OUTAUTHENTICATION = $00007007;
	SEC_OPT_ID = $00007008;
	SEC_OPT_PASSWORD = $00007009;
	CC_OPT_REMINDERTIMER = $00007010;
	CC_OPT_IPIDLETIMER = $00007011;
	CC_OPT_DTEADDRESSTYPE = $00007012;
	CC_OPT_DTEADDRESS = $00007013;
	CC_OPT_CALLINFO = $00007014;
	CC_OPT_GETMISCINFO = $00007015;
	PPP_OPT_GETCURRENTSTATE = $00007016;
	LCP_OPT_ECHO = $00007017; { Available on Mac OS X only }
	CC_OPT_SERIALPORTNAME = $00007200;

{ Endpoint events}

const
	kPPPEvent = kPROTOCOLEVENT or $000F0000;
	kPPPConnectCompleteEvent = kPPPEvent + 1;
	kPPPSetScriptCompleteEvent = kPPPEvent + 2;
	kPPPDisconnectCompleteEvent = kPPPEvent + 3;
	kPPPDisconnectEvent = kPPPEvent + 4;
	kPPPIPCPUpEvent = kPPPEvent + 5;
	kPPPIPCPDownEvent = kPPPEvent + 6;
	kPPPLCPUpEvent = kPPPEvent + 7;
	kPPPLCPDownEvent = kPPPEvent + 8;
	kPPPLowerLayerUpEvent = kPPPEvent + 9;
	kPPPLowerLayerDownEvent = kPPPEvent + 10;
	kPPPAuthenticationStartedEvent = kPPPEvent + 11;
	kPPPAuthenticationFinishedEvent = kPPPEvent + 12;
	kPPPDCEInitStartedEvent = kPPPEvent + 13;
	kPPPDCEInitFinishedEvent = kPPPEvent + 14;
	kPPPDCECallStartedEvent = kPPPEvent + 15;
	kPPPDCECallFinishedEvent = kPPPEvent + 16;


{******************************************************************************
*   IOCTL constants for I_OTConnect, I_OTDisconnect and I_OTScript
*   are defined in OpenTransport.h
*******************************************************************************}

{******************************************************************************
*   PPPMRULimits
*******************************************************************************}
type
	PPPMRULimitsPtr = ^PPPMRULimits;
	PPPMRULimits = record
		mruSize: UInt32;                { proposed or actual}
		upperMRULimit: UInt32;
		lowerMRULimit: UInt32;
	end;

{******************************************************************************
*   CCMiscInfo
*******************************************************************************}
type
	CCMiscInfoPtr = ^CCMiscInfo;
	CCMiscInfo = record
		connectionStatus: UInt32;
		connectionTimeElapsed: UInt32;
		connectionTimeRemaining: UInt32;
		bytesTransmitted: UInt32;
		bytesReceived: UInt32;
		reserved: UInt32;
	end;

{******************************************************************************
*   LCPEcho
*******************************************************************************}
{ Set both fields to zero to disable sending of LCP echo requests}

type
	LCPEchoPtr = ^LCPEcho;
	LCPEcho = record
		retryCount: UInt32;
		retryPeriod: UInt32;            { in milliseconds}
	end;

{******************************************************************************
*   Bits used to tell kind of product
*******************************************************************************}
const
	kRAProductClientOnly = 2;
	kRAProductOnePortServer = 3;
	kRAProductManyPortServer = 4;




end.