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

多媒体编程

开发平台:

Visual C++

  1.     UInt32                          dl_primitive;               /* DL_CONNECT_RES */
  2.     UInt32                          dl_correlation;             /* provider's correlation token */
  3.     UInt32                          dl_resp_token;              /* token associated with responding stream */
  4.     UInt32                          dl_qos_length;              /* length of qos structure */
  5.     UInt32                          dl_qos_offset;              /* offset from beginning of block */
  6.     UInt32                          dl_growth;                  /* set to zero */
  7. };
  8. typedef struct dl_connect_res_t         dl_connect_res_t;
  9. /* DL_CONNECT_CON, M_PROTO type*/
  10. struct dl_connect_con_t {
  11.     UInt32                          dl_primitive;               /* DL_CONNECT_CON*/
  12.     UInt32                          dl_resp_addr_length;        /* length of responder's address */
  13.     UInt32                          dl_resp_addr_offset;        /* offset from beginning of block*/
  14.     UInt32                          dl_qos_length;              /* length of qos structure */
  15.     UInt32                          dl_qos_offset;              /* offset from beginning of block*/
  16.     UInt32                          dl_growth;                  /* set to zero */
  17. };
  18. typedef struct dl_connect_con_t         dl_connect_con_t;
  19. /* DL_TOKEN_REQ, M_PCPROTO type*/
  20. struct dl_token_req_t {
  21.     UInt32                          dl_primitive;               /* DL_TOKEN_REQ */
  22. };
  23. typedef struct dl_token_req_t           dl_token_req_t;
  24. /* DL_TOKEN_ACK, M_PCPROTO type*/
  25. struct dl_token_ack_t {
  26.     UInt32                          dl_primitive;               /* DL_TOKEN_ACK */
  27.     UInt32                          dl_token;                   /* Connection response token associated with the stream */
  28. };
  29. typedef struct dl_token_ack_t           dl_token_ack_t;
  30. /* DL_DISCONNECT_REQ, M_PROTO type*/
  31. struct dl_disconnect_req_t {
  32.     UInt32                          dl_primitive;               /* DL_DISCONNECT_REQ */
  33.     UInt32                          dl_reason;                  /*normal, abnormal, perm. or transient*/
  34.     UInt32                          dl_correlation;             /* association with connect_ind */
  35. };
  36. typedef struct dl_disconnect_req_t      dl_disconnect_req_t;
  37. /* DL_DISCONNECT_IND, M_PROTO type*/
  38. struct dl_disconnect_ind_t {
  39.     UInt32                          dl_primitive;               /* DL_DISCONNECT_IND */
  40.     UInt32                          dl_originator;              /* USER or PROVIDER */
  41.     UInt32                          dl_reason;                  /* permanent or transient */
  42.     UInt32                          dl_correlation;             /* association with connect_ind */
  43. };
  44. typedef struct dl_disconnect_ind_t      dl_disconnect_ind_t;
  45. /* DL_RESET_REQ, M_PROTO type*/
  46. struct dl_reset_req_t {
  47.     UInt32                          dl_primitive;               /* DL_RESET_REQ */
  48. };
  49. typedef struct dl_reset_req_t           dl_reset_req_t;
  50. /* DL_RESET_IND, M_PROTO type*/
  51. struct dl_reset_ind_t {
  52.     UInt32                          dl_primitive;               /* DL_RESET_IND */
  53.     UInt32                          dl_originator;              /* Provider or User */
  54.     UInt32                          dl_reason;                  /* flow control, link error or resynch*/
  55. };
  56. typedef struct dl_reset_ind_t           dl_reset_ind_t;
  57. /* DL_RESET_RES, M_PROTO type*/
  58. struct dl_reset_res_t {
  59.     UInt32                          dl_primitive;               /* DL_RESET_RES */
  60. };
  61. typedef struct dl_reset_res_t           dl_reset_res_t;
  62. /* DL_RESET_CON, M_PROTO type*/
  63. struct dl_reset_con_t {
  64.     UInt32                          dl_primitive;               /* DL_RESET_CON */
  65. };
  66. typedef struct dl_reset_con_t           dl_reset_con_t;
  67. /* CONNECTIONLESS SERVICE PRIMITIVES*/
  68. /* DL_UNITDATA_REQ, M_PROTO type, with M_DATA block(s)*/
  69. struct dl_unitdata_req_t {
  70.     UInt32                          dl_primitive;               /* DL_UNITDATA_REQ */
  71.     UInt32                          dl_dest_addr_length;        /* DLSAP length of dest. user */
  72.     UInt32                          dl_dest_addr_offset;        /* offset from beg. of block */
  73.     dl_priority_t                   dl_priority;                /* priority value */
  74. };
  75. typedef struct dl_unitdata_req_t        dl_unitdata_req_t;
  76. /* DL_UNITDATA_IND, M_PROTO type, with M_DATA block(s)*/
  77. struct dl_unitdata_ind_t {
  78.     UInt32                          dl_primitive;               /* DL_UNITDATA_IND */
  79.     UInt32                          dl_dest_addr_length;        /* DLSAP length of dest. user */
  80.     UInt32                          dl_dest_addr_offset;        /* offset from beg. of block */
  81.     UInt32                          dl_src_addr_length;         /* DLSAP addr length of sending user*/
  82.     UInt32                          dl_src_addr_offset;         /* offset from beg. of block */
  83.     UInt32                          dl_group_address;           /* set to one if multicast/broadcast*/
  84. };
  85. typedef struct dl_unitdata_ind_t        dl_unitdata_ind_t;
  86. /*
  87.    DL_UDERROR_IND, M_PROTO type
  88.    (or M_PCPROTO type if LLI-based provider)
  89. */
  90. struct dl_uderror_ind_t {
  91.     UInt32                          dl_primitive;               /* DL_UDERROR_IND */
  92.     UInt32                          dl_dest_addr_length;        /* Destination DLSAP */
  93.     UInt32                          dl_dest_addr_offset;        /* Offset from beg. of block */
  94.     UInt32                          dl_unix_errno;              /* unix system error code*/
  95.     UInt32                          dl_errno;                   /* DLPI error code */
  96. };
  97. typedef struct dl_uderror_ind_t         dl_uderror_ind_t;
  98. /* DL_UDQOS_REQ, M_PROTO type*/
  99. struct dl_udqos_req_t {
  100.     UInt32                          dl_primitive;               /* DL_UDQOS_REQ */
  101.     UInt32                          dl_qos_length;              /* length in bytes of requested qos*/
  102.     UInt32                          dl_qos_offset;              /* offset from beg. of block */
  103. };
  104. typedef struct dl_udqos_req_t           dl_udqos_req_t;
  105. /* Primitives to handle XID and TEST operations*/
  106. /* DL_TEST_REQ, M_PROTO type*/
  107. struct dl_test_req_t {
  108.     UInt32                          dl_primitive;               /* DL_TEST_REQ */
  109.     UInt32                          dl_flag;                    /* poll/final */
  110.     UInt32                          dl_dest_addr_length;        /* DLSAP length of dest. user */
  111.     UInt32                          dl_dest_addr_offset;        /* offset from beg. of block */
  112. };
  113. typedef struct dl_test_req_t            dl_test_req_t;
  114. /* DL_TEST_IND, M_PROTO type*/
  115. struct dl_test_ind_t {
  116.     UInt32                          dl_primitive;               /* DL_TEST_IND */
  117.     UInt32                          dl_flag;                    /* poll/final */
  118.     UInt32                          dl_dest_addr_length;        /* dlsap length of dest. user */
  119.     UInt32                          dl_dest_addr_offset;        /* offset from beg. of block */
  120.     UInt32                          dl_src_addr_length;         /* dlsap length of source user */
  121.     UInt32                          dl_src_addr_offset;         /* offset from beg. of block */
  122. };
  123. typedef struct dl_test_ind_t            dl_test_ind_t;
  124. /* DL_TEST_RES, M_PROTO type*/
  125. struct dl_test_res_t {
  126.     UInt32                          dl_primitive;               /* DL_TEST_RES */
  127.     UInt32                          dl_flag;                    /* poll/final */
  128.     UInt32                          dl_dest_addr_length;        /* DLSAP length of dest. user */
  129.     UInt32                          dl_dest_addr_offset;        /* offset from beg. of block */
  130. };
  131. typedef struct dl_test_res_t            dl_test_res_t;
  132. /* DL_TEST_CON, M_PROTO type*/
  133. struct dl_test_con_t {
  134.     UInt32                          dl_primitive;               /* DL_TEST_CON */
  135.     UInt32                          dl_flag;                    /* poll/final */
  136.     UInt32                          dl_dest_addr_length;        /* dlsap length of dest. user */
  137.     UInt32                          dl_dest_addr_offset;        /* offset from beg. of block */
  138.     UInt32                          dl_src_addr_length;         /* dlsap length of source user */
  139.     UInt32                          dl_src_addr_offset;         /* offset from beg. of block */
  140. };
  141. typedef struct dl_test_con_t            dl_test_con_t;
  142. /* DL_XID_REQ, M_PROTO type*/
  143. struct dl_xid_req_t {
  144.     UInt32                          dl_primitive;               /* DL_XID_REQ */
  145.     UInt32                          dl_flag;                    /* poll/final */
  146.     UInt32                          dl_dest_addr_length;        /* dlsap length of dest. user */
  147.     UInt32                          dl_dest_addr_offset;        /* offset from beg. of block */
  148. };
  149. typedef struct dl_xid_req_t             dl_xid_req_t;
  150. /* DL_XID_IND, M_PROTO type*/
  151. struct dl_xid_ind_t {
  152.     UInt32                          dl_primitive;               /* DL_XID_IND */
  153.     UInt32                          dl_flag;                    /* poll/final */
  154.     UInt32                          dl_dest_addr_length;        /* dlsap length of dest. user */
  155.     UInt32                          dl_dest_addr_offset;        /* offset from beg. of block */
  156.     UInt32                          dl_src_addr_length;         /* dlsap length of source user */
  157.     UInt32                          dl_src_addr_offset;         /* offset from beg. of block */
  158. };
  159. typedef struct dl_xid_ind_t             dl_xid_ind_t;
  160. /* DL_XID_RES, M_PROTO type*/
  161. struct dl_xid_res_t {
  162.     UInt32                          dl_primitive;               /* DL_XID_RES */
  163.     UInt32                          dl_flag;                    /* poll/final */
  164.     UInt32                          dl_dest_addr_length;        /* DLSAP length of dest. user */
  165.     UInt32                          dl_dest_addr_offset;        /* offset from beg. of block */
  166. };
  167. typedef struct dl_xid_res_t             dl_xid_res_t;
  168. /* DL_XID_CON, M_PROTO type*/
  169. struct dl_xid_con_t {
  170.     UInt32                          dl_primitive;               /* DL_XID_CON */
  171.     UInt32                          dl_flag;                    /* poll/final */
  172.     UInt32                          dl_dest_addr_length;        /* dlsap length of dest. user */
  173.     UInt32                          dl_dest_addr_offset;        /* offset from beg. of block */
  174.     UInt32                          dl_src_addr_length;         /* dlsap length of source user */
  175.     UInt32                          dl_src_addr_offset;         /* offset from beg. of block */
  176. };
  177. typedef struct dl_xid_con_t             dl_xid_con_t;
  178. /* ACKNOWLEDGED CONNECTIONLESS SERVICE PRIMITIVES*/
  179. /* DL_DATA_ACK_REQ, M_PROTO type*/
  180. struct dl_data_ack_req_t {
  181.     UInt32                          dl_primitive;               /* DL_DATA_ACK_REQ */
  182.     UInt32                          dl_correlation;             /* User's correlation token */
  183.     UInt32                          dl_dest_addr_length;        /* length of destination addr */
  184.     UInt32                          dl_dest_addr_offset;        /* offset from beginning of block */
  185.     UInt32                          dl_src_addr_length;         /* length of source address */
  186.     UInt32                          dl_src_addr_offset;         /* offset from beginning of block */
  187.     UInt32                          dl_priority;                /* priority */
  188.     UInt32                          dl_service_class;           /* DL_RQST_RSP or DL_RQST_NORSP */
  189. };
  190. typedef struct dl_data_ack_req_t        dl_data_ack_req_t;
  191. /* DL_DATA_ACK_IND, M_PROTO type*/
  192. struct dl_data_ack_ind_t {
  193.     UInt32                          dl_primitive;               /* DL_DATA_ACK_IND */
  194.     UInt32                          dl_dest_addr_length;        /* length of destination addr */
  195.     UInt32                          dl_dest_addr_offset;        /* offset from beginning of block */
  196.     UInt32                          dl_src_addr_length;         /* length of source address */
  197.     UInt32                          dl_src_addr_offset;         /* offset from beginning of block */
  198.     UInt32                          dl_priority;                /* priority for data unit transm. */
  199.     UInt32                          dl_service_class;           /* DL_RQST_RSP or DL_RQST_NORSP */
  200. };
  201. typedef struct dl_data_ack_ind_t        dl_data_ack_ind_t;
  202. /* DL_DATA_ACK_STATUS_IND, M_PROTO type*/
  203. struct dl_data_ack_status_ind_t {
  204.     UInt32                          dl_primitive;               /* DL_DATA_ACK_STATUS_IND */
  205.     UInt32                          dl_correlation;             /* User's correlation token */
  206.     UInt32                          dl_status;                  /* success or failure of previous req*/
  207. };
  208. typedef struct dl_data_ack_status_ind_t dl_data_ack_status_ind_t;
  209. /* DL_REPLY_REQ, M_PROTO type*/
  210. struct dl_reply_req_t {
  211.     UInt32                          dl_primitive;               /* DL_REPLY_REQ */
  212.     UInt32                          dl_correlation;             /* User's correlation token */
  213.     UInt32                          dl_dest_addr_length;        /* length of destination address */
  214.     UInt32                          dl_dest_addr_offset;        /* offset from beginning of block */
  215.     UInt32                          dl_src_addr_length;         /* source address length */
  216.     UInt32                          dl_src_addr_offset;         /* offset from beginning of block */
  217.     UInt32                          dl_priority;                /* priority for data unit transmission*/
  218.     UInt32                          dl_service_class;
  219. };
  220. typedef struct dl_reply_req_t           dl_reply_req_t;
  221. /* DL_REPLY_IND, M_PROTO type*/
  222. struct dl_reply_ind_t {
  223.     UInt32                          dl_primitive;               /* DL_REPLY_IND */
  224.     UInt32                          dl_dest_addr_length;        /* length of destination address */
  225.     UInt32                          dl_dest_addr_offset;        /* offset from beginning of block*/
  226.     UInt32                          dl_src_addr_length;         /* length of source address */
  227.     UInt32                          dl_src_addr_offset;         /* offset from beginning of block */
  228.     UInt32                          dl_priority;                /* priority for data unit transmission*/
  229.     UInt32                          dl_service_class;           /* DL_RQST_RSP or DL_RQST_NORSP */
  230. };
  231. typedef struct dl_reply_ind_t           dl_reply_ind_t;
  232. /* DL_REPLY_STATUS_IND, M_PROTO type*/
  233. struct dl_reply_status_ind_t {
  234.     UInt32                          dl_primitive;               /* DL_REPLY_STATUS_IND */
  235.     UInt32                          dl_correlation;             /* User's correlation token */
  236.     UInt32                          dl_status;                  /* success or failure of previous req*/
  237. };
  238. typedef struct dl_reply_status_ind_t    dl_reply_status_ind_t;
  239. /* DL_REPLY_UPDATE_REQ, M_PROTO type*/
  240. struct dl_reply_update_req_t {
  241.     UInt32                          dl_primitive;               /* DL_REPLY_UPDATE_REQ */
  242.     UInt32                          dl_correlation;             /* user's correlation token */
  243.     UInt32                          dl_src_addr_length;         /* length of source address */
  244.     UInt32                          dl_src_addr_offset;         /* offset from beginning of block */
  245. };
  246. typedef struct dl_reply_update_req_t    dl_reply_update_req_t;
  247. /* DL_REPLY_UPDATE_STATUS_IND, M_PROTO type*/
  248. struct dl_reply_update_status_ind_t {
  249.     UInt32                          dl_primitive;               /* DL_REPLY_UPDATE_STATUS_IND */
  250.     UInt32                          dl_correlation;             /* User's correlation token */
  251.     UInt32                          dl_status;                  /* success or failure of previous req*/
  252. };
  253. typedef struct dl_reply_update_status_ind_t dl_reply_update_status_ind_t;
  254. union DL_primitives {
  255.     UInt32                          dl_primitive;
  256.     dl_info_req_t                   info_req;
  257.     dl_info_ack_t                   info_ack;
  258.     dl_attach_req_t                 attach_req;
  259.     dl_detach_req_t                 detach_req;
  260.     dl_bind_req_t                   bind_req;
  261.     dl_bind_ack_t                   bind_ack;
  262.     dl_unbind_req_t                 unbind_req;
  263.     dl_subs_bind_req_t              subs_bind_req;
  264.     dl_subs_bind_ack_t              subs_bind_ack;
  265.     dl_subs_unbind_req_t            subs_unbind_req;
  266.     dl_ok_ack_t                     ok_ack;
  267.     dl_error_ack_t                  error_ack;
  268.     dl_connect_req_t                connect_req;
  269.     dl_connect_ind_t                connect_ind;
  270.     dl_connect_res_t                connect_res;
  271.     dl_connect_con_t                connect_con;
  272.     dl_token_req_t                  token_req;
  273.     dl_token_ack_t                  token_ack;
  274.     dl_disconnect_req_t             disconnect_req;
  275.     dl_disconnect_ind_t             disconnect_ind;
  276.     dl_reset_req_t                  reset_req;
  277.     dl_reset_ind_t                  reset_ind;
  278.     dl_reset_res_t                  reset_res;
  279.     dl_reset_con_t                  reset_con;
  280.     dl_unitdata_req_t               unitdata_req;
  281.     dl_unitdata_ind_t               unitdata_ind;
  282.     dl_uderror_ind_t                uderror_ind;
  283.     dl_udqos_req_t                  udqos_req;
  284.     dl_enabmulti_req_t              enabmulti_req;
  285.     dl_disabmulti_req_t             disabmulti_req;
  286.     dl_promiscon_req_t              promiscon_req;
  287.     dl_promiscoff_req_t             promiscoff_req;
  288.     dl_phys_addr_req_t              physaddr_req;
  289.     dl_phys_addr_ack_t              physaddr_ack;
  290.     dl_set_phys_addr_req_t          set_physaddr_req;
  291.     dl_get_statistics_req_t         get_statistics_req;
  292.     dl_get_statistics_ack_t         get_statistics_ack;
  293.     dl_test_req_t                   test_req;
  294.     dl_test_ind_t                   test_ind;
  295.     dl_test_res_t                   test_res;
  296.     dl_test_con_t                   test_con;
  297.     dl_xid_req_t                    xid_req;
  298.     dl_xid_ind_t                    xid_ind;
  299.     dl_xid_res_t                    xid_res;
  300.     dl_xid_con_t                    xid_con;
  301.     dl_data_ack_req_t               data_ack_req;
  302.     dl_data_ack_ind_t               data_ack_ind;
  303.     dl_data_ack_status_ind_t        data_ack_status_ind;
  304.     dl_reply_req_t                  reply_req;
  305.     dl_reply_ind_t                  reply_ind;
  306.     dl_reply_status_ind_t           reply_status_ind;
  307.     dl_reply_update_req_t           reply_update_req;
  308.     dl_reply_update_status_ind_t    reply_update_status_ind;
  309. };
  310. typedef union DL_primitives             DL_primitives;
  311. enum {
  312.     DL_INFO_REQ_SIZE            = sizeof(dl_info_req_t),
  313.     DL_INFO_ACK_SIZE            = sizeof(dl_info_ack_t),
  314.     DL_ATTACH_REQ_SIZE          = sizeof(dl_attach_req_t),
  315.     DL_DETACH_REQ_SIZE          = sizeof(dl_detach_req_t),
  316.     DL_BIND_REQ_SIZE            = sizeof(dl_bind_req_t),
  317.     DL_BIND_ACK_SIZE            = sizeof(dl_bind_ack_t),
  318.     DL_UNBIND_REQ_SIZE          = sizeof(dl_unbind_req_t),
  319.     DL_SUBS_BIND_REQ_SIZE       = sizeof(dl_subs_bind_req_t),
  320.     DL_SUBS_BIND_ACK_SIZE       = sizeof(dl_subs_bind_ack_t),
  321.     DL_SUBS_UNBIND_REQ_SIZE     = sizeof(dl_subs_unbind_req_t),
  322.     DL_OK_ACK_SIZE              = sizeof(dl_ok_ack_t),
  323.     DL_ERROR_ACK_SIZE           = sizeof(dl_error_ack_t),
  324.     DL_CONNECT_REQ_SIZE         = sizeof(dl_connect_req_t),
  325.     DL_CONNECT_IND_SIZE         = sizeof(dl_connect_ind_t),
  326.     DL_CONNECT_RES_SIZE         = sizeof(dl_connect_res_t),
  327.     DL_CONNECT_CON_SIZE         = sizeof(dl_connect_con_t),
  328.     DL_TOKEN_REQ_SIZE           = sizeof(dl_token_req_t),
  329.     DL_TOKEN_ACK_SIZE           = sizeof(dl_token_ack_t),
  330.     DL_DISCONNECT_REQ_SIZE      = sizeof(dl_disconnect_req_t),
  331.     DL_DISCONNECT_IND_SIZE      = sizeof(dl_disconnect_ind_t),
  332.     DL_RESET_REQ_SIZE           = sizeof(dl_reset_req_t),
  333.     DL_RESET_IND_SIZE           = sizeof(dl_reset_ind_t),
  334.     DL_RESET_RES_SIZE           = sizeof(dl_reset_res_t),
  335.     DL_RESET_CON_SIZE           = sizeof(dl_reset_con_t),
  336.     DL_UNITDATA_REQ_SIZE        = sizeof(dl_unitdata_req_t),
  337.     DL_UNITDATA_IND_SIZE        = sizeof(dl_unitdata_ind_t),
  338.     DL_UDERROR_IND_SIZE         = sizeof(dl_uderror_ind_t),
  339.     DL_UDQOS_REQ_SIZE           = sizeof(dl_udqos_req_t),
  340.     DL_ENABMULTI_REQ_SIZE       = sizeof(dl_enabmulti_req_t),
  341.     DL_DISABMULTI_REQ_SIZE      = sizeof(dl_disabmulti_req_t),
  342.     DL_PROMISCON_REQ_SIZE       = sizeof(dl_promiscon_req_t),
  343.     DL_PROMISCOFF_REQ_SIZE      = sizeof(dl_promiscoff_req_t),
  344.     DL_PHYS_ADDR_REQ_SIZE       = sizeof(dl_phys_addr_req_t),
  345.     DL_PHYS_ADDR_ACK_SIZE       = sizeof(dl_phys_addr_ack_t),
  346.     DL_SET_PHYS_ADDR_REQ_SIZE   = sizeof(dl_set_phys_addr_req_t),
  347.     DL_GET_STATISTICS_REQ_SIZE  = sizeof(dl_get_statistics_req_t),
  348.     DL_GET_STATISTICS_ACK_SIZE  = sizeof(dl_get_statistics_ack_t),
  349.     DL_XID_REQ_SIZE             = sizeof(dl_xid_req_t),
  350.     DL_XID_IND_SIZE             = sizeof(dl_xid_ind_t),
  351.     DL_XID_RES_SIZE             = sizeof(dl_xid_res_t),
  352.     DL_XID_CON_SIZE             = sizeof(dl_xid_con_t),
  353.     DL_TEST_REQ_SIZE            = sizeof(dl_test_req_t),
  354.     DL_TEST_IND_SIZE            = sizeof(dl_test_ind_t),
  355.     DL_TEST_RES_SIZE            = sizeof(dl_test_res_t),
  356.     DL_TEST_CON_SIZE            = sizeof(dl_test_con_t),
  357.     DL_DATA_ACK_REQ_SIZE        = sizeof(dl_data_ack_req_t),
  358.     DL_DATA_ACK_IND_SIZE        = sizeof(dl_data_ack_ind_t),
  359.     DL_DATA_ACK_STATUS_IND_SIZE = sizeof(dl_data_ack_status_ind_t),
  360.     DL_REPLY_REQ_SIZE           = sizeof(dl_reply_req_t),
  361.     DL_REPLY_IND_SIZE           = sizeof(dl_reply_ind_t),
  362.     DL_REPLY_STATUS_IND_SIZE    = sizeof(dl_reply_status_ind_t),
  363.     DL_REPLY_UPDATE_REQ_SIZE    = sizeof(dl_reply_update_req_t),
  364.     DL_REPLY_UPDATE_STATUS_IND_SIZE = sizeof(dl_reply_update_status_ind_t)
  365. };
  366. enum {
  367.     DL_IOC_HDR_INFO             = ((MIOC_DLPI << 8) | 10)       /* Fast path request */
  368. };
  369. /* ***** From the Mentat "modnames.h" ******/
  370. #define MI_AFU_NAME         "afu"
  371. #define MI_AHARP_NAME       "ahar"
  372. #define MI_AHENET_NAME      "ahen"
  373. #define MI_ARP_NAME         "arp"
  374. #define MI_ARPM_NAME        "arpm"
  375. #define MI_COURMUX_NAME     "courmux"
  376. #define MI_CLONE_NAME       "clone"
  377. #define MI_DLB_NAME         "dlb"
  378. #define MI_DLM_NAME         "dlm"
  379. #define MI_DMODD_NAME       "disdlpi"
  380. #define MI_DMODT_NAME       "distpi"
  381. #define MI_DN_NAME          "dn"
  382. #define MI_DNF_NAME         "dnf"
  383. #define MI_DRVE_NAME        "drve"
  384. #define MI_ECHO_NAME        "echo"
  385. #define MI_ENXR_NAME        "enxr"
  386. #define MI_RAWIP_NAME       "rawip"
  387. #define MI_RAWIPM_NAME      "rawipm"
  388. #define MI_HAVOC_NAME       "havoc"
  389. #define MI_HAVOCM_NAME      "havocm"
  390. #define MI_IP_NAME          "ip"
  391. #define MI_IPM_NAME         "ipm"
  392. #define MI_IPX_NAME         "ipx"
  393. #define MI_LOG_NAME         "log"
  394. #define MI_MODE_NAME        "mode"
  395. #define MI_MUX_NAME         "mux"
  396. #define MI_NECHO_NAME       "necho"
  397. #define MI_NPEP_NAME        "npep"
  398. #define MI_NULS_NAME        "nuls"
  399. #define MI_NULZ_NAME        "nulz"
  400. #define MI_PASS_NAME        "pass"
  401. #define MI_PIPEMOD_NAME     "pipemod"
  402. #define MI_SAD_NAME         "sad"
  403. #define MI_SC_NAME          "sc"
  404. #define MI_SOCKMOD_NAME     "sockmod"
  405. #define MI_SPASS_NAME       "spass"
  406. #define MI_SPX_NAME         "spx"
  407. #define MI_STH_NAME         "mi_sth"
  408. #define MI_TCP_NAME         "tcp"
  409. #define MI_TCPM_NAME        "tcpm"
  410. #define MI_TIMOD_NAME       "timod"
  411. #define MI_TIRDWR_NAME      "tirdwr"
  412. #define MI_TMOD_NAME        "tmod"
  413. #define MI_TMUX_NAME        "tmux"
  414. #define MI_TPIT_NAME        "tpit"
  415. #define MI_TRSR_NAME        "trsr"
  416. #define MI_TRXR_NAME        "trxr"
  417. #define MI_UDP_NAME         "udp"
  418. #define MI_UDPM_NAME        "udpm"
  419. #define MI_WELD_NAME        "mi_weld"
  420. #define MI_XDG_NAME         "xdg"
  421. #define MI_XECHO_NAME       "xecho"
  422. #define MI_XF_NAME          "xf"
  423. #define MI_XFIPX_NAME       "xfipx"
  424. #define MI_XFXNS_NAME       "xfxns"
  425. #define MI_XPE_NAME         "xpe"
  426. #define MI_XS_NAME          "xs"
  427. #define MI_XTINDG_NAME      "xtindg"
  428. #define MI_XTINVC_NAME      "xtinvc"
  429. #define MI_XTM_NAME         "xtm"
  430. #define MI_XTMIP_NAME       "xtmip"
  431. #define MI_AFU_DEVICE       "/dev/afu"
  432. #define MI_ARP_DEVICE       "/dev/arp"
  433. #define MI_COURMUX_DEVICE   "/dev/courmux"
  434. #define MI_CLONE_DEVICE     "/dev/clone"
  435. #define MI_DLB_DEVICE       "/dev/dlb"
  436. #define MI_DN_DEVICE        "/dev/dn"
  437. #define MI_DNF_DEVICE       "/dev/dnf"
  438. #define MI_DRVE_DEVICE      "/dev/drve"
  439. #define MI_ECHO_DEVICE      "/dev/echo"
  440. #define MI_RAWIP_DEVICE     "/dev/rawip"
  441. #define MI_HAVOC_DEVICE     "/dev/havoc"
  442. #define MI_IP_DEVICE        "/dev/ip"
  443. #define MI_IPX_DEVICE       "/dev/ipx"
  444. #define MI_LOG_DEVICE       "/dev/log"
  445. #define MI_MODE_DEVICE      "/dev/mode"
  446. #define MI_MUX_DEVICE       "/dev/mux"
  447. #define MI_NECHO_DEVICE     "/dev/necho"
  448. #define MI_NPEP_DEVICE      "/dev/npep"
  449. #define MI_NULS_DEVICE      "/dev/nuls"
  450. #define MI_NULZ_DEVICE      "/dev/nulz"
  451. #define MI_SAD_DEVICE       "/dev/sad"
  452. #define MI_SPX_DEVICE       "/dev/spx"
  453. #define MI_TCP_DEVICE       "/dev/tcp"
  454. #define MI_TMUX_DEVICE      "/dev/tmux"
  455. #define MI_TMUX0_DEVICE     "/dev/tmux#0"
  456. #define MI_TMUX1_DEVICE     "/dev/tmux#1"
  457. #define MI_TPIT_DEVICE      "/dev/tpit"
  458. #define MI_UDP_DEVICE       "/dev/udp"
  459. #define MI_XDG_DEVICE       "/dev/xdg"
  460. #define MI_XECHO_DEVICE     "/dev/xecho"
  461. #define MI_XF_DEVICE        "/dev/xf"
  462. #define MI_XPE_DEVICE       "/dev/xpe"
  463. #define MI_XS_DEVICE        "/dev/xs"
  464. #define MI_XTINDG_DEVICE    "/dev/xtindg"
  465. #define MI_XTINVC_DEVICE    "/dev/xtinvc"
  466. /* Streamtab entries */
  467. #define MI_AFU_STREAMTAB    afuinfo
  468. #define MI_AHARP_STREAMTAB  aharinfo
  469. #define MI_AHENET_STREAMTAB aheninfo
  470. #define MI_ARP_STREAMTAB    arpinfo
  471. #define MI_ARPM_STREAMTAB   arpminfo
  472. #define MI_COURMUX_STREAMTAB    courmuxinfo
  473. #define MI_CLONE_STREAMTAB  cloneinfo
  474. #define MI_DLB_STREAMTAB    dlbinfo
  475. #define MI_DLM_STREAMTAB    dlminfo
  476. #define MI_DMODD_STREAMTAB  dmoddinfo
  477. #define MI_DMODT_STREAMTAB  dmodtinfo
  478. #define MI_DN_STREAMTAB     dninfo
  479. #define MI_DNF_STREAMTAB    dnfinfo
  480. #define MI_DRVE_STREAMTAB   drveinfo
  481. #define MI_ECHO_STREAMTAB   echoinfo
  482. #define MI_ENXR_STREAMTAB   enxrinfo
  483. #define MI_HAVOC_STREAMTAB  hvcinfo
  484. #define MI_HAVOCM_STREAMTAB hvcminfo
  485. #define MI_IP_STREAMTAB     ipinfo
  486. #define MI_IPM_STREAMTAB    ipminfo
  487. #define MI_IPX_STREAMTAB    ipxinfo
  488. #define MI_LOG_STREAMTAB    loginfo
  489. #define MI_MODE_STREAMTAB   modeinfo
  490. #define MI_MUX_STREAMTAB    muxinfo
  491. #define MI_NECHO_STREAMTAB  nechoinfo
  492. #define MI_NPEP_STREAMTAB   npepinfo
  493. #define MI_NULS_STREAMTAB   nulsinfo
  494. #define MI_NULZ_STREAMTAB   nulzinfo
  495. #define MI_PASS_STREAMTAB   passinfo
  496. #define MI_PIPEMOD_STREAMTAB    pmodinfo
  497. #define MI_RAWIP_STREAMTAB  rawipinfo
  498. #define MI_RAWIPM_STREAMTAB rawipminfo
  499. #define MI_SAD_STREAMTAB    sadinfo
  500. #define MI_SC_STREAMTAB     scinfo
  501. #define MI_SOCKMOD_STREAMTAB    sockmodinfo
  502. #define MI_SPASS_STREAMTAB  spassinfo
  503. #define MI_SPX_STREAMTAB    spxinfo
  504. #define MI_STH_STREAMTAB    mi_sthinfo
  505. #define MI_TCP_STREAMTAB    tcpinfo
  506. #define MI_TCPM_STREAMTAB   tcpminfo
  507. #define MI_TIMOD_STREAMTAB  timodinfo
  508. #define MI_TIRDWR_STREAMTAB tirdwrinfo
  509. #define MI_TMOD_STREAMTAB   tmodinfo
  510. #define MI_TMUX_STREAMTAB   tmuxinfo
  511. #define MI_TPIT_STREAMTAB   tpitinfo
  512. #define MI_TRSR_STREAMTAB   trsrinfo
  513. #define MI_TRXR_STREAMTAB   trxrinfo
  514. #define MI_UDP_STREAMTAB    udpinfo
  515. #define MI_UDPM_STREAMTAB   udpminfo
  516. #define MI_WELD_STREAMTAB   mi_weldinfo
  517. #define MI_XDG_STREAMTAB    xdginfo
  518. #define MI_XECHO_STREAMTAB  xechoinfo
  519. #define MI_XF_STREAMTAB     xfinfo
  520. #define MI_XFIPX_STREAMTAB  xfipxinfo
  521. #define MI_XFXNS_STREAMTAB  xfxnsinfo
  522. #define MI_XPE_STREAMTAB    xpeinfo
  523. #define MI_XS_STREAMTAB     xsinfo
  524. #define MI_XTINDG_STREAMTAB xtindginfo
  525. #define MI_XTINVC_STREAMTAB xtinvcinfo
  526. #define MI_XTM_STREAMTAB    xtminfo
  527. #define MI_XTMIP_STREAMTAB  xtmipinfo
  528. #define MI_AFU_DEVFLAG      afudevflag
  529. #define MI_AHARP_DEVFLAG    ahardevflag
  530. #define MI_AHENET_DEVFLAG   ahendevflag
  531. #define MI_ARP_DEVFLAG      arpdevflag
  532. #define MI_ARPM_DEVFLAG     arpmdevflag
  533. #define MI_COURMUX_DEVFLAG  courmuxdevflag
  534. #define MI_CLONE_DEVFLAG    clonedevflag
  535. #define MI_DLB_DEVFLAG      dlbdevflag
  536. #define MI_DLM_DEVFLAG      dlmdevflag
  537. #define MI_DMODD_DEVFLAG    dmodddevflag
  538. #define MI_DMODT_DEVFLAG    dmodtdevflag
  539. #define MI_DN_DEVFLAG       dndevflag
  540. #define MI_DNF_DEVFLAG      dnfdevflag
  541. #define MI_DRVE_DEVFLAG     drvedevflag
  542. #define MI_ECHO_DEVFLAG     echodevflag
  543. #define MI_ENXR_DEVFLAG     enxrdevflag
  544. #define MI_HAVOC_DEVFLAG    hvcdevflag
  545. #define MI_HAVOCM_DEVFLAG   hvcmdevflag
  546. #define MI_IP_DEVFLAG       ipdevflag
  547. #define MI_IPM_DEVFLAG      ipmdevflag
  548. #define MI_IPX_DEVFLAG      ipxdevflag
  549. #define MI_LOG_DEVFLAG      logdevflag
  550. #define MI_MODE_DEVFLAG     modedevflag
  551. #define MI_MUX_DEVFLAG      muxdevflag
  552. #define MI_NECHO_DEVFLAG    nechodevflag
  553. #define MI_NPEP_DEVFLAG     npepdevflag
  554. #define MI_NULS_DEVFLAG     nulsdevflag
  555. #define MI_NULZ_DEVFLAG     nulzdevflag
  556. #define MI_PASS_DEVFLAG     passdevflag
  557. #define MI_PIPEMOD_DEVFLAG  pipemoddevflag
  558. #define MI_RAWIP_DEVFLAG    rawipdevflag
  559. #define MI_RAWIPM_DEVFLAG   rawipmdevflag
  560. #define MI_SAD_DEVFLAG      saddevflag
  561. #define MI_SC_DEVFLAG       scdevflag
  562. #define MI_SOCKMOD_DEVFLAG  sockmoddevflag
  563. #define MI_SPASS_DEVFLAG    spassdevflag
  564. #define MI_SPX_DEVFLAG      spxdevflag
  565. #define MI_TCP_DEVFLAG      tcpdevflag
  566. #define MI_TCPM_DEVFLAG     tcpmdevflag
  567. #define MI_TIMOD_DEVFLAG    timoddevflag
  568. #define MI_TIRDWR_DEVFLAG   tirdwrdevflag
  569. #define MI_TMOD_DEVFLAG     tmoddevflag
  570. #define MI_TMUX_DEVFLAG     tmuxdevflag
  571. #define MI_TPIT_DEVFLAG     tpitdevflag
  572. #define MI_TRSR_DEVFLAG     trsrdevflag
  573. #define MI_TRXR_DEVFLAG     trxrdevflag
  574. #define MI_UDP_DEVFLAG      udpdevflag
  575. #define MI_UDPM_DEVFLAG     udpmdevflag
  576. #define MI_XDG_DEVFLAG      xdgdevflag
  577. #define MI_XECHO_DEVFLAG    xechodevflag
  578. #define MI_XF_DEVFLAG       xfdevflag
  579. #define MI_XFIPX_DEVFLAG    xfipxdevflag
  580. #define MI_XFXNS_DEVFLAG    xfxnsdevflag
  581. #define MI_XPE_DEVFLAG      xpedevflag
  582. #define MI_XS_DEVFLAG       xsdevflag
  583. #define MI_XTINDG_DEVFLAG   xtindgdevflag
  584. #define MI_XTINVC_DEVFLAG   xtinvcdevflag
  585. #define MI_XTM_DEVFLAG      xtmdevflag
  586. #define MI_XTMIP_DEVFLAG    xtmipdevflag
  587. #define MI_AFU_SQLVL        SQLVL_QUEUEPAIR
  588. #define MI_AHARP_SQLVL      SQLVL_QUEUE
  589. #define MI_AHENET_SQLVL     SQLVL_QUEUE
  590. #define MI_ARP_SQLVL        SQLVL_MODULE
  591. #define MI_ARPM_SQLVL       SQLVL_MODULE
  592. #define MI_COURMUX_SQLVL    SQLVL_MODULE
  593. #define MI_CLONE_SQLVL      SQLVL_MODULE
  594. #define MI_DLB_SQLVL        SQLVL_QUEUE
  595. #define MI_DLM_SQLVL        SQLVL_QUEUE
  596. #define MI_DMODD_SQLVL      SQLVL_QUEUE
  597. #define MI_DMODT_SQLVL      SQLVL_QUEUE
  598. #define MI_DN_SQLVL         SQLVL_QUEUE
  599. #define MI_DNF_SQLVL        SQLVL_QUEUE
  600. #define MI_DRVE_SQLVL       SQLVL_QUEUEPAIR
  601. #define MI_ECHO_SQLVL       SQLVL_QUEUE
  602. #define MI_ENXR_SQLVL       SQLVL_QUEUE
  603. #define MI_RAWIP_SQLVL      SQLVL_QUEUE
  604. #define MI_RAWIPM_SQLVL     SQLVL_QUEUE
  605. #define MI_HAVOC_SQLVL      SQLVL_QUEUE
  606. #define MI_HAVOCM_SQLVL     SQLVL_QUEUE
  607. #define MI_IP_SQLVL         SQLVL_QUEUEPAIR
  608. #define MI_IPM_SQLVL        SQLVL_QUEUEPAIR
  609. #define MI_IPX_SQLVL        SQLVL_QUEUE
  610. #define MI_LOG_SQLVL        SQLVL_MODULE
  611. #define MI_MODE_SQLVL       SQLVL_QUEUEPAIR
  612. #define MI_MUX_SQLVL        SQLVL_MODULE
  613. #define MI_NECHO_SQLVL      SQLVL_QUEUE
  614. #define MI_NPEP_SQLVL       SQLVL_QUEUE
  615. #define MI_NULS_SQLVL       SQLVL_QUEUE
  616. #define MI_NULZ_SQLVL       SQLVL_QUEUE
  617. #define MI_PASS_SQLVL       SQLVL_QUEUE
  618. #define MI_PIPEMOD_SQLVL    SQLVL_QUEUE
  619. #define MI_SAD_SQLVL        SQLVL_MODULE
  620. #define MI_SC_SQLVL         SQLVL_QUEUE
  621. #define MI_SOCKMOD_SQLVL    SQLVL_QUEUEPAIR
  622. #define MI_SPASS_SQLVL      SQLVL_QUEUE
  623. #define MI_SPX_SQLVL        SQLVL_QUEUE
  624. #define MI_TCP_SQLVL        SQLVL_QUEUEPAIR
  625. #define MI_TCPM_SQLVL       SQLVL_QUEUEPAIR
  626. #define MI_TIMOD_SQLVL      SQLVL_QUEUEPAIR
  627. #define MI_TIRDWR_SQLVL     SQLVL_QUEUE
  628. #define MI_TMOD_SQLVL       SQLVL_QUEUEPAIR
  629. #define MI_TMUX_SQLVL       SQLVL_MODULE
  630. #define MI_TPIT_SQLVL       SQLVL_MODULE
  631. #define MI_TRSR_SQLVL       SQLVL_MODULE
  632. #define MI_TRXR_SQLVL       SQLVL_QUEUE
  633. #define MI_UDP_SQLVL        SQLVL_QUEUE
  634. #define MI_UDPM_SQLVL       SQLVL_QUEUE
  635. #define MI_XDG_SQLVL        SQLVL_QUEUE
  636. #define MI_XECHO_SQLVL      SQLVL_QUEUE
  637. #define MI_XF_SQLVL         SQLVL_MODULE
  638. #define MI_XFIPX_SQLVL      SQLVL_MODULE
  639. #define MI_XFXNS_SQLVL      SQLVL_MODULE
  640. #define MI_XPE_SQLVL        SQLVL_QUEUE
  641. #define MI_XS_SQLVL         SQLVL_QUEUEPAIR
  642. #define MI_XTINDG_SQLVL     SQLVL_QUEUEPAIR
  643. #define MI_XTINVC_SQLVL     SQLVL_QUEUEPAIR
  644. #define MI_XTM_SQLVL        SQLVL_QUEUEPAIR
  645. #define MI_XTMIP_SQLVL      SQLVL_QUEUEPAIR
  646. /* ***** Raw Streams ******/
  647. /*
  648.    Flags used in the fType field of OTReadInfo for functions.
  649.    I've removed the terse and confusing comments in this header
  650.    file.  For a full description, read "Open Transport Advanced
  651.    Client Programming".
  652. */
  653. enum {
  654.     kOTNoMessagesAvailable      = (unsigned long)0xFFFFFFFF,
  655.     kOTAnyMsgType               = (unsigned long)0xFFFFFFFE,
  656.     kOTDataMsgTypes             = (unsigned long)0xFFFFFFFC,
  657.     kOTMProtoMsgTypes           = (unsigned long)0xFFFFFFFB,
  658.     kOTOnlyMProtoMsgTypes       = (unsigned long)0xFFFFFFFA
  659. };
  660. #if !OTKERNEL
  661. /* StreamRef is an opaque reference to a raw stream.*/
  662. typedef struct OpaqueStreamRef*         StreamRef;
  663. #define kOTInvalidStreamRef ((StreamRef)0L)
  664. /* PollRef structure is used with the OTStreamPoll function.*/
  665. struct PollRef {
  666.     SInt32                          filler;                     /* holds a file descriptor an a UNIX system, replaced by ref (at end of structure) under OT*/
  667.     SInt16                          events;
  668.     SInt16                          revents;
  669.     StreamRef                       ref;
  670. };
  671. typedef struct PollRef                  PollRef;
  672. /* OTReadInfo structure is used with the various functions that read and peek at the stream head.*/
  673. struct OTReadInfo {
  674.     UInt32                          fType;
  675.     OTCommand                       fCommand;
  676.     UInt32                          fFiller;                    /* For compatibility with OT 1.0 and 1.1 */
  677.     ByteCount                       fBytes;
  678.     OSStatus                        fError;
  679. };
  680. typedef struct OTReadInfo               OTReadInfo;
  681. /* Opening and closing raw streams*/
  682. #if CALL_NOT_IN_CARBON
  683. EXTERN_API( StreamRef )
  684. OTStreamOpen                    (const char *           name,
  685.                                  OTOpenFlags            oFlags,
  686.                                  OSStatus *             errPtr);
  687. EXTERN_API( OSStatus )
  688. OTAsyncStreamOpen               (const char *           name,
  689.                                  OTOpenFlags            oFlags,
  690.                                  OTNotifyUPP            proc,
  691.                                  void *                 contextPtr);
  692. EXTERN_API( StreamRef )
  693. OTCreateStream                  (OTConfigurationRef     cfig,
  694.                                  OTOpenFlags            oFlags,
  695.                                  OSStatus *             errPtr);
  696. EXTERN_API( OSStatus )
  697. OTAsyncCreateStream             (OTConfigurationRef     cfig,
  698.                                  OTOpenFlags            oFlags,
  699.                                  OTNotifyUPP            proc,
  700.                                  void *                 contextPtr);
  701. EXTERN_API( OSStatus )
  702. OTStreamClose                   (StreamRef              strm);
  703. /* Polling a stream for activity*/
  704. EXTERN_API( OTResult )
  705. OTStreamPoll                    (PollRef *              fds,
  706.                                  UInt32                 nfds,
  707.                                  OTTimeout              timeout);
  708. EXTERN_API( OTResult )
  709. OTAsyncStreamPoll               (PollRef *              fds,
  710.                                  UInt32                 nfds,
  711.                                  OTTimeout              timeout,
  712.                                  OTNotifyUPP            proc,
  713.                                  void *                 contextPtr);
  714. /* Classic UNIX file descriptor operations*/
  715. EXTERN_API( OTResult )
  716. OTStreamRead                    (StreamRef              strm,
  717.                                  void *                 buf,
  718.                                  OTByteCount            len);
  719. EXTERN_API( OTResult )
  720. OTStreamWrite                   (StreamRef              strm,
  721.                                  void *                 buf,
  722.                                  OTByteCount            len);
  723. EXTERN_API( OTResult )
  724. OTStreamIoctl                   (StreamRef              strm,
  725.                                  UInt32                 cmd,
  726.                                  void *                 data);
  727. EXTERN_API( OTResult )
  728. OTStreamPipe                    (StreamRef              streamsToPipe[]);
  729. /* there can be only 2!*/
  730. /* Notifiers and modes of operation*/
  731. EXTERN_API( OSStatus )
  732. OTStreamInstallNotifier         (StreamRef              strm,
  733.                                  OTNotifyUPP            proc,
  734.                                  void *                 contextPtr);
  735. EXTERN_API( void )
  736. OTStreamRemoveNotifier          (StreamRef              strm);
  737. EXTERN_API( OSStatus )
  738. OTStreamUseSyncIdleEvents       (StreamRef              strm,
  739.                                  Boolean                useEvents);
  740. EXTERN_API( void )
  741. OTStreamSetBlocking             (StreamRef              strm);
  742. EXTERN_API( void )
  743. OTStreamSetNonBlocking          (StreamRef              strm);
  744. EXTERN_API( Boolean )
  745. OTStreamIsBlocking              (StreamRef              strm);
  746. EXTERN_API( void )
  747. OTStreamSetSynchronous          (StreamRef              strm);
  748. EXTERN_API( void )
  749. OTStreamSetAsynchronous         (StreamRef              strm);
  750. EXTERN_API( Boolean )
  751. OTStreamIsSynchronous           (StreamRef              strm);
  752. /* STREAMS primitives*/
  753. EXTERN_API( OTResult )
  754. OTStreamGetMessage              (StreamRef              strm,
  755.                                  strbuf *               ctlbuf,
  756.                                  strbuf *               databuf,
  757.                                  OTFlags *              flags);
  758. EXTERN_API( OTResult )
  759. OTStreamGetPriorityMessage      (StreamRef              strm,
  760.                                  strbuf *               ctlbuf,
  761.                                  strbuf *               databuf,
  762.                                  OTBand *               band,
  763.                                  OTFlags *              flags);
  764. EXTERN_API( OSStatus )
  765. OTStreamPutMessage              (StreamRef              strm,
  766.                                  const strbuf *         ctlbuf,
  767.                                  const strbuf *         databuf,
  768.                                  OTFlags                flags);
  769. EXTERN_API( OSStatus )
  770. OTStreamPutPriorityMessage      (StreamRef              strm,
  771.                                  const strbuf *         ctlbuf,
  772.                                  const strbuf *         databuf,
  773.                                  OTBand                 band,
  774.                                  OTFlags                flags);
  775. /* Miscellaneous stuff*/
  776. EXTERN_API( void )
  777. OTStreamSetControlMask          (StreamRef              strm,
  778.                                  UInt32                 mask,
  779.                                  Boolean                setClear);
  780. /*
  781.    Opening endpoints and mappers on a Stream - these calls are synchronous, and may
  782.    only be used at System Task time. Once the stream has been installed into a provider
  783.    or endpoint, you should not continue to use STREAMS APIs on it
  784. */
  785. EXTERN_API( ProviderRef )
  786. OTOpenProviderOnStream          (StreamRef              strm,
  787.                                  OSStatus *             errPtr);
  788. EXTERN_API( EndpointRef )
  789. OTOpenEndpointOnStream          (StreamRef              strm,
  790.                                  OSStatus *             errPtr);
  791. /*
  792.    To quote an earlier version of this header file:
  793.    
  794.         Some functions that should only be used if
  795.         you really know what you're doing.
  796. */
  797. EXTERN_API( StreamRef )
  798. OTRemoveStreamFromProvider      (ProviderRef            ref);
  799. EXTERN_API( OSStatus )
  800. OTPeekMessage                   (StreamRef              strm,
  801.                                  OTReadInfo *           readInfo);
  802. EXTERN_API( OTBuffer *)
  803. OTReadMessage                   (StreamRef              strm,
  804.                                  OTReadInfo *           readInfo);
  805. EXTERN_API( void )
  806. OTPutBackBuffer                 (StreamRef              strm,
  807.                                  OTBuffer *             buffer);
  808. EXTERN_API( void )
  809. OTPutBackPartialBuffer          (StreamRef              strm,
  810.                                  OTBufferInfo *         readInfo,
  811.                                  OTBuffer *             buffer);
  812. #endif  /* CALL_NOT_IN_CARBON */
  813. #endif  /* !OTKERNEL */
  814. #endif  /* CALL_NOT_IN_CARBON */
  815. /* ***** Port Utilities ******/
  816. #if !OTKERNEL
  817. /*
  818.    These types and routines are used during sophisticated
  819.    port management.  High-level clients may get involved
  820.    for things like request a port to be yielding, but typically
  821.    this stuff is used by protocol infrastructure.
  822. */
  823. /*
  824.    OTPortCloseStruct is used when processing the kOTClosePortRequest
  825.    and kOTYieldPortRequest events.
  826. */
  827. struct OTPortCloseStruct {
  828.     OTPortRef                       fPortRef;                   /* The port requested to be closed.*/
  829.     ProviderRef                     fTheProvider;               /* The provider using the port.*/
  830.     OSStatus                        fDenyReason;                /* Set to a negative number to deny the request*/
  831. };
  832. typedef struct OTPortCloseStruct        OTPortCloseStruct;
  833. /* OTClientList structure is used with the OTYieldPortRequest function.*/
  834. struct OTClientList {
  835.     ItemCount                       fNumClients;
  836.     UInt8                           fBuffer[4];
  837. };
  838. typedef struct OTClientList             OTClientList;
  839. /*
  840.    Returns a buffer containing all of the clients that refused to yield the port.
  841.    "size" is the total number of bytes @ buffer, including the fNumClients field.
  842. */
  843. #if CALL_NOT_IN_CARBON
  844. EXTERN_API_C( OSStatus )
  845. OTYieldPortRequest              (ProviderRef            ref,
  846.                                  OTPortRef              portRef,
  847.                                  OTClientList *         buffer,
  848.                                  OTByteCount            size);
  849. /* Send a notification to all Open Transport registered clients*/
  850. EXTERN_API_C( void )
  851. OTNotifyAllClients              (OTEventCode            code,
  852.                                  OTResult               result,
  853.                                  void *                 cookie);
  854. /* Determine if "child" is a child port of "parent"*/
  855. EXTERN_API_C( Boolean )
  856. OTIsDependentPort               (OTPortRef              parent,
  857.                                  OTPortRef              child);
  858. #endif  /* CALL_NOT_IN_CARBON */
  859. #endif  /* !OTKERNEL */
  860. /* ***** Timers ***** */
  861. /*
  862.    STREAMS plug-ins code should not use these timers, instead
  863.    they should use timer messages, ie mi_timer etc.
  864. */
  865. #if !OTKERNEL
  866. typedef long                            OTTimerTask;
  867. /*
  868.    Under Carbon, OTCreateTimerTask takes a client context pointer.  Applications may pass NULL
  869.    after calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
  870.    valid client context.
  871. */
  872. EXTERN_API( long )
  873. OTCreateTimerTaskInContext      (OTProcessUPP           upp,
  874.                                  void *                 arg,
  875.                                  OTClientContextPtr     clientContext);
  876. #if CALL_NOT_IN_CARBON
  877. EXTERN_API( OTTimerTask )
  878. OTCreateTimerTask               (OTProcessUPP           proc,
  879.                                  void *                 arg);
  880. #endif  /* CALL_NOT_IN_CARBON */
  881. EXTERN_API( Boolean )
  882. OTCancelTimerTask               (OTTimerTask            timerTask);
  883. EXTERN_API( void )
  884. OTDestroyTimerTask              (OTTimerTask            timerTask);
  885. EXTERN_API( Boolean )
  886. OTScheduleTimerTask             (OTTimerTask            timerTask,
  887.                                  OTTimeout              milliSeconds);
  888. #if OTCARBONAPPLICATION
  889. /* The following macro may be used by applications only.*/
  890. #define OTCreateTimerTask(upp, arg) OTCreateTimerTaskInContext(upp, arg, NULL)
  891. #endif  /* OTCARBONAPPLICATION */
  892. #endif  /* !OTKERNEL */
  893. /* ***** Miscellaneous Helpful Functions ******/
  894. #if !OTKERNEL
  895. /*
  896.    These routines allow you to manipulate OT's buffer structures.
  897.    If you use no-copy receives (described in "OpenTransport.h")
  898.    you will need some of these routines, and may choose to use others.
  899.    See "Open Tranport Advanced Client Programming" for documentation.
  900. */
  901. EXTERN_API_C( OTByteCount )
  902. OTBufferDataSize                (OTBuffer *             buffer);
  903. EXTERN_API_C( Boolean )
  904. OTReadBuffer                    (OTBufferInfo *         buffer,
  905.                                  void *                 dest,
  906.                                  OTByteCount *          len);
  907. EXTERN_API_C( void )
  908. OTReleaseBuffer                 (OTBuffer *             buffer);
  909. #if CALL_NOT_IN_CARBON
  910. EXTERN_API_C( Boolean )
  911. StoreIntoNetbuf                 (TNetbuf *              netBuf,
  912.                                  void *                 source,
  913.                                  SInt32                 len);
  914. EXTERN_API_C( Boolean )
  915. StoreMsgIntoNetbuf              (TNetbuf *              netBuf,
  916.                                  OTBuffer *             buffer);
  917. #endif  /* CALL_NOT_IN_CARBON */
  918. #endif  /* !OTKERNEL */
  919. /* ***** OTConfiguration ******/
  920. #if CALL_NOT_IN_CARBON
  921. #if !OTKERNEL
  922. /*
  923.    As promised in "OpenTransport.h", here are the routines
  924.    for advanced operations on configurations.
  925. */
  926. /* Manipulating a configuration*/
  927. #if CALL_NOT_IN_CARBON
  928. EXTERN_API_C( OTConfigurationRef )
  929. OTCfigNewConfiguration          (const char *           path);
  930. EXTERN_API_C( void )
  931. OTCfigDeleteConfiguration       (OTConfigurationRef     cfig);
  932. EXTERN_API_C( OTConfigurationRef )
  933. OTCfigCloneConfiguration        (OTConfigurationRef     cfig);
  934. EXTERN_API_C( OTConfigurationRef )
  935. OTCfigPushNewSingleChild        (OTConfigurationRef     cfig,
  936.                                  const char *           path,
  937.                                  OSStatus *             errPtr);
  938. EXTERN_API_C( OTConfigurationRef )
  939. OTCfigPushParent                (OTConfigurationRef     cfig,
  940.                                  const char *           path,
  941.                                  OSStatus *             errPtr);
  942. EXTERN_API_C( OTConfigurationRef )
  943. OTCfigPushChild                 (OTConfigurationRef     cfig,
  944.                                  OTItemCount            index,
  945.                                  const char *           path,
  946.                                  OSStatus *             errPtr);
  947. EXTERN_API_C( OSStatus )
  948. OTCfigPopChild                  (OTConfigurationRef     cfig,
  949.                                  OTItemCount            index);
  950. EXTERN_API_C( OTConfigurationRef )
  951. OTCfigGetChild                  (OTConfigurationRef     cfig,
  952.                                  OTItemCount            index);
  953. EXTERN_API_C( OSStatus )
  954. OTCfigSetPath                   (OTConfigurationRef     cfig,
  955.                                  const char *           path);
  956. EXTERN_API_C( OTConfigurationRef )
  957. OTCfigNewChild                  (OTConfigurationRef     cfig,
  958.                                  const char *           path,
  959.                                  OSStatus *             errPtr);
  960. EXTERN_API_C( OSStatus )
  961. OTCfigAddChild                  (OTConfigurationRef     cfig,
  962.                                  OTConfigurationRef     child);
  963. EXTERN_API_C( OTConfigurationRef )
  964. OTCfigRemoveChild               (OTConfigurationRef     cfig,
  965.                                  OTItemCount            index);
  966. EXTERN_API_C( void )
  967. OTCfigSetPortRef                (OTConfigurationRef     cfig,
  968.                                  OTPortRef              portRef);
  969. EXTERN_API_C( void )
  970. OTCfigChangeProviderName        (OTConfigurationRef     cfig,
  971.                                  const char *           name);
  972. /* Query a configuration*/
  973. EXTERN_API_C( UInt16 )
  974. OTCfigNumberOfChildren          (OTConfigurationRef     cfig);
  975. EXTERN_API_C( OTConfigurationRef )
  976. OTCfigGetParent                 (OTConfigurationRef     cfig);
  977. EXTERN_API_C( TNetbuf *)
  978. OTCfigGetOptionNetbuf           (OTConfigurationRef     cfig);
  979. EXTERN_API_C( OTPortRef )
  980. OTCfigGetPortRef                (OTConfigurationRef     cfig);
  981. EXTERN_API_C( UInt32 )
  982. OTCfigGetInstallFlags           (OTConfigurationRef     cfig);
  983. EXTERN_API_C( const char *)
  984. OTCfigGetProviderName           (OTConfigurationRef     cfig);
  985. EXTERN_API_C( Boolean )
  986. OTCfigIsPort                    (OTConfigurationRef     cfig);
  987. #endif  /* CALL_NOT_IN_CARBON */
  988. #endif  /* !OTKERNEL */
  989. /* ***** Configurators ******/
  990. /*
  991.    The kOTConfiguratorInterfaceID define is what you need to add to your
  992.    export file for the "interfaceID = " clause to export a configurator
  993.    for ASLM.  Similarly, kOTConfiguratorCFMTag is used for CFM-based
  994.    configurators.
  995. */
  996. #define kOTConfiguratorInterfaceID  kOTClientPrefix "cfigMkr"
  997. #define kOTConfiguratorCFMTag       kOTClientPrefix "cfigMkr"
  998. #if !OTKERNEL
  999. #ifdef __cplusplus
  1000.     class TOTConfigurator;
  1001.     typedef class TOTConfigurator* TOTConfiguratorRef;
  1002. #else
  1003.     typedef struct TOTConfigurator TOTConfigurator;
  1004.     typedef TOTConfigurator* TOTConfiguratorRef;
  1005. #endif
  1006. /*
  1007.    Typedef for the OTCanConfigure function, and the enum for which pass we're doing.
  1008.    The first (kOTSpecificConfigPass) is to give configurators a shot at the configuration
  1009.    before we start allowing the generic configurators to get into the act.
  1010. */
  1011. enum {
  1012.     kOTSpecificConfigPass       = 0,
  1013.     kOTGenericConfigPass        = 1
  1014. };
  1015. typedef CALLBACK_API_C( Boolean , OTCanConfigureProcPtr )(OTConfigurationRef cfig, UInt32 pass);
  1016. /* Typedef for the function to create and return a configurator object*/
  1017. typedef CALLBACK_API_C( OSStatus , OTCreateConfiguratorProcPtr )(TOTConfiguratorRef *cfigor);
  1018. /*
  1019.    Typedef for the "OTSetupConfigurator" function that your configurator library must export.
  1020.    The enum is for the type of configurator that it is.
  1021. */
  1022. #define kOTSetupConfiguratorID "OTSetupConfigurator"
  1023. enum {
  1024.     kOTDefaultConfigurator      = 0,
  1025.     kOTProtocolFamilyConfigurator = 1,
  1026.     kOTLinkDriverConfigurator   = 2
  1027. };
  1028. typedef CALLBACK_API_C( OSStatus , OTSetupConfiguratorProcPtr )(OTCanConfigureProcPtr *canConfigure, OTCreateConfiguratorProcPtr *createConfigurator, UInt8 *configuratorType);
  1029. /*
  1030.    Procedure pointer definitions for the three key callbacks associated
  1031.    with a configurator, as established by OTNewConfigurator.
  1032. */
  1033. typedef CALLBACK_API_C( OSStatus , OTCFConfigureProcPtr )(TOTConfiguratorRef cfigor, OTConfigurationRef cfig);
  1034. typedef CALLBACK_API_C( OSStatus , OTCFCreateStreamProcPtr )(TOTConfiguratorRef cfigor, OTConfigurationRef cfig, OTOpenFlags oFlags, OTNotifyUPP proc, void *contextPtr);
  1035. typedef CALLBACK_API_C( void , OTCFHandleSystemEventProcPtr )(TOTConfiguratorRef cfigor, OTEventCode code, OTResult result, void *cookie);
  1036. /*
  1037.    Determine if this instance of your configurator is the "master"
  1038.    (the one that can create and destroy control streams)
  1039. */
  1040. #if CALL_NOT_IN_CARBON
  1041. EXTERN_API_C( Boolean )
  1042. OTIsMasterConfigurator          (TOTConfiguratorRef     cfigor);
  1043. /* Get back the userData you passed in to OTNewConfigurator*/
  1044. EXTERN_API_C( void *)
  1045. OTGetConfiguratorUserData       (TOTConfiguratorRef     cfigor);
  1046. /* Create a configurator object for use by Open Transport*/
  1047. EXTERN_API_C( TOTConfiguratorRef )
  1048. OTNewConfigurator               (void *                 userData,
  1049.                                  OTCFConfigureProcPtr   configure,
  1050.                                  OTCFCreateStreamProcPtr  createStream,
  1051.                                  OTCFHandleSystemEventProcPtr  handleEvent);
  1052. /* Delete a configurator object created by OTNewConfigurator*/
  1053. EXTERN_API_C( void )
  1054. OTDeleteConfigurator            (TOTConfiguratorRef     cfigor);
  1055. /*
  1056.    A utility function to send notifications to the user - it takes care of calls
  1057.    from deferred tasks
  1058. */
  1059. EXTERN_API_C( OSStatus )
  1060. OTNotifyUser                    (FSSpec *               theFile,
  1061.                                  SInt32                 rsrcID,
  1062.                                  OTItemCount            index,
  1063.                                  char *                 parm1,
  1064.                                  char *                 parm2);
  1065. /* Call when the configurator unloads from memory*/
  1066. EXTERN_API_C( void )
  1067. OTConfiguratorUnloaded          (TOTConfiguratorRef     cfigor);
  1068. /*
  1069.    Call to create your control stream if you're not the master
  1070.    configurator.  You can also use the state machine function
  1071.    OTSMCreateControlStream(OTStateMachine*, OTConfigurationRef, TOTConfiguratorRef cfigor).
  1072. */
  1073. EXTERN_API_C( OSStatus )
  1074. OTCreateControlStream           (OTConfigurationRef     cfig,
  1075.                                  TOTConfiguratorRef     cfigor,
  1076.                                  OTNotifyUPP            proc,
  1077.                                  void *                 contextPtr);
  1078. /*
  1079.    A helpful function for the configurators to
  1080.    be able to recursively configure the children.
  1081. */
  1082. EXTERN_API_C( OSStatus )
  1083. OTConfigureChildren             (OTConfigurationRef     cfig);
  1084. /* Allocate a bit in the system-wide control mask for streams.*/
  1085. EXTERN_API_C( UInt32 )
  1086. OTNewControlMask                (void);
  1087. /* Warning: These 2 APIs is going away*/
  1088. EXTERN_API_C( void )
  1089. OTCloseProvidersByUseCount      (SInt32 *               useCount,
  1090.                                  OTResult               reason,
  1091.                                  OTBooleanParam         doneDeal);
  1092. EXTERN_API_C( void )
  1093. OTCloseProvidersByPortRef       (OTPortRef              ref,
  1094.                                  OTResult               reason,
  1095.                                  OTBooleanParam         doneDeal);
  1096. /* These are the "real" APIs*/
  1097. EXTERN_API_C( void )
  1098. OTCloseProviderByStream         (StreamRef              ref,
  1099.                                  OTResult               reason,
  1100.                                  OTBooleanParam         doneDeal);
  1101. EXTERN_API_C( void )
  1102. OTCloseMatchingProviders        (UInt32                 mask,
  1103.                                  OTPortRef              port,
  1104.                                  OTResult               reason,
  1105.                                  OTBooleanParam         doneDeal);
  1106. #endif  /* CALL_NOT_IN_CARBON */
  1107. #endif  /* !OTKERNEL */
  1108. #endif  /* CALL_NOT_IN_CARBON */
  1109. /* ***** OTStateMachine ******/
  1110. #if CALL_NOT_IN_CARBON
  1111. /*
  1112.    This utility set allows you to write an asynchronous chain of code that looks 
  1113.    somewhat like it is synchronous.  This is primarily used for plumbing 
  1114.    streams asynchronously, especially in configurators
  1115. */
  1116. #if !OTKERNEL
  1117. /* Alas, the state machine is only available to client code.  Sorry.*/
  1118. /*
  1119.    There are 12 or 8 bytes of reserved space at the front of
  1120.    the OTStateMachine structure, depending on whether you're
  1121.    building PowerPC or 68K code..  The OTStateMachineDataPad
  1122.    type compensates for this.
  1123. */
  1124. #if TARGET_CPU_PPC
  1125. typedef UInt8                           OTStateMachineDataPad[12];
  1126. #else
  1127. typedef UInt8                           OTStateMachineDataPad[8];
  1128. #endif  /* TARGET_CPU_PPC */
  1129. /*
  1130.    Forward define OTStateMachine so that OTStateProcPtr has
  1131.    access to it.
  1132. */
  1133. typedef struct OTStateMachine           OTStateMachine;
  1134. /*
  1135.    This type is is the required prototype of a state machine
  1136.    entry point.
  1137. */
  1138. typedef CALLBACK_API( void , OTStateProcPtr )(OTStateMachine *sm);
  1139. /*
  1140.    This type defines a routine that the state machine will
  1141.    call when the top level completes.
  1142. */
  1143. typedef CALLBACK_API_C( void , OTSMCompleteProcPtr )(void *contextPtr);
  1144. /* And now for the state machine structure itself.*/
  1145. struct OTStateMachine {
  1146.     OTStateMachineDataPad           fData;
  1147.     void *                          fCookie;
  1148.     OTEventCode                     fCode;
  1149.     OTResult                        fResult;
  1150. #ifdef __cplusplus
  1151.     // C++ inline methods on this structure.
  1152.     void*       GetClientData();
  1153.     Boolean     CallStateProc(OTStateProcPtr proc, UInt32 state = 0);
  1154.     UInt16      GetState();
  1155.     void        SetState(UInt32 state);
  1156.     void        Complete();
  1157.     void        Complete(OTResult result);
  1158.     void        Complete(OTResult result, OTEventCode code, void* contextPtr);
  1159.     void        CompleteToClient();
  1160.     void        CompleteToClient(OTResult result);
  1161.     void        CompleteToClient(OTResult result, OTEventCode code, void* contexPtr);
  1162.     void        PopCallback();
  1163.     Boolean     CreateStream(OTConfigurationRef cfig, OTOpenFlags flags);
  1164.     Boolean     OpenStream(const char* name, OTOpenFlags flags);
  1165.     Boolean     SendIoctl(StreamRef ref, UInt32 type, void* data);
  1166.     Boolean     SendIoctl(StreamRef ref, UInt32 type, long data);
  1167.     Boolean     PutMessage(StreamRef ref, strbuf* ctl, strbuf* data, OTFlags flags);
  1168.     Boolean     GetMessage(StreamRef ref, strbuf* ctl, strbuf* data, OTFlags* flagPtr);
  1169.     OSStatus    ReturnToCaller();
  1170. #endif
  1171. };
  1172. #define kOTSMBufferSize(callDepth) (80 + (callDepth * 8))
  1173. /*
  1174.    For structSize, pass the size of your structure that you want associated with
  1175.    the state machine.  It can later be obtained by calling OTSMGetClientData.
  1176.    For bufSize, use the kOTSMBufferSize macro, plus the size of your structure
  1177.    to create a buffer on the stack. For synchronous calls, the stack buffer will
  1178.    be used (unless you pass in NULL).  The callDepth is the depth level of nested
  1179.    calls using OTSMCallStateProc.
  1180. */
  1181. #if CALL_NOT_IN_CARBON
  1182. EXTERN_API_C( OTStateMachine *)
  1183. OTCreateStateMachine            (void *                 buf,
  1184.                                  OTByteCount            bufSize,
  1185.                                  OTByteCount            structSize,
  1186.                                  OTNotifyUPP            proc,
  1187.                                  void *                 contextPtr);
  1188. EXTERN_API_C( void )
  1189. OTDestroyStateMachine           (OTStateMachine *       sm);
  1190. /*
  1191.    OTSMCallStateProc used to take a parameter of type UInt16_p,
  1192.    which was defined to be the same as UInt32.  In an attempt
  1193.    to reduce the number of wacky types defined by the OT
  1194.    interfaces, we've changed these routines to just take a
  1195.    straight UInt32.  You should be warned that the current
  1196.    implementation does not support values outside of the
  1197.    range 0..32767.  The same applies to OTSMSetState.
  1198. */
  1199. EXTERN_API_C( Boolean )
  1200. OTSMCallStateProc               (OTStateMachine *       sm,
  1201.                                  OTStateProcPtr         proc,
  1202.                                  UInt32                 state);
  1203. EXTERN_API_C( UInt16 )
  1204. OTSMGetState                    (OTStateMachine *       sm);
  1205. EXTERN_API_C( void )
  1206. OTSMSetState                    (OTStateMachine *       sm,
  1207.                                  UInt32                 state);
  1208. /* Fill out the fCookie, fCode, and fResult fields before calling!*/
  1209. EXTERN_API_C( void )
  1210. OTSMComplete                    (OTStateMachine *       sm);
  1211. EXTERN_API_C( void )
  1212. OTSMPopCallback                 (OTStateMachine *       sm);
  1213. EXTERN_API_C( Boolean )
  1214. OTSMWaitForComplete             (OTStateMachine *       sm);
  1215. EXTERN_API_C( Boolean )
  1216. OTSMCreateStream                (OTStateMachine *       sm,
  1217.                                  OTConfigurationRef     cfig,
  1218.                                  OTOpenFlags            flags);
  1219. EXTERN_API_C( Boolean )
  1220. OTSMOpenStream                  (OTStateMachine *       sm,
  1221.                                  const char *           name,
  1222.                                  OTOpenFlags            flags);
  1223. EXTERN_API_C( Boolean )
  1224. OTSMIoctl                       (OTStateMachine *       sm,
  1225.                                  StreamRef              strm,
  1226.                                  UInt32                 cmd,
  1227.                                  long                   data);
  1228. EXTERN_API_C( Boolean )
  1229. OTSMPutMessage                  (OTStateMachine *       sm,
  1230.                                  StreamRef              strm,
  1231.                                  strbuf *               ctlbuf,
  1232.                                  strbuf *               databuf,
  1233.                                  OTFlags                flags);
  1234. EXTERN_API_C( Boolean )
  1235. OTSMGetMessage                  (OTStateMachine *       sm,
  1236.                                  StreamRef              strm,
  1237.                                  strbuf *               ctlbuf,
  1238.                                  strbuf *               databuf,
  1239.                                  OTFlags *              flagsPtr);
  1240. EXTERN_API_C( OSStatus )
  1241. OTSMReturnToCaller              (OTStateMachine *       sm);
  1242. EXTERN_API_C( void *)
  1243. OTSMGetClientData               (OTStateMachine *       sm);
  1244. EXTERN_API_C( void )
  1245. OTSMInstallCompletionProc       (OTStateMachine *       sm,
  1246.                                  OTSMCompleteProcPtr    completeProc,
  1247.                                  void *                 contextPtr);
  1248. EXTERN_API_C( Boolean )
  1249. OTSMCreateControlStream         (OTStateMachine *       sm,
  1250.                                  OTConfigurationRef     cfig,
  1251.                                  TOTConfiguratorRef     cfigor);
  1252. #ifdef __cplusplus
  1253.     inline void*        OTStateMachine::GetClientData() { return OTSMGetClientData(this); }
  1254.     inline Boolean      OTStateMachine::CallStateProc(OTStateProcPtr proc, UInt32 state)
  1255.                                                         { return OTSMCallStateProc(this, proc, state); }
  1256.     inline UInt16       OTStateMachine::GetState()      { return OTSMGetState(this); }
  1257.     inline void         OTStateMachine::SetState(UInt32 state)
  1258.                                                         { OTSMSetState(this, state); }
  1259.     inline void         OTStateMachine::PopCallback()   { OTSMPopCallback(this); }
  1260.     inline void         OTStateMachine::Complete()      { OTSMComplete(this); }
  1261.     inline void         OTStateMachine::Complete(OTResult result, OTEventCode code, void* cookie)
  1262.                                                         { fCookie = cookie; fCode = code; fResult = result; Complete(); }
  1263.     inline void         OTStateMachine::Complete(OTResult result)
  1264.                                                         { fResult = result; Complete(); }
  1265.     inline void         OTStateMachine::CompleteToClient()
  1266.                                                         { PopCallback(); Complete(); }
  1267.     inline void         OTStateMachine::CompleteToClient(OTResult result)
  1268.                                                         { fResult   = result; CompleteToClient(); }
  1269.     
  1270.     inline void         OTStateMachine::CompleteToClient(OTResult result, OTEventCode code, void* cookie)
  1271.                                                         { fCookie = cookie; fCode = code; fResult = result; CompleteToClient(); }
  1272.     inline Boolean      OTStateMachine::CreateStream(OTConfigurationRef cfig, OTOpenFlags flags)
  1273.                                                         { return OTSMCreateStream(this, cfig, flags); }
  1274.     inline Boolean      OTStateMachine::OpenStream(const char* name, OTOpenFlags flags)
  1275.                                                         { return OTSMOpenStream(this, name, flags); }
  1276.     inline Boolean      OTStateMachine::SendIoctl(StreamRef ref, UInt32 type, void* data)
  1277.                                                         { return OTSMIoctl(this, ref, type, (long)data); }
  1278.     inline Boolean      OTStateMachine::SendIoctl(StreamRef ref, UInt32 type, long data)
  1279.                                                         { return OTSMIoctl(this, ref, type, data); }
  1280.     inline Boolean      OTStateMachine::PutMessage(StreamRef ref, struct strbuf* ctl, struct strbuf* data, OTFlags flags)
  1281.                                                         { return OTSMPutMessage(this, ref, ctl, data, flags); }
  1282.     inline Boolean      OTStateMachine::GetMessage(StreamRef ref, struct strbuf* ctl, struct strbuf* data, OTFlags* flagPtr)
  1283.                                                         { return OTSMGetMessage(this, ref, ctl, data, flagPtr); }
  1284.     inline OSStatus     OTStateMachine::ReturnToCaller()
  1285.                                                         { return OTSMReturnToCaller(this); }
  1286. #endif
  1287. #endif  /* CALL_NOT_IN_CARBON */
  1288. #endif  /* !OTKERNEL */
  1289. /* ***** Autopush Definitions ******/
  1290. /*
  1291.    The autopush functionality for Open Transport is based on the names of
  1292.    devices and modules, rather than on the major number information like 
  1293.    SVR4.  This is so that autopush information can be set up for modules
  1294.    that are not yet loaded.
  1295. */
  1296. /* The name of the STREAMS driver you open and send the ioctls to.*/
  1297. #define kSADModuleName  "sad"
  1298. /* Autopush ioctls.*/
  1299. enum {
  1300.     I_SAD_SAP                   = ((MIOC_SAD << 8) | 1),        /* Set autopush information     */
  1301.     I_SAD_GAP                   = ((MIOC_SAD << 8) | 2),        /* Get autopush information     */
  1302.     I_SAD_VML                   = ((MIOC_SAD << 8) | 3)         /* Validate a list of modules (uses str_list structure) */
  1303. };
  1304. /* Maximum number of modules autopushed on a driver.*/
  1305. enum {
  1306.     kOTAutopushMax              = 8
  1307. };
  1308. /* ioctl structure used for SAD_SAP and SAD_GAP commands.*/
  1309. struct OTAutopushInfo {
  1310.     UInt32                          sap_cmd;
  1311.     char                            sap_device_name[32];
  1312.     SInt32                          sap_minor;
  1313.     SInt32                          sap_lastminor;
  1314.     SInt32                          sap_npush;
  1315.     char                            sap_list[8][32];
  1316. };
  1317. typedef struct OTAutopushInfo           OTAutopushInfo;
  1318. /* Command values for sap_cmd field of the above.*/
  1319. enum {
  1320.     kSAP_ONE                    = 1,                            /* Configure a single minor device         */
  1321.     kSAP_RANGE                  = 2,                            /* Configure a range of minor devices     */
  1322.     kSAP_ALL                    = 3,                            /* Configure all minor devices          */
  1323.     kSAP_CLEAR                  = 4                             /* Clear autopush information          */
  1324. };
  1325. /* ***** Configuration Helpers ******/
  1326. /*
  1327.    These definitions are used by device driver and port scanner
  1328.    developers to provide a library giving client-side information about
  1329.    the registered ports, such as a user-visible name or an icon.
  1330. */
  1331. /* Configuration helper library prefix*/
  1332. /*
  1333.    This prefix is prepended to the string found in the "fResourceInfo"
  1334.    field of the OTPortRecord to build the actual library name of the
  1335.    configuration helper library.
  1336. */
  1337. #define kPortConfigLibPrefix "OTPortCfg$"
  1338. /* Get user visible port name entry point.*/
  1339. /*
  1340.    This entry point returns the user visible name of the port.  If includeSlot
  1341.    is true, a slot distinguishing suffix (eg "slot X") should be added.  If
  1342.    includePort is true, a port distinguishing suffix (eg " port X") should be added for
  1343.    multiport cards.
  1344. */
  1345. #define kOTGetUserPortNameID "OTGetUserPortName"
  1346. typedef CALLBACK_API_C( void , OTGetPortNameProcPtr )(OTPortRecord *port, OTBooleanParam includeSlot, OTBooleanParam includePort, Str255 userVisibleName);
  1347. /* Get icon entry point.*/
  1348. /*
  1349.    This entry point returns the location of the icon for the port.  Return false if no
  1350.    icon is provided.
  1351. */
  1352. #define kOTGetPortIconID "OTGetPortIcon"
  1353. struct OTResourceLocator {
  1354.     FSSpec                          fFile;
  1355.     UInt16                          fResID;
  1356. };
  1357. typedef struct OTResourceLocator        OTResourceLocator;
  1358. typedef CALLBACK_API_C( Boolean , OTGetPortIconProcPtr )(OTPortRecord *port, OTResourceLocator *iconLocation);
  1359. /* ***** Application Access to Configuration Helpers ******/
  1360. #if !OTKERNEL
  1361. /*
  1362.    These routines are used by clients to get information about ports.
  1363.    The canonical user of these routines is the OT control panel(s),
  1364.    but applications may want to use them as well (to display the list
  1365.    of available Ethernet cards, for example).
  1366. */
  1367. /*  Returns a user friendly name for a port.*/
  1368. #if CALL_NOT_IN_CARBON
  1369. EXTERN_API_C( void )
  1370. OTGetUserPortNameFromPortRef    (OTPortRef              ref,
  1371.                                  Str255                 friendlyName);
  1372. /*
  1373.     Returns the location for the icon familly representing the port.
  1374.     Returns false if the port has no icon.
  1375. */
  1376. EXTERN_API_C( Boolean )
  1377. OTGetPortIconFromPortRef        (OTPortRef              ref,
  1378.                                  OTResourceLocator *    iconLocation);
  1379. #endif  /* CALL_NOT_IN_CARBON */
  1380. /* Returns true if the port can be used with the specified protocol.*/
  1381. #if CALL_NOT_IN_CARBON
  1382. EXTERN_API_C( Boolean )
  1383. OTIsPortCompatibleWith          (const OTPortRecord *   port,
  1384.                                  char *                 protocolName);
  1385. #endif  /* CALL_NOT_IN_CARBON */
  1386. #endif  /* !OTKERNEL */
  1387. #endif  /* CALL_NOT_IN_CARBON */
  1388. /* ***** Common Utilities ******/
  1389. /*
  1390.    The utilities defined in this section are available to both client
  1391.    and kernel code.  Cool huh?  These utilities differ from those
  1392.    provided in "OpenTransport.h" in that they are only available to native
  1393.    architecture clients.
  1394. */
  1395. /* Bitmap functions*/
  1396. /* These functions atomically deal with a bitmap that is multiple-bytes long*/
  1397. /*
  1398.    Set the first clear bit in "bitMap", starting with bit "startBit",
  1399.    giving up after "numBits".  Returns the bit # that was set, or
  1400.    a kOTNotFoundErr if there was no clear bit available
  1401. */
  1402. EXTERN_API_C( OTResult )
  1403. OTSetFirstClearBit              (UInt8 *                bitMap,
  1404.                                  OTByteCount            startBit,
  1405.                                  OTByteCount            numBits);
  1406. /* Standard clear, set and test bit functions*/
  1407. EXTERN_API_C( Boolean )
  1408. OTClearBit                      (UInt8 *                bitMap,
  1409.                                  OTByteCount            bitNo);
  1410. EXTERN_API_C( Boolean )
  1411. OTSetBit                        (UInt8 *                bitMap,
  1412.                                  OTByteCount            bitNo);
  1413. EXTERN_API_C( Boolean )
  1414. OTTestBit                       (UInt8 *                bitMap,
  1415.                                  OTByteCount            bitNo);
  1416. /* OTHashList*/
  1417. /*
  1418.    This implements a simple, but efficient hash list.  It is not
  1419.    thread-safe.
  1420. */
  1421. typedef CALLBACK_API_C( UInt32 , OTHashProcPtr )(OTLink *linkToHash);
  1422. typedef CALLBACK_API_C( Boolean , OTHashSearchProcPtr )(const void *ref, OTLink *linkToCheck);
  1423. struct OTHashList {
  1424.     OTHashProcPtr                   fHashProc;
  1425.     ByteCount                       fHashTableSize;
  1426.     OTLink **                       fHashBuckets;
  1427. #ifdef __cplusplus
  1428.     // C++ inline methods on this structure.
  1429.     void            Add(OTLink* toAdd);
  1430.     Boolean         RemoveLink(OTLink* toRemove);
  1431.     OTLink*         Remove(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hashValue);
  1432.     Boolean         IsInList(OTLink* toFind);
  1433.     OTLink*         FindLink(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hash);
  1434. #endif
  1435. };
  1436. typedef struct OTHashList               OTHashList;
  1437. /*
  1438.    Return the number of bytes of memory needed to create a hash list
  1439.    of at least "numEntries" entries.
  1440. */
  1441. #if CALL_NOT_IN_CARBON
  1442. EXTERN_API_C( OTByteCount )
  1443. OTCalculateHashListMemoryNeeds  (OTItemCount            numEntries);
  1444. /*
  1445.    Create an OTHashList from "memory".  Return an error if it
  1446.    couldn't be done.
  1447. */
  1448. EXTERN_API_C( OTResult )
  1449. OTInitHashList                  (void *                 memory,
  1450.                                  OTByteCount            numBytes,
  1451.                                  OTHashProcPtr          hashProc);
  1452. EXTERN_API_C( void )
  1453. OTAddToHashList                 (OTHashList *           hashList,
  1454.                                  OTLink *               linkToAdd);
  1455. EXTERN_API_C( Boolean )
  1456. OTRemoveLinkFromHashList        (OTHashList *           hashList,
  1457.                                  OTLink *               linkToRemove);
  1458. EXTERN_API_C( Boolean )
  1459. OTIsInHashList                  (OTHashList *           hashList,
  1460.                                  OTLink *               link);
  1461. EXTERN_API_C( OTLink *)
  1462. OTFindInHashList                (OTHashList *           hashList,
  1463.                                  OTHashSearchProcPtr    searchProc,
  1464.                                  const void *           refPtr,
  1465.                                  UInt32                 hashValue);
  1466. EXTERN_API_C( OTLink *)
  1467. OTRemoveFromHashList            (OTHashList *           hashList,
  1468.                                  OTHashSearchProcPtr    searchProc,
  1469.                                  const void *           refPtr,
  1470.                                  UInt32                 hashValue);
  1471. #ifdef __cplusplus
  1472.     // C++ inline methods on this structure.
  1473.     inline void         OTHashList::Add(OTLink* toAdd)  { OTAddToHashList(this, toAdd); }
  1474.     inline Boolean      OTHashList::RemoveLink(OTLink* toRemove)
  1475.                                                         { return OTRemoveLinkFromHashList(this, toRemove); }
  1476.     inline OTLink*      OTHashList::Remove(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hashValue)
  1477.                                                         { return OTRemoveFromHashList(this, proc, refPtr, hashValue); }
  1478.     inline Boolean      OTHashList::IsInList(OTLink* toFind)
  1479.                                                         { return OTIsInHashList(this, toFind); }
  1480.     inline OTLink*      OTHashList::FindLink(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hash)
  1481.                                                         { return OTFindInHashList(this, proc, refPtr, hash); }
  1482. #endif
  1483. /* Random functions*/
  1484. /*
  1485.    These implement a very simple random number generator, suitable
  1486.    for protocol implementations but not "cryptographically" random.
  1487. */
  1488. EXTERN_API_C( UInt32 )
  1489. OTGetRandomSeed                 (void);
  1490. EXTERN_API_C( UInt32 )
  1491. OTGetRandomNumber               (UInt32 *               seed,
  1492.                                  UInt32                 lo,
  1493.                                  UInt32                 hi);
  1494. /* Concurrency Control*/
  1495. /*
  1496.    OTGate implements a cool concurrency control primitive.
  1497.    You're not going to understand it without reading the documentation!
  1498.    See "Open Transport Advanced Client Programming" for details.
  1499.    WARNING:
  1500.    This structure must be on a 4-byte boundary.
  1501. */
  1502. #endif  /* CALL_NOT_IN_CARBON */
  1503. typedef CALLBACK_API_C( Boolean , OTGateProcPtr )(OTLink *thisLink);
  1504. struct OTGate {
  1505.     OTLIFO                          fLIFO;
  1506.     OTList                          fList;
  1507.     OTGateProcPtr                   fProc;
  1508.     SInt32                          fNumQueued;
  1509.     SInt32                          fInside;
  1510. };
  1511. typedef struct OTGate                   OTGate;
  1512. #if CALL_NOT_IN_CARBON
  1513. EXTERN_API_C( void )
  1514. OTInitGate                      (OTGate *               gate,
  1515.                                  OTGateProcPtr          proc);
  1516. EXTERN_API_C( Boolean )
  1517. OTEnterGate                     (OTGate *               gate,
  1518.                                  OTLink *               withLink);
  1519. EXTERN_API_C( Boolean )
  1520. OTLeaveGate                     (OTGate *               gate);
  1521. /* ***** Shared Library Bonus Extras ******/
  1522. #endif  /* CALL_NOT_IN_CARBON */
  1523. #if CALL_NOT_IN_CARBON
  1524. /*
  1525.    These routines provide addition shared library support beyond
  1526.    that provided by the base shared library mechanism.
  1527. */
  1528. /*
  1529.    Some flags which can be passed to the "loadFlags" parameter of the
  1530.    various CFM routines.  Not all flags can be used with all routines.
  1531.    See "Open Transport Advanced Client Programming" for details.
  1532. */
  1533. enum {
  1534.     kOTGetDataSymbol            = 0,
  1535.     kOTGetCodeSymbol            = 1,
  1536.     kOTLoadNewCopy              = 2,
  1537.     kOTLoadACopy                = 4,
  1538.     kOTFindACopy                = 8,
  1539.     kOTLibMask                  = kOTLoadNewCopy | kOTLoadACopy | kOTFindACopy,
  1540.     kOTLoadLibResident          = 0x20
  1541. };
  1542. /* Finding all matching CFM libraries.*/
  1543. /*
  1544.    The routine OTFindCFMLibraries allows you to find all CFM libraries
  1545.    that match specific criteria.  The result is placed in a list
  1546.    of CFMLibraryInfo structures.  OT allocates those structures using
  1547.    a routine of type OTAllocMemProcPtr that you pass to OTFindCFMLibraries.
  1548. */
  1549. /*
  1550.    A list of CFMLibraryInfo structures is returned by the OTFindCFMLibraries routine.
  1551.    The list is created out of the data that is passed to the function.
  1552.    
  1553.    IMPORTANT:
  1554.    Only the first 3 fields are valid when using OT 1.2 and older.
  1555. */
  1556. struct CFMLibraryInfo {
  1557.     OTLink                          link;                       /* To link them all up on a list            */
  1558.     char *                          libName;                    /* "C" String which is fragment name          */
  1559.     StringPtr                       intlName;                   /* Pascal String which is internationalized name  */
  1560.     FSSpec *                        fileSpec;                   /* location of fragment's file */
  1561.     StringPtr                       pstring2;                   /* Secondary string from extended cfrg          */
  1562.     StringPtr                       pstring3;                   /* Extra info from extended cfrg            */
  1563. };
  1564. typedef struct CFMLibraryInfo           CFMLibraryInfo;
  1565. /*
  1566.    You must pass a routine of type OTAllocMemProcPtr to OTFindCFMLibraries
  1567.    which it calls to allocate memory for the CFMLibraryInfo structures.
  1568. */
  1569. typedef CALLBACK_API_C( void *, OTAllocMemProcPtr )(OTByteCount size);
  1570. /* Find CFM libraries of the specified kind and type*/
  1571. #if CALL_NOT_IN_CARBON
  1572. EXTERN_API_C( OSStatus )
  1573. OTFindCFMLibraries              (OSType                 libKind,
  1574.                                  const char *           libType,
  1575.                                  OTList *               theList,
  1576.                                  OTAllocMemProcPtr      allocator);
  1577. /* Loading libraries and connecting to symbols.*/
  1578. /* Load a CFM library by name*/
  1579. EXTERN_API_C( OSStatus )
  1580. OTLoadCFMLibrary                (const char *           libName,
  1581.                                  UInt32 *               connID,
  1582.                                  UInt32                 loadFlags);
  1583. /* Load a CFM library and get a named pointer from it*/
  1584. EXTERN_API_C( void *)
  1585. OTGetCFMPointer                 (const char *           libName,
  1586.                                  const char *           entryName,
  1587.                                  UInt32 *               connID,
  1588.                                  UInt32                 loadFlags);
  1589. /* Get a named pointer from a CFM library that's already loaded*/
  1590. EXTERN_API_C( void *)
  1591. OTGetCFMSymbol                  (const char *           entryName,
  1592.                                  UInt32                 connID,
  1593.                                  UInt32                 loadFlags);
  1594. /* Release a connection to a CFM library*/
  1595. EXTERN_API_C( void )
  1596. OTReleaseCFMConnection          (UInt32 *               connID);
  1597. #endif  /* CALL_NOT_IN_CARBON */
  1598. #if !TARGET_CPU_68K
  1599. /*
  1600.    You can call these routines in your CFM initialisation and termination
  1601.    routines to hold or unhold your libraries sections.
  1602. */
  1603. /*
  1604.    Used in a CFM InitProc, will hold the executable code, if applicable.
  1605.    This can also be the InitProc of the library
  1606. */
  1607. #if CALL_NOT_IN_CARBON
  1608. EXTERN_API_C( OSStatus )
  1609. OTHoldThisCFMLibrary            (const CFragInitBlock * initBlock);
  1610. /*
  1611.    Used in a CFM terminate proc, will unhold the executable code, if applicable.
  1612.    This can also be the terminate proc of the library
  1613. */
  1614. EXTERN_API_C( void )
  1615. OTUnholdThisCFMLibrary          (void);
  1616. #endif  /* CALL_NOT_IN_CARBON */
  1617. #endif  /* !TARGET_CPU_68K */
  1618. /* ASLM Utilities*/
  1619. /* Load an ASLM library*/
  1620. #if CALL_NOT_IN_CARBON
  1621. EXTERN_API_C( OSStatus )
  1622. OTLoadASLMLibrary               (const char *           libName);
  1623. /* Unload an ASLM library*/
  1624. EXTERN_API_C( void )
  1625. OTUnloadASLMLibrary             (const char *           libName);
  1626. /*
  1627.    This is an ASLM utility routine.  You can get it by including
  1628.    "LibraryManagerUtilities.h", but since we only use a few ASLM utilities,
  1629.    we put the prototype here for convenience.
  1630. */
  1631. EXTERN_API_C( void )
  1632. UnloadUnusedLibraries           (void);
  1633. #endif  /* CALL_NOT_IN_CARBON */
  1634. #if !OTKERNEL
  1635. /*******************************************************************************
  1636. ** A few C++ objects for C++ fans
  1637. ********************************************************************************/
  1638. #if CALL_NOT_IN_CARBON
  1639. #ifdef __cplusplus
  1640. }                   // Terminate C definitions
  1641.     class OTConfiguration
  1642.     {
  1643.         public:
  1644.                     OTConfigurationRef  Clone()
  1645.                                         { return OTCfigCloneConfiguration(this); }
  1646.                 //
  1647.                 // The Path for PushChild and PushParent must be a single module
  1648.                 //
  1649.                     OTConfigurationRef  PushChild(const char* path, OSStatus* errPtr)
  1650.                                         { return OTCfigPushNewSingleChild(this, path, errPtr); }
  1651.                     OTConfigurationRef  PushParent(const char* path, OSStatus* errPtr)
  1652.                                         { return OTCfigPushParent(this, path, errPtr); }
  1653.                     OTConfigurationRef  PushNthChild(OTItemCount index, const char* path,
  1654.                                                      OSStatus* errPtr)
  1655.                                         { return OTCfigPushChild(this, index, path, errPtr); }
  1656.                     OSStatus            PopChild(OTItemCount index)
  1657.                                         { return OTCfigPopChild(this, index); }
  1658.                     OTConfigurationRef  GetChild(OTItemCount index = 0)
  1659.                                         { return OTCfigGetChild(this, index); }
  1660.                     OTConfigurationRef  GetParent()
  1661.                                         { return OTCfigGetParent(this); }
  1662.             
  1663.                     OSStatus            AddChild(OTConfigurationRef child)
  1664.                                         { return OTCfigAddChild(this, child); }
  1665.                     
  1666.                     OTConfigurationRef  NewChild(const char* path, OSStatus* errPtr)
  1667.                                         { return OTCfigNewChild(this, path, errPtr); }
  1668.         
  1669.                     OSStatus            SetPath(const char* path)
  1670.                                         { return OTCfigSetPath(this, path); }
  1671.             
  1672.                     Boolean             HasOptions()
  1673.                                         { return OTCfigGetOptionNetbuf(this)->len != 0; }
  1674.     };
  1675. /*  -------------------------------------------------------------------------
  1676.     Class TOTConfigurator
  1677.     This class is subclassed to do configuration for a protocol or protocol stack.
  1678.     Of course, you can also use OTNewConfigurator to do it from C.
  1679.     
  1680.     If you subclass it using C++, you MUST have a UInt32 field as the first
  1681.     field of your object that you do not touch or use.
  1682.     ------------------------------------------------------------------------- */
  1683. #if TARGET_CPU_68K && !defined(__SC__) && !defined(THINK_CPLUS)
  1684.     class TOTConfigurator : public SingleObject
  1685. #else
  1686.     class TOTConfigurator
  1687. #endif
  1688.     {
  1689.     #if defined(__SC__) || defined(THINK_CPLUS) || defined(__MRC__)
  1690.         private:
  1691.             virtual     void DummyVirtualFunction();
  1692.     #endif
  1693.                 
  1694.         public:
  1695.                 void*           operator new(OTByteCount size)
  1696.                                 { return OTAllocSharedClientMem(size); }
  1697.                 void            operator delete(void* mem)
  1698.                                 { OTFreeSharedClientMem(mem); };
  1699.                                 
  1700.                                 _MDECL TOTConfigurator();
  1701.             virtual             ~ _MDECL TOTConfigurator();
  1702.     
  1703.             virtual void        _MDECL HandleSystemEvent(OTEventCode event, OTResult result,
  1704.                                                          void* cookie)                      = 0;
  1705.             
  1706.             virtual OSStatus    _MDECL Configure(OTConfigurationRef)                            = 0;
  1707.             virtual OSStatus    _MDECL CreateStream(OTConfigurationRef, OTOpenFlags,
  1708.                                                      OTNotifyUPP, void* contextPtr)     = 0;
  1709.     };
  1710. extern "C" {        // resume C definitions
  1711. #endif /*__cplusplus*/
  1712. #endif /* CALL_NOT_IN_CARBON */
  1713. #endif  /* !OTKERNEL */
  1714. #endif  /* CALL_NOT_IN_CARBON */
  1715. #if defined(__MWERKS__) && TARGET_CPU_68K
  1716.     #pragma pop
  1717. #endif
  1718. #if PRAGMA_STRUCT_ALIGN
  1719.     #pragma options align=reset
  1720. #elif PRAGMA_STRUCT_PACKPUSH
  1721.     #pragma pack(pop)
  1722. #elif PRAGMA_STRUCT_PACK
  1723.     #pragma pack()
  1724. #endif
  1725. #ifdef PRAGMA_IMPORT_OFF
  1726. #pragma import off
  1727. #elif PRAGMA_IMPORT
  1728. #pragma import reset
  1729. #endif
  1730. #ifdef __cplusplus
  1731. }
  1732. #endif
  1733. #endif /* __OPENTRANSPORTPROTOCOL__ */