Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5241 lines
177 KiB

  1. /*
  2. File: OpenTransportProtocol.h
  3. Contains: Definitions likely to be used by low-level protocol stack implementation.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1993-2001 by Apple Computer, Inc. and Mentat Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __OPENTRANSPORTPROTOCOL__
  11. #define __OPENTRANSPORTPROTOCOL__
  12. #ifndef __CONDITIONALMACROS__
  13. #include <ConditionalMacros.h>
  14. #endif
  15. #if CALL_NOT_IN_CARBON
  16. #ifndef __FILES__
  17. #include <Files.h>
  18. #endif
  19. #ifndef __CODEFRAGMENTS__
  20. #include <CodeFragments.h>
  21. #endif
  22. #endif /* CALL_NOT_IN_CARBON */
  23. #ifndef __OPENTRANSPORT__
  24. #include <OpenTransport.h>
  25. #endif
  26. #ifdef __cplusplus
  27. #include <stddef.h>
  28. #endif
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #if PRAGMA_IMPORT
  36. #pragma import on
  37. #endif
  38. #if PRAGMA_STRUCT_ALIGN
  39. #pragma options align=mac68k
  40. #elif PRAGMA_STRUCT_PACKPUSH
  41. #pragma pack(push, 2)
  42. #elif PRAGMA_STRUCT_PACK
  43. #pragma pack(2)
  44. #endif
  45. #if defined(__MWERKS__) && TARGET_CPU_68K
  46. #pragma push
  47. #pragma pointers_in_D0
  48. #endif
  49. /* ***** Setup Default Compiler Variables ******/
  50. /*
  51. OTKERNEL is used to indicate whether the code is being built
  52. for the kernel environment. It defaults to 0. If you include
  53. "OpenTransportKernel.h" before including this file,
  54. it will be 1 and you will only be able to see stuff available
  55. to kernel code.
  56. As we've included "OpenTransport.h" and it defaults this variable
  57. to 0 if it's not already been defined, it should always be defined
  58. by the time we get here. So we just assert that. Assertions in
  59. header files! Cool (-:
  60. */
  61. #ifndef OTKERNEL
  62. #error OpenTransportProtocol.h expects OpenTransport.h to set up OTKERNEL.
  63. #endif /* !defined(OTKERNEL) */
  64. /* ***** Shared Client Memory ******/
  65. #if !OTKERNEL
  66. /*
  67. These allocators allocate memory in the shared client pool,
  68. which is shared between all clients and is not disposed when
  69. a particular client goes away. See DTS Technote ooo
  70. "Understanding Open Transport Memory Management" for details.
  71. */
  72. #if CALL_NOT_IN_CARBON
  73. /*
  74. * OTAllocSharedClientMem()
  75. *
  76. * Availability:
  77. * Non-Carbon CFM: not available
  78. * CarbonLib: not available
  79. * Mac OS X: not available
  80. */
  81. EXTERN_API_C( void * )
  82. OTAllocSharedClientMem(OTByteCount size);
  83. /*
  84. * OTFreeSharedClientMem()
  85. *
  86. * Availability:
  87. * Non-Carbon CFM: not available
  88. * CarbonLib: not available
  89. * Mac OS X: not available
  90. */
  91. EXTERN_API_C( void )
  92. OTFreeSharedClientMem(void * mem);
  93. #endif /* CALL_NOT_IN_CARBON */
  94. #endif /* !OTKERNEL */
  95. /* ***** UNIX Types ******/
  96. #if CALL_NOT_IN_CARBON
  97. /*
  98. On UNIX, uid_t and gid_t are defined to be big enough
  99. to hold a user ID and group ID respectively. As Mac OS
  100. has no such concepts, we just define them as UInt32 place
  101. holders.
  102. */
  103. typedef UInt32 uid_t;
  104. typedef UInt32 gid_t;
  105. /* Similarly, dev_t is a UNIX type for denoting a device number.*/
  106. typedef UInt32 dev_t;
  107. /* ***** From the Mentat "strstat.h" ******/
  108. /* module statistics structure */
  109. struct module_stat {
  110. long ms_pcnt; /* count of calls to put proc */
  111. long ms_scnt; /* count of calls to service proc */
  112. long ms_ocnt; /* count of calls to open proc */
  113. long ms_ccnt; /* count of calls to close proc */
  114. long ms_acnt; /* count of calls to admin proc */
  115. char * ms_xptr; /* pointer to private statistics */
  116. short ms_xsize; /* length of private statistics buffer */
  117. };
  118. typedef struct module_stat module_stat;
  119. /* ***** From the Mentat "cred.h" ******/
  120. struct cred {
  121. UInt16 cr_ref; /* reference count on processes using cred structures */
  122. UInt16 cr_ngroups; /* number of groups in cr_groups */
  123. uid_t cr_uid; /* effective user id */
  124. gid_t cr_gid; /* effective group id */
  125. uid_t cr_ruid; /* real user id */
  126. gid_t cr_rgid; /* real group id */
  127. uid_t cr_suid; /* user id saved by exec */
  128. gid_t cr_sgid; /* group id saved by exec */
  129. gid_t cr_groups[1]; /* supplementary groups list */
  130. };
  131. typedef struct cred cred;
  132. typedef cred cred_t;
  133. /* Free return structure for esballoc */
  134. typedef CALLBACK_API_C( void , FreeFuncType )(char * arg);
  135. struct free_rtn {
  136. FreeFuncType free_func; /* Routine to call to free buffer */
  137. char * free_arg; /* Parameter to free_func */
  138. };
  139. typedef struct free_rtn free_rtn;
  140. typedef free_rtn frtn_t;
  141. /* data descriptor */
  142. typedef struct datab datab;
  143. union datab_db_f {
  144. datab * freep;
  145. free_rtn * frtnp;
  146. };
  147. typedef union datab_db_f datab_db_f;
  148. struct datab {
  149. datab_db_f db_f;
  150. unsigned char * db_base; /* first byte of buffer */
  151. unsigned char * db_lim; /* last byte+1 of buffer */
  152. unsigned char db_ref; /* count of messages pointing to block*/
  153. unsigned char db_type; /* message type */
  154. unsigned char db_iswhat; /* message status */
  155. unsigned char db_filler2; /* for spacing */
  156. UInt32 db_size; /* used internally */
  157. unsigned char * db_msgaddr; /* used internally */
  158. long db_filler;
  159. };
  160. typedef datab dblk_t;
  161. #define db_freep db_f.freep
  162. #define db_frtnp db_f.frtnp
  163. /* message block */
  164. struct msgb {
  165. struct msgb * b_next; /* next message on queue */
  166. struct msgb * b_prev; /* previous message on queue */
  167. struct msgb * b_cont; /* next message block of message */
  168. unsigned char * b_rptr; /* first unread data byte in buffer */
  169. unsigned char * b_wptr; /* first unwritten data byte */
  170. datab * b_datap; /* data block */
  171. unsigned char b_band; /* message priority */
  172. unsigned char b_pad1;
  173. unsigned short b_flag;
  174. #ifdef MSGB_XTRA
  175. MSGB_XTRA
  176. #endif
  177. };
  178. typedef struct msgb msgb;
  179. typedef msgb mblk_t;
  180. /* mblk flags */
  181. enum {
  182. MSGMARK = 0x01, /* last byte of message is tagged */
  183. MSGNOLOOP = 0x02, /* don't pass message to write-side of stream */
  184. MSGDELIM = 0x04, /* message is delimited */
  185. MSGNOGET = 0x08
  186. };
  187. /* STREAMS environments are expected to define these constants in a public header file.*/
  188. enum {
  189. STRCTLSZ = 256, /* Maximum Control buffer size for messages */
  190. STRMSGSZ = 8192 /* Maximum # data bytes for messages */
  191. };
  192. /* Message types */
  193. enum {
  194. QNORM = 0,
  195. M_DATA = 0, /* Ordinary data */
  196. M_PROTO = 1, /* Internal control info and data */
  197. M_BREAK = 0x08, /* Request a driver to send a break */
  198. M_PASSFP = 0x09, /* Used to pass a file pointer */
  199. M_SIG = 0x0B, /* Requests a signal to be sent */
  200. M_DELAY = 0x0C, /* Request a real-time delay */
  201. M_CTL = 0x0D, /* For inter-module communication */
  202. M_IOCTL = 0x0E, /* Used internally for I_STR requests */
  203. M_SETOPTS = 0x10, /* Alters characteristics of Stream head */
  204. M_RSE = 0x11 /* Reserved for internal use */
  205. };
  206. /* MPS private type */
  207. enum {
  208. M_MI = 0x40,
  209. M_MI_READ_RESET = 1,
  210. M_MI_READ_SEEK = 2,
  211. M_MI_READ_END = 4
  212. };
  213. /* Priority messages types */
  214. enum {
  215. QPCTL = 0x80,
  216. M_IOCACK = 0x81, /* Positive ack of previous M_IOCTL */
  217. M_IOCNAK = 0x82, /* Previous M_IOCTL failed */
  218. M_PCPROTO = 0x83, /* Same as M_PROTO except for priority */
  219. M_PCSIG = 0x84, /* Priority signal */
  220. M_FLUSH = 0x86, /* Requests modules to flush queues */
  221. M_STOP = 0x87, /* Request drivers to stop output */
  222. M_START = 0x88, /* Request drivers to start output */
  223. M_HANGUP = 0x89, /* Driver can no longer produce data */
  224. M_ERROR = 0x8A, /* Reports downstream error condition */
  225. M_READ = 0x8B, /* Reports client read at Stream head */
  226. M_COPYIN = 0x8C, /* Requests the Stream to copy data in for a module */
  227. M_COPYOUT = 0x8D, /* Requests the Stream to copy data out for a module */
  228. M_IOCDATA = 0x8E, /* Status from M_COPYIN/M_COPYOUT message */
  229. M_PCRSE = 0x90, /* Reserved for internal use */
  230. M_STOPI = 0x91, /* Request drivers to stop input */
  231. M_STARTI = 0x92, /* Request drivers to start input */
  232. M_HPDATA = 0x93 /* MPS-private type; high priority data */
  233. };
  234. /* Defines for flush messages */
  235. enum {
  236. FLUSHALL = 1,
  237. FLUSHDATA = 0
  238. };
  239. enum {
  240. NOERROR = -1 /* used in M_ERROR messages */
  241. };
  242. typedef struct sth_s sth_s;
  243. typedef struct sqh_s sqh_s;
  244. typedef struct q_xtra q_xtra;
  245. #if OTKERNEL
  246. /*
  247. module_info is aligned differently on 68K than
  248. on PowerPC. Yucky. I can't defined a conditionalised
  249. pad field because a) you can't conditionalise specific
  250. fields in the interface definition language used to
  251. create Universal Interfaces, and b) lots of code
  252. assigns C structured constants to global variables
  253. of this type, and these assignments break if you
  254. add an extra field to the type. Instead, I
  255. set the alignment appropriately before defining the
  256. structure. The problem with doing that is that
  257. the interface definition language doesn't allow
  258. my to set the alignment in the middle of a file,
  259. so I have to do this via "pass throughs". This
  260. works fine for the well known languages (C, Pascal),
  261. but may cause problems for other languages (Java,
  262. Asm).
  263. */
  264. #if TARGET_CPU_PPC
  265. #pragma options align=power
  266. #endif
  267. struct module_info {
  268. unsigned short mi_idnum; /* module ID number */
  269. char * mi_idname; /* module name */
  270. long mi_minpsz; /* min pkt size, for developer use */
  271. long mi_maxpsz; /* max pkt size, for developer use */
  272. unsigned long mi_hiwat; /* hi-water mark, for flow control */
  273. unsigned long mi_lowat; /* lo-water mark, for flow control */
  274. };
  275. typedef struct module_info module_info;
  276. typedef module_info * module_infoPtr;
  277. #if TARGET_CPU_PPC
  278. #pragma options align=reset
  279. #endif
  280. typedef struct queue queue;
  281. typedef CALLBACK_API_C( OTInt32 , admin_t )(void);
  282. typedef CALLBACK_API_C( void , bufcall_t )(long size);
  283. typedef CALLBACK_API_C( void , bufcallp_t )(long size);
  284. typedef CALLBACK_API_C( OTInt32 , closep_t )(queue *q, OTInt32 foo, cred_t *cred);
  285. typedef CALLBACK_API_C( OTInt32 , old_closep_t )(queue * q);
  286. typedef CALLBACK_API_C( OTInt32 , openp_t )(queue *q, dev_t *dev, OTInt32 foo, OTInt32 bar, cred_t *cred);
  287. typedef CALLBACK_API_C( OTInt32 , openOld_t )(queue *q, dev_t dev, OTInt32 foo, OTInt32 bar);
  288. typedef CALLBACK_API_C( OTInt32 , old_openp_t )(queue *q, dev_t dev, OTInt32 foo, OTInt32 bar);
  289. typedef CALLBACK_API_C( OTInt32 , closeOld_t )(queue * q);
  290. typedef CALLBACK_API_C( OTInt32 , putp_t )(queue *q, msgb *mp);
  291. typedef CALLBACK_API_C( OTInt32 , srvp_t )(queue * q);
  292. struct qinit {
  293. putp_t qi_putp; /* put procedure */
  294. srvp_t qi_srvp; /* service procedure */
  295. openp_t qi_qopen; /* called on each open or a push */
  296. closep_t qi_qclose; /* called on last close or a pop */
  297. admin_t qi_qadmin; /* reserved for future use */
  298. module_info * qi_minfo; /* information structure */
  299. module_stat * qi_mstat; /* statistics structure - optional */
  300. };
  301. typedef struct qinit qinit;
  302. /* defines module or driver */
  303. struct streamtab {
  304. qinit * st_rdinit; /* defines read QUEUE */
  305. qinit * st_wrinit; /* defines write QUEUE */
  306. qinit * st_muxrinit; /* for multiplexing drivers only */
  307. qinit * st_muxwinit; /* ditto */
  308. };
  309. typedef struct streamtab streamtab;
  310. struct qband {
  311. struct qband * qb_next; /* next band for this queue */
  312. unsigned long qb_count; /* weighted count of characters in this band */
  313. msgb * qb_first; /* head of message queue */
  314. msgb * qb_last; /* tail of message queue */
  315. unsigned long qb_hiwat; /* high water mark */
  316. unsigned long qb_lowat; /* low water mark */
  317. unsigned short qb_flag; /* ooo.state */
  318. short qb_pad1; /* ooo reserved */
  319. };
  320. typedef struct qband qband;
  321. typedef qband qband_t;
  322. union queue_q_u {
  323. queue * q_u_link; /* link to scheduling queue */
  324. sqh_s * q_u_sqh_parent;
  325. };
  326. typedef union queue_q_u queue_q_u;
  327. struct queue {
  328. qinit * q_qinfo; /* procedures and limits for queue */
  329. msgb * q_first; /* head of message queue */
  330. msgb * q_last; /* tail of message queue */
  331. struct queue * q_next; /* next queue in Stream */
  332. queue_q_u q_u;
  333. char * q_ptr; /* to private data structure */
  334. unsigned long q_count; /* weighted count of characters on q */
  335. long q_minpsz; /* min packet size accepted */
  336. long q_maxpsz; /* max packet size accepted */
  337. unsigned long q_hiwat; /* high water mark, for flow control */
  338. unsigned long q_lowat; /* low water mark */
  339. qband * q_bandp; /* band information */
  340. unsigned short q_flag; /* ooo queue state */
  341. unsigned char q_nband; /* ooo number of bands */
  342. unsigned char q_pad1[1]; /* ooo reserved */
  343. q_xtra * q_osx; /* Pointer to OS-dependent extra stuff */
  344. struct queue * q_ffcp; /* Forward flow control pointer */
  345. struct queue * q_bfcp; /* Backward flow control pointer */
  346. };
  347. typedef queue * queuePtr;
  348. typedef queue queue_t;
  349. #define q_link q_u.q_u_link
  350. #define q_sqh_parent q_u.q_u_sqh_parent
  351. /* queue_t flag defines */
  352. enum {
  353. QREADR = 0x01, /* This queue is a read queue */
  354. QNOENB = 0x02, /* Don't enable in putq */
  355. QFULL = 0x04, /* The queue is full */
  356. QWANTR = 0x08, /* The queue should be scheduled in the next putq */
  357. QWANTW = 0x10, /* The stream should be back enabled when this queue drains */
  358. QUSE = 0x20, /* The queue is allocated and ready for use */
  359. QENAB = 0x40, /* The queue is scheduled (on the run queue) */
  360. QBACK = 0x80, /* The queue has been back enabled */
  361. QOLD = 0x0100, /* Module supports old style opens and closes */
  362. QHLIST = 0x0200, /* The Stream head is doing something with this queue (Not supported by MPS) */
  363. QWELDED = 0x0400, /* Mentat flag for welded queues */
  364. QUNWELDING = 0x0800, /* Queue is scheduled to be unwelded */
  365. QPROTECTED = 0x1000, /* Mentat flag for unsafe q access */
  366. QEXCOPENCLOSE = 0x2000 /* Queue wants exclusive open/close calls */
  367. };
  368. /* qband_t flag defines */
  369. enum {
  370. QB_FULL = 0x01, /* The band is full */
  371. QB_WANTW = 0x02, /* The stream should be back enabled when this band/queue drains */
  372. QB_BACK = 0x04 /* The queue has been back enabled */
  373. };
  374. #else
  375. /*
  376. Client code views a queue_t as a simple cookie.
  377. The real definition lives above and is only available
  378. to kernel code.
  379. */
  380. typedef SInt32 queue_t;
  381. #endif /* OTKERNEL */
  382. /* structure contained in M_COPYIN/M_COPYOUT messages */
  383. typedef char * caddr_t;
  384. struct copyreq {
  385. SInt32 cq_cmd; /* ioctl command (from ioc_cmd) */
  386. cred * cq_cr; /* pointer to full credentials */
  387. UInt32 cq_id; /* ioctl id (from ioc_id) */
  388. caddr_t cq_addr; /* address to copy data to/from */
  389. UInt32 cq_size; /* number of bytes to copy */
  390. SInt32 cq_flag; /* state */
  391. mblk_t * cq_private; /* private state information */
  392. long cq_filler[4];
  393. };
  394. typedef struct copyreq copyreq;
  395. #define cq_uid cq_cr->cr_uid
  396. #define cq_gid cq_cr->cr_gid
  397. /* copyreq defines */
  398. enum {
  399. STRCANON = 0x01, /* b_cont data block contains canonical format specifier */
  400. RECOPY = 0x02 /* perform I_STR copyin again this time using canonical format specifier */
  401. };
  402. /* structure contained in M_IOCDATA message block */
  403. struct copyresp {
  404. SInt32 cp_cmd; /* ioctl command (from ioc_cmd) */
  405. cred * cp_cr; /* pointer to full credentials */
  406. UInt32 cp_id; /* ioctl id (from ioc_id) */
  407. caddr_t cp_rval; /* status of request; 0 for success; error value for failure */
  408. UInt32 cp_pad1;
  409. SInt32 cp_pad2;
  410. mblk_t * cp_private; /* private state information */
  411. long cp_filler[4];
  412. };
  413. typedef struct copyresp copyresp;
  414. #define cp_uid cp_cr->cr_uid
  415. #define cp_gid cp_cr->cr_gid
  416. /* structure contained in an M_IOCTL message block */
  417. struct iocblk {
  418. SInt32 ioc_cmd; /* ioctl command type */
  419. cred * ioc_cr; /* pointer to full credentials */
  420. UInt32 ioc_id; /* ioctl id */
  421. UInt32 ioc_count; /* count of bytes in data field */
  422. SInt32 ioc_error; /* error code */
  423. SInt32 ioc_rval; /* return value */
  424. long ioc_filler[4];
  425. };
  426. typedef struct iocblk iocblk;
  427. #define ioc_uid ioc_cr->cr_uid
  428. #define ioc_gid ioc_cr->cr_gid
  429. enum {
  430. TRANSPARENT = (unsigned long)0xFFFFFFFF
  431. };
  432. /* Used in M_IOCTL mblks to muxes (ioc_cmd I_LINK) */
  433. struct linkblk {
  434. queue_t * l_qtop; /* lowest level write queue of upper stream */
  435. queue_t * l_qbot; /* highest level write queue of lower stream */
  436. SInt32 l_index; /* system-unique index for lower stream */
  437. long l_pad[5];
  438. };
  439. typedef struct linkblk linkblk;
  440. /* structure contained in an M_PASSFP message block */
  441. struct strpfp {
  442. unsigned long pass_file_cookie; /* file 'pointer' */
  443. unsigned short pass_uid; /* user id of sending stream */
  444. unsigned short pass_gid;
  445. sth_s * pass_sth; /* Stream head pointer of passed stream */
  446. };
  447. typedef struct strpfp strpfp;
  448. /* structure contained in an M_SETOPTS message block */
  449. struct stroptions {
  450. unsigned long so_flags; /* options to set */
  451. short so_readopt; /* read option */
  452. unsigned short so_wroff; /* write offset */
  453. long so_minpsz; /* minimum read packet size */
  454. long so_maxpsz; /* maximum read packet size */
  455. unsigned long so_hiwat; /* read queue high-water mark */
  456. unsigned long so_lowat; /* read queue low-water mark */
  457. unsigned char so_band; /* band for water marks */
  458. unsigned char so_filler[3]; /* added for alignment */
  459. unsigned long so_poll_set; /* poll events to set */
  460. unsigned long so_poll_clr; /* poll events to clear */
  461. };
  462. typedef struct stroptions stroptions;
  463. /* definitions for so_flags field */
  464. enum {
  465. SO_ALL = 0x7FFF, /* Update all options */
  466. SO_READOPT = 0x0001, /* Set the read mode */
  467. SO_WROFF = 0x0002, /* Insert an offset in write M_DATA mblks */
  468. SO_MINPSZ = 0x0004, /* Change the min packet size on sth rq */
  469. SO_MAXPSZ = 0x0008, /* Change the max packet size on sth rq */
  470. SO_HIWAT = 0x0010, /* Change the high water mark on sth rq */
  471. SO_LOWAT = 0x0020, /* Change the low water mark */
  472. SO_MREADON = 0x0040, /* Request M_READ messages */
  473. SO_MREADOFF = 0x0080, /* Don't gen M_READ messages */
  474. SO_NDELON = 0x0100, /* old TTY semantics for O_NDELAY reads and writes */
  475. SO_NDELOFF = 0x0200, /* STREAMS semantics for O_NDELAY reads and writes */
  476. SO_ISTTY = 0x0400, /* Become a controlling tty */
  477. SO_ISNTTY = 0x0800, /* No longer a controlling tty */
  478. SO_TOSTOP = 0x1000, /* Stop on background writes */
  479. SO_TONSTOP = 0x2000, /* Don't stop on background writes */
  480. SO_BAND = 0x4000, /* Water marks are for a band */
  481. SO_POLL_SET = 0x8000, /* Set events to poll */
  482. SO_POLL_CLR = 0x00010000 /* Clear events to poll */
  483. };
  484. /* Buffer Allocation Priority */
  485. enum {
  486. BPRI_LO = 1,
  487. BPRI_MED = 2,
  488. BPRI_HI = 3
  489. };
  490. enum {
  491. INFPSZ = -1
  492. };
  493. /** Test whether message is a data message */
  494. #define datamsg(type) ((type) == M_DATA || (type) == M_PROTO || (type) == M_PCPROTO || (type) == M_DELAY)
  495. enum {
  496. CLONEOPEN = 0x02,
  497. MODOPEN = 0x01,
  498. OPENFAIL = -1
  499. };
  500. /* Enumeration values for strqget and strqset */
  501. typedef SInt32 qfields;
  502. enum {
  503. QHIWAT = 0,
  504. QLOWAT = 1,
  505. QMAXPSZ = 2,
  506. QMINPSZ = 3,
  507. QCOUNT = 4,
  508. QFIRST = 5,
  509. QLAST = 6,
  510. QFLAG = 7,
  511. QBAD = 8
  512. };
  513. typedef qfields qfields_t;
  514. #endif /* CALL_NOT_IN_CARBON */
  515. /* ***** From the Mentat "stropts.h" ******/
  516. enum {
  517. I_NREAD = ((MIOC_STREAMIO << 8) | 1), /* return the number of bytes in 1st msg */
  518. I_PUSH = ((MIOC_STREAMIO << 8) | 2), /* push module just below stream head */
  519. I_POP = ((MIOC_STREAMIO << 8) | 3), /* pop module below stream head */
  520. I_LOOK = ((MIOC_STREAMIO << 8) | 4), /* retrieve name of first stream module */
  521. I_FLUSH = ((MIOC_STREAMIO << 8) | 5), /* flush all input and/or output queues */
  522. I_SRDOPT = ((MIOC_STREAMIO << 8) | 6), /* set the read mode */
  523. I_GRDOPT = ((MIOC_STREAMIO << 8) | 7), /* get the current read mode */
  524. I_STR = ((MIOC_STREAMIO << 8) | 8), /* create an internal ioctl message */
  525. I_SETSIG = ((MIOC_STREAMIO << 8) | 9), /* request SIGPOLL signal on events */
  526. I_GETSIG = ((MIOC_STREAMIO << 8) | 10), /* query the registered events */
  527. I_FIND = ((MIOC_STREAMIO << 8) | 11), /* check for module in stream */
  528. I_LINK = ((MIOC_STREAMIO << 8) | 12), /* connect stream under mux fd */
  529. I_UNLINK = ((MIOC_STREAMIO << 8) | 13), /* disconnect two streams */
  530. I_PEEK = ((MIOC_STREAMIO << 8) | 15), /* peek at data on read queue */
  531. I_FDINSERT = ((MIOC_STREAMIO << 8) | 16), /* create a message and send downstream */
  532. I_SENDFD = ((MIOC_STREAMIO << 8) | 17), /* send an fd to a connected pipe stream */
  533. I_RECVFD = ((MIOC_STREAMIO << 8) | 18), /* retrieve a file descriptor */
  534. I_FLUSHBAND = ((MIOC_STREAMIO << 8) | 19), /* flush a particular input and/or output band */
  535. I_SWROPT = ((MIOC_STREAMIO << 8) | 20), /* set the write mode */
  536. I_GWROPT = ((MIOC_STREAMIO << 8) | 21), /* get the current write mode */
  537. I_LIST = ((MIOC_STREAMIO << 8) | 22), /* get a list of all modules on a stream */
  538. I_ATMARK = ((MIOC_STREAMIO << 8) | 23), /* check to see if the next message is "marked" */
  539. I_CKBAND = ((MIOC_STREAMIO << 8) | 24), /* check for a message of a particular band */
  540. I_GETBAND = ((MIOC_STREAMIO << 8) | 25), /* get the band of the next message to be read */
  541. I_CANPUT = ((MIOC_STREAMIO << 8) | 26), /* check to see if a message may be passed on a stream */
  542. I_SETCLTIME = ((MIOC_STREAMIO << 8) | 27), /* set the close timeout wait */
  543. I_GETCLTIME = ((MIOC_STREAMIO << 8) | 28), /* get the current close timeout wait */
  544. I_PLINK = ((MIOC_STREAMIO << 8) | 29), /* permanently connect a stream under a mux */
  545. I_PUNLINK = ((MIOC_STREAMIO << 8) | 30), /* disconnect a permanent link */
  546. I_GETMSG = ((MIOC_STREAMIO << 8) | 40), /* getmsg() system call */
  547. I_PUTMSG = ((MIOC_STREAMIO << 8) | 41), /* putmsg() system call */
  548. I_POLL = ((MIOC_STREAMIO << 8) | 42), /* poll() system call */
  549. I_SETDELAY = ((MIOC_STREAMIO << 8) | 43), /* set blocking status */
  550. I_GETDELAY = ((MIOC_STREAMIO << 8) | 44), /* get blocking status */
  551. I_RUN_QUEUES = ((MIOC_STREAMIO << 8) | 45), /* sacrifice for the greater good */
  552. I_GETPMSG = ((MIOC_STREAMIO << 8) | 46), /* getpmsg() system call */
  553. I_PUTPMSG = ((MIOC_STREAMIO << 8) | 47), /* putpmsg() system call */
  554. I_AUTOPUSH = ((MIOC_STREAMIO << 8) | 48), /* for systems that cannot do the autopush in open */
  555. I_PIPE = ((MIOC_STREAMIO << 8) | 49), /* for pipe library call */
  556. I_HEAP_REPORT = ((MIOC_STREAMIO << 8) | 50), /* get heap statistics */
  557. I_FIFO = ((MIOC_STREAMIO << 8) | 51) /* for fifo library call */
  558. };
  559. /* priority message request on putmsg() or strpeek */
  560. enum {
  561. RS_HIPRI = 0x01
  562. };
  563. /* flags for getpmsg and putpmsg */
  564. enum {
  565. MSG_HIPRI = 0x01,
  566. MSG_BAND = 0x02, /* Retrieve a message from a particular band */
  567. MSG_ANY = 0x04 /* Retrieve a message from any band */
  568. };
  569. /* return values from getmsg(), 0 indicates all ok */
  570. enum {
  571. MORECTL = 0x01, /* more control info available */
  572. MOREDATA = 0x02 /* more data available */
  573. };
  574. enum {
  575. FMNAMESZ = 31 /* maximum length of a module or device name */
  576. };
  577. /* Infinite poll wait time */
  578. enum {
  579. INFTIM = (unsigned long)0xFFFFFFFF
  580. };
  581. /* flush requests */
  582. enum {
  583. FLUSHR = 0x01, /* Flush the read queue */
  584. FLUSHW = 0x02, /* Flush the write queue */
  585. FLUSHRW = (FLUSHW | FLUSHR) /* Flush both */
  586. };
  587. enum {
  588. FLUSHBAND = 0x40 /* Flush a particular band */
  589. };
  590. /* I_FLUSHBAND */
  591. struct bandinfo {
  592. unsigned char bi_pri; /* Band to flush */
  593. char pad1;
  594. SInt32 bi_flag; /* One of the above flush requests */
  595. };
  596. typedef struct bandinfo bandinfo;
  597. /* flags for I_ATMARK */
  598. enum {
  599. ANYMARK = 0x01, /* Check if message is marked */
  600. LASTMARK = 0x02 /* Check if this is the only message marked */
  601. };
  602. /* signal event masks */
  603. enum {
  604. S_INPUT = 0x01, /* A non-M_PCPROTO message has arrived */
  605. S_HIPRI = 0x02, /* A priority (M_PCPROTO) message is available */
  606. S_OUTPUT = 0x04, /* The write queue is no longer full */
  607. S_MSG = 0x08, /* A signal message has reached the front of read queue */
  608. S_RDNORM = 0x10, /* A non-priority message is available */
  609. S_RDBAND = 0x20, /* A banded messsage is available */
  610. S_WRNORM = 0x40, /* Same as S_OUTPUT */
  611. S_WRBAND = 0x80, /* A priority band exists and is writable */
  612. S_ERROR = 0x0100, /* Error message has arrived */
  613. S_HANGUP = 0x0200, /* Hangup message has arrived */
  614. S_BANDURG = 0x0400 /* Use SIGURG instead of SIGPOLL on S_RDBAND signals */
  615. };
  616. /* read mode bits for I_S|GRDOPT; choose one of the following */
  617. enum {
  618. RNORM = 0x01, /* byte-stream mode, default */
  619. RMSGD = 0x02, /* message-discard mode */
  620. RMSGN = 0x04, /* message-nondiscard mode */
  621. RFILL = 0x08 /* fill read buffer mode (PSE private) */
  622. };
  623. /* More read modes, these are bitwise or'ed with the modes above */
  624. enum {
  625. RPROTNORM = 0x10, /* Normal handling of M_PROTO/M_PCPROTO messages, default */
  626. RPROTDIS = 0x20, /* Discard M_PROTO/M_PCPROTO message blocks */
  627. RPROTDAT = 0x40 /* Convert M_PROTO/M_PCPROTO message blocks into M_DATA */
  628. };
  629. /* write modes for I_S|GWROPT */
  630. enum {
  631. SNDZERO = 0x01 /* Send a zero-length message downstream on a write of zero bytes */
  632. };
  633. enum {
  634. MUXID_ALL = -1 /* Unlink all lower streams for I_UNLINK and I_PUNLINK */
  635. };
  636. /*
  637. strbuf is moved to "OpenTransport.h" because that header file
  638. exports provider routines that take it as a parameter.
  639. */
  640. /* structure of ioctl data on I_FDINSERT */
  641. struct strfdinsert {
  642. strbuf ctlbuf;
  643. strbuf databuf;
  644. long flags; /* type of message, 0 or RS_HIPRI */
  645. long fildes; /* fd of other stream (FDCELL) */
  646. SInt32 offset; /* where to put other stream read qp */
  647. };
  648. typedef struct strfdinsert strfdinsert;
  649. /* I_LIST structures */
  650. struct str_mlist {
  651. char l_name[32];
  652. };
  653. typedef struct str_mlist str_mlist;
  654. struct str_list {
  655. SInt32 sl_nmods; /* number of modules in sl_modlist array */
  656. str_mlist * sl_modlist;
  657. };
  658. typedef struct str_list str_list;
  659. /* I_PEEK structure */
  660. struct strpeek {
  661. strbuf ctlbuf;
  662. strbuf databuf;
  663. long flags; /* if RS_HIPRI, get priority messages only */
  664. };
  665. typedef struct strpeek strpeek;
  666. /* structure for getpmsg and putpmsg */
  667. struct strpmsg {
  668. strbuf ctlbuf;
  669. strbuf databuf;
  670. SInt32 band;
  671. long flags;
  672. };
  673. typedef struct strpmsg strpmsg;
  674. /* structure of ioctl data on I_RECVFD */
  675. struct strrecvfd {
  676. long fd; /* new file descriptor (FDCELL) */
  677. unsigned short uid; /* user id of sending stream */
  678. unsigned short gid;
  679. char fill[8];
  680. };
  681. typedef struct strrecvfd strrecvfd;
  682. /* structure of ioctl data on I_STR */
  683. struct strioctl {
  684. SInt32 ic_cmd; /* downstream command */
  685. SInt32 ic_timout; /* ACK/NAK timeout */
  686. SInt32 ic_len; /* length of data arg */
  687. char * ic_dp; /* ptr to data arg */
  688. };
  689. typedef struct strioctl strioctl;
  690. /* ***** From the Mentat "strlog.h" ******/
  691. struct log_ctl {
  692. short mid;
  693. short sid;
  694. char level;
  695. char pad1;
  696. short flags;
  697. long ltime;
  698. long ttime;
  699. SInt32 seq_no;
  700. };
  701. typedef struct log_ctl log_ctl;
  702. enum {
  703. SL_FATAL = 0x01, /* Fatal error */
  704. SL_NOTIFY = 0x02, /* Notify the system administrator */
  705. SL_ERROR = 0x04, /* Pass message to error logger */
  706. SL_TRACE = 0x08, /* Pass message to tracer */
  707. SL_CONSOLE = 0x00, /* Console messages are disabled */
  708. SL_WARN = 0x20, /* Warning */
  709. SL_NOTE = 0x40 /* Notice this message */
  710. };
  711. struct trace_ids {
  712. short ti_mid;
  713. short ti_sid;
  714. char ti_level;
  715. };
  716. typedef struct trace_ids trace_ids;
  717. enum {
  718. I_TRCLOG = ((MIOC_STRLOG << 8) | 1),
  719. I_ERRLOG = ((MIOC_STRLOG << 8) | 2)
  720. };
  721. enum {
  722. LOGMSGSZ = 128
  723. };
  724. /* ***** From the Mentat "tihdr.h" ******/
  725. #if CALL_NOT_IN_CARBON
  726. /* TPI Primitives*/
  727. enum {
  728. T_BIND_REQ = 101,
  729. T_CONN_REQ = 102, /* connection request */
  730. T_CONN_RES = 103, /* respond to connection indication */
  731. T_DATA_REQ = 104,
  732. T_DISCON_REQ = 105,
  733. T_EXDATA_REQ = 106,
  734. T_INFO_REQ = 107,
  735. T_OPTMGMT_REQ = 108,
  736. T_ORDREL_REQ = 109,
  737. T_UNBIND_REQ = 110,
  738. T_UNITDATA_REQ = 111,
  739. T_ADDR_REQ = 112, /* Get address request */
  740. T_UREQUEST_REQ = 113, /* UnitRequest (transaction) req */
  741. T_REQUEST_REQ = 114, /* Request (CO transaction) req */
  742. T_UREPLY_REQ = 115, /* UnitRequest (transaction) req */
  743. T_REPLY_REQ = 116, /* REPLY (CO transaction) req */
  744. T_CANCELREQUEST_REQ = 117, /* Cancel outgoing request */
  745. T_CANCELREPLY_REQ = 118, /* Cancel incoming request */
  746. T_REGNAME_REQ = 119, /* Request name registration */
  747. T_DELNAME_REQ = 120, /* Request delete name registration */
  748. T_LKUPNAME_REQ = 121, /* Request name lookup */
  749. T_BIND_ACK = 122,
  750. T_CONN_CON = 123, /* connection confirmation */
  751. T_CONN_IND = 124, /* incoming connection indication */
  752. T_DATA_IND = 125,
  753. T_DISCON_IND = 126,
  754. T_ERROR_ACK = 127,
  755. T_EXDATA_IND = 128,
  756. T_INFO_ACK = 129,
  757. T_OK_ACK = 130,
  758. T_OPTMGMT_ACK = 131,
  759. T_ORDREL_IND = 132,
  760. T_UNITDATA_IND = 133,
  761. T_UDERROR_IND = 134,
  762. T_ADDR_ACK = 135, /* Get address ack */
  763. T_UREQUEST_IND = 136, /* UnitRequest (transaction) ind */
  764. T_REQUEST_IND = 137, /* Request (CO transaction) ind */
  765. T_UREPLY_IND = 138, /* Incoming unit reply */
  766. T_REPLY_IND = 139, /* Incoming reply */
  767. T_UREPLY_ACK = 140, /* outgoing Unit Reply is complete */
  768. T_REPLY_ACK = 141, /* outgoing Reply is complete */
  769. T_RESOLVEADDR_REQ = 142,
  770. T_RESOLVEADDR_ACK = 143,
  771. T_LKUPNAME_CON = 146, /* Results of name lookup */
  772. T_LKUPNAME_RES = 147, /* Partial results of name lookup */
  773. T_REGNAME_ACK = 148, /* Request name registration */
  774. T_SEQUENCED_ACK = 149, /* Sequenced version of OK or ERROR ACK */
  775. T_EVENT_IND = 160 /* Miscellaneous event Indication */
  776. };
  777. /* State values */
  778. enum {
  779. TS_UNBND = 1,
  780. TS_WACK_BREQ = 2,
  781. TS_WACK_UREQ = 3,
  782. TS_IDLE = 4,
  783. TS_WACK_OPTREQ = 5,
  784. TS_WACK_CREQ = 6,
  785. TS_WCON_CREQ = 7,
  786. TS_WRES_CIND = 8,
  787. TS_WACK_CRES = 9,
  788. TS_DATA_XFER = 10,
  789. TS_WIND_ORDREL = 11,
  790. TS_WREQ_ORDREL = 12,
  791. TS_WACK_DREQ6 = 13,
  792. TS_WACK_DREQ7 = 14,
  793. TS_WACK_DREQ9 = 15,
  794. TS_WACK_DREQ10 = 16,
  795. TS_WACK_DREQ11 = 17,
  796. TS_WACK_ORDREL = 18,
  797. TS_NOSTATES = 19,
  798. TS_BAD_STATE = 19
  799. };
  800. /* Transport events */
  801. enum {
  802. TE_OPENED = 1,
  803. TE_BIND = 2,
  804. TE_OPTMGMT = 3,
  805. TE_UNBIND = 4,
  806. TE_CLOSED = 5,
  807. TE_CONNECT1 = 6,
  808. TE_CONNECT2 = 7,
  809. TE_ACCEPT1 = 8,
  810. TE_ACCEPT2 = 9,
  811. TE_ACCEPT3 = 10,
  812. TE_SND = 11,
  813. TE_SNDDIS1 = 12,
  814. TE_SNDDIS2 = 13,
  815. TE_SNDREL = 14,
  816. TE_SNDUDATA = 15,
  817. TE_LISTEN = 16,
  818. TE_RCVCONNECT = 17,
  819. TE_RCV = 18,
  820. TE_RCVDIS1 = 19,
  821. TE_RCVDIS2 = 20,
  822. TE_RCVDIS3 = 21,
  823. TE_RCVREL = 22,
  824. TE_RCVUDATA = 23,
  825. TE_RCVUDERR = 24,
  826. TE_PASS_CONN = 25,
  827. TE_BAD_EVENT = 26
  828. };
  829. struct T_addr_ack {
  830. long PRIM_type; /* Always T_ADDR_ACK */
  831. long LOCADDR_length;
  832. long LOCADDR_offset;
  833. long REMADDR_length;
  834. long REMADDR_offset;
  835. };
  836. typedef struct T_addr_ack T_addr_ack;
  837. struct T_addr_req {
  838. long PRIM_type; /* Always T_ADDR_REQ */
  839. };
  840. typedef struct T_addr_req T_addr_req;
  841. struct T_bind_ack {
  842. long PRIM_type; /* always T_BIND_ACK */
  843. long ADDR_length;
  844. long ADDR_offset;
  845. unsigned long CONIND_number;
  846. };
  847. typedef struct T_bind_ack T_bind_ack;
  848. struct T_bind_req {
  849. long PRIM_type; /* always T_BIND_REQ */
  850. long ADDR_length;
  851. long ADDR_offset;
  852. unsigned long CONIND_number;
  853. };
  854. typedef struct T_bind_req T_bind_req;
  855. struct T_conn_con {
  856. long PRIM_type; /* always T_CONN_CON */
  857. long RES_length; /* responding address length */
  858. long RES_offset;
  859. long OPT_length;
  860. long OPT_offset;
  861. };
  862. typedef struct T_conn_con T_conn_con;
  863. struct T_conn_ind {
  864. long PRIM_type; /* always T_CONN_IND */
  865. long SRC_length;
  866. long SRC_offset;
  867. long OPT_length;
  868. long OPT_offset;
  869. long SEQ_number;
  870. };
  871. typedef struct T_conn_ind T_conn_ind;
  872. struct T_conn_req {
  873. long PRIM_type; /* always T_CONN_REQ */
  874. long DEST_length;
  875. long DEST_offset;
  876. long OPT_length;
  877. long OPT_offset;
  878. };
  879. typedef struct T_conn_req T_conn_req;
  880. struct T_conn_res {
  881. long PRIM_type; /* always T_CONN_RES */
  882. queue_t * QUEUE_ptr;
  883. long OPT_length;
  884. long OPT_offset;
  885. long SEQ_number;
  886. };
  887. typedef struct T_conn_res T_conn_res;
  888. struct T_data_ind {
  889. long PRIM_type; /* always T_DATA_IND */
  890. long MORE_flag;
  891. };
  892. typedef struct T_data_ind T_data_ind;
  893. struct T_data_req {
  894. long PRIM_type; /* always T_DATA_REQ */
  895. long MORE_flag;
  896. };
  897. typedef struct T_data_req T_data_req;
  898. struct T_discon_ind {
  899. long PRIM_type; /* always T_DISCON_IND */
  900. long DISCON_reason;
  901. long SEQ_number;
  902. };
  903. typedef struct T_discon_ind T_discon_ind;
  904. struct T_discon_req {
  905. long PRIM_type; /* always T_DISCON_REQ */
  906. long SEQ_number;
  907. };
  908. typedef struct T_discon_req T_discon_req;
  909. struct T_exdata_ind {
  910. long PRIM_type; /* always T_EXDATA_IND */
  911. long MORE_flag;
  912. };
  913. typedef struct T_exdata_ind T_exdata_ind;
  914. struct T_exdata_req {
  915. long PRIM_type; /* always T_EXDATA_REQ */
  916. long MORE_flag;
  917. };
  918. typedef struct T_exdata_req T_exdata_req;
  919. struct T_error_ack {
  920. long PRIM_type; /* always T_ERROR_ACK */
  921. long ERROR_prim; /* primitive in error */
  922. long TLI_error;
  923. long UNIX_error;
  924. };
  925. typedef struct T_error_ack T_error_ack;
  926. struct T_info_ack {
  927. long PRIM_type; /* always T_INFO_ACK */
  928. long TSDU_size; /* max TSDU size */
  929. long ETSDU_size; /* max ETSDU size */
  930. long CDATA_size; /* connect data size */
  931. long DDATA_size; /* disconnect data size */
  932. long ADDR_size; /* TSAP size */
  933. long OPT_size; /* options size */
  934. long TIDU_size; /* TIDU size */
  935. long SERV_type; /* service type */
  936. long CURRENT_state; /* current state */
  937. long PROVIDER_flag; /* provider flags (see xti.h for defines) */
  938. };
  939. typedef struct T_info_ack T_info_ack;
  940. /* Provider flags */
  941. enum {
  942. SENDZERO = 0x0001, /* supports 0-length TSDU's */
  943. XPG4_1 = 0x0002 /* provider supports recent stuff */
  944. };
  945. struct T_info_req {
  946. long PRIM_type; /* always T_INFO_REQ */
  947. };
  948. typedef struct T_info_req T_info_req;
  949. struct T_ok_ack {
  950. long PRIM_type; /* always T_OK_ACK */
  951. long CORRECT_prim;
  952. };
  953. typedef struct T_ok_ack T_ok_ack;
  954. struct T_optmgmt_ack {
  955. long PRIM_type; /* always T_OPTMGMT_ACK */
  956. long OPT_length;
  957. long OPT_offset;
  958. long MGMT_flags;
  959. };
  960. typedef struct T_optmgmt_ack T_optmgmt_ack;
  961. struct T_optmgmt_req {
  962. long PRIM_type; /* always T_OPTMGMT_REQ */
  963. long OPT_length;
  964. long OPT_offset;
  965. long MGMT_flags;
  966. };
  967. typedef struct T_optmgmt_req T_optmgmt_req;
  968. struct T_ordrel_ind {
  969. long PRIM_type; /* always T_ORDREL_IND */
  970. };
  971. typedef struct T_ordrel_ind T_ordrel_ind;
  972. struct T_ordrel_req {
  973. long PRIM_type; /* always T_ORDREL_REQ */
  974. };
  975. typedef struct T_ordrel_req T_ordrel_req;
  976. struct T_unbind_req {
  977. long PRIM_type; /* always T_UNBIND_REQ */
  978. };
  979. typedef struct T_unbind_req T_unbind_req;
  980. struct T_uderror_ind {
  981. long PRIM_type; /* always T_UDERROR_IND */
  982. long DEST_length;
  983. long DEST_offset;
  984. long OPT_length;
  985. long OPT_offset;
  986. long ERROR_type;
  987. };
  988. typedef struct T_uderror_ind T_uderror_ind;
  989. struct T_unitdata_ind {
  990. long PRIM_type; /* always T_UNITDATA_IND */
  991. long SRC_length;
  992. long SRC_offset;
  993. long OPT_length;
  994. long OPT_offset;
  995. };
  996. typedef struct T_unitdata_ind T_unitdata_ind;
  997. struct T_unitdata_req {
  998. long PRIM_type; /* always T_UNITDATA_REQ */
  999. long DEST_length;
  1000. long DEST_offset;
  1001. long OPT_length;
  1002. long OPT_offset;
  1003. };
  1004. typedef struct T_unitdata_req T_unitdata_req;
  1005. struct T_resolveaddr_ack {
  1006. long PRIM_type; /* always T_RESOLVEADDR_ACK */
  1007. long SEQ_number;
  1008. long ADDR_length;
  1009. long ADDR_offset;
  1010. long ORIG_client;
  1011. long ORIG_data;
  1012. long TLI_error;
  1013. long UNIX_error;
  1014. };
  1015. typedef struct T_resolveaddr_ack T_resolveaddr_ack;
  1016. struct T_resolveaddr_req {
  1017. long PRIM_type; /* always T_RESOLVEADDR_REQ */
  1018. long SEQ_number;
  1019. long ADDR_length;
  1020. long ADDR_offset;
  1021. long ORIG_client;
  1022. long ORIG_data;
  1023. long MAX_milliseconds;
  1024. };
  1025. typedef struct T_resolveaddr_req T_resolveaddr_req;
  1026. struct T_unitreply_ind {
  1027. long PRIM_type; /* Always T_UREPLY_IND */
  1028. long SEQ_number;
  1029. long OPT_length;
  1030. long OPT_offset;
  1031. long REP_flags;
  1032. long TLI_error;
  1033. long UNIX_error;
  1034. };
  1035. typedef struct T_unitreply_ind T_unitreply_ind;
  1036. struct T_unitrequest_ind {
  1037. long PRIM_type; /* Always T_UREQUEST_IND */
  1038. long SEQ_number;
  1039. long SRC_length;
  1040. long SRC_offset;
  1041. long OPT_length;
  1042. long OPT_offset;
  1043. long REQ_flags;
  1044. };
  1045. typedef struct T_unitrequest_ind T_unitrequest_ind;
  1046. struct T_unitrequest_req {
  1047. long PRIM_type; /* Always T_UREQUEST_REQ */
  1048. long SEQ_number;
  1049. long DEST_length;
  1050. long DEST_offset;
  1051. long OPT_length;
  1052. long OPT_offset;
  1053. long REQ_flags;
  1054. };
  1055. typedef struct T_unitrequest_req T_unitrequest_req;
  1056. struct T_unitreply_req {
  1057. long PRIM_type; /* Always T_UREPLY_REQ */
  1058. long SEQ_number;
  1059. long OPT_length;
  1060. long OPT_offset;
  1061. long REP_flags;
  1062. };
  1063. typedef struct T_unitreply_req T_unitreply_req;
  1064. struct T_unitreply_ack {
  1065. long PRIM_type; /* Always T_UREPLY_ACK */
  1066. long SEQ_number;
  1067. long TLI_error;
  1068. long UNIX_error;
  1069. };
  1070. typedef struct T_unitreply_ack T_unitreply_ack;
  1071. struct T_cancelrequest_req {
  1072. long PRIM_type; /* Always T_CANCELREQUEST_REQ */
  1073. long SEQ_number;
  1074. };
  1075. typedef struct T_cancelrequest_req T_cancelrequest_req;
  1076. struct T_cancelreply_req {
  1077. long PRIM_type; /* Always T_CANCELREPLY_REQ */
  1078. long SEQ_number;
  1079. };
  1080. typedef struct T_cancelreply_req T_cancelreply_req;
  1081. struct T_reply_ind {
  1082. long PRIM_type; /* Always T_REPLY_IND */
  1083. long SEQ_number;
  1084. long OPT_length;
  1085. long OPT_offset;
  1086. long REP_flags;
  1087. long TLI_error;
  1088. long UNIX_error;
  1089. };
  1090. typedef struct T_reply_ind T_reply_ind;
  1091. struct T_request_ind {
  1092. long PRIM_type; /* Always T_REQUEST_IND */
  1093. long SEQ_number;
  1094. long OPT_length;
  1095. long OPT_offset;
  1096. long REQ_flags;
  1097. };
  1098. typedef struct T_request_ind T_request_ind;
  1099. struct T_request_req {
  1100. long PRIM_type; /* Always T_REQUEST_REQ */
  1101. long SEQ_number;
  1102. long OPT_length;
  1103. long OPT_offset;
  1104. long REQ_flags;
  1105. };
  1106. typedef struct T_request_req T_request_req;
  1107. struct T_reply_req {
  1108. long PRIM_type; /* Always T_REPLY_REQ */
  1109. long SEQ_number;
  1110. long OPT_length;
  1111. long OPT_offset;
  1112. long REP_flags;
  1113. };
  1114. typedef struct T_reply_req T_reply_req;
  1115. struct T_reply_ack {
  1116. long PRIM_type; /* Always T_REPLY_ACK */
  1117. long SEQ_number;
  1118. long TLI_error;
  1119. long UNIX_error;
  1120. };
  1121. typedef struct T_reply_ack T_reply_ack;
  1122. struct T_regname_req {
  1123. long PRIM_type; /* Always T_REGNAME_REQ */
  1124. long SEQ_number; /* Reply is sequence ack */
  1125. long NAME_length;
  1126. long NAME_offset;
  1127. long ADDR_length;
  1128. long ADDR_offset;
  1129. long REQ_flags;
  1130. };
  1131. typedef struct T_regname_req T_regname_req;
  1132. struct T_regname_ack {
  1133. long PRIM_type; /* always T_REGNAME_ACK */
  1134. long SEQ_number;
  1135. long REG_id;
  1136. long ADDR_length;
  1137. long ADDR_offset;
  1138. };
  1139. typedef struct T_regname_ack T_regname_ack;
  1140. struct T_delname_req {
  1141. long PRIM_type; /* Always T_DELNAME_REQ */
  1142. long SEQ_number; /* Reply is sequence ack */
  1143. long NAME_length;
  1144. long NAME_offset;
  1145. };
  1146. typedef struct T_delname_req T_delname_req;
  1147. struct T_lkupname_req {
  1148. long PRIM_type; /* Always T_LKUPNAME_REQ */
  1149. long SEQ_number; /* Reply is sequence ack */
  1150. long NAME_length; /* ... or T_LKUPNAME_CON */
  1151. long NAME_offset;
  1152. long ADDR_length;
  1153. long ADDR_offset;
  1154. long MAX_number;
  1155. long MAX_milliseconds;
  1156. long REQ_flags;
  1157. };
  1158. typedef struct T_lkupname_req T_lkupname_req;
  1159. struct T_lkupname_con {
  1160. long PRIM_type; /* Either T_LKUPNAME_CON */
  1161. long SEQ_number; /* Or T_LKUPNAME_RES */
  1162. long NAME_length;
  1163. long NAME_offset;
  1164. long RSP_count;
  1165. long RSP_cumcount;
  1166. };
  1167. typedef struct T_lkupname_con T_lkupname_con;
  1168. struct T_sequence_ack {
  1169. long PRIM_type; /* always T_SEQUENCED_ACK */
  1170. long ORIG_prim; /* original primitive */
  1171. long SEQ_number;
  1172. long TLI_error;
  1173. long UNIX_error;
  1174. };
  1175. typedef struct T_sequence_ack T_sequence_ack;
  1176. struct T_event_ind {
  1177. long PRIM_type; /* always T_EVENT_IND */
  1178. long EVENT_code;
  1179. long EVENT_cookie;
  1180. };
  1181. typedef struct T_event_ind T_event_ind;
  1182. union T_primitives {
  1183. long type;
  1184. long primType;
  1185. T_addr_ack taddrack;
  1186. T_bind_ack tbindack;
  1187. T_bind_req tbindreq;
  1188. T_conn_con tconncon;
  1189. T_conn_ind tconnind;
  1190. T_conn_req tconnreq;
  1191. T_conn_res tconnres;
  1192. T_data_ind tdataind;
  1193. T_data_req tdatareq;
  1194. T_discon_ind tdisconind;
  1195. T_discon_req tdisconreq;
  1196. T_exdata_ind texdataind;
  1197. T_exdata_req texdatareq;
  1198. T_error_ack terrorack;
  1199. T_info_ack tinfoack;
  1200. T_info_req tinforeq;
  1201. T_ok_ack tokack;
  1202. T_optmgmt_ack toptmgmtack;
  1203. T_optmgmt_req toptmgmtreq;
  1204. T_ordrel_ind tordrelind;
  1205. T_ordrel_req tordrelreq;
  1206. T_unbind_req tunbindreq;
  1207. T_uderror_ind tuderrorind;
  1208. T_unitdata_ind tunitdataind;
  1209. T_unitdata_req tunitdatareq;
  1210. T_unitreply_ind tunitreplyind;
  1211. T_unitrequest_ind tunitrequestind;
  1212. T_unitrequest_req tunitrequestreq;
  1213. T_unitreply_req tunitreplyreq;
  1214. T_unitreply_ack tunitreplyack;
  1215. T_reply_ind treplyind;
  1216. T_request_ind trequestind;
  1217. T_request_req trequestreq;
  1218. T_reply_req treplyreq;
  1219. T_reply_ack treplyack;
  1220. T_cancelrequest_req tcancelreqreq;
  1221. T_resolveaddr_req tresolvereq;
  1222. T_resolveaddr_ack tresolveack;
  1223. T_regname_req tregnamereq;
  1224. T_regname_ack tregnameack;
  1225. T_delname_req tdelnamereq;
  1226. T_lkupname_req tlkupnamereq;
  1227. T_lkupname_con tlkupnamecon;
  1228. T_sequence_ack tsequenceack;
  1229. T_event_ind teventind;
  1230. };
  1231. typedef union T_primitives T_primitives;
  1232. /* ***** From the Mentat "dlpi.h" ******/
  1233. /*
  1234. This header file has encoded the values so an existing driver
  1235. or user which was written with the Logical Link Interface(LLI)
  1236. can migrate to the DLPI interface in a binary compatible manner.
  1237. Any fields which require a specific format or value are flagged
  1238. with a comment containing the message LLI compatibility.
  1239. */
  1240. /* DLPI revision definition history*/
  1241. enum {
  1242. DL_CURRENT_VERSION = 0x02, /* current version of dlpi */
  1243. DL_VERSION_2 = 0x02 /* version of dlpi March 12,1991 */
  1244. };
  1245. enum {
  1246. DL_INFO_REQ = 0x00, /* Information Req, LLI compatibility */
  1247. DL_INFO_ACK = 0x03, /* Information Ack, LLI compatibility */
  1248. DL_ATTACH_REQ = 0x0B, /* Attach a PPA */
  1249. DL_DETACH_REQ = 0x0C, /* Detach a PPA */
  1250. DL_BIND_REQ = 0x01, /* Bind dlsap address, LLI compatibility */
  1251. DL_BIND_ACK = 0x04, /* Dlsap address bound, LLI compatibility */
  1252. DL_UNBIND_REQ = 0x02, /* Unbind dlsap address, LLI compatibility */
  1253. DL_OK_ACK = 0x06, /* Success acknowledgment, LLI compatibility */
  1254. DL_ERROR_ACK = 0x05, /* Error acknowledgment, LLI compatibility */
  1255. DL_SUBS_BIND_REQ = 0x1B, /* Bind Subsequent DLSAP address */
  1256. DL_SUBS_BIND_ACK = 0x1C, /* Subsequent DLSAP address bound */
  1257. DL_SUBS_UNBIND_REQ = 0x15, /* Subsequent unbind */
  1258. DL_ENABMULTI_REQ = 0x1D, /* Enable multicast addresses */
  1259. DL_DISABMULTI_REQ = 0x1E, /* Disable multicast addresses */
  1260. DL_PROMISCON_REQ = 0x1F, /* Turn on promiscuous mode */
  1261. DL_PROMISCOFF_REQ = 0x20, /* Turn off promiscuous mode */
  1262. DL_UNITDATA_REQ = 0x07, /* datagram send request, LLI compatibility */
  1263. DL_UNITDATA_IND = 0x08, /* datagram receive indication, LLI compatibility */
  1264. DL_UDERROR_IND = 0x09, /* datagram error indication, LLI compatibility */
  1265. DL_UDQOS_REQ = 0x0A, /* set QOS for subsequent datagram transmissions */
  1266. DL_CONNECT_REQ = 0x0D, /* Connect request */
  1267. DL_CONNECT_IND = 0x0E, /* Incoming connect indication */
  1268. DL_CONNECT_RES = 0x0F, /* Accept previous connect indication */
  1269. DL_CONNECT_CON = 0x10, /* Connection established */
  1270. DL_TOKEN_REQ = 0x11, /* Passoff token request */
  1271. DL_TOKEN_ACK = 0x12, /* Passoff token ack */
  1272. DL_DISCONNECT_REQ = 0x13, /* Disconnect request */
  1273. DL_DISCONNECT_IND = 0x14, /* Disconnect indication */
  1274. DL_RESET_REQ = 0x17, /* Reset service request */
  1275. DL_RESET_IND = 0x18, /* Incoming reset indication */
  1276. DL_RESET_RES = 0x19, /* Complete reset processing */
  1277. DL_RESET_CON = 0x1A, /* Reset processing complete */
  1278. DL_DATA_ACK_REQ = 0x21, /* data unit transmission request */
  1279. DL_DATA_ACK_IND = 0x22, /* Arrival of a command PDU */
  1280. DL_DATA_ACK_STATUS_IND = 0x23, /* Status indication of DATA_ACK_REQ*/
  1281. DL_REPLY_REQ = 0x24, /* Request a DLSDU from the remote */
  1282. DL_REPLY_IND = 0x25, /* Arrival of a command PDU */
  1283. DL_REPLY_STATUS_IND = 0x26, /* Status indication of REPLY_REQ */
  1284. DL_REPLY_UPDATE_REQ = 0x27, /* Hold a DLSDU for transmission */
  1285. DL_REPLY_UPDATE_STATUS_IND = 0x28, /* Status of REPLY_UPDATE req */
  1286. DL_XID_REQ = 0x29, /* Request to send an XID PDU */
  1287. DL_XID_IND = 0x2A, /* Arrival of an XID PDU */
  1288. DL_XID_RES = 0x2B, /* request to send a response XID PDU*/
  1289. DL_XID_CON = 0x2C, /* Arrival of a response XID PDU */
  1290. DL_TEST_REQ = 0x2D, /* TEST command request */
  1291. DL_TEST_IND = 0x2E, /* TEST response indication */
  1292. DL_TEST_RES = 0x2F, /* TEST response */
  1293. DL_TEST_CON = 0x30, /* TEST Confirmation */
  1294. DL_PHYS_ADDR_REQ = 0x31, /* Request to get physical addr */
  1295. DL_PHYS_ADDR_ACK = 0x32, /* Return physical addr */
  1296. DL_SET_PHYS_ADDR_REQ = 0x33, /* set physical addr */
  1297. DL_GET_STATISTICS_REQ = 0x34, /* Request to get statistics */
  1298. DL_GET_STATISTICS_ACK = 0x35 /* Return statistics */
  1299. };
  1300. /* DLPI interface states*/
  1301. enum {
  1302. DL_UNATTACHED = 0x04, /* PPA not attached */
  1303. DL_ATTACH_PENDING = 0x05, /* Waiting ack of DL_ATTACH_REQ */
  1304. DL_DETACH_PENDING = 0x06, /* Waiting ack of DL_DETACH_REQ */
  1305. DL_UNBOUND = 0x00, /* PPA attached, LLI compatibility */
  1306. DL_BIND_PENDING = 0x01, /* Waiting ack of DL_BIND_REQ, LLI compatibility */
  1307. DL_UNBIND_PENDING = 0x02, /* Waiting ack of DL_UNBIND_REQ, LLI compatibility */
  1308. DL_IDLE = 0x03, /* dlsap bound, awaiting use, LLI compatibility */
  1309. DL_UDQOS_PENDING = 0x07, /* Waiting ack of DL_UDQOS_REQ */
  1310. DL_OUTCON_PENDING = 0x08, /* outgoing connection, awaiting DL_CONN_CON */
  1311. DL_INCON_PENDING = 0x09, /* incoming connection, awaiting DL_CONN_RES */
  1312. DL_CONN_RES_PENDING = 0x0A, /* Waiting ack of DL_CONNECT_RES */
  1313. DL_DATAXFER = 0x0B, /* connection-oriented data transfer */
  1314. DL_USER_RESET_PENDING = 0x0C, /* user initiated reset, awaiting DL_RESET_CON */
  1315. DL_PROV_RESET_PENDING = 0x0D, /* provider initiated reset, awaiting DL_RESET_RES */
  1316. DL_RESET_RES_PENDING = 0x0E, /* Waiting ack of DL_RESET_RES */
  1317. DL_DISCON8_PENDING = 0x0F, /* Waiting ack of DL_DISC_REQ when in DL_OUTCON_PENDING */
  1318. DL_DISCON9_PENDING = 0x10, /* Waiting ack of DL_DISC_REQ when in DL_INCON_PENDING */
  1319. DL_DISCON11_PENDING = 0x11, /* Waiting ack of DL_DISC_REQ when in DL_DATAXFER */
  1320. DL_DISCON12_PENDING = 0x12, /* Waiting ack of DL_DISC_REQ when in DL_USER_RESET_PENDING */
  1321. DL_DISCON13_PENDING = 0x13, /* Waiting ack of DL_DISC_REQ when in DL_DL_PROV_RESET_PENDING */
  1322. DL_SUBS_BIND_PND = 0x14, /* Waiting ack of DL_SUBS_BIND_REQ */
  1323. DL_SUBS_UNBIND_PND = 0x15 /* Waiting ack of DL_SUBS_UNBIND_REQ */
  1324. };
  1325. /* DL_ERROR_ACK error return values*/
  1326. enum {
  1327. DL_ACCESS = 0x02, /* Improper permissions for request, LLI compatibility */
  1328. DL_BADADDR = 0x01, /* DLSAP address in improper format or invalid */
  1329. DL_BADCORR = 0x05, /* Sequence number not from outstanding DL_CONN_IND */
  1330. DL_BADDATA = 0x06, /* User data exceeded provider limit */
  1331. DL_BADPPA = 0x08, /* Specified PPA was invalid */
  1332. DL_BADPRIM = 0x09, /* Primitive received is not known by DLS provider */
  1333. DL_BADQOSPARAM = 0x0A, /* QOS parameters contained invalid values */
  1334. DL_BADQOSTYPE = 0x0B, /* QOS structure type is unknown or unsupported */
  1335. DL_BADSAP = 0x00, /* Bad LSAP selector, LLI compatibility */
  1336. DL_BADTOKEN = 0x0C, /* Token used not associated with an active stream */
  1337. DL_BOUND = 0x0D, /* Attempted second bind with dl_max_conind or */
  1338. /* dl_conn_mgmt > 0 on same DLSAP or PPA */
  1339. DL_INITFAILED = 0x0E, /* Physical Link initialization failed */
  1340. DL_NOADDR = 0x0F, /* Provider couldn't allocate alternate address */
  1341. DL_NOTINIT = 0x10, /* Physical Link not initialized */
  1342. DL_OUTSTATE = 0x03, /* Primitive issued in improper state, LLI compatibility */
  1343. DL_SYSERR = 0x04, /* UNIX system error occurred, LLI compatibility */
  1344. DL_UNSUPPORTED = 0x07, /* Requested service not supplied by provider */
  1345. DL_UNDELIVERABLE = 0x11, /* Previous data unit could not be delivered */
  1346. DL_NOTSUPPORTED = 0x12, /* Primitive is known but not supported by DLS provider */
  1347. DL_TOOMANY = 0x13, /* limit exceeded */
  1348. DL_NOTENAB = 0x14, /* Promiscuous mode not enabled */
  1349. DL_BUSY = 0x15, /* Other streams for a particular PPA in the post-attached state */
  1350. DL_NOAUTO = 0x16, /* Automatic handling of XID & TEST responses not supported */
  1351. DL_NOXIDAUTO = 0x17, /* Automatic handling of XID not supported */
  1352. DL_NOTESTAUTO = 0x18, /* Automatic handling of TEST not supported */
  1353. DL_XIDAUTO = 0x19, /* Automatic handling of XID response */
  1354. DL_TESTAUTO = 0x1A, /* AUtomatic handling of TEST response*/
  1355. DL_PENDING = 0x1B /* pending outstanding connect indications */
  1356. };
  1357. /* DLPI media types supported*/
  1358. enum {
  1359. DL_CSMACD = 0x00, /* IEEE 802.3 CSMA/CD network, LLI Compatibility */
  1360. DL_TPB = 0x01, /* IEEE 802.4 Token Passing Bus, LLI Compatibility */
  1361. DL_TPR = 0x02, /* IEEE 802.5 Token Passing Ring, LLI Compatibility */
  1362. DL_METRO = 0x03, /* IEEE 802.6 Metro Net, LLI Compatibility */
  1363. DL_ETHER = 0x04, /* Ethernet Bus, LLI Compatibility */
  1364. DL_HDLC = 0x05, /* ISO HDLC protocol support, bit synchronous */
  1365. DL_CHAR = 0x06, /* Character Synchronous protocol support, eg BISYNC */
  1366. DL_CTCA = 0x07, /* IBM Channel-to-Channel Adapter */
  1367. DL_FDDI = 0x08, /* Fiber Distributed data interface */
  1368. DL_OTHER = 0x09 /* Any other medium not listed above */
  1369. };
  1370. /*
  1371. DLPI provider service supported.
  1372. These must be allowed to be bitwise-OR for dl_service_mode in
  1373. DL_INFO_ACK.
  1374. */
  1375. enum {
  1376. DL_CODLS = 0x01, /* support connection-oriented service */
  1377. DL_CLDLS = 0x02, /* support connectionless data link service */
  1378. DL_ACLDLS = 0x04 /* support acknowledged connectionless service*/
  1379. };
  1380. /*
  1381. DLPI provider style.
  1382. The DLPI provider style which determines whether a provider
  1383. requires a DL_ATTACH_REQ to inform the provider which PPA
  1384. user messages should be sent/received on.
  1385. */
  1386. enum {
  1387. DL_STYLE1 = 0x0500, /* PPA is implicitly bound by open(2) */
  1388. DL_STYLE2 = 0x0501 /* PPA must be explicitly bound via DL_ATTACH_REQ */
  1389. };
  1390. /* DLPI Originator for Disconnect and Resets*/
  1391. enum {
  1392. DL_PROVIDER = 0x0700,
  1393. DL_USER = 0x0701
  1394. };
  1395. /* DLPI Disconnect Reasons*/
  1396. enum {
  1397. DL_CONREJ_DEST_UNKNOWN = 0x0800,
  1398. DL_CONREJ_DEST_UNREACH_PERMANENT = 0x0801,
  1399. DL_CONREJ_DEST_UNREACH_TRANSIENT = 0x0802,
  1400. DL_CONREJ_QOS_UNAVAIL_PERMANENT = 0x0803,
  1401. DL_CONREJ_QOS_UNAVAIL_TRANSIENT = 0x0804,
  1402. DL_CONREJ_PERMANENT_COND = 0x0805,
  1403. DL_CONREJ_TRANSIENT_COND = 0x0806,
  1404. DL_DISC_ABNORMAL_CONDITION = 0x0807,
  1405. DL_DISC_NORMAL_CONDITION = 0x0808,
  1406. DL_DISC_PERMANENT_CONDITION = 0x0809,
  1407. DL_DISC_TRANSIENT_CONDITION = 0x080A,
  1408. DL_DISC_UNSPECIFIED = 0x080B
  1409. };
  1410. /* DLPI Reset Reasons*/
  1411. enum {
  1412. DL_RESET_FLOW_CONTROL = 0x0900,
  1413. DL_RESET_LINK_ERROR = 0x0901,
  1414. DL_RESET_RESYNCH = 0x0902
  1415. };
  1416. /* DLPI status values for acknowledged connectionless data transfer*/
  1417. enum {
  1418. DL_CMD_MASK = 0x0F, /* mask for command portion of status */
  1419. DL_CMD_OK = 0x00, /* Command Accepted */
  1420. DL_CMD_RS = 0x01, /* Unimplemented or inactivated service */
  1421. DL_CMD_UE = 0x05, /* Data Link User interface error */
  1422. DL_CMD_PE = 0x06, /* Protocol error */
  1423. DL_CMD_IP = 0x07, /* Permanent implementation dependent error*/
  1424. DL_CMD_UN = 0x09, /* Resources temporarily unavailable */
  1425. DL_CMD_IT = 0x0F, /* Temporary implementation dependent error */
  1426. DL_RSP_MASK = 0xF0, /* mask for response portion of status */
  1427. DL_RSP_OK = 0x00, /* Response DLSDU present */
  1428. DL_RSP_RS = 0x10, /* Unimplemented or inactivated service */
  1429. DL_RSP_NE = 0x30, /* Response DLSDU never submitted */
  1430. DL_RSP_NR = 0x40, /* Response DLSDU not requested */
  1431. DL_RSP_UE = 0x50, /* Data Link User interface error */
  1432. DL_RSP_IP = 0x70, /* Permanent implementation dependent error */
  1433. DL_RSP_UN = 0x90, /* Resources temporarily unavailable */
  1434. DL_RSP_IT = 0xF0 /* Temporary implementation dependent error */
  1435. };
  1436. /* Service Class values for acknowledged connectionless data transfer*/
  1437. enum {
  1438. DL_RQST_RSP = 0x01, /* Use acknowledge capability in MAC sublayer*/
  1439. DL_RQST_NORSP = 0x02 /* No acknowledgement service requested */
  1440. };
  1441. /* DLPI address type definition*/
  1442. enum {
  1443. DL_FACT_PHYS_ADDR = 0x01, /* factory physical address */
  1444. DL_CURR_PHYS_ADDR = 0x02 /* current physical address */
  1445. };
  1446. /* DLPI flag definitions*/
  1447. enum {
  1448. DL_POLL_FINAL = 0x01 /* if set,indicates poll/final bit set*/
  1449. };
  1450. /* XID and TEST responses supported by the provider*/
  1451. enum {
  1452. DL_AUTO_XID = 0x01, /* provider will respond to XID */
  1453. DL_AUTO_TEST = 0x02 /* provider will respond to TEST */
  1454. };
  1455. /* Subsequent bind type*/
  1456. enum {
  1457. DL_PEER_BIND = 0x01, /* subsequent bind on a peer addr */
  1458. DL_HIERARCHICAL_BIND = 0x02 /* subs_bind on a hierarchical addr*/
  1459. };
  1460. /* DLPI promiscuous mode definitions*/
  1461. enum {
  1462. DL_PROMISC_PHYS = 0x01, /* promiscuous mode at phys level */
  1463. DL_PROMISC_SAP = 0x02, /* promiscous mode at sap level */
  1464. DL_PROMISC_MULTI = 0x03 /* promiscuous mode for multicast */
  1465. };
  1466. /* M_DATA "raw" mode */
  1467. #define DLIOCRAW MIOC_CMD(MIOC_DLPI,1)
  1468. /*
  1469. DLPI Quality Of Service definition for use in QOS structure definitions.
  1470. The QOS structures are used in connection establishment, DL_INFO_ACK,
  1471. and setting connectionless QOS values.
  1472. */
  1473. /*
  1474. Throughput
  1475. This parameter is specified for both directions.
  1476. */
  1477. struct dl_through_t {
  1478. SInt32 dl_target_value; /* desired bits/second desired */
  1479. SInt32 dl_accept_value; /* min. acceptable bits/second */
  1480. };
  1481. typedef struct dl_through_t dl_through_t;
  1482. /*
  1483. transit delay specification
  1484. This parameter is specified for both directions.
  1485. expressed in milliseconds assuming a DLSDU size of 128 octets.
  1486. The scaling of the value to the current DLSDU size is provider dependent.
  1487. */
  1488. struct dl_transdelay_t {
  1489. SInt32 dl_target_value; /* desired value of service */
  1490. SInt32 dl_accept_value; /* min. acceptable value of service */
  1491. };
  1492. typedef struct dl_transdelay_t dl_transdelay_t;
  1493. /*
  1494. priority specification
  1495. priority range is 0-100, with 0 being highest value.
  1496. */
  1497. struct dl_priority_t {
  1498. SInt32 dl_min;
  1499. SInt32 dl_max;
  1500. };
  1501. typedef struct dl_priority_t dl_priority_t;
  1502. /* protection specification*/
  1503. enum {
  1504. DL_NONE = 0x0B01, /* no protection supplied */
  1505. DL_MONITOR = 0x0B02, /* protection against passive monitoring */
  1506. DL_MAXIMUM = 0x0B03 /* protection against modification, replay, addition, or deletion */
  1507. };
  1508. struct dl_protect_t {
  1509. SInt32 dl_min;
  1510. SInt32 dl_max;
  1511. };
  1512. typedef struct dl_protect_t dl_protect_t;
  1513. /*
  1514. Resilience specification
  1515. probabilities are scaled by a factor of 10,000 with a time interval
  1516. of 10,000 seconds.
  1517. */
  1518. struct dl_resilience_t {
  1519. SInt32 dl_disc_prob; /* probability of provider init DISC */
  1520. SInt32 dl_reset_prob; /* probability of provider init RESET */
  1521. };
  1522. typedef struct dl_resilience_t dl_resilience_t;
  1523. /*
  1524. QOS type definition to be used for negotiation with the
  1525. remote end of a connection, or a connectionless unitdata request.
  1526. There are two type definitions to handle the negotiation
  1527. process at connection establishment. The typedef dl_qos_range_t
  1528. is used to present a range for parameters. This is used
  1529. in the DL_CONNECT_REQ and DL_CONNECT_IND messages. The typedef
  1530. dl_qos_sel_t is used to select a specific value for the QOS
  1531. parameters. This is used in the DL_CONNECT_RES, DL_CONNECT_CON,
  1532. and DL_INFO_ACK messages to define the selected QOS parameters
  1533. for a connection.
  1534. NOTE
  1535. A DataLink provider which has unknown values for any of the fields
  1536. will use a value of DL_UNKNOWN for all values in the fields.
  1537. NOTE
  1538. A QOS parameter value of DL_QOS_DONT_CARE informs the DLS
  1539. provider the user requesting this value doesn't care
  1540. what the QOS parameter is set to. This value becomes the
  1541. least possible value in the range of QOS parameters.
  1542. The order of the QOS parameter range is then:
  1543. DL_QOS_DONT_CARE < 0 < MAXIMUM QOS VALUE
  1544. */
  1545. enum {
  1546. DL_UNKNOWN = -1,
  1547. DL_QOS_DONT_CARE = -2
  1548. };
  1549. /*
  1550. Every QOS structure has the first 4 bytes containing a type
  1551. field, denoting the definition of the rest of the structure.
  1552. This is used in the same manner has the dl_primitive variable
  1553. is in messages.
  1554. The following list is the defined QOS structure type values and structures.
  1555. */
  1556. enum {
  1557. DL_QOS_CO_RANGE1 = 0x0101, /* QOS range struct. for Connection modeservice */
  1558. DL_QOS_CO_SEL1 = 0x0102, /* QOS selection structure */
  1559. DL_QOS_CL_RANGE1 = 0x0103, /* QOS range struct. for connectionless*/
  1560. DL_QOS_CL_SEL1 = 0x0104 /* QOS selection for connectionless mode*/
  1561. };
  1562. struct dl_qos_co_range1_t {
  1563. UInt32 dl_qos_type;
  1564. dl_through_t dl_rcv_throughput; /* desired and acceptable*/
  1565. dl_transdelay_t dl_rcv_trans_delay; /* desired and acceptable*/
  1566. dl_through_t dl_xmt_throughput;
  1567. dl_transdelay_t dl_xmt_trans_delay;
  1568. dl_priority_t dl_priority; /* min and max values */
  1569. dl_protect_t dl_protection; /* min and max values */
  1570. SInt32 dl_residual_error;
  1571. dl_resilience_t dl_resilience;
  1572. };
  1573. typedef struct dl_qos_co_range1_t dl_qos_co_range1_t;
  1574. struct dl_qos_co_sel1_t {
  1575. UInt32 dl_qos_type;
  1576. SInt32 dl_rcv_throughput;
  1577. SInt32 dl_rcv_trans_delay;
  1578. SInt32 dl_xmt_throughput;
  1579. SInt32 dl_xmt_trans_delay;
  1580. SInt32 dl_priority;
  1581. SInt32 dl_protection;
  1582. SInt32 dl_residual_error;
  1583. dl_resilience_t dl_resilience;
  1584. };
  1585. typedef struct dl_qos_co_sel1_t dl_qos_co_sel1_t;
  1586. struct dl_qos_cl_range1_t {
  1587. UInt32 dl_qos_type;
  1588. dl_transdelay_t dl_trans_delay;
  1589. dl_priority_t dl_priority;
  1590. dl_protect_t dl_protection;
  1591. SInt32 dl_residual_error;
  1592. };
  1593. typedef struct dl_qos_cl_range1_t dl_qos_cl_range1_t;
  1594. struct dl_qos_cl_sel1_t {
  1595. UInt32 dl_qos_type;
  1596. SInt32 dl_trans_delay;
  1597. SInt32 dl_priority;
  1598. SInt32 dl_protection;
  1599. SInt32 dl_residual_error;
  1600. };
  1601. typedef struct dl_qos_cl_sel1_t dl_qos_cl_sel1_t;
  1602. /*
  1603. DLPI interface primitive definitions.
  1604. Each primitive is sent as a stream message. It is possible that
  1605. the messages may be viewed as a sequence of bytes that have the
  1606. following form without any padding. The structure definition
  1607. of the following messages may have to change depending on the
  1608. underlying hardware architecture and crossing of a hardware
  1609. boundary with a different hardware architecture.
  1610. Fields in the primitives having a name of the form
  1611. dl_reserved cannot be used and have the value of
  1612. binary zero, no bits turned on.
  1613. Each message has the name defined followed by the
  1614. stream message type (M_PROTO, M_PCPROTO, M_DATA)
  1615. */
  1616. /* LOCAL MANAGEMENT SERVICE PRIMITIVES*/
  1617. /* DL_INFO_REQ, M_PCPROTO type*/
  1618. struct dl_info_req_t {
  1619. UInt32 dl_primitive; /* set to DL_INFO_REQ */
  1620. };
  1621. typedef struct dl_info_req_t dl_info_req_t;
  1622. /* DL_INFO_ACK, M_PCPROTO type*/
  1623. struct dl_info_ack_t {
  1624. UInt32 dl_primitive; /* set to DL_INFO_ACK */
  1625. UInt32 dl_max_sdu; /* Max bytes in a DLSDU */
  1626. UInt32 dl_min_sdu; /* Min bytes in a DLSDU */
  1627. UInt32 dl_addr_length; /* length of DLSAP address */
  1628. UInt32 dl_mac_type; /* type of medium supported*/
  1629. UInt32 dl_reserved; /* value set to zero */
  1630. UInt32 dl_current_state; /* state of DLPI interface */
  1631. SInt32 dl_sap_length; /* current length of SAP part of dlsap address */
  1632. UInt32 dl_service_mode; /* CO, CL or ACL */
  1633. UInt32 dl_qos_length; /* length of qos values */
  1634. UInt32 dl_qos_offset; /* offset from beg. of block*/
  1635. UInt32 dl_qos_range_length; /* available range of qos */
  1636. UInt32 dl_qos_range_offset; /* offset from beg. of block*/
  1637. UInt32 dl_provider_style; /* style1 or style2 */
  1638. UInt32 dl_addr_offset; /* offset of the dlsap addr */
  1639. UInt32 dl_version; /* version number */
  1640. UInt32 dl_brdcst_addr_length; /* length of broadcast addr */
  1641. UInt32 dl_brdcst_addr_offset; /* offset from beg. of block*/
  1642. UInt32 dl_growth; /* set to zero */
  1643. };
  1644. typedef struct dl_info_ack_t dl_info_ack_t;
  1645. /* DL_ATTACH_REQ, M_PROTO type*/
  1646. struct dl_attach_req_t {
  1647. UInt32 dl_primitive; /* set to DL_ATTACH_REQ*/
  1648. UInt32 dl_ppa; /* id of the PPA */
  1649. };
  1650. typedef struct dl_attach_req_t dl_attach_req_t;
  1651. /* DL_DETACH_REQ, M_PROTO type*/
  1652. struct dl_detach_req_t {
  1653. UInt32 dl_primitive; /* set to DL_DETACH_REQ */
  1654. };
  1655. typedef struct dl_detach_req_t dl_detach_req_t;
  1656. /* DL_BIND_REQ, M_PROTO type*/
  1657. struct dl_bind_req_t {
  1658. UInt32 dl_primitive; /* set to DL_BIND_REQ */
  1659. UInt32 dl_sap; /* info to identify dlsap addr*/
  1660. UInt32 dl_max_conind; /* max # of outstanding con_ind*/
  1661. UInt16 dl_service_mode; /* CO, CL or ACL */
  1662. UInt16 dl_conn_mgmt; /* if non-zero, is con-mgmt stream*/
  1663. UInt32 dl_xidtest_flg; /* if set to 1 indicates automatic initiation of test and xid frames */
  1664. };
  1665. typedef struct dl_bind_req_t dl_bind_req_t;
  1666. /* DL_BIND_ACK, M_PCPROTO type*/
  1667. struct dl_bind_ack_t {
  1668. UInt32 dl_primitive; /* DL_BIND_ACK */
  1669. UInt32 dl_sap; /* DLSAP addr info */
  1670. UInt32 dl_addr_length; /* length of complete DLSAP addr */
  1671. UInt32 dl_addr_offset; /* offset from beginning of M_PCPROTO*/
  1672. UInt32 dl_max_conind; /* allowed max. # of con-ind */
  1673. UInt32 dl_xidtest_flg; /* responses supported by provider*/
  1674. };
  1675. typedef struct dl_bind_ack_t dl_bind_ack_t;
  1676. /* DL_SUBS_BIND_REQ, M_PROTO type*/
  1677. struct dl_subs_bind_req_t {
  1678. UInt32 dl_primitive; /* DL_SUBS_BIND_REQ */
  1679. UInt32 dl_subs_sap_offset; /* offset of subs_sap */
  1680. UInt32 dl_subs_sap_length; /* length of subs_sap */
  1681. UInt32 dl_subs_bind_class; /* peer or hierarchical */
  1682. };
  1683. typedef struct dl_subs_bind_req_t dl_subs_bind_req_t;
  1684. /* DL_SUBS_BIND_ACK, M_PCPROTO type*/
  1685. struct dl_subs_bind_ack_t {
  1686. UInt32 dl_primitive; /* DL_SUBS_BIND_ACK */
  1687. UInt32 dl_subs_sap_offset; /* offset of subs_sap */
  1688. UInt32 dl_subs_sap_length; /* length of subs_sap */
  1689. };
  1690. typedef struct dl_subs_bind_ack_t dl_subs_bind_ack_t;
  1691. /* DL_UNBIND_REQ, M_PROTO type*/
  1692. struct dl_unbind_req_t {
  1693. UInt32 dl_primitive; /* DL_UNBIND_REQ */
  1694. };
  1695. typedef struct dl_unbind_req_t dl_unbind_req_t;
  1696. /* DL_SUBS_UNBIND_REQ, M_PROTO type*/
  1697. struct dl_subs_unbind_req_t {
  1698. UInt32 dl_primitive; /* DL_SUBS_UNBIND_REQ */
  1699. UInt32 dl_subs_sap_offset; /* offset of subs_sap */
  1700. UInt32 dl_subs_sap_length; /* length of subs_sap */
  1701. };
  1702. typedef struct dl_subs_unbind_req_t dl_subs_unbind_req_t;
  1703. /* DL_OK_ACK, M_PCPROTO type*/
  1704. struct dl_ok_ack_t {
  1705. UInt32 dl_primitive; /* DL_OK_ACK */
  1706. UInt32 dl_correct_primitive; /* primitive being acknowledged */
  1707. };
  1708. typedef struct dl_ok_ack_t dl_ok_ack_t;
  1709. /* DL_ERROR_ACK, M_PCPROTO type*/
  1710. struct dl_error_ack_t {
  1711. UInt32 dl_primitive; /* DL_ERROR_ACK */
  1712. UInt32 dl_error_primitive; /* primitive in error */
  1713. UInt32 dl_errno; /* DLPI error code */
  1714. UInt32 dl_unix_errno; /* UNIX system error code */
  1715. };
  1716. typedef struct dl_error_ack_t dl_error_ack_t;
  1717. /* DL_ENABMULTI_REQ, M_PROTO type*/
  1718. struct dl_enabmulti_req_t {
  1719. UInt32 dl_primitive; /* DL_ENABMULTI_REQ */
  1720. UInt32 dl_addr_length; /* length of multicast address */
  1721. UInt32 dl_addr_offset; /* offset from beg. of M_PROTO block*/
  1722. };
  1723. typedef struct dl_enabmulti_req_t dl_enabmulti_req_t;
  1724. /* DL_DISABMULTI_REQ, M_PROTO type*/
  1725. struct dl_disabmulti_req_t {
  1726. UInt32 dl_primitive; /* DL_DISABMULTI_REQ */
  1727. UInt32 dl_addr_length; /* length of multicast address */
  1728. UInt32 dl_addr_offset; /* offset from beg. of M_PROTO block*/
  1729. };
  1730. typedef struct dl_disabmulti_req_t dl_disabmulti_req_t;
  1731. /* DL_PROMISCON_REQ, M_PROTO type*/
  1732. struct dl_promiscon_req_t {
  1733. UInt32 dl_primitive; /* DL_PROMISCON_REQ */
  1734. UInt32 dl_level; /* physical,SAP level or ALL multicast*/
  1735. };
  1736. typedef struct dl_promiscon_req_t dl_promiscon_req_t;
  1737. /* DL_PROMISCOFF_REQ, M_PROTO type*/
  1738. struct dl_promiscoff_req_t {
  1739. UInt32 dl_primitive; /* DL_PROMISCOFF_REQ */
  1740. UInt32 dl_level; /* Physical,SAP level or ALL multicast*/
  1741. };
  1742. typedef struct dl_promiscoff_req_t dl_promiscoff_req_t;
  1743. /* Primitives to get and set the Physical address*/
  1744. /* DL_PHYS_ADDR_REQ, M_PROTO type*/
  1745. struct dl_phys_addr_req_t {
  1746. UInt32 dl_primitive; /* DL_PHYS_ADDR_REQ */
  1747. UInt32 dl_addr_type; /* factory or current physical addr */
  1748. };
  1749. typedef struct dl_phys_addr_req_t dl_phys_addr_req_t;
  1750. /* DL_PHYS_ADDR_ACK, M_PCPROTO type*/
  1751. struct dl_phys_addr_ack_t {
  1752. UInt32 dl_primitive; /* DL_PHYS_ADDR_ACK */
  1753. UInt32 dl_addr_length; /* length of the physical addr */
  1754. UInt32 dl_addr_offset; /* offset from beg. of block */
  1755. };
  1756. typedef struct dl_phys_addr_ack_t dl_phys_addr_ack_t;
  1757. /* DL_SET_PHYS_ADDR_REQ, M_PROTO type*/
  1758. struct dl_set_phys_addr_req_t {
  1759. UInt32 dl_primitive; /* DL_SET_PHYS_ADDR_REQ */
  1760. UInt32 dl_addr_length; /* length of physical addr */
  1761. UInt32 dl_addr_offset; /* offset from beg. of block */
  1762. };
  1763. typedef struct dl_set_phys_addr_req_t dl_set_phys_addr_req_t;
  1764. /* Primitives to get statistics*/
  1765. /* DL_GET_STATISTICS_REQ, M_PROTO type*/
  1766. struct dl_get_statistics_req_t {
  1767. UInt32 dl_primitive; /* DL_GET_STATISTICS_REQ */
  1768. };
  1769. typedef struct dl_get_statistics_req_t dl_get_statistics_req_t;
  1770. /* DL_GET_STATISTICS_ACK, M_PCPROTO type*/
  1771. struct dl_get_statistics_ack_t {
  1772. UInt32 dl_primitive; /* DL_GET_STATISTICS_ACK */
  1773. UInt32 dl_stat_length; /* length of statistics structure*/
  1774. UInt32 dl_stat_offset; /* offset from beg. of block */
  1775. };
  1776. typedef struct dl_get_statistics_ack_t dl_get_statistics_ack_t;
  1777. /* CONNECTION-ORIENTED SERVICE PRIMITIVES*/
  1778. /* DL_CONNECT_REQ, M_PROTO type*/
  1779. struct dl_connect_req_t {
  1780. UInt32 dl_primitive; /* DL_CONNECT_REQ */
  1781. UInt32 dl_dest_addr_length; /* len. of dlsap addr*/
  1782. UInt32 dl_dest_addr_offset; /* offset */
  1783. UInt32 dl_qos_length; /* len. of QOS parm val*/
  1784. UInt32 dl_qos_offset; /* offset */
  1785. UInt32 dl_growth; /* set to zero */
  1786. };
  1787. typedef struct dl_connect_req_t dl_connect_req_t;
  1788. /* DL_CONNECT_IND, M_PROTO type*/
  1789. struct dl_connect_ind_t {
  1790. UInt32 dl_primitive; /* DL_CONNECT_IND */
  1791. UInt32 dl_correlation; /* provider's correlation token*/
  1792. UInt32 dl_called_addr_length; /* length of called address */
  1793. UInt32 dl_called_addr_offset; /* offset from beginning of block */
  1794. UInt32 dl_calling_addr_length; /* length of calling address */
  1795. UInt32 dl_calling_addr_offset; /* offset from beginning of block */
  1796. UInt32 dl_qos_length; /* length of qos structure */
  1797. UInt32 dl_qos_offset; /* offset from beginning of block */
  1798. UInt32 dl_growth; /* set to zero */
  1799. };
  1800. typedef struct dl_connect_ind_t dl_connect_ind_t;
  1801. /* DL_CONNECT_RES, M_PROTO type*/
  1802. struct dl_connect_res_t {
  1803. UInt32 dl_primitive; /* DL_CONNECT_RES */
  1804. UInt32 dl_correlation; /* provider's correlation token */
  1805. UInt32 dl_resp_token; /* token associated with responding stream */
  1806. UInt32 dl_qos_length; /* length of qos structure */
  1807. UInt32 dl_qos_offset; /* offset from beginning of block */
  1808. UInt32 dl_growth; /* set to zero */
  1809. };
  1810. typedef struct dl_connect_res_t dl_connect_res_t;
  1811. /* DL_CONNECT_CON, M_PROTO type*/
  1812. struct dl_connect_con_t {
  1813. UInt32 dl_primitive; /* DL_CONNECT_CON*/
  1814. UInt32 dl_resp_addr_length; /* length of responder's address */
  1815. UInt32 dl_resp_addr_offset; /* offset from beginning of block*/
  1816. UInt32 dl_qos_length; /* length of qos structure */
  1817. UInt32 dl_qos_offset; /* offset from beginning of block*/
  1818. UInt32 dl_growth; /* set to zero */
  1819. };
  1820. typedef struct dl_connect_con_t dl_connect_con_t;
  1821. /* DL_TOKEN_REQ, M_PCPROTO type*/
  1822. struct dl_token_req_t {
  1823. UInt32 dl_primitive; /* DL_TOKEN_REQ */
  1824. };
  1825. typedef struct dl_token_req_t dl_token_req_t;
  1826. /* DL_TOKEN_ACK, M_PCPROTO type*/
  1827. struct dl_token_ack_t {
  1828. UInt32 dl_primitive; /* DL_TOKEN_ACK */
  1829. UInt32 dl_token; /* Connection response token associated with the stream */
  1830. };
  1831. typedef struct dl_token_ack_t dl_token_ack_t;
  1832. /* DL_DISCONNECT_REQ, M_PROTO type*/
  1833. struct dl_disconnect_req_t {
  1834. UInt32 dl_primitive; /* DL_DISCONNECT_REQ */
  1835. UInt32 dl_reason; /*normal, abnormal, perm. or transient*/
  1836. UInt32 dl_correlation; /* association with connect_ind */
  1837. };
  1838. typedef struct dl_disconnect_req_t dl_disconnect_req_t;
  1839. /* DL_DISCONNECT_IND, M_PROTO type*/
  1840. struct dl_disconnect_ind_t {
  1841. UInt32 dl_primitive; /* DL_DISCONNECT_IND */
  1842. UInt32 dl_originator; /* USER or PROVIDER */
  1843. UInt32 dl_reason; /* permanent or transient */
  1844. UInt32 dl_correlation; /* association with connect_ind */
  1845. };
  1846. typedef struct dl_disconnect_ind_t dl_disconnect_ind_t;
  1847. /* DL_RESET_REQ, M_PROTO type*/
  1848. struct dl_reset_req_t {
  1849. UInt32 dl_primitive; /* DL_RESET_REQ */
  1850. };
  1851. typedef struct dl_reset_req_t dl_reset_req_t;
  1852. /* DL_RESET_IND, M_PROTO type*/
  1853. struct dl_reset_ind_t {
  1854. UInt32 dl_primitive; /* DL_RESET_IND */
  1855. UInt32 dl_originator; /* Provider or User */
  1856. UInt32 dl_reason; /* flow control, link error or resynch*/
  1857. };
  1858. typedef struct dl_reset_ind_t dl_reset_ind_t;
  1859. /* DL_RESET_RES, M_PROTO type*/
  1860. struct dl_reset_res_t {
  1861. UInt32 dl_primitive; /* DL_RESET_RES */
  1862. };
  1863. typedef struct dl_reset_res_t dl_reset_res_t;
  1864. /* DL_RESET_CON, M_PROTO type*/
  1865. struct dl_reset_con_t {
  1866. UInt32 dl_primitive; /* DL_RESET_CON */
  1867. };
  1868. typedef struct dl_reset_con_t dl_reset_con_t;
  1869. /* CONNECTIONLESS SERVICE PRIMITIVES*/
  1870. /* DL_UNITDATA_REQ, M_PROTO type, with M_DATA block(s)*/
  1871. struct dl_unitdata_req_t {
  1872. UInt32 dl_primitive; /* DL_UNITDATA_REQ */
  1873. UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
  1874. UInt32 dl_dest_addr_offset; /* offset from beg. of block */
  1875. dl_priority_t dl_priority; /* priority value */
  1876. };
  1877. typedef struct dl_unitdata_req_t dl_unitdata_req_t;
  1878. /* DL_UNITDATA_IND, M_PROTO type, with M_DATA block(s)*/
  1879. struct dl_unitdata_ind_t {
  1880. UInt32 dl_primitive; /* DL_UNITDATA_IND */
  1881. UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
  1882. UInt32 dl_dest_addr_offset; /* offset from beg. of block */
  1883. UInt32 dl_src_addr_length; /* DLSAP addr length of sending user*/
  1884. UInt32 dl_src_addr_offset; /* offset from beg. of block */
  1885. UInt32 dl_group_address; /* set to one if multicast/broadcast*/
  1886. };
  1887. typedef struct dl_unitdata_ind_t dl_unitdata_ind_t;
  1888. /*
  1889. DL_UDERROR_IND, M_PROTO type
  1890. (or M_PCPROTO type if LLI-based provider)
  1891. */
  1892. struct dl_uderror_ind_t {
  1893. UInt32 dl_primitive; /* DL_UDERROR_IND */
  1894. UInt32 dl_dest_addr_length; /* Destination DLSAP */
  1895. UInt32 dl_dest_addr_offset; /* Offset from beg. of block */
  1896. UInt32 dl_unix_errno; /* unix system error code*/
  1897. UInt32 dl_errno; /* DLPI error code */
  1898. };
  1899. typedef struct dl_uderror_ind_t dl_uderror_ind_t;
  1900. /* DL_UDQOS_REQ, M_PROTO type*/
  1901. struct dl_udqos_req_t {
  1902. UInt32 dl_primitive; /* DL_UDQOS_REQ */
  1903. UInt32 dl_qos_length; /* length in bytes of requested qos*/
  1904. UInt32 dl_qos_offset; /* offset from beg. of block */
  1905. };
  1906. typedef struct dl_udqos_req_t dl_udqos_req_t;
  1907. /* Primitives to handle XID and TEST operations*/
  1908. /* DL_TEST_REQ, M_PROTO type*/
  1909. struct dl_test_req_t {
  1910. UInt32 dl_primitive; /* DL_TEST_REQ */
  1911. UInt32 dl_flag; /* poll/final */
  1912. UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
  1913. UInt32 dl_dest_addr_offset; /* offset from beg. of block */
  1914. };
  1915. typedef struct dl_test_req_t dl_test_req_t;
  1916. /* DL_TEST_IND, M_PROTO type*/
  1917. struct dl_test_ind_t {
  1918. UInt32 dl_primitive; /* DL_TEST_IND */
  1919. UInt32 dl_flag; /* poll/final */
  1920. UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
  1921. UInt32 dl_dest_addr_offset; /* offset from beg. of block */
  1922. UInt32 dl_src_addr_length; /* dlsap length of source user */
  1923. UInt32 dl_src_addr_offset; /* offset from beg. of block */
  1924. };
  1925. typedef struct dl_test_ind_t dl_test_ind_t;
  1926. /* DL_TEST_RES, M_PROTO type*/
  1927. struct dl_test_res_t {
  1928. UInt32 dl_primitive; /* DL_TEST_RES */
  1929. UInt32 dl_flag; /* poll/final */
  1930. UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
  1931. UInt32 dl_dest_addr_offset; /* offset from beg. of block */
  1932. };
  1933. typedef struct dl_test_res_t dl_test_res_t;
  1934. /* DL_TEST_CON, M_PROTO type*/
  1935. struct dl_test_con_t {
  1936. UInt32 dl_primitive; /* DL_TEST_CON */
  1937. UInt32 dl_flag; /* poll/final */
  1938. UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
  1939. UInt32 dl_dest_addr_offset; /* offset from beg. of block */
  1940. UInt32 dl_src_addr_length; /* dlsap length of source user */
  1941. UInt32 dl_src_addr_offset; /* offset from beg. of block */
  1942. };
  1943. typedef struct dl_test_con_t dl_test_con_t;
  1944. /* DL_XID_REQ, M_PROTO type*/
  1945. struct dl_xid_req_t {
  1946. UInt32 dl_primitive; /* DL_XID_REQ */
  1947. UInt32 dl_flag; /* poll/final */
  1948. UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
  1949. UInt32 dl_dest_addr_offset; /* offset from beg. of block */
  1950. };
  1951. typedef struct dl_xid_req_t dl_xid_req_t;
  1952. /* DL_XID_IND, M_PROTO type*/
  1953. struct dl_xid_ind_t {
  1954. UInt32 dl_primitive; /* DL_XID_IND */
  1955. UInt32 dl_flag; /* poll/final */
  1956. UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
  1957. UInt32 dl_dest_addr_offset; /* offset from beg. of block */
  1958. UInt32 dl_src_addr_length; /* dlsap length of source user */
  1959. UInt32 dl_src_addr_offset; /* offset from beg. of block */
  1960. };
  1961. typedef struct dl_xid_ind_t dl_xid_ind_t;
  1962. /* DL_XID_RES, M_PROTO type*/
  1963. struct dl_xid_res_t {
  1964. UInt32 dl_primitive; /* DL_XID_RES */
  1965. UInt32 dl_flag; /* poll/final */
  1966. UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
  1967. UInt32 dl_dest_addr_offset; /* offset from beg. of block */
  1968. };
  1969. typedef struct dl_xid_res_t dl_xid_res_t;
  1970. /* DL_XID_CON, M_PROTO type*/
  1971. struct dl_xid_con_t {
  1972. UInt32 dl_primitive; /* DL_XID_CON */
  1973. UInt32 dl_flag; /* poll/final */
  1974. UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
  1975. UInt32 dl_dest_addr_offset; /* offset from beg. of block */
  1976. UInt32 dl_src_addr_length; /* dlsap length of source user */
  1977. UInt32 dl_src_addr_offset; /* offset from beg. of block */
  1978. };
  1979. typedef struct dl_xid_con_t dl_xid_con_t;
  1980. /* ACKNOWLEDGED CONNECTIONLESS SERVICE PRIMITIVES*/
  1981. /* DL_DATA_ACK_REQ, M_PROTO type*/
  1982. struct dl_data_ack_req_t {
  1983. UInt32 dl_primitive; /* DL_DATA_ACK_REQ */
  1984. UInt32 dl_correlation; /* User's correlation token */
  1985. UInt32 dl_dest_addr_length; /* length of destination addr */
  1986. UInt32 dl_dest_addr_offset; /* offset from beginning of block */
  1987. UInt32 dl_src_addr_length; /* length of source address */
  1988. UInt32 dl_src_addr_offset; /* offset from beginning of block */
  1989. UInt32 dl_priority; /* priority */
  1990. UInt32 dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */
  1991. };
  1992. typedef struct dl_data_ack_req_t dl_data_ack_req_t;
  1993. /* DL_DATA_ACK_IND, M_PROTO type*/
  1994. struct dl_data_ack_ind_t {
  1995. UInt32 dl_primitive; /* DL_DATA_ACK_IND */
  1996. UInt32 dl_dest_addr_length; /* length of destination addr */
  1997. UInt32 dl_dest_addr_offset; /* offset from beginning of block */
  1998. UInt32 dl_src_addr_length; /* length of source address */
  1999. UInt32 dl_src_addr_offset; /* offset from beginning of block */
  2000. UInt32 dl_priority; /* priority for data unit transm. */
  2001. UInt32 dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */
  2002. };
  2003. typedef struct dl_data_ack_ind_t dl_data_ack_ind_t;
  2004. /* DL_DATA_ACK_STATUS_IND, M_PROTO type*/
  2005. struct dl_data_ack_status_ind_t {
  2006. UInt32 dl_primitive; /* DL_DATA_ACK_STATUS_IND */
  2007. UInt32 dl_correlation; /* User's correlation token */
  2008. UInt32 dl_status; /* success or failure of previous req*/
  2009. };
  2010. typedef struct dl_data_ack_status_ind_t dl_data_ack_status_ind_t;
  2011. /* DL_REPLY_REQ, M_PROTO type*/
  2012. struct dl_reply_req_t {
  2013. UInt32 dl_primitive; /* DL_REPLY_REQ */
  2014. UInt32 dl_correlation; /* User's correlation token */
  2015. UInt32 dl_dest_addr_length; /* length of destination address */
  2016. UInt32 dl_dest_addr_offset; /* offset from beginning of block */
  2017. UInt32 dl_src_addr_length; /* source address length */
  2018. UInt32 dl_src_addr_offset; /* offset from beginning of block */
  2019. UInt32 dl_priority; /* priority for data unit transmission*/
  2020. UInt32 dl_service_class;
  2021. };
  2022. typedef struct dl_reply_req_t dl_reply_req_t;
  2023. /* DL_REPLY_IND, M_PROTO type*/
  2024. struct dl_reply_ind_t {
  2025. UInt32 dl_primitive; /* DL_REPLY_IND */
  2026. UInt32 dl_dest_addr_length; /* length of destination address */
  2027. UInt32 dl_dest_addr_offset; /* offset from beginning of block*/
  2028. UInt32 dl_src_addr_length; /* length of source address */
  2029. UInt32 dl_src_addr_offset; /* offset from beginning of block */
  2030. UInt32 dl_priority; /* priority for data unit transmission*/
  2031. UInt32 dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */
  2032. };
  2033. typedef struct dl_reply_ind_t dl_reply_ind_t;
  2034. /* DL_REPLY_STATUS_IND, M_PROTO type*/
  2035. struct dl_reply_status_ind_t {
  2036. UInt32 dl_primitive; /* DL_REPLY_STATUS_IND */
  2037. UInt32 dl_correlation; /* User's correlation token */
  2038. UInt32 dl_status; /* success or failure of previous req*/
  2039. };
  2040. typedef struct dl_reply_status_ind_t dl_reply_status_ind_t;
  2041. /* DL_REPLY_UPDATE_REQ, M_PROTO type*/
  2042. struct dl_reply_update_req_t {
  2043. UInt32 dl_primitive; /* DL_REPLY_UPDATE_REQ */
  2044. UInt32 dl_correlation; /* user's correlation token */
  2045. UInt32 dl_src_addr_length; /* length of source address */
  2046. UInt32 dl_src_addr_offset; /* offset from beginning of block */
  2047. };
  2048. typedef struct dl_reply_update_req_t dl_reply_update_req_t;
  2049. /* DL_REPLY_UPDATE_STATUS_IND, M_PROTO type*/
  2050. struct dl_reply_update_status_ind_t {
  2051. UInt32 dl_primitive; /* DL_REPLY_UPDATE_STATUS_IND */
  2052. UInt32 dl_correlation; /* User's correlation token */
  2053. UInt32 dl_status; /* success or failure of previous req*/
  2054. };
  2055. typedef struct dl_reply_update_status_ind_t dl_reply_update_status_ind_t;
  2056. union DL_primitives {
  2057. UInt32 dl_primitive;
  2058. dl_info_req_t info_req;
  2059. dl_info_ack_t info_ack;
  2060. dl_attach_req_t attach_req;
  2061. dl_detach_req_t detach_req;
  2062. dl_bind_req_t bind_req;
  2063. dl_bind_ack_t bind_ack;
  2064. dl_unbind_req_t unbind_req;
  2065. dl_subs_bind_req_t subs_bind_req;
  2066. dl_subs_bind_ack_t subs_bind_ack;
  2067. dl_subs_unbind_req_t subs_unbind_req;
  2068. dl_ok_ack_t ok_ack;
  2069. dl_error_ack_t error_ack;
  2070. dl_connect_req_t connect_req;
  2071. dl_connect_ind_t connect_ind;
  2072. dl_connect_res_t connect_res;
  2073. dl_connect_con_t connect_con;
  2074. dl_token_req_t token_req;
  2075. dl_token_ack_t token_ack;
  2076. dl_disconnect_req_t disconnect_req;
  2077. dl_disconnect_ind_t disconnect_ind;
  2078. dl_reset_req_t reset_req;
  2079. dl_reset_ind_t reset_ind;
  2080. dl_reset_res_t reset_res;
  2081. dl_reset_con_t reset_con;
  2082. dl_unitdata_req_t unitdata_req;
  2083. dl_unitdata_ind_t unitdata_ind;
  2084. dl_uderror_ind_t uderror_ind;
  2085. dl_udqos_req_t udqos_req;
  2086. dl_enabmulti_req_t enabmulti_req;
  2087. dl_disabmulti_req_t disabmulti_req;
  2088. dl_promiscon_req_t promiscon_req;
  2089. dl_promiscoff_req_t promiscoff_req;
  2090. dl_phys_addr_req_t physaddr_req;
  2091. dl_phys_addr_ack_t physaddr_ack;
  2092. dl_set_phys_addr_req_t set_physaddr_req;
  2093. dl_get_statistics_req_t get_statistics_req;
  2094. dl_get_statistics_ack_t get_statistics_ack;
  2095. dl_test_req_t test_req;
  2096. dl_test_ind_t test_ind;
  2097. dl_test_res_t test_res;
  2098. dl_test_con_t test_con;
  2099. dl_xid_req_t xid_req;
  2100. dl_xid_ind_t xid_ind;
  2101. dl_xid_res_t xid_res;
  2102. dl_xid_con_t xid_con;
  2103. dl_data_ack_req_t data_ack_req;
  2104. dl_data_ack_ind_t data_ack_ind;
  2105. dl_data_ack_status_ind_t data_ack_status_ind;
  2106. dl_reply_req_t reply_req;
  2107. dl_reply_ind_t reply_ind;
  2108. dl_reply_status_ind_t reply_status_ind;
  2109. dl_reply_update_req_t reply_update_req;
  2110. dl_reply_update_status_ind_t reply_update_status_ind;
  2111. };
  2112. typedef union DL_primitives DL_primitives;
  2113. enum {
  2114. DL_INFO_REQ_SIZE = sizeof(dl_info_req_t),
  2115. DL_INFO_ACK_SIZE = sizeof(dl_info_ack_t),
  2116. DL_ATTACH_REQ_SIZE = sizeof(dl_attach_req_t),
  2117. DL_DETACH_REQ_SIZE = sizeof(dl_detach_req_t),
  2118. DL_BIND_REQ_SIZE = sizeof(dl_bind_req_t),
  2119. DL_BIND_ACK_SIZE = sizeof(dl_bind_ack_t),
  2120. DL_UNBIND_REQ_SIZE = sizeof(dl_unbind_req_t),
  2121. DL_SUBS_BIND_REQ_SIZE = sizeof(dl_subs_bind_req_t),
  2122. DL_SUBS_BIND_ACK_SIZE = sizeof(dl_subs_bind_ack_t),
  2123. DL_SUBS_UNBIND_REQ_SIZE = sizeof(dl_subs_unbind_req_t),
  2124. DL_OK_ACK_SIZE = sizeof(dl_ok_ack_t),
  2125. DL_ERROR_ACK_SIZE = sizeof(dl_error_ack_t),
  2126. DL_CONNECT_REQ_SIZE = sizeof(dl_connect_req_t),
  2127. DL_CONNECT_IND_SIZE = sizeof(dl_connect_ind_t),
  2128. DL_CONNECT_RES_SIZE = sizeof(dl_connect_res_t),
  2129. DL_CONNECT_CON_SIZE = sizeof(dl_connect_con_t),
  2130. DL_TOKEN_REQ_SIZE = sizeof(dl_token_req_t),
  2131. DL_TOKEN_ACK_SIZE = sizeof(dl_token_ack_t),
  2132. DL_DISCONNECT_REQ_SIZE = sizeof(dl_disconnect_req_t),
  2133. DL_DISCONNECT_IND_SIZE = sizeof(dl_disconnect_ind_t),
  2134. DL_RESET_REQ_SIZE = sizeof(dl_reset_req_t),
  2135. DL_RESET_IND_SIZE = sizeof(dl_reset_ind_t),
  2136. DL_RESET_RES_SIZE = sizeof(dl_reset_res_t),
  2137. DL_RESET_CON_SIZE = sizeof(dl_reset_con_t),
  2138. DL_UNITDATA_REQ_SIZE = sizeof(dl_unitdata_req_t),
  2139. DL_UNITDATA_IND_SIZE = sizeof(dl_unitdata_ind_t),
  2140. DL_UDERROR_IND_SIZE = sizeof(dl_uderror_ind_t),
  2141. DL_UDQOS_REQ_SIZE = sizeof(dl_udqos_req_t),
  2142. DL_ENABMULTI_REQ_SIZE = sizeof(dl_enabmulti_req_t),
  2143. DL_DISABMULTI_REQ_SIZE = sizeof(dl_disabmulti_req_t),
  2144. DL_PROMISCON_REQ_SIZE = sizeof(dl_promiscon_req_t),
  2145. DL_PROMISCOFF_REQ_SIZE = sizeof(dl_promiscoff_req_t),
  2146. DL_PHYS_ADDR_REQ_SIZE = sizeof(dl_phys_addr_req_t),
  2147. DL_PHYS_ADDR_ACK_SIZE = sizeof(dl_phys_addr_ack_t),
  2148. DL_SET_PHYS_ADDR_REQ_SIZE = sizeof(dl_set_phys_addr_req_t),
  2149. DL_GET_STATISTICS_REQ_SIZE = sizeof(dl_get_statistics_req_t),
  2150. DL_GET_STATISTICS_ACK_SIZE = sizeof(dl_get_statistics_ack_t),
  2151. DL_XID_REQ_SIZE = sizeof(dl_xid_req_t),
  2152. DL_XID_IND_SIZE = sizeof(dl_xid_ind_t),
  2153. DL_XID_RES_SIZE = sizeof(dl_xid_res_t),
  2154. DL_XID_CON_SIZE = sizeof(dl_xid_con_t),
  2155. DL_TEST_REQ_SIZE = sizeof(dl_test_req_t),
  2156. DL_TEST_IND_SIZE = sizeof(dl_test_ind_t),
  2157. DL_TEST_RES_SIZE = sizeof(dl_test_res_t),
  2158. DL_TEST_CON_SIZE = sizeof(dl_test_con_t),
  2159. DL_DATA_ACK_REQ_SIZE = sizeof(dl_data_ack_req_t),
  2160. DL_DATA_ACK_IND_SIZE = sizeof(dl_data_ack_ind_t),
  2161. DL_DATA_ACK_STATUS_IND_SIZE = sizeof(dl_data_ack_status_ind_t),
  2162. DL_REPLY_REQ_SIZE = sizeof(dl_reply_req_t),
  2163. DL_REPLY_IND_SIZE = sizeof(dl_reply_ind_t),
  2164. DL_REPLY_STATUS_IND_SIZE = sizeof(dl_reply_status_ind_t),
  2165. DL_REPLY_UPDATE_REQ_SIZE = sizeof(dl_reply_update_req_t),
  2166. DL_REPLY_UPDATE_STATUS_IND_SIZE = sizeof(dl_reply_update_status_ind_t)
  2167. };
  2168. enum {
  2169. DL_IOC_HDR_INFO = ((MIOC_DLPI << 8) | 10) /* Fast path request */
  2170. };
  2171. /* ***** From the Mentat "modnames.h" ******/
  2172. #define MI_AFU_NAME "afu"
  2173. #define MI_AHARP_NAME "ahar"
  2174. #define MI_AHENET_NAME "ahen"
  2175. #define MI_ARP_NAME "arp"
  2176. #define MI_ARPM_NAME "arpm"
  2177. #define MI_COURMUX_NAME "courmux"
  2178. #define MI_CLONE_NAME "clone"
  2179. #define MI_DLB_NAME "dlb"
  2180. #define MI_DLM_NAME "dlm"
  2181. #define MI_DMODD_NAME "disdlpi"
  2182. #define MI_DMODT_NAME "distpi"
  2183. #define MI_DN_NAME "dn"
  2184. #define MI_DNF_NAME "dnf"
  2185. #define MI_DRVE_NAME "drve"
  2186. #define MI_ECHO_NAME "echo"
  2187. #define MI_ENXR_NAME "enxr"
  2188. #define MI_RAWIP_NAME "rawip"
  2189. #define MI_RAWIPM_NAME "rawipm"
  2190. #define MI_HAVOC_NAME "havoc"
  2191. #define MI_HAVOCM_NAME "havocm"
  2192. #define MI_IP_NAME "ip"
  2193. #define MI_IPM_NAME "ipm"
  2194. #define MI_IPX_NAME "ipx"
  2195. #define MI_LOG_NAME "log"
  2196. #define MI_MODE_NAME "mode"
  2197. #define MI_MUX_NAME "mux"
  2198. #define MI_NECHO_NAME "necho"
  2199. #define MI_NPEP_NAME "npep"
  2200. #define MI_NULS_NAME "nuls"
  2201. #define MI_NULZ_NAME "nulz"
  2202. #define MI_PASS_NAME "pass"
  2203. #define MI_PIPEMOD_NAME "pipemod"
  2204. #define MI_SAD_NAME "sad"
  2205. #define MI_SC_NAME "sc"
  2206. #define MI_SOCKMOD_NAME "sockmod"
  2207. #define MI_SPASS_NAME "spass"
  2208. #define MI_SPX_NAME "spx"
  2209. #define MI_STH_NAME "mi_sth"
  2210. #define MI_TCP_NAME "tcp"
  2211. #define MI_TCPM_NAME "tcpm"
  2212. #define MI_TIMOD_NAME "timod"
  2213. #define MI_TIRDWR_NAME "tirdwr"
  2214. #define MI_TMOD_NAME "tmod"
  2215. #define MI_TMUX_NAME "tmux"
  2216. #define MI_TPIT_NAME "tpit"
  2217. #define MI_TRSR_NAME "trsr"
  2218. #define MI_TRXR_NAME "trxr"
  2219. #define MI_UDP_NAME "udp"
  2220. #define MI_UDPM_NAME "udpm"
  2221. #define MI_WELD_NAME "mi_weld"
  2222. #define MI_XDG_NAME "xdg"
  2223. #define MI_XECHO_NAME "xecho"
  2224. #define MI_XF_NAME "xf"
  2225. #define MI_XFIPX_NAME "xfipx"
  2226. #define MI_XFXNS_NAME "xfxns"
  2227. #define MI_XPE_NAME "xpe"
  2228. #define MI_XS_NAME "xs"
  2229. #define MI_XTINDG_NAME "xtindg"
  2230. #define MI_XTINVC_NAME "xtinvc"
  2231. #define MI_XTM_NAME "xtm"
  2232. #define MI_XTMIP_NAME "xtmip"
  2233. #define MI_AFU_DEVICE "/dev/afu"
  2234. #define MI_ARP_DEVICE "/dev/arp"
  2235. #define MI_COURMUX_DEVICE "/dev/courmux"
  2236. #define MI_CLONE_DEVICE "/dev/clone"
  2237. #define MI_DLB_DEVICE "/dev/dlb"
  2238. #define MI_DN_DEVICE "/dev/dn"
  2239. #define MI_DNF_DEVICE "/dev/dnf"
  2240. #define MI_DRVE_DEVICE "/dev/drve"
  2241. #define MI_ECHO_DEVICE "/dev/echo"
  2242. #define MI_RAWIP_DEVICE "/dev/rawip"
  2243. #define MI_HAVOC_DEVICE "/dev/havoc"
  2244. #define MI_IP_DEVICE "/dev/ip"
  2245. #define MI_IPX_DEVICE "/dev/ipx"
  2246. #define MI_LOG_DEVICE "/dev/log"
  2247. #define MI_MODE_DEVICE "/dev/mode"
  2248. #define MI_MUX_DEVICE "/dev/mux"
  2249. #define MI_NECHO_DEVICE "/dev/necho"
  2250. #define MI_NPEP_DEVICE "/dev/npep"
  2251. #define MI_NULS_DEVICE "/dev/nuls"
  2252. #define MI_NULZ_DEVICE "/dev/nulz"
  2253. #define MI_SAD_DEVICE "/dev/sad"
  2254. #define MI_SPX_DEVICE "/dev/spx"
  2255. #define MI_TCP_DEVICE "/dev/tcp"
  2256. #define MI_TMUX_DEVICE "/dev/tmux"
  2257. #define MI_TMUX0_DEVICE "/dev/tmux#0"
  2258. #define MI_TMUX1_DEVICE "/dev/tmux#1"
  2259. #define MI_TPIT_DEVICE "/dev/tpit"
  2260. #define MI_UDP_DEVICE "/dev/udp"
  2261. #define MI_XDG_DEVICE "/dev/xdg"
  2262. #define MI_XECHO_DEVICE "/dev/xecho"
  2263. #define MI_XF_DEVICE "/dev/xf"
  2264. #define MI_XPE_DEVICE "/dev/xpe"
  2265. #define MI_XS_DEVICE "/dev/xs"
  2266. #define MI_XTINDG_DEVICE "/dev/xtindg"
  2267. #define MI_XTINVC_DEVICE "/dev/xtinvc"
  2268. /* Streamtab entries */
  2269. #define MI_AFU_STREAMTAB afuinfo
  2270. #define MI_AHARP_STREAMTAB aharinfo
  2271. #define MI_AHENET_STREAMTAB aheninfo
  2272. #define MI_ARP_STREAMTAB arpinfo
  2273. #define MI_ARPM_STREAMTAB arpminfo
  2274. #define MI_COURMUX_STREAMTAB courmuxinfo
  2275. #define MI_CLONE_STREAMTAB cloneinfo
  2276. #define MI_DLB_STREAMTAB dlbinfo
  2277. #define MI_DLM_STREAMTAB dlminfo
  2278. #define MI_DMODD_STREAMTAB dmoddinfo
  2279. #define MI_DMODT_STREAMTAB dmodtinfo
  2280. #define MI_DN_STREAMTAB dninfo
  2281. #define MI_DNF_STREAMTAB dnfinfo
  2282. #define MI_DRVE_STREAMTAB drveinfo
  2283. #define MI_ECHO_STREAMTAB echoinfo
  2284. #define MI_ENXR_STREAMTAB enxrinfo
  2285. #define MI_HAVOC_STREAMTAB hvcinfo
  2286. #define MI_HAVOCM_STREAMTAB hvcminfo
  2287. #define MI_IP_STREAMTAB ipinfo
  2288. #define MI_IPM_STREAMTAB ipminfo
  2289. #define MI_IPX_STREAMTAB ipxinfo
  2290. #define MI_LOG_STREAMTAB loginfo
  2291. #define MI_MODE_STREAMTAB modeinfo
  2292. #define MI_MUX_STREAMTAB muxinfo
  2293. #define MI_NECHO_STREAMTAB nechoinfo
  2294. #define MI_NPEP_STREAMTAB npepinfo
  2295. #define MI_NULS_STREAMTAB nulsinfo
  2296. #define MI_NULZ_STREAMTAB nulzinfo
  2297. #define MI_PASS_STREAMTAB passinfo
  2298. #define MI_PIPEMOD_STREAMTAB pmodinfo
  2299. #define MI_RAWIP_STREAMTAB rawipinfo
  2300. #define MI_RAWIPM_STREAMTAB rawipminfo
  2301. #define MI_SAD_STREAMTAB sadinfo
  2302. #define MI_SC_STREAMTAB scinfo
  2303. #define MI_SOCKMOD_STREAMTAB sockmodinfo
  2304. #define MI_SPASS_STREAMTAB spassinfo
  2305. #define MI_SPX_STREAMTAB spxinfo
  2306. #define MI_STH_STREAMTAB mi_sthinfo
  2307. #define MI_TCP_STREAMTAB tcpinfo
  2308. #define MI_TCPM_STREAMTAB tcpminfo
  2309. #define MI_TIMOD_STREAMTAB timodinfo
  2310. #define MI_TIRDWR_STREAMTAB tirdwrinfo
  2311. #define MI_TMOD_STREAMTAB tmodinfo
  2312. #define MI_TMUX_STREAMTAB tmuxinfo
  2313. #define MI_TPIT_STREAMTAB tpitinfo
  2314. #define MI_TRSR_STREAMTAB trsrinfo
  2315. #define MI_TRXR_STREAMTAB trxrinfo
  2316. #define MI_UDP_STREAMTAB udpinfo
  2317. #define MI_UDPM_STREAMTAB udpminfo
  2318. #define MI_WELD_STREAMTAB mi_weldinfo
  2319. #define MI_XDG_STREAMTAB xdginfo
  2320. #define MI_XECHO_STREAMTAB xechoinfo
  2321. #define MI_XF_STREAMTAB xfinfo
  2322. #define MI_XFIPX_STREAMTAB xfipxinfo
  2323. #define MI_XFXNS_STREAMTAB xfxnsinfo
  2324. #define MI_XPE_STREAMTAB xpeinfo
  2325. #define MI_XS_STREAMTAB xsinfo
  2326. #define MI_XTINDG_STREAMTAB xtindginfo
  2327. #define MI_XTINVC_STREAMTAB xtinvcinfo
  2328. #define MI_XTM_STREAMTAB xtminfo
  2329. #define MI_XTMIP_STREAMTAB xtmipinfo
  2330. #define MI_AFU_DEVFLAG afudevflag
  2331. #define MI_AHARP_DEVFLAG ahardevflag
  2332. #define MI_AHENET_DEVFLAG ahendevflag
  2333. #define MI_ARP_DEVFLAG arpdevflag
  2334. #define MI_ARPM_DEVFLAG arpmdevflag
  2335. #define MI_COURMUX_DEVFLAG courmuxdevflag
  2336. #define MI_CLONE_DEVFLAG clonedevflag
  2337. #define MI_DLB_DEVFLAG dlbdevflag
  2338. #define MI_DLM_DEVFLAG dlmdevflag
  2339. #define MI_DMODD_DEVFLAG dmodddevflag
  2340. #define MI_DMODT_DEVFLAG dmodtdevflag
  2341. #define MI_DN_DEVFLAG dndevflag
  2342. #define MI_DNF_DEVFLAG dnfdevflag
  2343. #define MI_DRVE_DEVFLAG drvedevflag
  2344. #define MI_ECHO_DEVFLAG echodevflag
  2345. #define MI_ENXR_DEVFLAG enxrdevflag
  2346. #define MI_HAVOC_DEVFLAG hvcdevflag
  2347. #define MI_HAVOCM_DEVFLAG hvcmdevflag
  2348. #define MI_IP_DEVFLAG ipdevflag
  2349. #define MI_IPM_DEVFLAG ipmdevflag
  2350. #define MI_IPX_DEVFLAG ipxdevflag
  2351. #define MI_LOG_DEVFLAG logdevflag
  2352. #define MI_MODE_DEVFLAG modedevflag
  2353. #define MI_MUX_DEVFLAG muxdevflag
  2354. #define MI_NECHO_DEVFLAG nechodevflag
  2355. #define MI_NPEP_DEVFLAG npepdevflag
  2356. #define MI_NULS_DEVFLAG nulsdevflag
  2357. #define MI_NULZ_DEVFLAG nulzdevflag
  2358. #define MI_PASS_DEVFLAG passdevflag
  2359. #define MI_PIPEMOD_DEVFLAG pipemoddevflag
  2360. #define MI_RAWIP_DEVFLAG rawipdevflag
  2361. #define MI_RAWIPM_DEVFLAG rawipmdevflag
  2362. #define MI_SAD_DEVFLAG saddevflag
  2363. #define MI_SC_DEVFLAG scdevflag
  2364. #define MI_SOCKMOD_DEVFLAG sockmoddevflag
  2365. #define MI_SPASS_DEVFLAG spassdevflag
  2366. #define MI_SPX_DEVFLAG spxdevflag
  2367. #define MI_TCP_DEVFLAG tcpdevflag
  2368. #define MI_TCPM_DEVFLAG tcpmdevflag
  2369. #define MI_TIMOD_DEVFLAG timoddevflag
  2370. #define MI_TIRDWR_DEVFLAG tirdwrdevflag
  2371. #define MI_TMOD_DEVFLAG tmoddevflag
  2372. #define MI_TMUX_DEVFLAG tmuxdevflag
  2373. #define MI_TPIT_DEVFLAG tpitdevflag
  2374. #define MI_TRSR_DEVFLAG trsrdevflag
  2375. #define MI_TRXR_DEVFLAG trxrdevflag
  2376. #define MI_UDP_DEVFLAG udpdevflag
  2377. #define MI_UDPM_DEVFLAG udpmdevflag
  2378. #define MI_XDG_DEVFLAG xdgdevflag
  2379. #define MI_XECHO_DEVFLAG xechodevflag
  2380. #define MI_XF_DEVFLAG xfdevflag
  2381. #define MI_XFIPX_DEVFLAG xfipxdevflag
  2382. #define MI_XFXNS_DEVFLAG xfxnsdevflag
  2383. #define MI_XPE_DEVFLAG xpedevflag
  2384. #define MI_XS_DEVFLAG xsdevflag
  2385. #define MI_XTINDG_DEVFLAG xtindgdevflag
  2386. #define MI_XTINVC_DEVFLAG xtinvcdevflag
  2387. #define MI_XTM_DEVFLAG xtmdevflag
  2388. #define MI_XTMIP_DEVFLAG xtmipdevflag
  2389. #define MI_AFU_SQLVL SQLVL_QUEUEPAIR
  2390. #define MI_AHARP_SQLVL SQLVL_QUEUE
  2391. #define MI_AHENET_SQLVL SQLVL_QUEUE
  2392. #define MI_ARP_SQLVL SQLVL_MODULE
  2393. #define MI_ARPM_SQLVL SQLVL_MODULE
  2394. #define MI_COURMUX_SQLVL SQLVL_MODULE
  2395. #define MI_CLONE_SQLVL SQLVL_MODULE
  2396. #define MI_DLB_SQLVL SQLVL_QUEUE
  2397. #define MI_DLM_SQLVL SQLVL_QUEUE
  2398. #define MI_DMODD_SQLVL SQLVL_QUEUE
  2399. #define MI_DMODT_SQLVL SQLVL_QUEUE
  2400. #define MI_DN_SQLVL SQLVL_QUEUE
  2401. #define MI_DNF_SQLVL SQLVL_QUEUE
  2402. #define MI_DRVE_SQLVL SQLVL_QUEUEPAIR
  2403. #define MI_ECHO_SQLVL SQLVL_QUEUE
  2404. #define MI_ENXR_SQLVL SQLVL_QUEUE
  2405. #define MI_RAWIP_SQLVL SQLVL_QUEUE
  2406. #define MI_RAWIPM_SQLVL SQLVL_QUEUE
  2407. #define MI_HAVOC_SQLVL SQLVL_QUEUE
  2408. #define MI_HAVOCM_SQLVL SQLVL_QUEUE
  2409. #define MI_IP_SQLVL SQLVL_QUEUEPAIR
  2410. #define MI_IPM_SQLVL SQLVL_QUEUEPAIR
  2411. #define MI_IPX_SQLVL SQLVL_QUEUE
  2412. #define MI_LOG_SQLVL SQLVL_MODULE
  2413. #define MI_MODE_SQLVL SQLVL_QUEUEPAIR
  2414. #define MI_MUX_SQLVL SQLVL_MODULE
  2415. #define MI_NECHO_SQLVL SQLVL_QUEUE
  2416. #define MI_NPEP_SQLVL SQLVL_QUEUE
  2417. #define MI_NULS_SQLVL SQLVL_QUEUE
  2418. #define MI_NULZ_SQLVL SQLVL_QUEUE
  2419. #define MI_PASS_SQLVL SQLVL_QUEUE
  2420. #define MI_PIPEMOD_SQLVL SQLVL_QUEUE
  2421. #define MI_SAD_SQLVL SQLVL_MODULE
  2422. #define MI_SC_SQLVL SQLVL_QUEUE
  2423. #define MI_SOCKMOD_SQLVL SQLVL_QUEUEPAIR
  2424. #define MI_SPASS_SQLVL SQLVL_QUEUE
  2425. #define MI_SPX_SQLVL SQLVL_QUEUE
  2426. #define MI_TCP_SQLVL SQLVL_QUEUEPAIR
  2427. #define MI_TCPM_SQLVL SQLVL_QUEUEPAIR
  2428. #define MI_TIMOD_SQLVL SQLVL_QUEUEPAIR
  2429. #define MI_TIRDWR_SQLVL SQLVL_QUEUE
  2430. #define MI_TMOD_SQLVL SQLVL_QUEUEPAIR
  2431. #define MI_TMUX_SQLVL SQLVL_MODULE
  2432. #define MI_TPIT_SQLVL SQLVL_MODULE
  2433. #define MI_TRSR_SQLVL SQLVL_MODULE
  2434. #define MI_TRXR_SQLVL SQLVL_QUEUE
  2435. #define MI_UDP_SQLVL SQLVL_QUEUE
  2436. #define MI_UDPM_SQLVL SQLVL_QUEUE
  2437. #define MI_XDG_SQLVL SQLVL_QUEUE
  2438. #define MI_XECHO_SQLVL SQLVL_QUEUE
  2439. #define MI_XF_SQLVL SQLVL_MODULE
  2440. #define MI_XFIPX_SQLVL SQLVL_MODULE
  2441. #define MI_XFXNS_SQLVL SQLVL_MODULE
  2442. #define MI_XPE_SQLVL SQLVL_QUEUE
  2443. #define MI_XS_SQLVL SQLVL_QUEUEPAIR
  2444. #define MI_XTINDG_SQLVL SQLVL_QUEUEPAIR
  2445. #define MI_XTINVC_SQLVL SQLVL_QUEUEPAIR
  2446. #define MI_XTM_SQLVL SQLVL_QUEUEPAIR
  2447. #define MI_XTMIP_SQLVL SQLVL_QUEUEPAIR
  2448. /* ***** Raw Streams ******/
  2449. /*
  2450. Flags used in the fType field of OTReadInfo for functions.
  2451. I've removed the terse and confusing comments in this header
  2452. file. For a full description, read "Open Transport Advanced
  2453. Client Programming".
  2454. */
  2455. enum {
  2456. kOTNoMessagesAvailable = (unsigned long)0xFFFFFFFF,
  2457. kOTAnyMsgType = (unsigned long)0xFFFFFFFE,
  2458. kOTDataMsgTypes = (unsigned long)0xFFFFFFFC,
  2459. kOTMProtoMsgTypes = (unsigned long)0xFFFFFFFB,
  2460. kOTOnlyMProtoMsgTypes = (unsigned long)0xFFFFFFFA
  2461. };
  2462. #if !OTKERNEL
  2463. /* StreamRef is an opaque reference to a raw stream.*/
  2464. typedef struct OpaqueStreamRef* StreamRef;
  2465. #define kOTInvalidStreamRef ((StreamRef)0L)
  2466. /* PollRef structure is used with the OTStreamPoll function.*/
  2467. struct PollRef {
  2468. SInt32 filler; /* holds a file descriptor an a UNIX system, replaced by ref (at end of structure) under OT*/
  2469. SInt16 events;
  2470. SInt16 revents;
  2471. StreamRef ref;
  2472. };
  2473. typedef struct PollRef PollRef;
  2474. /* Poll masks for use with OTStreamPoll: */
  2475. #define POLLIN 0x001 /* A non-priority message is available */
  2476. #define POLLPRI 0x002 /* A high priority message is available */
  2477. #define POLLOUT 0x004 /* The stream is writable for non-priority messages */
  2478. #define POLLERR 0x008 /* A error message has arrived */
  2479. #define POLLHUP 0x010 /* A hangup has occurred */
  2480. #define POLLNVAL 0x020 /* This fd is bogus */
  2481. #define POLLRDNORM 0x040 /* A non-priority message is available */
  2482. #define POLLRDBAND 0x080 /* A priority message (band > 0) message is available */
  2483. #define POLLWRNORM 0x100 /* Same as POLLOUT */
  2484. #define POLLWRBAND 0x200 /* A priority band exists and is writable */
  2485. #define POLLMSG 0x400 /* A signal message has reached the front of the queue */
  2486. /* OTReadInfo structure is used with the various functions that read and peek at the stream head.*/
  2487. struct OTReadInfo {
  2488. UInt32 fType;
  2489. OTCommand fCommand;
  2490. UInt32 fFiller; /* For compatibility with OT 1.0 and 1.1 */
  2491. ByteCount fBytes;
  2492. OSStatus fError;
  2493. };
  2494. typedef struct OTReadInfo OTReadInfo;
  2495. /* Opening and closing raw streams*/
  2496. #if CALL_NOT_IN_CARBON
  2497. /*
  2498. * OTStreamOpen()
  2499. *
  2500. * Availability:
  2501. * Non-Carbon CFM: not available
  2502. * CarbonLib: not available
  2503. * Mac OS X: not available
  2504. */
  2505. EXTERN_API( StreamRef )
  2506. OTStreamOpen(
  2507. const char * name,
  2508. OTOpenFlags oFlags,
  2509. OSStatus * errPtr);
  2510. /*
  2511. * OTAsyncStreamOpen()
  2512. *
  2513. * Availability:
  2514. * Non-Carbon CFM: not available
  2515. * CarbonLib: not available
  2516. * Mac OS X: not available
  2517. */
  2518. EXTERN_API( OSStatus )
  2519. OTAsyncStreamOpen(
  2520. const char * name,
  2521. OTOpenFlags oFlags,
  2522. OTNotifyUPP proc,
  2523. void * contextPtr);
  2524. /*
  2525. * OTCreateStream()
  2526. *
  2527. * Availability:
  2528. * Non-Carbon CFM: not available
  2529. * CarbonLib: not available
  2530. * Mac OS X: not available
  2531. */
  2532. EXTERN_API( StreamRef )
  2533. OTCreateStream(
  2534. OTConfigurationRef cfig,
  2535. OTOpenFlags oFlags,
  2536. OSStatus * errPtr);
  2537. /*
  2538. * OTAsyncCreateStream()
  2539. *
  2540. * Availability:
  2541. * Non-Carbon CFM: not available
  2542. * CarbonLib: not available
  2543. * Mac OS X: not available
  2544. */
  2545. EXTERN_API( OSStatus )
  2546. OTAsyncCreateStream(
  2547. OTConfigurationRef cfig,
  2548. OTOpenFlags oFlags,
  2549. OTNotifyUPP proc,
  2550. void * contextPtr);
  2551. /*
  2552. * OTStreamClose()
  2553. *
  2554. * Availability:
  2555. * Non-Carbon CFM: not available
  2556. * CarbonLib: not available
  2557. * Mac OS X: not available
  2558. */
  2559. EXTERN_API( OSStatus )
  2560. OTStreamClose(StreamRef strm);
  2561. /* Polling a stream for activity*/
  2562. /*
  2563. * OTStreamPoll()
  2564. *
  2565. * Availability:
  2566. * Non-Carbon CFM: not available
  2567. * CarbonLib: not available
  2568. * Mac OS X: not available
  2569. */
  2570. EXTERN_API( OTResult )
  2571. OTStreamPoll(
  2572. PollRef * fds,
  2573. UInt32 nfds,
  2574. OTTimeout timeout);
  2575. /*
  2576. * OTAsyncStreamPoll()
  2577. *
  2578. * Availability:
  2579. * Non-Carbon CFM: not available
  2580. * CarbonLib: not available
  2581. * Mac OS X: not available
  2582. */
  2583. EXTERN_API( OTResult )
  2584. OTAsyncStreamPoll(
  2585. PollRef * fds,
  2586. UInt32 nfds,
  2587. OTTimeout timeout,
  2588. OTNotifyUPP proc,
  2589. void * contextPtr);
  2590. /* Classic UNIX file descriptor operations*/
  2591. /*
  2592. * OTStreamRead()
  2593. *
  2594. * Availability:
  2595. * Non-Carbon CFM: not available
  2596. * CarbonLib: not available
  2597. * Mac OS X: not available
  2598. */
  2599. EXTERN_API( OTResult )
  2600. OTStreamRead(
  2601. StreamRef strm,
  2602. void * buf,
  2603. OTByteCount len);
  2604. /*
  2605. * OTStreamWrite()
  2606. *
  2607. * Availability:
  2608. * Non-Carbon CFM: not available
  2609. * CarbonLib: not available
  2610. * Mac OS X: not available
  2611. */
  2612. EXTERN_API( OTResult )
  2613. OTStreamWrite(
  2614. StreamRef strm,
  2615. void * buf,
  2616. OTByteCount len);
  2617. /*
  2618. * OTStreamIoctl()
  2619. *
  2620. * Availability:
  2621. * Non-Carbon CFM: not available
  2622. * CarbonLib: not available
  2623. * Mac OS X: not available
  2624. */
  2625. EXTERN_API( OTResult )
  2626. OTStreamIoctl(
  2627. StreamRef strm,
  2628. UInt32 cmd,
  2629. void * data);
  2630. /*
  2631. * OTStreamPipe()
  2632. *
  2633. * Availability:
  2634. * Non-Carbon CFM: not available
  2635. * CarbonLib: not available
  2636. * Mac OS X: not available
  2637. */
  2638. EXTERN_API( OTResult )
  2639. OTStreamPipe(StreamRef streamsToPipe[]);
  2640. /* there can be only 2!*/
  2641. /* Notifiers and modes of operation*/
  2642. /*
  2643. * OTStreamInstallNotifier()
  2644. *
  2645. * Availability:
  2646. * Non-Carbon CFM: not available
  2647. * CarbonLib: not available
  2648. * Mac OS X: not available
  2649. */
  2650. EXTERN_API( OSStatus )
  2651. OTStreamInstallNotifier(
  2652. StreamRef strm,
  2653. OTNotifyUPP proc,
  2654. void * contextPtr);
  2655. /*
  2656. * OTStreamRemoveNotifier()
  2657. *
  2658. * Availability:
  2659. * Non-Carbon CFM: not available
  2660. * CarbonLib: not available
  2661. * Mac OS X: not available
  2662. */
  2663. EXTERN_API( void )
  2664. OTStreamRemoveNotifier(StreamRef strm);
  2665. /*
  2666. * OTStreamUseSyncIdleEvents()
  2667. *
  2668. * Availability:
  2669. * Non-Carbon CFM: not available
  2670. * CarbonLib: not available
  2671. * Mac OS X: not available
  2672. */
  2673. EXTERN_API( OSStatus )
  2674. OTStreamUseSyncIdleEvents(
  2675. StreamRef strm,
  2676. Boolean useEvents);
  2677. /*
  2678. * OTStreamSetBlocking()
  2679. *
  2680. * Availability:
  2681. * Non-Carbon CFM: not available
  2682. * CarbonLib: not available
  2683. * Mac OS X: not available
  2684. */
  2685. EXTERN_API( void )
  2686. OTStreamSetBlocking(StreamRef strm);
  2687. /*
  2688. * OTStreamSetNonBlocking()
  2689. *
  2690. * Availability:
  2691. * Non-Carbon CFM: not available
  2692. * CarbonLib: not available
  2693. * Mac OS X: not available
  2694. */
  2695. EXTERN_API( void )
  2696. OTStreamSetNonBlocking(StreamRef strm);
  2697. /*
  2698. * OTStreamIsBlocking()
  2699. *
  2700. * Availability:
  2701. * Non-Carbon CFM: not available
  2702. * CarbonLib: not available
  2703. * Mac OS X: not available
  2704. */
  2705. EXTERN_API( Boolean )
  2706. OTStreamIsBlocking(StreamRef strm);
  2707. /*
  2708. * OTStreamSetSynchronous()
  2709. *
  2710. * Availability:
  2711. * Non-Carbon CFM: not available
  2712. * CarbonLib: not available
  2713. * Mac OS X: not available
  2714. */
  2715. EXTERN_API( void )
  2716. OTStreamSetSynchronous(StreamRef strm);
  2717. /*
  2718. * OTStreamSetAsynchronous()
  2719. *
  2720. * Availability:
  2721. * Non-Carbon CFM: not available
  2722. * CarbonLib: not available
  2723. * Mac OS X: not available
  2724. */
  2725. EXTERN_API( void )
  2726. OTStreamSetAsynchronous(StreamRef strm);
  2727. /*
  2728. * OTStreamIsSynchronous()
  2729. *
  2730. * Availability:
  2731. * Non-Carbon CFM: not available
  2732. * CarbonLib: not available
  2733. * Mac OS X: not available
  2734. */
  2735. EXTERN_API( Boolean )
  2736. OTStreamIsSynchronous(StreamRef strm);
  2737. /* STREAMS primitives*/
  2738. /*
  2739. * OTStreamGetMessage()
  2740. *
  2741. * Availability:
  2742. * Non-Carbon CFM: not available
  2743. * CarbonLib: not available
  2744. * Mac OS X: not available
  2745. */
  2746. EXTERN_API( OTResult )
  2747. OTStreamGetMessage(
  2748. StreamRef strm,
  2749. strbuf * ctlbuf,
  2750. strbuf * databuf,
  2751. OTFlags * flags);
  2752. /*
  2753. * OTStreamGetPriorityMessage()
  2754. *
  2755. * Availability:
  2756. * Non-Carbon CFM: not available
  2757. * CarbonLib: not available
  2758. * Mac OS X: not available
  2759. */
  2760. EXTERN_API( OTResult )
  2761. OTStreamGetPriorityMessage(
  2762. StreamRef strm,
  2763. strbuf * ctlbuf,
  2764. strbuf * databuf,
  2765. OTBand * band,
  2766. OTFlags * flags);
  2767. /*
  2768. * OTStreamPutMessage()
  2769. *
  2770. * Availability:
  2771. * Non-Carbon CFM: not available
  2772. * CarbonLib: not available
  2773. * Mac OS X: not available
  2774. */
  2775. EXTERN_API( OSStatus )
  2776. OTStreamPutMessage(
  2777. StreamRef strm,
  2778. const strbuf * ctlbuf,
  2779. const strbuf * databuf,
  2780. OTFlags flags);
  2781. /*
  2782. * OTStreamPutPriorityMessage()
  2783. *
  2784. * Availability:
  2785. * Non-Carbon CFM: not available
  2786. * CarbonLib: not available
  2787. * Mac OS X: not available
  2788. */
  2789. EXTERN_API( OSStatus )
  2790. OTStreamPutPriorityMessage(
  2791. StreamRef strm,
  2792. const strbuf * ctlbuf,
  2793. const strbuf * databuf,
  2794. OTBand band,
  2795. OTFlags flags);
  2796. /* Miscellaneous stuff*/
  2797. /*
  2798. * OTStreamSetControlMask()
  2799. *
  2800. * Availability:
  2801. * Non-Carbon CFM: not available
  2802. * CarbonLib: not available
  2803. * Mac OS X: not available
  2804. */
  2805. EXTERN_API( void )
  2806. OTStreamSetControlMask(
  2807. StreamRef strm,
  2808. UInt32 mask,
  2809. Boolean setClear);
  2810. /*
  2811. Opening endpoints and mappers on a Stream - these calls are synchronous, and may
  2812. only be used at System Task time. Once the stream has been installed into a provider
  2813. or endpoint, you should not continue to use STREAMS APIs on it
  2814. */
  2815. /*
  2816. * OTOpenProviderOnStream()
  2817. *
  2818. * Availability:
  2819. * Non-Carbon CFM: not available
  2820. * CarbonLib: not available
  2821. * Mac OS X: not available
  2822. */
  2823. EXTERN_API( ProviderRef )
  2824. OTOpenProviderOnStream(
  2825. StreamRef strm,
  2826. OSStatus * errPtr);
  2827. /*
  2828. * OTOpenEndpointOnStream()
  2829. *
  2830. * Availability:
  2831. * Non-Carbon CFM: not available
  2832. * CarbonLib: not available
  2833. * Mac OS X: not available
  2834. */
  2835. EXTERN_API( EndpointRef )
  2836. OTOpenEndpointOnStream(
  2837. StreamRef strm,
  2838. OSStatus * errPtr);
  2839. /*
  2840. To quote an earlier version of this header file:
  2841. Some functions that should only be used if
  2842. you really know what you're doing.
  2843. */
  2844. /*
  2845. * OTRemoveStreamFromProvider()
  2846. *
  2847. * Availability:
  2848. * Non-Carbon CFM: not available
  2849. * CarbonLib: not available
  2850. * Mac OS X: not available
  2851. */
  2852. EXTERN_API( StreamRef )
  2853. OTRemoveStreamFromProvider(ProviderRef ref);
  2854. /*
  2855. * OTPeekMessage()
  2856. *
  2857. * Availability:
  2858. * Non-Carbon CFM: not available
  2859. * CarbonLib: not available
  2860. * Mac OS X: not available
  2861. */
  2862. EXTERN_API( OSStatus )
  2863. OTPeekMessage(
  2864. StreamRef strm,
  2865. OTReadInfo * readInfo);
  2866. /*
  2867. * OTReadMessage()
  2868. *
  2869. * Availability:
  2870. * Non-Carbon CFM: not available
  2871. * CarbonLib: not available
  2872. * Mac OS X: not available
  2873. */
  2874. EXTERN_API( OTBuffer * )
  2875. OTReadMessage(
  2876. StreamRef strm,
  2877. OTReadInfo * readInfo);
  2878. /*
  2879. * OTPutBackBuffer()
  2880. *
  2881. * Availability:
  2882. * Non-Carbon CFM: not available
  2883. * CarbonLib: not available
  2884. * Mac OS X: not available
  2885. */
  2886. EXTERN_API( void )
  2887. OTPutBackBuffer(
  2888. StreamRef strm,
  2889. OTBuffer * buffer);
  2890. /*
  2891. * OTPutBackPartialBuffer()
  2892. *
  2893. * Availability:
  2894. * Non-Carbon CFM: not available
  2895. * CarbonLib: not available
  2896. * Mac OS X: not available
  2897. */
  2898. EXTERN_API( void )
  2899. OTPutBackPartialBuffer(
  2900. StreamRef strm,
  2901. OTBufferInfo * readInfo,
  2902. OTBuffer * buffer);
  2903. #endif /* CALL_NOT_IN_CARBON */
  2904. #endif /* !OTKERNEL */
  2905. #endif /* CALL_NOT_IN_CARBON */
  2906. /* ***** Port Utilities ******/
  2907. #if !OTKERNEL
  2908. /*
  2909. These types and routines are used during sophisticated
  2910. port management. High-level clients may get involved
  2911. for things like request a port to be yielding, but typically
  2912. this stuff is used by protocol infrastructure.
  2913. */
  2914. /*
  2915. OTPortCloseStruct is used when processing the kOTClosePortRequest
  2916. and kOTYieldPortRequest events.
  2917. */
  2918. struct OTPortCloseStruct {
  2919. OTPortRef fPortRef; /* The port requested to be closed.*/
  2920. ProviderRef fTheProvider; /* The provider using the port.*/
  2921. OSStatus fDenyReason; /* Set to a negative number to deny the request*/
  2922. };
  2923. typedef struct OTPortCloseStruct OTPortCloseStruct;
  2924. /* OTClientList structure is used with the OTYieldPortRequest function.*/
  2925. struct OTClientList {
  2926. ItemCount fNumClients;
  2927. UInt8 fBuffer[4];
  2928. };
  2929. typedef struct OTClientList OTClientList;
  2930. /*
  2931. Returns a buffer containing all of the clients that refused to yield the port.
  2932. "size" is the total number of bytes @ buffer, including the fNumClients field.
  2933. */
  2934. #if CALL_NOT_IN_CARBON
  2935. /*
  2936. * OTYieldPortRequest()
  2937. *
  2938. * Availability:
  2939. * Non-Carbon CFM: not available
  2940. * CarbonLib: not available
  2941. * Mac OS X: not available
  2942. */
  2943. EXTERN_API_C( OSStatus )
  2944. OTYieldPortRequest(
  2945. ProviderRef ref,
  2946. OTPortRef portRef,
  2947. OTClientList * buffer,
  2948. OTByteCount size);
  2949. /* Send a notification to all Open Transport registered clients*/
  2950. /*
  2951. * OTNotifyAllClients()
  2952. *
  2953. * Availability:
  2954. * Non-Carbon CFM: not available
  2955. * CarbonLib: not available
  2956. * Mac OS X: not available
  2957. */
  2958. EXTERN_API_C( void )
  2959. OTNotifyAllClients(
  2960. OTEventCode code,
  2961. OTResult result,
  2962. void * cookie);
  2963. /* Determine if "child" is a child port of "parent"*/
  2964. /*
  2965. * OTIsDependentPort()
  2966. *
  2967. * Availability:
  2968. * Non-Carbon CFM: not available
  2969. * CarbonLib: not available
  2970. * Mac OS X: not available
  2971. */
  2972. EXTERN_API_C( Boolean )
  2973. OTIsDependentPort(
  2974. OTPortRef parent,
  2975. OTPortRef child);
  2976. #endif /* CALL_NOT_IN_CARBON */
  2977. #endif /* !OTKERNEL */
  2978. /* ***** Timers ***** */
  2979. /*
  2980. STREAMS plug-ins code should not use these timers, instead
  2981. they should use timer messages, ie mi_timer etc.
  2982. */
  2983. #if !OTKERNEL
  2984. typedef long OTTimerTask;
  2985. /*
  2986. Under Carbon, OTCreateTimerTask takes a client context pointer. Applications may pass NULL
  2987. after calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
  2988. valid client context.
  2989. */
  2990. /*
  2991. * OTCreateTimerTaskInContext()
  2992. *
  2993. * Availability:
  2994. * Non-Carbon CFM: not available
  2995. * CarbonLib: in CarbonLib 1.0 and later
  2996. * Mac OS X: in version 10.0 and later
  2997. */
  2998. EXTERN_API( long )
  2999. OTCreateTimerTaskInContext(
  3000. OTProcessUPP upp,
  3001. void * arg,
  3002. OTClientContextPtr clientContext);
  3003. #if CALL_NOT_IN_CARBON
  3004. /*
  3005. * OTCreateTimerTask()
  3006. *
  3007. * Availability:
  3008. * Non-Carbon CFM: not available
  3009. * CarbonLib: not available
  3010. * Mac OS X: not available
  3011. */
  3012. EXTERN_API( OTTimerTask )
  3013. OTCreateTimerTask(
  3014. OTProcessUPP proc,
  3015. void * arg);
  3016. #endif /* CALL_NOT_IN_CARBON */
  3017. /*
  3018. * OTCancelTimerTask()
  3019. *
  3020. * Availability:
  3021. * Non-Carbon CFM: not available
  3022. * CarbonLib: in CarbonLib 1.0 and later
  3023. * Mac OS X: in version 10.0 and later
  3024. */
  3025. EXTERN_API( Boolean )
  3026. OTCancelTimerTask(OTTimerTask timerTask);
  3027. /*
  3028. * OTDestroyTimerTask()
  3029. *
  3030. * Availability:
  3031. * Non-Carbon CFM: not available
  3032. * CarbonLib: in CarbonLib 1.0 and later
  3033. * Mac OS X: in version 10.0 and later
  3034. */
  3035. EXTERN_API( void )
  3036. OTDestroyTimerTask(OTTimerTask timerTask);
  3037. /*
  3038. * OTScheduleTimerTask()
  3039. *
  3040. * Availability:
  3041. * Non-Carbon CFM: not available
  3042. * CarbonLib: in CarbonLib 1.0 and later
  3043. * Mac OS X: in version 10.0 and later
  3044. */
  3045. EXTERN_API( Boolean )
  3046. OTScheduleTimerTask(
  3047. OTTimerTask timerTask,
  3048. OTTimeout milliSeconds);
  3049. #if OTCARBONAPPLICATION
  3050. /* The following macro may be used by applications only.*/
  3051. #define OTCreateTimerTask(upp, arg) OTCreateTimerTaskInContext(upp, arg, NULL)
  3052. #endif /* OTCARBONAPPLICATION */
  3053. #endif /* !OTKERNEL */
  3054. /* ***** Miscellaneous Helpful Functions ******/
  3055. #if !OTKERNEL
  3056. /*
  3057. These routines allow you to manipulate OT's buffer structures.
  3058. If you use no-copy receives (described in "OpenTransport.h")
  3059. you will need some of these routines, and may choose to use others.
  3060. See "Open Tranport Advanced Client Programming" for documentation.
  3061. */
  3062. /*
  3063. * OTBufferDataSize()
  3064. *
  3065. * Availability:
  3066. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3067. * CarbonLib: in CarbonLib 1.0 and later
  3068. * Mac OS X: in version 10.0 and later
  3069. */
  3070. EXTERN_API_C( OTByteCount )
  3071. OTBufferDataSize(OTBuffer * buffer);
  3072. /*
  3073. * OTReadBuffer()
  3074. *
  3075. * Availability:
  3076. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3077. * CarbonLib: in CarbonLib 1.0 and later
  3078. * Mac OS X: in version 10.0 and later
  3079. */
  3080. EXTERN_API_C( Boolean )
  3081. OTReadBuffer(
  3082. OTBufferInfo * buffer,
  3083. void * dest,
  3084. OTByteCount * len);
  3085. /*
  3086. * OTReleaseBuffer()
  3087. *
  3088. * Availability:
  3089. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  3090. * CarbonLib: in CarbonLib 1.0 and later
  3091. * Mac OS X: in version 10.0 and later
  3092. */
  3093. EXTERN_API_C( void )
  3094. OTReleaseBuffer(OTBuffer * buffer);
  3095. #if CALL_NOT_IN_CARBON
  3096. /*
  3097. * StoreIntoNetbuf()
  3098. *
  3099. * Availability:
  3100. * Non-Carbon CFM: not available
  3101. * CarbonLib: not available
  3102. * Mac OS X: not available
  3103. */
  3104. EXTERN_API_C( Boolean )
  3105. StoreIntoNetbuf(
  3106. TNetbuf * netBuf,
  3107. void * source,
  3108. SInt32 len);
  3109. /*
  3110. * StoreMsgIntoNetbuf()
  3111. *
  3112. * Availability:
  3113. * Non-Carbon CFM: not available
  3114. * CarbonLib: not available
  3115. * Mac OS X: not available
  3116. */
  3117. EXTERN_API_C( Boolean )
  3118. StoreMsgIntoNetbuf(
  3119. TNetbuf * netBuf,
  3120. OTBuffer * buffer);
  3121. #endif /* CALL_NOT_IN_CARBON */
  3122. #endif /* !OTKERNEL */
  3123. /* ***** OTConfiguration ******/
  3124. #if CALL_NOT_IN_CARBON
  3125. #if !OTKERNEL
  3126. /*
  3127. As promised in "OpenTransport.h", here are the routines
  3128. for advanced operations on configurations.
  3129. */
  3130. /* Manipulating a configuration*/
  3131. #if CALL_NOT_IN_CARBON
  3132. /*
  3133. * OTCfigNewConfiguration()
  3134. *
  3135. * Availability:
  3136. * Non-Carbon CFM: not available
  3137. * CarbonLib: not available
  3138. * Mac OS X: not available
  3139. */
  3140. EXTERN_API_C( OTConfigurationRef )
  3141. OTCfigNewConfiguration(const char * path);
  3142. /*
  3143. * OTCfigDeleteConfiguration()
  3144. *
  3145. * Availability:
  3146. * Non-Carbon CFM: not available
  3147. * CarbonLib: not available
  3148. * Mac OS X: not available
  3149. */
  3150. EXTERN_API_C( void )
  3151. OTCfigDeleteConfiguration(OTConfigurationRef cfig);
  3152. /*
  3153. * OTCfigCloneConfiguration()
  3154. *
  3155. * Availability:
  3156. * Non-Carbon CFM: not available
  3157. * CarbonLib: not available
  3158. * Mac OS X: not available
  3159. */
  3160. EXTERN_API_C( OTConfigurationRef )
  3161. OTCfigCloneConfiguration(OTConfigurationRef cfig);
  3162. /*
  3163. * OTCfigPushNewSingleChild()
  3164. *
  3165. * Availability:
  3166. * Non-Carbon CFM: not available
  3167. * CarbonLib: not available
  3168. * Mac OS X: not available
  3169. */
  3170. EXTERN_API_C( OTConfigurationRef )
  3171. OTCfigPushNewSingleChild(
  3172. OTConfigurationRef cfig,
  3173. const char * path,
  3174. OSStatus * errPtr);
  3175. /*
  3176. * OTCfigPushParent()
  3177. *
  3178. * Availability:
  3179. * Non-Carbon CFM: not available
  3180. * CarbonLib: not available
  3181. * Mac OS X: not available
  3182. */
  3183. EXTERN_API_C( OTConfigurationRef )
  3184. OTCfigPushParent(
  3185. OTConfigurationRef cfig,
  3186. const char * path,
  3187. OSStatus * errPtr);
  3188. /*
  3189. * OTCfigPushChild()
  3190. *
  3191. * Availability:
  3192. * Non-Carbon CFM: not available
  3193. * CarbonLib: not available
  3194. * Mac OS X: not available
  3195. */
  3196. EXTERN_API_C( OTConfigurationRef )
  3197. OTCfigPushChild(
  3198. OTConfigurationRef cfig,
  3199. OTItemCount index,
  3200. const char * path,
  3201. OSStatus * errPtr);
  3202. /*
  3203. * OTCfigPopChild()
  3204. *
  3205. * Availability:
  3206. * Non-Carbon CFM: not available
  3207. * CarbonLib: not available
  3208. * Mac OS X: not available
  3209. */
  3210. EXTERN_API_C( OSStatus )
  3211. OTCfigPopChild(
  3212. OTConfigurationRef cfig,
  3213. OTItemCount index);
  3214. /*
  3215. * OTCfigGetChild()
  3216. *
  3217. * Availability:
  3218. * Non-Carbon CFM: not available
  3219. * CarbonLib: not available
  3220. * Mac OS X: not available
  3221. */
  3222. EXTERN_API_C( OTConfigurationRef )
  3223. OTCfigGetChild(
  3224. OTConfigurationRef cfig,
  3225. OTItemCount index);
  3226. /*
  3227. * OTCfigSetPath()
  3228. *
  3229. * Availability:
  3230. * Non-Carbon CFM: not available
  3231. * CarbonLib: not available
  3232. * Mac OS X: not available
  3233. */
  3234. EXTERN_API_C( OSStatus )
  3235. OTCfigSetPath(
  3236. OTConfigurationRef cfig,
  3237. const char * path);
  3238. /*
  3239. * OTCfigNewChild()
  3240. *
  3241. * Availability:
  3242. * Non-Carbon CFM: not available
  3243. * CarbonLib: not available
  3244. * Mac OS X: not available
  3245. */
  3246. EXTERN_API_C( OTConfigurationRef )
  3247. OTCfigNewChild(
  3248. OTConfigurationRef cfig,
  3249. const char * path,
  3250. OSStatus * errPtr);
  3251. /*
  3252. * OTCfigAddChild()
  3253. *
  3254. * Availability:
  3255. * Non-Carbon CFM: not available
  3256. * CarbonLib: not available
  3257. * Mac OS X: not available
  3258. */
  3259. EXTERN_API_C( OSStatus )
  3260. OTCfigAddChild(
  3261. OTConfigurationRef cfig,
  3262. OTConfigurationRef child);
  3263. /*
  3264. * OTCfigRemoveChild()
  3265. *
  3266. * Availability:
  3267. * Non-Carbon CFM: not available
  3268. * CarbonLib: not available
  3269. * Mac OS X: not available
  3270. */
  3271. EXTERN_API_C( OTConfigurationRef )
  3272. OTCfigRemoveChild(
  3273. OTConfigurationRef cfig,
  3274. OTItemCount index);
  3275. /*
  3276. * OTCfigSetPortRef()
  3277. *
  3278. * Availability:
  3279. * Non-Carbon CFM: not available
  3280. * CarbonLib: not available
  3281. * Mac OS X: not available
  3282. */
  3283. EXTERN_API_C( void )
  3284. OTCfigSetPortRef(
  3285. OTConfigurationRef cfig,
  3286. OTPortRef portRef);
  3287. /*
  3288. * OTCfigChangeProviderName()
  3289. *
  3290. * Availability:
  3291. * Non-Carbon CFM: not available
  3292. * CarbonLib: not available
  3293. * Mac OS X: not available
  3294. */
  3295. EXTERN_API_C( void )
  3296. OTCfigChangeProviderName(
  3297. OTConfigurationRef cfig,
  3298. const char * name);
  3299. /* Query a configuration*/
  3300. /*
  3301. * OTCfigNumberOfChildren()
  3302. *
  3303. * Availability:
  3304. * Non-Carbon CFM: not available
  3305. * CarbonLib: not available
  3306. * Mac OS X: not available
  3307. */
  3308. EXTERN_API_C( UInt16 )
  3309. OTCfigNumberOfChildren(OTConfigurationRef cfig);
  3310. /*
  3311. * OTCfigGetParent()
  3312. *
  3313. * Availability:
  3314. * Non-Carbon CFM: not available
  3315. * CarbonLib: not available
  3316. * Mac OS X: not available
  3317. */
  3318. EXTERN_API_C( OTConfigurationRef )
  3319. OTCfigGetParent(OTConfigurationRef cfig);
  3320. /*
  3321. * OTCfigGetOptionNetbuf()
  3322. *
  3323. * Availability:
  3324. * Non-Carbon CFM: not available
  3325. * CarbonLib: not available
  3326. * Mac OS X: not available
  3327. */
  3328. EXTERN_API_C( TNetbuf * )
  3329. OTCfigGetOptionNetbuf(OTConfigurationRef cfig);
  3330. /*
  3331. * OTCfigGetPortRef()
  3332. *
  3333. * Availability:
  3334. * Non-Carbon CFM: not available
  3335. * CarbonLib: not available
  3336. * Mac OS X: not available
  3337. */
  3338. EXTERN_API_C( OTPortRef )
  3339. OTCfigGetPortRef(OTConfigurationRef cfig);
  3340. /*
  3341. * OTCfigGetInstallFlags()
  3342. *
  3343. * Availability:
  3344. * Non-Carbon CFM: not available
  3345. * CarbonLib: not available
  3346. * Mac OS X: not available
  3347. */
  3348. EXTERN_API_C( UInt32 )
  3349. OTCfigGetInstallFlags(OTConfigurationRef cfig);
  3350. /*
  3351. * OTCfigGetProviderName()
  3352. *
  3353. * Availability:
  3354. * Non-Carbon CFM: not available
  3355. * CarbonLib: not available
  3356. * Mac OS X: not available
  3357. */
  3358. EXTERN_API_C( const char * )
  3359. OTCfigGetProviderName(OTConfigurationRef cfig);
  3360. /*
  3361. * OTCfigIsPort()
  3362. *
  3363. * Availability:
  3364. * Non-Carbon CFM: not available
  3365. * CarbonLib: not available
  3366. * Mac OS X: not available
  3367. */
  3368. EXTERN_API_C( Boolean )
  3369. OTCfigIsPort(OTConfigurationRef cfig);
  3370. #endif /* CALL_NOT_IN_CARBON */
  3371. #endif /* !OTKERNEL */
  3372. /* ***** Configurators ******/
  3373. /*
  3374. The kOTConfiguratorInterfaceID define is what you need to add to your
  3375. export file for the "interfaceID = " clause to export a configurator
  3376. for ASLM. Similarly, kOTConfiguratorCFMTag is used for CFM-based
  3377. configurators.
  3378. */
  3379. #define kOTConfiguratorInterfaceID kOTClientPrefix "cfigMkr"
  3380. #define kOTConfiguratorCFMTag kOTClientPrefix "cfigMkr"
  3381. #if !OTKERNEL
  3382. #ifdef __cplusplus
  3383. class TOTConfigurator;
  3384. typedef class TOTConfigurator* TOTConfiguratorRef;
  3385. #else
  3386. typedef struct TOTConfigurator TOTConfigurator;
  3387. typedef TOTConfigurator* TOTConfiguratorRef;
  3388. #endif
  3389. /*
  3390. Typedef for the OTCanConfigure function, and the enum for which pass we're doing.
  3391. The first (kOTSpecificConfigPass) is to give configurators a shot at the configuration
  3392. before we start allowing the generic configurators to get into the act.
  3393. */
  3394. enum {
  3395. kOTSpecificConfigPass = 0,
  3396. kOTGenericConfigPass = 1
  3397. };
  3398. typedef CALLBACK_API_C( Boolean , OTCanConfigureProcPtr )(OTConfigurationRef cfig, UInt32 pass);
  3399. /* Typedef for the function to create and return a configurator object*/
  3400. typedef CALLBACK_API_C( OSStatus , OTCreateConfiguratorProcPtr )(TOTConfiguratorRef * cfigor);
  3401. /*
  3402. Typedef for the "OTSetupConfigurator" function that your configurator library must export.
  3403. The enum is for the type of configurator that it is.
  3404. */
  3405. #define kOTSetupConfiguratorID "OTSetupConfigurator"
  3406. enum {
  3407. kOTDefaultConfigurator = 0,
  3408. kOTProtocolFamilyConfigurator = 1,
  3409. kOTLinkDriverConfigurator = 2
  3410. };
  3411. typedef CALLBACK_API_C( OSStatus , OTSetupConfiguratorProcPtr )(OTCanConfigureProcPtr *canConfigure, OTCreateConfiguratorProcPtr *createConfigurator, UInt8 *configuratorType);
  3412. /*
  3413. Procedure pointer definitions for the three key callbacks associated
  3414. with a configurator, as established by OTNewConfigurator.
  3415. */
  3416. typedef CALLBACK_API_C( OSStatus , OTCFConfigureProcPtr )(TOTConfiguratorRef cfigor, OTConfigurationRef cfig);
  3417. typedef CALLBACK_API_C( OSStatus , OTCFCreateStreamProcPtr )(TOTConfiguratorRef cfigor, OTConfigurationRef cfig, OTOpenFlags oFlags, OTNotifyUPP proc, void *contextPtr);
  3418. typedef CALLBACK_API_C( void , OTCFHandleSystemEventProcPtr )(TOTConfiguratorRef cfigor, OTEventCode code, OTResult result, void *cookie);
  3419. /*
  3420. Determine if this instance of your configurator is the "master"
  3421. (the one that can create and destroy control streams)
  3422. */
  3423. #if CALL_NOT_IN_CARBON
  3424. /*
  3425. * OTIsMasterConfigurator()
  3426. *
  3427. * Availability:
  3428. * Non-Carbon CFM: not available
  3429. * CarbonLib: not available
  3430. * Mac OS X: not available
  3431. */
  3432. EXTERN_API_C( Boolean )
  3433. OTIsMasterConfigurator(TOTConfiguratorRef cfigor);
  3434. /* Get back the userData you passed in to OTNewConfigurator*/
  3435. /*
  3436. * OTGetConfiguratorUserData()
  3437. *
  3438. * Availability:
  3439. * Non-Carbon CFM: not available
  3440. * CarbonLib: not available
  3441. * Mac OS X: not available
  3442. */
  3443. EXTERN_API_C( void * )
  3444. OTGetConfiguratorUserData(TOTConfiguratorRef cfigor);
  3445. /* Create a configurator object for use by Open Transport*/
  3446. /*
  3447. * OTNewConfigurator()
  3448. *
  3449. * Availability:
  3450. * Non-Carbon CFM: not available
  3451. * CarbonLib: not available
  3452. * Mac OS X: not available
  3453. */
  3454. EXTERN_API_C( TOTConfiguratorRef )
  3455. OTNewConfigurator(
  3456. void * userData,
  3457. OTCFConfigureProcPtr configure,
  3458. OTCFCreateStreamProcPtr createStream,
  3459. OTCFHandleSystemEventProcPtr handleEvent);
  3460. /* Delete a configurator object created by OTNewConfigurator*/
  3461. /*
  3462. * OTDeleteConfigurator()
  3463. *
  3464. * Availability:
  3465. * Non-Carbon CFM: not available
  3466. * CarbonLib: not available
  3467. * Mac OS X: not available
  3468. */
  3469. EXTERN_API_C( void )
  3470. OTDeleteConfigurator(TOTConfiguratorRef cfigor);
  3471. /*
  3472. A utility function to send notifications to the user - it takes care of calls
  3473. from deferred tasks
  3474. */
  3475. /*
  3476. * OTNotifyUser()
  3477. *
  3478. * Availability:
  3479. * Non-Carbon CFM: not available
  3480. * CarbonLib: not available
  3481. * Mac OS X: not available
  3482. */
  3483. EXTERN_API_C( OSStatus )
  3484. OTNotifyUser(
  3485. FSSpec * theFile,
  3486. SInt32 rsrcID,
  3487. OTItemCount index,
  3488. char * parm1,
  3489. char * parm2);
  3490. /* Call when the configurator unloads from memory*/
  3491. /*
  3492. * OTConfiguratorUnloaded()
  3493. *
  3494. * Availability:
  3495. * Non-Carbon CFM: not available
  3496. * CarbonLib: not available
  3497. * Mac OS X: not available
  3498. */
  3499. EXTERN_API_C( void )
  3500. OTConfiguratorUnloaded(TOTConfiguratorRef cfigor);
  3501. /*
  3502. Call to create your control stream if you're not the master
  3503. configurator. You can also use the state machine function
  3504. OTSMCreateControlStream(OTStateMachine*, OTConfigurationRef, TOTConfiguratorRef cfigor).
  3505. */
  3506. /*
  3507. * OTCreateControlStream()
  3508. *
  3509. * Availability:
  3510. * Non-Carbon CFM: not available
  3511. * CarbonLib: not available
  3512. * Mac OS X: not available
  3513. */
  3514. EXTERN_API_C( OSStatus )
  3515. OTCreateControlStream(
  3516. OTConfigurationRef cfig,
  3517. TOTConfiguratorRef cfigor,
  3518. OTNotifyUPP proc,
  3519. void * contextPtr);
  3520. /*
  3521. A helpful function for the configurators to
  3522. be able to recursively configure the children.
  3523. */
  3524. /*
  3525. * OTConfigureChildren()
  3526. *
  3527. * Availability:
  3528. * Non-Carbon CFM: not available
  3529. * CarbonLib: not available
  3530. * Mac OS X: not available
  3531. */
  3532. EXTERN_API_C( OSStatus )
  3533. OTConfigureChildren(OTConfigurationRef cfig);
  3534. /* Allocate a bit in the system-wide control mask for streams.*/
  3535. /*
  3536. * OTNewControlMask()
  3537. *
  3538. * Availability:
  3539. * Non-Carbon CFM: not available
  3540. * CarbonLib: not available
  3541. * Mac OS X: not available
  3542. */
  3543. EXTERN_API_C( UInt32 )
  3544. OTNewControlMask(void);
  3545. /* Warning: These 2 APIs is going away*/
  3546. /*
  3547. * OTCloseProvidersByUseCount()
  3548. *
  3549. * Availability:
  3550. * Non-Carbon CFM: not available
  3551. * CarbonLib: not available
  3552. * Mac OS X: not available
  3553. */
  3554. EXTERN_API_C( void )
  3555. OTCloseProvidersByUseCount(
  3556. SInt32 * useCount,
  3557. OTResult reason,
  3558. OTBooleanParam doneDeal);
  3559. /*
  3560. * OTCloseProvidersByPortRef()
  3561. *
  3562. * Availability:
  3563. * Non-Carbon CFM: not available
  3564. * CarbonLib: not available
  3565. * Mac OS X: not available
  3566. */
  3567. EXTERN_API_C( void )
  3568. OTCloseProvidersByPortRef(
  3569. OTPortRef ref,
  3570. OTResult reason,
  3571. OTBooleanParam doneDeal);
  3572. /* These are the "real" APIs*/
  3573. /*
  3574. * OTCloseProviderByStream()
  3575. *
  3576. * Availability:
  3577. * Non-Carbon CFM: not available
  3578. * CarbonLib: not available
  3579. * Mac OS X: not available
  3580. */
  3581. EXTERN_API_C( void )
  3582. OTCloseProviderByStream(
  3583. StreamRef ref,
  3584. OTResult reason,
  3585. OTBooleanParam doneDeal);
  3586. /*
  3587. * OTCloseMatchingProviders()
  3588. *
  3589. * Availability:
  3590. * Non-Carbon CFM: not available
  3591. * CarbonLib: not available
  3592. * Mac OS X: not available
  3593. */
  3594. EXTERN_API_C( void )
  3595. OTCloseMatchingProviders(
  3596. UInt32 mask,
  3597. OTPortRef port,
  3598. OTResult reason,
  3599. OTBooleanParam doneDeal);
  3600. /* The following defines are for use in building an 'epcf' resource: */
  3601. /* Defines for fFlags field: */
  3602. #define kIsReliable 0x00000001
  3603. #define kIsNotReliable 0x00000002
  3604. #define kSupportsOrderlyRelease 0x00000004
  3605. /* Defines for fProtocolType field: */
  3606. #define kStream 0x0001
  3607. #define kUStream 0x0002
  3608. #define kTransaction 0x0004
  3609. #define kUTransaction 0x0008
  3610. #define kMapper 0x0010
  3611. #define kGenericProtocol 0x0020
  3612. /* Defines for optionType field: */
  3613. #define kBooleanOption 0
  3614. #define kUnsignedValueOption 1
  3615. #define kSignedValueOption 2
  3616. #define kHexValueOption 3
  3617. #define kPrintableStringOption 4
  3618. #define kOctetStringOption 5
  3619. /* Defines for fUpperInterface and fLowerInterface: */
  3620. #define kTPIInterface 'TPI '
  3621. #define kDLPIInterface 'DLPI'
  3622. #define kMapperInterface 'MAPR'
  3623. #define kPrivateInterface -1
  3624. #define kNoInterface 0
  3625. #endif /* CALL_NOT_IN_CARBON */
  3626. #endif /* !OTKERNEL */
  3627. #endif /* CALL_NOT_IN_CARBON */
  3628. /* ***** OTStateMachine ******/
  3629. #if CALL_NOT_IN_CARBON
  3630. /*
  3631. This utility set allows you to write an asynchronous chain of code that looks
  3632. somewhat like it is synchronous. This is primarily used for plumbing
  3633. streams asynchronously, especially in configurators
  3634. */
  3635. #if !OTKERNEL
  3636. /* Alas, the state machine is only available to client code. Sorry.*/
  3637. /*
  3638. There are 12 or 8 bytes of reserved space at the front of
  3639. the OTStateMachine structure, depending on whether you're
  3640. building PowerPC or 68K code.. The OTStateMachineDataPad
  3641. type compensates for this.
  3642. */
  3643. #if TARGET_CPU_PPC
  3644. typedef UInt8 OTStateMachineDataPad[12];
  3645. #else
  3646. typedef UInt8 OTStateMachineDataPad[8];
  3647. #endif /* TARGET_CPU_PPC */
  3648. /*
  3649. Forward define OTStateMachine so that OTStateProcPtr has
  3650. access to it.
  3651. */
  3652. typedef struct OTStateMachine OTStateMachine;
  3653. /*
  3654. This type is is the required prototype of a state machine
  3655. entry point.
  3656. */
  3657. typedef CALLBACK_API( void , OTStateProcPtr )(OTStateMachine * sm);
  3658. /*
  3659. This type defines a routine that the state machine will
  3660. call when the top level completes.
  3661. */
  3662. typedef CALLBACK_API_C( void , OTSMCompleteProcPtr )(void * contextPtr);
  3663. /* And now for the state machine structure itself.*/
  3664. struct OTStateMachine {
  3665. OTStateMachineDataPad fData;
  3666. void * fCookie;
  3667. OTEventCode fCode;
  3668. OTResult fResult;
  3669. #ifdef __cplusplus
  3670. // C++ inline methods on this structure.
  3671. void* GetClientData();
  3672. Boolean CallStateProc(OTStateProcPtr proc, UInt32 state = 0);
  3673. UInt16 GetState();
  3674. void SetState(UInt32 state);
  3675. void Complete();
  3676. void Complete(OTResult result);
  3677. void Complete(OTResult result, OTEventCode code, void* contextPtr);
  3678. void CompleteToClient();
  3679. void CompleteToClient(OTResult result);
  3680. void CompleteToClient(OTResult result, OTEventCode code, void* contexPtr);
  3681. void PopCallback();
  3682. Boolean CreateStream(OTConfigurationRef cfig, OTOpenFlags flags);
  3683. Boolean OpenStream(const char* name, OTOpenFlags flags);
  3684. Boolean SendIoctl(StreamRef ref, UInt32 type, void* data);
  3685. Boolean SendIoctl(StreamRef ref, UInt32 type, long data);
  3686. Boolean PutMessage(StreamRef ref, strbuf* ctl, strbuf* data, OTFlags flags);
  3687. Boolean GetMessage(StreamRef ref, strbuf* ctl, strbuf* data, OTFlags* flagPtr);
  3688. OSStatus ReturnToCaller();
  3689. #endif
  3690. };
  3691. #define kOTSMBufferSize(callDepth) (80 + (callDepth * 8))
  3692. /*
  3693. For structSize, pass the size of your structure that you want associated with
  3694. the state machine. It can later be obtained by calling OTSMGetClientData.
  3695. For bufSize, use the kOTSMBufferSize macro, plus the size of your structure
  3696. to create a buffer on the stack. For synchronous calls, the stack buffer will
  3697. be used (unless you pass in NULL). The callDepth is the depth level of nested
  3698. calls using OTSMCallStateProc.
  3699. */
  3700. #if CALL_NOT_IN_CARBON
  3701. /*
  3702. * OTCreateStateMachine()
  3703. *
  3704. * Availability:
  3705. * Non-Carbon CFM: not available
  3706. * CarbonLib: not available
  3707. * Mac OS X: not available
  3708. */
  3709. EXTERN_API_C( OTStateMachine * )
  3710. OTCreateStateMachine(
  3711. void * buf,
  3712. OTByteCount bufSize,
  3713. OTByteCount structSize,
  3714. OTNotifyUPP proc,
  3715. void * contextPtr);
  3716. /*
  3717. * OTDestroyStateMachine()
  3718. *
  3719. * Availability:
  3720. * Non-Carbon CFM: not available
  3721. * CarbonLib: not available
  3722. * Mac OS X: not available
  3723. */
  3724. EXTERN_API_C( void )
  3725. OTDestroyStateMachine(OTStateMachine * sm);
  3726. /*
  3727. OTSMCallStateProc used to take a parameter of type UInt16_p,
  3728. which was defined to be the same as UInt32. In an attempt
  3729. to reduce the number of wacky types defined by the OT
  3730. interfaces, we've changed these routines to just take a
  3731. straight UInt32. You should be warned that the current
  3732. implementation does not support values outside of the
  3733. range 0..32767. The same applies to OTSMSetState.
  3734. */
  3735. /*
  3736. * OTSMCallStateProc()
  3737. *
  3738. * Availability:
  3739. * Non-Carbon CFM: not available
  3740. * CarbonLib: not available
  3741. * Mac OS X: not available
  3742. */
  3743. EXTERN_API_C( Boolean )
  3744. OTSMCallStateProc(
  3745. OTStateMachine * sm,
  3746. OTStateProcPtr proc,
  3747. UInt32 state);
  3748. /*
  3749. * OTSMGetState()
  3750. *
  3751. * Availability:
  3752. * Non-Carbon CFM: not available
  3753. * CarbonLib: not available
  3754. * Mac OS X: not available
  3755. */
  3756. EXTERN_API_C( UInt16 )
  3757. OTSMGetState(OTStateMachine * sm);
  3758. /*
  3759. * OTSMSetState()
  3760. *
  3761. * Availability:
  3762. * Non-Carbon CFM: not available
  3763. * CarbonLib: not available
  3764. * Mac OS X: not available
  3765. */
  3766. EXTERN_API_C( void )
  3767. OTSMSetState(
  3768. OTStateMachine * sm,
  3769. UInt32 state);
  3770. /* Fill out the fCookie, fCode, and fResult fields before calling!*/
  3771. /*
  3772. * OTSMComplete()
  3773. *
  3774. * Availability:
  3775. * Non-Carbon CFM: not available
  3776. * CarbonLib: not available
  3777. * Mac OS X: not available
  3778. */
  3779. EXTERN_API_C( void )
  3780. OTSMComplete(OTStateMachine * sm);
  3781. /*
  3782. * OTSMPopCallback()
  3783. *
  3784. * Availability:
  3785. * Non-Carbon CFM: not available
  3786. * CarbonLib: not available
  3787. * Mac OS X: not available
  3788. */
  3789. EXTERN_API_C( void )
  3790. OTSMPopCallback(OTStateMachine * sm);
  3791. /*
  3792. * OTSMWaitForComplete()
  3793. *
  3794. * Availability:
  3795. * Non-Carbon CFM: not available
  3796. * CarbonLib: not available
  3797. * Mac OS X: not available
  3798. */
  3799. EXTERN_API_C( Boolean )
  3800. OTSMWaitForComplete(OTStateMachine * sm);
  3801. /*
  3802. * OTSMCreateStream()
  3803. *
  3804. * Availability:
  3805. * Non-Carbon CFM: not available
  3806. * CarbonLib: not available
  3807. * Mac OS X: not available
  3808. */
  3809. EXTERN_API_C( Boolean )
  3810. OTSMCreateStream(
  3811. OTStateMachine * sm,
  3812. OTConfigurationRef cfig,
  3813. OTOpenFlags flags);
  3814. /*
  3815. * OTSMOpenStream()
  3816. *
  3817. * Availability:
  3818. * Non-Carbon CFM: not available
  3819. * CarbonLib: not available
  3820. * Mac OS X: not available
  3821. */
  3822. EXTERN_API_C( Boolean )
  3823. OTSMOpenStream(
  3824. OTStateMachine * sm,
  3825. const char * name,
  3826. OTOpenFlags flags);
  3827. /*
  3828. * OTSMIoctl()
  3829. *
  3830. * Availability:
  3831. * Non-Carbon CFM: not available
  3832. * CarbonLib: not available
  3833. * Mac OS X: not available
  3834. */
  3835. EXTERN_API_C( Boolean )
  3836. OTSMIoctl(
  3837. OTStateMachine * sm,
  3838. StreamRef strm,
  3839. UInt32 cmd,
  3840. long data);
  3841. /*
  3842. * OTSMPutMessage()
  3843. *
  3844. * Availability:
  3845. * Non-Carbon CFM: not available
  3846. * CarbonLib: not available
  3847. * Mac OS X: not available
  3848. */
  3849. EXTERN_API_C( Boolean )
  3850. OTSMPutMessage(
  3851. OTStateMachine * sm,
  3852. StreamRef strm,
  3853. strbuf * ctlbuf,
  3854. strbuf * databuf,
  3855. OTFlags flags);
  3856. /*
  3857. * OTSMGetMessage()
  3858. *
  3859. * Availability:
  3860. * Non-Carbon CFM: not available
  3861. * CarbonLib: not available
  3862. * Mac OS X: not available
  3863. */
  3864. EXTERN_API_C( Boolean )
  3865. OTSMGetMessage(
  3866. OTStateMachine * sm,
  3867. StreamRef strm,
  3868. strbuf * ctlbuf,
  3869. strbuf * databuf,
  3870. OTFlags * flagsPtr);
  3871. /*
  3872. * OTSMReturnToCaller()
  3873. *
  3874. * Availability:
  3875. * Non-Carbon CFM: not available
  3876. * CarbonLib: not available
  3877. * Mac OS X: not available
  3878. */
  3879. EXTERN_API_C( OSStatus )
  3880. OTSMReturnToCaller(OTStateMachine * sm);
  3881. /*
  3882. * OTSMGetClientData()
  3883. *
  3884. * Availability:
  3885. * Non-Carbon CFM: not available
  3886. * CarbonLib: not available
  3887. * Mac OS X: not available
  3888. */
  3889. EXTERN_API_C( void * )
  3890. OTSMGetClientData(OTStateMachine * sm);
  3891. /*
  3892. * OTSMInstallCompletionProc()
  3893. *
  3894. * Availability:
  3895. * Non-Carbon CFM: not available
  3896. * CarbonLib: not available
  3897. * Mac OS X: not available
  3898. */
  3899. EXTERN_API_C( void )
  3900. OTSMInstallCompletionProc(
  3901. OTStateMachine * sm,
  3902. OTSMCompleteProcPtr completeProc,
  3903. void * contextPtr);
  3904. /*
  3905. * OTSMCreateControlStream()
  3906. *
  3907. * Availability:
  3908. * Non-Carbon CFM: not available
  3909. * CarbonLib: not available
  3910. * Mac OS X: not available
  3911. */
  3912. EXTERN_API_C( Boolean )
  3913. OTSMCreateControlStream(
  3914. OTStateMachine * sm,
  3915. OTConfigurationRef cfig,
  3916. TOTConfiguratorRef cfigor);
  3917. #ifdef __cplusplus
  3918. inline void* OTStateMachine::GetClientData() { return OTSMGetClientData(this); }
  3919. inline Boolean OTStateMachine::CallStateProc(OTStateProcPtr proc, UInt32 state)
  3920. { return OTSMCallStateProc(this, proc, state); }
  3921. inline UInt16 OTStateMachine::GetState() { return OTSMGetState(this); }
  3922. inline void OTStateMachine::SetState(UInt32 state)
  3923. { OTSMSetState(this, state); }
  3924. inline void OTStateMachine::PopCallback() { OTSMPopCallback(this); }
  3925. inline void OTStateMachine::Complete() { OTSMComplete(this); }
  3926. inline void OTStateMachine::Complete(OTResult result, OTEventCode code, void* cookie)
  3927. { fCookie = cookie; fCode = code; fResult = result; Complete(); }
  3928. inline void OTStateMachine::Complete(OTResult result)
  3929. { fResult = result; Complete(); }
  3930. inline void OTStateMachine::CompleteToClient()
  3931. { PopCallback(); Complete(); }
  3932. inline void OTStateMachine::CompleteToClient(OTResult result)
  3933. { fResult = result; CompleteToClient(); }
  3934. inline void OTStateMachine::CompleteToClient(OTResult result, OTEventCode code, void* cookie)
  3935. { fCookie = cookie; fCode = code; fResult = result; CompleteToClient(); }
  3936. inline Boolean OTStateMachine::CreateStream(OTConfigurationRef cfig, OTOpenFlags flags)
  3937. { return OTSMCreateStream(this, cfig, flags); }
  3938. inline Boolean OTStateMachine::OpenStream(const char* name, OTOpenFlags flags)
  3939. { return OTSMOpenStream(this, name, flags); }
  3940. inline Boolean OTStateMachine::SendIoctl(StreamRef ref, UInt32 type, void* data)
  3941. { return OTSMIoctl(this, ref, type, (long)data); }
  3942. inline Boolean OTStateMachine::SendIoctl(StreamRef ref, UInt32 type, long data)
  3943. { return OTSMIoctl(this, ref, type, data); }
  3944. inline Boolean OTStateMachine::PutMessage(StreamRef ref, struct strbuf* ctl, struct strbuf* data, OTFlags flags)
  3945. { return OTSMPutMessage(this, ref, ctl, data, flags); }
  3946. inline Boolean OTStateMachine::GetMessage(StreamRef ref, struct strbuf* ctl, struct strbuf* data, OTFlags* flagPtr)
  3947. { return OTSMGetMessage(this, ref, ctl, data, flagPtr); }
  3948. inline OSStatus OTStateMachine::ReturnToCaller()
  3949. { return OTSMReturnToCaller(this); }
  3950. #endif
  3951. #endif /* CALL_NOT_IN_CARBON */
  3952. #endif /* !OTKERNEL */
  3953. /* ***** Autopush Definitions ******/
  3954. /*
  3955. The autopush functionality for Open Transport is based on the names of
  3956. devices and modules, rather than on the major number information like
  3957. SVR4. This is so that autopush information can be set up for modules
  3958. that are not yet loaded.
  3959. */
  3960. /* The name of the STREAMS driver you open and send the ioctls to.*/
  3961. #define kSADModuleName "sad"
  3962. /* Autopush ioctls.*/
  3963. enum {
  3964. I_SAD_SAP = ((MIOC_SAD << 8) | 1), /* Set autopush information */
  3965. I_SAD_GAP = ((MIOC_SAD << 8) | 2), /* Get autopush information */
  3966. I_SAD_VML = ((MIOC_SAD << 8) | 3) /* Validate a list of modules (uses str_list structure) */
  3967. };
  3968. /* Maximum number of modules autopushed on a driver.*/
  3969. enum {
  3970. kOTAutopushMax = 8
  3971. };
  3972. /* ioctl structure used for SAD_SAP and SAD_GAP commands.*/
  3973. struct OTAutopushInfo {
  3974. UInt32 sap_cmd;
  3975. char sap_device_name[32];
  3976. SInt32 sap_minor;
  3977. SInt32 sap_lastminor;
  3978. SInt32 sap_npush;
  3979. char sap_list[8][32];
  3980. };
  3981. typedef struct OTAutopushInfo OTAutopushInfo;
  3982. /* Command values for sap_cmd field of the above.*/
  3983. enum {
  3984. kSAP_ONE = 1, /* Configure a single minor device */
  3985. kSAP_RANGE = 2, /* Configure a range of minor devices */
  3986. kSAP_ALL = 3, /* Configure all minor devices */
  3987. kSAP_CLEAR = 4 /* Clear autopush information */
  3988. };
  3989. /* ***** Configuration Helpers ******/
  3990. /*
  3991. These definitions are used by device driver and port scanner
  3992. developers to provide a library giving client-side information about
  3993. the registered ports, such as a user-visible name or an icon.
  3994. */
  3995. /* Configuration helper library prefix*/
  3996. /*
  3997. This prefix is prepended to the string found in the "fResourceInfo"
  3998. field of the OTPortRecord to build the actual library name of the
  3999. configuration helper library.
  4000. */
  4001. #define kPortConfigLibPrefix "OTPortCfg$"
  4002. /* Get user visible port name entry point.*/
  4003. /*
  4004. This entry point returns the user visible name of the port. If includeSlot
  4005. is true, a slot distinguishing suffix (eg "slot X") should be added. If
  4006. includePort is true, a port distinguishing suffix (eg " port X") should be added for
  4007. multiport cards.
  4008. */
  4009. #define kOTGetUserPortNameID "OTGetUserPortName"
  4010. typedef CALLBACK_API_C( void , OTGetPortNameProcPtr )(OTPortRecord *port, OTBooleanParam includeSlot, OTBooleanParam includePort, Str255 userVisibleName);
  4011. /* Get icon entry point.*/
  4012. /*
  4013. This entry point returns the location of the icon for the port. Return false if no
  4014. icon is provided.
  4015. */
  4016. #define kOTGetPortIconID "OTGetPortIcon"
  4017. struct OTResourceLocator {
  4018. FSSpec fFile;
  4019. UInt16 fResID;
  4020. };
  4021. typedef struct OTResourceLocator OTResourceLocator;
  4022. typedef CALLBACK_API_C( Boolean , OTGetPortIconProcPtr )(OTPortRecord *port, OTResourceLocator *iconLocation);
  4023. /* ***** Application Access to Configuration Helpers ******/
  4024. #if !OTKERNEL
  4025. /*
  4026. These routines are used by clients to get information about ports.
  4027. The canonical user of these routines is the OT control panel(s),
  4028. but applications may want to use them as well (to display the list
  4029. of available Ethernet cards, for example).
  4030. */
  4031. /* Returns a user friendly name for a port.*/
  4032. #if CALL_NOT_IN_CARBON
  4033. /*
  4034. * OTGetUserPortNameFromPortRef()
  4035. *
  4036. * Availability:
  4037. * Non-Carbon CFM: not available
  4038. * CarbonLib: not available
  4039. * Mac OS X: not available
  4040. */
  4041. EXTERN_API_C( void )
  4042. OTGetUserPortNameFromPortRef(
  4043. OTPortRef ref,
  4044. Str255 friendlyName);
  4045. /*
  4046. Returns the location for the icon familly representing the port.
  4047. Returns false if the port has no icon.
  4048. */
  4049. /*
  4050. * OTGetPortIconFromPortRef()
  4051. *
  4052. * Availability:
  4053. * Non-Carbon CFM: not available
  4054. * CarbonLib: not available
  4055. * Mac OS X: not available
  4056. */
  4057. EXTERN_API_C( Boolean )
  4058. OTGetPortIconFromPortRef(
  4059. OTPortRef ref,
  4060. OTResourceLocator * iconLocation);
  4061. #endif /* CALL_NOT_IN_CARBON */
  4062. /* Returns true if the port can be used with the specified protocol.*/
  4063. #if CALL_NOT_IN_CARBON
  4064. /*
  4065. * OTIsPortCompatibleWith()
  4066. *
  4067. * Availability:
  4068. * Non-Carbon CFM: not available
  4069. * CarbonLib: not available
  4070. * Mac OS X: not available
  4071. */
  4072. EXTERN_API_C( Boolean )
  4073. OTIsPortCompatibleWith(
  4074. const OTPortRecord * port,
  4075. char * protocolName);
  4076. #endif /* CALL_NOT_IN_CARBON */
  4077. #endif /* !OTKERNEL */
  4078. #endif /* CALL_NOT_IN_CARBON */
  4079. /* ***** Common Utilities ******/
  4080. /*
  4081. The utilities defined in this section are available to both client
  4082. and kernel code. Cool huh? These utilities differ from those
  4083. provided in "OpenTransport.h" in that they are only available to native
  4084. architecture clients.
  4085. */
  4086. /* Bitmap functions*/
  4087. /* These functions atomically deal with a bitmap that is multiple-bytes long*/
  4088. /*
  4089. Set the first clear bit in "bitMap", starting with bit "startBit",
  4090. giving up after "numBits". Returns the bit # that was set, or
  4091. a kOTNotFoundErr if there was no clear bit available
  4092. */
  4093. /*
  4094. * OTSetFirstClearBit()
  4095. *
  4096. * Availability:
  4097. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4098. * CarbonLib: in CarbonLib 1.0 and later
  4099. * Mac OS X: in version 10.0 and later
  4100. */
  4101. EXTERN_API_C( OTResult )
  4102. OTSetFirstClearBit(
  4103. UInt8 * bitMap,
  4104. OTByteCount startBit,
  4105. OTByteCount numBits);
  4106. /* Standard clear, set and test bit functions*/
  4107. /*
  4108. * OTClearBit()
  4109. *
  4110. * Availability:
  4111. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4112. * CarbonLib: in CarbonLib 1.0 and later
  4113. * Mac OS X: in version 10.0 and later
  4114. */
  4115. EXTERN_API_C( Boolean )
  4116. OTClearBit(
  4117. UInt8 * bitMap,
  4118. OTByteCount bitNo);
  4119. /*
  4120. * OTSetBit()
  4121. *
  4122. * Availability:
  4123. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4124. * CarbonLib: in CarbonLib 1.0 and later
  4125. * Mac OS X: in version 10.0 and later
  4126. */
  4127. EXTERN_API_C( Boolean )
  4128. OTSetBit(
  4129. UInt8 * bitMap,
  4130. OTByteCount bitNo);
  4131. /*
  4132. * OTTestBit()
  4133. *
  4134. * Availability:
  4135. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4136. * CarbonLib: in CarbonLib 1.0 and later
  4137. * Mac OS X: in version 10.0 and later
  4138. */
  4139. EXTERN_API_C( Boolean )
  4140. OTTestBit(
  4141. UInt8 * bitMap,
  4142. OTByteCount bitNo);
  4143. /* OTHashList*/
  4144. /*
  4145. This implements a simple, but efficient hash list. It is not
  4146. thread-safe.
  4147. */
  4148. typedef CALLBACK_API_C( UInt32 , OTHashProcPtr )(OTLink * linkToHash);
  4149. typedef CALLBACK_API_C( Boolean , OTHashSearchProcPtr )(const void *ref, OTLink *linkToCheck);
  4150. struct OTHashList {
  4151. OTHashProcPtr fHashProc;
  4152. ByteCount fHashTableSize;
  4153. OTLink ** fHashBuckets;
  4154. #ifdef __cplusplus
  4155. // C++ inline methods on this structure.
  4156. void Add(OTLink* toAdd);
  4157. Boolean RemoveLink(OTLink* toRemove);
  4158. OTLink* Remove(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hashValue);
  4159. Boolean IsInList(OTLink* toFind);
  4160. OTLink* FindLink(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hash);
  4161. #endif
  4162. };
  4163. typedef struct OTHashList OTHashList;
  4164. /*
  4165. Return the number of bytes of memory needed to create a hash list
  4166. of at least "numEntries" entries.
  4167. */
  4168. #if CALL_NOT_IN_CARBON
  4169. /*
  4170. * OTCalculateHashListMemoryNeeds()
  4171. *
  4172. * Availability:
  4173. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4174. * CarbonLib: not available
  4175. * Mac OS X: not available
  4176. */
  4177. EXTERN_API_C( OTByteCount )
  4178. OTCalculateHashListMemoryNeeds(OTItemCount numEntries);
  4179. /*
  4180. Create an OTHashList from "memory". Return an error if it
  4181. couldn't be done.
  4182. */
  4183. /*
  4184. * OTInitHashList()
  4185. *
  4186. * Availability:
  4187. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4188. * CarbonLib: not available
  4189. * Mac OS X: not available
  4190. */
  4191. EXTERN_API_C( OTResult )
  4192. OTInitHashList(
  4193. void * memory,
  4194. OTByteCount numBytes,
  4195. OTHashProcPtr hashProc);
  4196. /*
  4197. * OTAddToHashList()
  4198. *
  4199. * Availability:
  4200. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4201. * CarbonLib: not available
  4202. * Mac OS X: not available
  4203. */
  4204. EXTERN_API_C( void )
  4205. OTAddToHashList(
  4206. OTHashList * hashList,
  4207. OTLink * linkToAdd);
  4208. /*
  4209. * OTRemoveLinkFromHashList()
  4210. *
  4211. * Availability:
  4212. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4213. * CarbonLib: not available
  4214. * Mac OS X: not available
  4215. */
  4216. EXTERN_API_C( Boolean )
  4217. OTRemoveLinkFromHashList(
  4218. OTHashList * hashList,
  4219. OTLink * linkToRemove);
  4220. /*
  4221. * OTIsInHashList()
  4222. *
  4223. * Availability:
  4224. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4225. * CarbonLib: not available
  4226. * Mac OS X: not available
  4227. */
  4228. EXTERN_API_C( Boolean )
  4229. OTIsInHashList(
  4230. OTHashList * hashList,
  4231. OTLink * link);
  4232. /*
  4233. * OTFindInHashList()
  4234. *
  4235. * Availability:
  4236. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4237. * CarbonLib: not available
  4238. * Mac OS X: not available
  4239. */
  4240. EXTERN_API_C( OTLink * )
  4241. OTFindInHashList(
  4242. OTHashList * hashList,
  4243. OTHashSearchProcPtr searchProc,
  4244. const void * refPtr,
  4245. UInt32 hashValue);
  4246. /*
  4247. * OTRemoveFromHashList()
  4248. *
  4249. * Availability:
  4250. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4251. * CarbonLib: not available
  4252. * Mac OS X: not available
  4253. */
  4254. EXTERN_API_C( OTLink * )
  4255. OTRemoveFromHashList(
  4256. OTHashList * hashList,
  4257. OTHashSearchProcPtr searchProc,
  4258. const void * refPtr,
  4259. UInt32 hashValue);
  4260. #endif /* CALL_NOT_IN_CARBON */
  4261. #ifdef __cplusplus
  4262. #if CALL_NOT_IN_CARBON
  4263. // C++ inline methods on this structure.
  4264. inline void OTHashList::Add(OTLink* toAdd) { OTAddToHashList(this, toAdd); }
  4265. inline Boolean OTHashList::RemoveLink(OTLink* toRemove)
  4266. { return OTRemoveLinkFromHashList(this, toRemove); }
  4267. inline OTLink* OTHashList::Remove(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hashValue)
  4268. { return OTRemoveFromHashList(this, proc, refPtr, hashValue); }
  4269. inline Boolean OTHashList::IsInList(OTLink* toFind)
  4270. { return OTIsInHashList(this, toFind); }
  4271. inline OTLink* OTHashList::FindLink(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hash)
  4272. { return OTFindInHashList(this, proc, refPtr, hash); }
  4273. #endif
  4274. #endif
  4275. /* Random functions*/
  4276. /*
  4277. These implement a very simple random number generator, suitable
  4278. for protocol implementations but not "cryptographically" random.
  4279. */
  4280. #if CALL_NOT_IN_CARBON
  4281. /*
  4282. * OTGetRandomSeed()
  4283. *
  4284. * Availability:
  4285. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4286. * CarbonLib: not available
  4287. * Mac OS X: not available
  4288. */
  4289. EXTERN_API_C( UInt32 )
  4290. OTGetRandomSeed(void);
  4291. /*
  4292. * OTGetRandomNumber()
  4293. *
  4294. * Availability:
  4295. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4296. * CarbonLib: not available
  4297. * Mac OS X: not available
  4298. */
  4299. EXTERN_API_C( UInt32 )
  4300. OTGetRandomNumber(
  4301. UInt32 * seed,
  4302. UInt32 lo,
  4303. UInt32 hi);
  4304. /* Concurrency Control*/
  4305. /*
  4306. OTGate implements a cool concurrency control primitive.
  4307. You're not going to understand it without reading the documentation!
  4308. See "Open Transport Advanced Client Programming" for details.
  4309. WARNING:
  4310. This structure must be on a 4-byte boundary.
  4311. */
  4312. #endif /* CALL_NOT_IN_CARBON */
  4313. typedef CALLBACK_API_C( Boolean , OTGateProcPtr )(OTLink * thisLink);
  4314. struct OTGate {
  4315. OTLIFO fLIFO;
  4316. OTList fList;
  4317. OTGateProcPtr fProc;
  4318. SInt32 fNumQueued;
  4319. SInt32 fInside;
  4320. };
  4321. typedef struct OTGate OTGate;
  4322. #if CALL_NOT_IN_CARBON
  4323. /*
  4324. * OTInitGate()
  4325. *
  4326. * Availability:
  4327. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4328. * CarbonLib: not available
  4329. * Mac OS X: not available
  4330. */
  4331. EXTERN_API_C( void )
  4332. OTInitGate(
  4333. OTGate * gate,
  4334. OTGateProcPtr proc);
  4335. /*
  4336. * OTEnterGate()
  4337. *
  4338. * Availability:
  4339. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4340. * CarbonLib: not available
  4341. * Mac OS X: not available
  4342. */
  4343. EXTERN_API_C( Boolean )
  4344. OTEnterGate(
  4345. OTGate * gate,
  4346. OTLink * withLink);
  4347. /*
  4348. * OTLeaveGate()
  4349. *
  4350. * Availability:
  4351. * Non-Carbon CFM: in OTUtilityLib 1.0 and later
  4352. * CarbonLib: not available
  4353. * Mac OS X: not available
  4354. */
  4355. EXTERN_API_C( Boolean )
  4356. OTLeaveGate(OTGate * gate);
  4357. /* ***** Shared Library Bonus Extras ******/
  4358. #endif /* CALL_NOT_IN_CARBON */
  4359. #if CALL_NOT_IN_CARBON
  4360. /*
  4361. These routines provide addition shared library support beyond
  4362. that provided by the base shared library mechanism.
  4363. */
  4364. /*
  4365. Some flags which can be passed to the "loadFlags" parameter of the
  4366. various CFM routines. Not all flags can be used with all routines.
  4367. See "Open Transport Advanced Client Programming" for details.
  4368. */
  4369. enum {
  4370. kOTGetDataSymbol = 0,
  4371. kOTGetCodeSymbol = 1,
  4372. kOTLoadNewCopy = 2,
  4373. kOTLoadACopy = 4,
  4374. kOTFindACopy = 8,
  4375. kOTLibMask = kOTLoadNewCopy | kOTLoadACopy | kOTFindACopy,
  4376. kOTLoadLibResident = 0x20
  4377. };
  4378. /* Finding all matching CFM libraries.*/
  4379. /*
  4380. The routine OTFindCFMLibraries allows you to find all CFM libraries
  4381. that match specific criteria. The result is placed in a list
  4382. of CFMLibraryInfo structures. OT allocates those structures using
  4383. a routine of type OTAllocMemProcPtr that you pass to OTFindCFMLibraries.
  4384. */
  4385. /*
  4386. A list of CFMLibraryInfo structures is returned by the OTFindCFMLibraries routine.
  4387. The list is created out of the data that is passed to the function.
  4388. IMPORTANT:
  4389. Only the first 3 fields are valid when using OT 1.2 and older.
  4390. */
  4391. struct CFMLibraryInfo {
  4392. OTLink link; /* To link them all up on a list */
  4393. char * libName; /* "C" String which is fragment name */
  4394. StringPtr intlName; /* Pascal String which is internationalized name */
  4395. FSSpec * fileSpec; /* location of fragment's file */
  4396. StringPtr pstring2; /* Secondary string from extended cfrg */
  4397. StringPtr pstring3; /* Extra info from extended cfrg */
  4398. };
  4399. typedef struct CFMLibraryInfo CFMLibraryInfo;
  4400. /*
  4401. You must pass a routine of type OTAllocMemProcPtr to OTFindCFMLibraries
  4402. which it calls to allocate memory for the CFMLibraryInfo structures.
  4403. */
  4404. typedef CALLBACK_API_C( void *, OTAllocMemProcPtr )(OTByteCount size);
  4405. /* Find CFM libraries of the specified kind and type*/
  4406. #if CALL_NOT_IN_CARBON
  4407. /*
  4408. * OTFindCFMLibraries()
  4409. *
  4410. * Availability:
  4411. * Non-Carbon CFM: not available
  4412. * CarbonLib: not available
  4413. * Mac OS X: not available
  4414. */
  4415. EXTERN_API_C( OSStatus )
  4416. OTFindCFMLibraries(
  4417. OSType libKind,
  4418. const char * libType,
  4419. OTList * theList,
  4420. OTAllocMemProcPtr allocator);
  4421. /* Loading libraries and connecting to symbols.*/
  4422. /* Load a CFM library by name*/
  4423. /*
  4424. * OTLoadCFMLibrary()
  4425. *
  4426. * Availability:
  4427. * Non-Carbon CFM: not available
  4428. * CarbonLib: not available
  4429. * Mac OS X: not available
  4430. */
  4431. EXTERN_API_C( OSStatus )
  4432. OTLoadCFMLibrary(
  4433. const char * libName,
  4434. UInt32 * connID,
  4435. UInt32 loadFlags);
  4436. /* Load a CFM library and get a named pointer from it*/
  4437. /*
  4438. * OTGetCFMPointer()
  4439. *
  4440. * Availability:
  4441. * Non-Carbon CFM: not available
  4442. * CarbonLib: not available
  4443. * Mac OS X: not available
  4444. */
  4445. EXTERN_API_C( void * )
  4446. OTGetCFMPointer(
  4447. const char * libName,
  4448. const char * entryName,
  4449. UInt32 * connID,
  4450. UInt32 loadFlags);
  4451. /* Get a named pointer from a CFM library that's already loaded*/
  4452. /*
  4453. * OTGetCFMSymbol()
  4454. *
  4455. * Availability:
  4456. * Non-Carbon CFM: not available
  4457. * CarbonLib: not available
  4458. * Mac OS X: not available
  4459. */
  4460. EXTERN_API_C( void * )
  4461. OTGetCFMSymbol(
  4462. const char * entryName,
  4463. UInt32 connID,
  4464. UInt32 loadFlags);
  4465. /* Release a connection to a CFM library*/
  4466. /*
  4467. * OTReleaseCFMConnection()
  4468. *
  4469. * Availability:
  4470. * Non-Carbon CFM: not available
  4471. * CarbonLib: not available
  4472. * Mac OS X: not available
  4473. */
  4474. EXTERN_API_C( void )
  4475. OTReleaseCFMConnection(UInt32 * connID);
  4476. #endif /* CALL_NOT_IN_CARBON */
  4477. #if !TARGET_CPU_68K
  4478. /*
  4479. You can call these routines in your CFM initialisation and termination
  4480. routines to hold or unhold your libraries sections.
  4481. */
  4482. /*
  4483. Used in a CFM InitProc, will hold the executable code, if applicable.
  4484. This can also be the InitProc of the library
  4485. */
  4486. #if CALL_NOT_IN_CARBON
  4487. /*
  4488. * OTHoldThisCFMLibrary()
  4489. *
  4490. * Availability:
  4491. * Non-Carbon CFM: not available
  4492. * CarbonLib: not available
  4493. * Mac OS X: not available
  4494. */
  4495. EXTERN_API_C( OSStatus )
  4496. OTHoldThisCFMLibrary(const CFragInitBlock * initBlock);
  4497. /*
  4498. Used in a CFM terminate proc, will unhold the executable code, if applicable.
  4499. This can also be the terminate proc of the library
  4500. */
  4501. /*
  4502. * OTUnholdThisCFMLibrary()
  4503. *
  4504. * Availability:
  4505. * Non-Carbon CFM: not available
  4506. * CarbonLib: not available
  4507. * Mac OS X: not available
  4508. */
  4509. EXTERN_API_C( void )
  4510. OTUnholdThisCFMLibrary(void);
  4511. #endif /* CALL_NOT_IN_CARBON */
  4512. #endif /* !TARGET_CPU_68K */
  4513. /* ASLM Utilities*/
  4514. /* Load an ASLM library*/
  4515. #if CALL_NOT_IN_CARBON
  4516. /*
  4517. * OTLoadASLMLibrary()
  4518. *
  4519. * Availability:
  4520. * Non-Carbon CFM: not available
  4521. * CarbonLib: not available
  4522. * Mac OS X: not available
  4523. */
  4524. EXTERN_API_C( OSStatus )
  4525. OTLoadASLMLibrary(const char * libName);
  4526. /* Unload an ASLM library*/
  4527. /*
  4528. * OTUnloadASLMLibrary()
  4529. *
  4530. * Availability:
  4531. * Non-Carbon CFM: not available
  4532. * CarbonLib: not available
  4533. * Mac OS X: not available
  4534. */
  4535. EXTERN_API_C( void )
  4536. OTUnloadASLMLibrary(const char * libName);
  4537. /*
  4538. This is an ASLM utility routine. You can get it by including
  4539. "LibraryManagerUtilities.h", but since we only use a few ASLM utilities,
  4540. we put the prototype here for convenience.
  4541. */
  4542. /*
  4543. * UnloadUnusedLibraries()
  4544. *
  4545. * Availability:
  4546. * Non-Carbon CFM: not available
  4547. * CarbonLib: not available
  4548. * Mac OS X: not available
  4549. */
  4550. EXTERN_API_C( void )
  4551. UnloadUnusedLibraries(void);
  4552. #endif /* CALL_NOT_IN_CARBON */
  4553. #if !OTKERNEL
  4554. /*******************************************************************************
  4555. ** A few C++ objects for C++ fans
  4556. ********************************************************************************/
  4557. #if CALL_NOT_IN_CARBON
  4558. #ifdef __cplusplus
  4559. } // Terminate C definitions
  4560. class OTConfiguration
  4561. {
  4562. public:
  4563. OTConfigurationRef Clone()
  4564. { return OTCfigCloneConfiguration(this); }
  4565. //
  4566. // The Path for PushChild and PushParent must be a single module
  4567. //
  4568. OTConfigurationRef PushChild(const char* path, OSStatus* errPtr)
  4569. { return OTCfigPushNewSingleChild(this, path, errPtr); }
  4570. OTConfigurationRef PushParent(const char* path, OSStatus* errPtr)
  4571. { return OTCfigPushParent(this, path, errPtr); }
  4572. OTConfigurationRef PushNthChild(OTItemCount index, const char* path,
  4573. OSStatus* errPtr)
  4574. { return OTCfigPushChild(this, index, path, errPtr); }
  4575. OSStatus PopChild(OTItemCount index)
  4576. { return OTCfigPopChild(this, index); }
  4577. OTConfigurationRef GetChild(OTItemCount index = 0)
  4578. { return OTCfigGetChild(this, index); }
  4579. OTConfigurationRef GetParent()
  4580. { return OTCfigGetParent(this); }
  4581. OSStatus AddChild(OTConfigurationRef child)
  4582. { return OTCfigAddChild(this, child); }
  4583. OTConfigurationRef NewChild(const char* path, OSStatus* errPtr)
  4584. { return OTCfigNewChild(this, path, errPtr); }
  4585. OSStatus SetPath(const char* path)
  4586. { return OTCfigSetPath(this, path); }
  4587. Boolean HasOptions()
  4588. { return OTCfigGetOptionNetbuf(this)->len != 0; }
  4589. };
  4590. /* -------------------------------------------------------------------------
  4591. Class TOTConfigurator
  4592. This class is subclassed to do configuration for a protocol or protocol stack.
  4593. Of course, you can also use OTNewConfigurator to do it from C.
  4594. If you subclass it using C++, you MUST have a UInt32 field as the first
  4595. field of your object that you do not touch or use.
  4596. ------------------------------------------------------------------------- */
  4597. #if TARGET_CPU_68K && !defined(__SC__) && !defined(THINK_CPLUS)
  4598. class TOTConfigurator : public SingleObject
  4599. #else
  4600. class TOTConfigurator
  4601. #endif
  4602. {
  4603. #if defined(__SC__) || defined(THINK_CPLUS) || defined(__MRC__)
  4604. private:
  4605. virtual void DummyVirtualFunction();
  4606. #endif
  4607. public:
  4608. void* operator new(size_t size)
  4609. { return OTAllocSharedClientMem((OTByteCount)size); }
  4610. void operator delete(void* mem)
  4611. { OTFreeSharedClientMem(mem); };
  4612. _MDECL TOTConfigurator();
  4613. virtual ~ _MDECL TOTConfigurator();
  4614. virtual void _MDECL HandleSystemEvent(OTEventCode event, OTResult result,
  4615. void* cookie) = 0;
  4616. virtual OSStatus _MDECL Configure(OTConfigurationRef) = 0;
  4617. virtual OSStatus _MDECL CreateStream(OTConfigurationRef, OTOpenFlags,
  4618. OTNotifyUPP, void* contextPtr) = 0;
  4619. };
  4620. extern "C" { // resume C definitions
  4621. #endif /*__cplusplus*/
  4622. #endif /* CALL_NOT_IN_CARBON */
  4623. #endif /* !OTKERNEL */
  4624. #endif /* CALL_NOT_IN_CARBON */
  4625. #if defined(__MWERKS__) && TARGET_CPU_68K
  4626. #pragma pop
  4627. #endif
  4628. #if PRAGMA_STRUCT_ALIGN
  4629. #pragma options align=reset
  4630. #elif PRAGMA_STRUCT_PACKPUSH
  4631. #pragma pack(pop)
  4632. #elif PRAGMA_STRUCT_PACK
  4633. #pragma pack()
  4634. #endif
  4635. #ifdef PRAGMA_IMPORT_OFF
  4636. #pragma import off
  4637. #elif PRAGMA_IMPORT
  4638. #pragma import reset
  4639. #endif
  4640. #ifdef __cplusplus
  4641. }
  4642. #endif
  4643. #endif /* __OPENTRANSPORTPROTOCOL__ */