OpenTransportProtocol.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:184k
源码类别:
多媒体编程
开发平台:
Visual C++
- UInt32 dl_primitive; /* DL_CONNECT_RES */
- UInt32 dl_correlation; /* provider's correlation token */
- UInt32 dl_resp_token; /* token associated with responding stream */
- UInt32 dl_qos_length; /* length of qos structure */
- UInt32 dl_qos_offset; /* offset from beginning of block */
- UInt32 dl_growth; /* set to zero */
- };
- typedef struct dl_connect_res_t dl_connect_res_t;
- /* DL_CONNECT_CON, M_PROTO type*/
- struct dl_connect_con_t {
- UInt32 dl_primitive; /* DL_CONNECT_CON*/
- UInt32 dl_resp_addr_length; /* length of responder's address */
- UInt32 dl_resp_addr_offset; /* offset from beginning of block*/
- UInt32 dl_qos_length; /* length of qos structure */
- UInt32 dl_qos_offset; /* offset from beginning of block*/
- UInt32 dl_growth; /* set to zero */
- };
- typedef struct dl_connect_con_t dl_connect_con_t;
- /* DL_TOKEN_REQ, M_PCPROTO type*/
- struct dl_token_req_t {
- UInt32 dl_primitive; /* DL_TOKEN_REQ */
- };
- typedef struct dl_token_req_t dl_token_req_t;
- /* DL_TOKEN_ACK, M_PCPROTO type*/
- struct dl_token_ack_t {
- UInt32 dl_primitive; /* DL_TOKEN_ACK */
- UInt32 dl_token; /* Connection response token associated with the stream */
- };
- typedef struct dl_token_ack_t dl_token_ack_t;
- /* DL_DISCONNECT_REQ, M_PROTO type*/
- struct dl_disconnect_req_t {
- UInt32 dl_primitive; /* DL_DISCONNECT_REQ */
- UInt32 dl_reason; /*normal, abnormal, perm. or transient*/
- UInt32 dl_correlation; /* association with connect_ind */
- };
- typedef struct dl_disconnect_req_t dl_disconnect_req_t;
- /* DL_DISCONNECT_IND, M_PROTO type*/
- struct dl_disconnect_ind_t {
- UInt32 dl_primitive; /* DL_DISCONNECT_IND */
- UInt32 dl_originator; /* USER or PROVIDER */
- UInt32 dl_reason; /* permanent or transient */
- UInt32 dl_correlation; /* association with connect_ind */
- };
- typedef struct dl_disconnect_ind_t dl_disconnect_ind_t;
- /* DL_RESET_REQ, M_PROTO type*/
- struct dl_reset_req_t {
- UInt32 dl_primitive; /* DL_RESET_REQ */
- };
- typedef struct dl_reset_req_t dl_reset_req_t;
- /* DL_RESET_IND, M_PROTO type*/
- struct dl_reset_ind_t {
- UInt32 dl_primitive; /* DL_RESET_IND */
- UInt32 dl_originator; /* Provider or User */
- UInt32 dl_reason; /* flow control, link error or resynch*/
- };
- typedef struct dl_reset_ind_t dl_reset_ind_t;
- /* DL_RESET_RES, M_PROTO type*/
- struct dl_reset_res_t {
- UInt32 dl_primitive; /* DL_RESET_RES */
- };
- typedef struct dl_reset_res_t dl_reset_res_t;
- /* DL_RESET_CON, M_PROTO type*/
- struct dl_reset_con_t {
- UInt32 dl_primitive; /* DL_RESET_CON */
- };
- typedef struct dl_reset_con_t dl_reset_con_t;
- /* CONNECTIONLESS SERVICE PRIMITIVES*/
- /* DL_UNITDATA_REQ, M_PROTO type, with M_DATA block(s)*/
- struct dl_unitdata_req_t {
- UInt32 dl_primitive; /* DL_UNITDATA_REQ */
- UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
- UInt32 dl_dest_addr_offset; /* offset from beg. of block */
- dl_priority_t dl_priority; /* priority value */
- };
- typedef struct dl_unitdata_req_t dl_unitdata_req_t;
- /* DL_UNITDATA_IND, M_PROTO type, with M_DATA block(s)*/
- struct dl_unitdata_ind_t {
- UInt32 dl_primitive; /* DL_UNITDATA_IND */
- UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
- UInt32 dl_dest_addr_offset; /* offset from beg. of block */
- UInt32 dl_src_addr_length; /* DLSAP addr length of sending user*/
- UInt32 dl_src_addr_offset; /* offset from beg. of block */
- UInt32 dl_group_address; /* set to one if multicast/broadcast*/
- };
- typedef struct dl_unitdata_ind_t dl_unitdata_ind_t;
- /*
- DL_UDERROR_IND, M_PROTO type
- (or M_PCPROTO type if LLI-based provider)
- */
- struct dl_uderror_ind_t {
- UInt32 dl_primitive; /* DL_UDERROR_IND */
- UInt32 dl_dest_addr_length; /* Destination DLSAP */
- UInt32 dl_dest_addr_offset; /* Offset from beg. of block */
- UInt32 dl_unix_errno; /* unix system error code*/
- UInt32 dl_errno; /* DLPI error code */
- };
- typedef struct dl_uderror_ind_t dl_uderror_ind_t;
- /* DL_UDQOS_REQ, M_PROTO type*/
- struct dl_udqos_req_t {
- UInt32 dl_primitive; /* DL_UDQOS_REQ */
- UInt32 dl_qos_length; /* length in bytes of requested qos*/
- UInt32 dl_qos_offset; /* offset from beg. of block */
- };
- typedef struct dl_udqos_req_t dl_udqos_req_t;
- /* Primitives to handle XID and TEST operations*/
- /* DL_TEST_REQ, M_PROTO type*/
- struct dl_test_req_t {
- UInt32 dl_primitive; /* DL_TEST_REQ */
- UInt32 dl_flag; /* poll/final */
- UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
- UInt32 dl_dest_addr_offset; /* offset from beg. of block */
- };
- typedef struct dl_test_req_t dl_test_req_t;
- /* DL_TEST_IND, M_PROTO type*/
- struct dl_test_ind_t {
- UInt32 dl_primitive; /* DL_TEST_IND */
- UInt32 dl_flag; /* poll/final */
- UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
- UInt32 dl_dest_addr_offset; /* offset from beg. of block */
- UInt32 dl_src_addr_length; /* dlsap length of source user */
- UInt32 dl_src_addr_offset; /* offset from beg. of block */
- };
- typedef struct dl_test_ind_t dl_test_ind_t;
- /* DL_TEST_RES, M_PROTO type*/
- struct dl_test_res_t {
- UInt32 dl_primitive; /* DL_TEST_RES */
- UInt32 dl_flag; /* poll/final */
- UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
- UInt32 dl_dest_addr_offset; /* offset from beg. of block */
- };
- typedef struct dl_test_res_t dl_test_res_t;
- /* DL_TEST_CON, M_PROTO type*/
- struct dl_test_con_t {
- UInt32 dl_primitive; /* DL_TEST_CON */
- UInt32 dl_flag; /* poll/final */
- UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
- UInt32 dl_dest_addr_offset; /* offset from beg. of block */
- UInt32 dl_src_addr_length; /* dlsap length of source user */
- UInt32 dl_src_addr_offset; /* offset from beg. of block */
- };
- typedef struct dl_test_con_t dl_test_con_t;
- /* DL_XID_REQ, M_PROTO type*/
- struct dl_xid_req_t {
- UInt32 dl_primitive; /* DL_XID_REQ */
- UInt32 dl_flag; /* poll/final */
- UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
- UInt32 dl_dest_addr_offset; /* offset from beg. of block */
- };
- typedef struct dl_xid_req_t dl_xid_req_t;
- /* DL_XID_IND, M_PROTO type*/
- struct dl_xid_ind_t {
- UInt32 dl_primitive; /* DL_XID_IND */
- UInt32 dl_flag; /* poll/final */
- UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
- UInt32 dl_dest_addr_offset; /* offset from beg. of block */
- UInt32 dl_src_addr_length; /* dlsap length of source user */
- UInt32 dl_src_addr_offset; /* offset from beg. of block */
- };
- typedef struct dl_xid_ind_t dl_xid_ind_t;
- /* DL_XID_RES, M_PROTO type*/
- struct dl_xid_res_t {
- UInt32 dl_primitive; /* DL_XID_RES */
- UInt32 dl_flag; /* poll/final */
- UInt32 dl_dest_addr_length; /* DLSAP length of dest. user */
- UInt32 dl_dest_addr_offset; /* offset from beg. of block */
- };
- typedef struct dl_xid_res_t dl_xid_res_t;
- /* DL_XID_CON, M_PROTO type*/
- struct dl_xid_con_t {
- UInt32 dl_primitive; /* DL_XID_CON */
- UInt32 dl_flag; /* poll/final */
- UInt32 dl_dest_addr_length; /* dlsap length of dest. user */
- UInt32 dl_dest_addr_offset; /* offset from beg. of block */
- UInt32 dl_src_addr_length; /* dlsap length of source user */
- UInt32 dl_src_addr_offset; /* offset from beg. of block */
- };
- typedef struct dl_xid_con_t dl_xid_con_t;
- /* ACKNOWLEDGED CONNECTIONLESS SERVICE PRIMITIVES*/
- /* DL_DATA_ACK_REQ, M_PROTO type*/
- struct dl_data_ack_req_t {
- UInt32 dl_primitive; /* DL_DATA_ACK_REQ */
- UInt32 dl_correlation; /* User's correlation token */
- UInt32 dl_dest_addr_length; /* length of destination addr */
- UInt32 dl_dest_addr_offset; /* offset from beginning of block */
- UInt32 dl_src_addr_length; /* length of source address */
- UInt32 dl_src_addr_offset; /* offset from beginning of block */
- UInt32 dl_priority; /* priority */
- UInt32 dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */
- };
- typedef struct dl_data_ack_req_t dl_data_ack_req_t;
- /* DL_DATA_ACK_IND, M_PROTO type*/
- struct dl_data_ack_ind_t {
- UInt32 dl_primitive; /* DL_DATA_ACK_IND */
- UInt32 dl_dest_addr_length; /* length of destination addr */
- UInt32 dl_dest_addr_offset; /* offset from beginning of block */
- UInt32 dl_src_addr_length; /* length of source address */
- UInt32 dl_src_addr_offset; /* offset from beginning of block */
- UInt32 dl_priority; /* priority for data unit transm. */
- UInt32 dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */
- };
- typedef struct dl_data_ack_ind_t dl_data_ack_ind_t;
- /* DL_DATA_ACK_STATUS_IND, M_PROTO type*/
- struct dl_data_ack_status_ind_t {
- UInt32 dl_primitive; /* DL_DATA_ACK_STATUS_IND */
- UInt32 dl_correlation; /* User's correlation token */
- UInt32 dl_status; /* success or failure of previous req*/
- };
- typedef struct dl_data_ack_status_ind_t dl_data_ack_status_ind_t;
- /* DL_REPLY_REQ, M_PROTO type*/
- struct dl_reply_req_t {
- UInt32 dl_primitive; /* DL_REPLY_REQ */
- UInt32 dl_correlation; /* User's correlation token */
- UInt32 dl_dest_addr_length; /* length of destination address */
- UInt32 dl_dest_addr_offset; /* offset from beginning of block */
- UInt32 dl_src_addr_length; /* source address length */
- UInt32 dl_src_addr_offset; /* offset from beginning of block */
- UInt32 dl_priority; /* priority for data unit transmission*/
- UInt32 dl_service_class;
- };
- typedef struct dl_reply_req_t dl_reply_req_t;
- /* DL_REPLY_IND, M_PROTO type*/
- struct dl_reply_ind_t {
- UInt32 dl_primitive; /* DL_REPLY_IND */
- UInt32 dl_dest_addr_length; /* length of destination address */
- UInt32 dl_dest_addr_offset; /* offset from beginning of block*/
- UInt32 dl_src_addr_length; /* length of source address */
- UInt32 dl_src_addr_offset; /* offset from beginning of block */
- UInt32 dl_priority; /* priority for data unit transmission*/
- UInt32 dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */
- };
- typedef struct dl_reply_ind_t dl_reply_ind_t;
- /* DL_REPLY_STATUS_IND, M_PROTO type*/
- struct dl_reply_status_ind_t {
- UInt32 dl_primitive; /* DL_REPLY_STATUS_IND */
- UInt32 dl_correlation; /* User's correlation token */
- UInt32 dl_status; /* success or failure of previous req*/
- };
- typedef struct dl_reply_status_ind_t dl_reply_status_ind_t;
- /* DL_REPLY_UPDATE_REQ, M_PROTO type*/
- struct dl_reply_update_req_t {
- UInt32 dl_primitive; /* DL_REPLY_UPDATE_REQ */
- UInt32 dl_correlation; /* user's correlation token */
- UInt32 dl_src_addr_length; /* length of source address */
- UInt32 dl_src_addr_offset; /* offset from beginning of block */
- };
- typedef struct dl_reply_update_req_t dl_reply_update_req_t;
- /* DL_REPLY_UPDATE_STATUS_IND, M_PROTO type*/
- struct dl_reply_update_status_ind_t {
- UInt32 dl_primitive; /* DL_REPLY_UPDATE_STATUS_IND */
- UInt32 dl_correlation; /* User's correlation token */
- UInt32 dl_status; /* success or failure of previous req*/
- };
- typedef struct dl_reply_update_status_ind_t dl_reply_update_status_ind_t;
- union DL_primitives {
- UInt32 dl_primitive;
- dl_info_req_t info_req;
- dl_info_ack_t info_ack;
- dl_attach_req_t attach_req;
- dl_detach_req_t detach_req;
- dl_bind_req_t bind_req;
- dl_bind_ack_t bind_ack;
- dl_unbind_req_t unbind_req;
- dl_subs_bind_req_t subs_bind_req;
- dl_subs_bind_ack_t subs_bind_ack;
- dl_subs_unbind_req_t subs_unbind_req;
- dl_ok_ack_t ok_ack;
- dl_error_ack_t error_ack;
- dl_connect_req_t connect_req;
- dl_connect_ind_t connect_ind;
- dl_connect_res_t connect_res;
- dl_connect_con_t connect_con;
- dl_token_req_t token_req;
- dl_token_ack_t token_ack;
- dl_disconnect_req_t disconnect_req;
- dl_disconnect_ind_t disconnect_ind;
- dl_reset_req_t reset_req;
- dl_reset_ind_t reset_ind;
- dl_reset_res_t reset_res;
- dl_reset_con_t reset_con;
- dl_unitdata_req_t unitdata_req;
- dl_unitdata_ind_t unitdata_ind;
- dl_uderror_ind_t uderror_ind;
- dl_udqos_req_t udqos_req;
- dl_enabmulti_req_t enabmulti_req;
- dl_disabmulti_req_t disabmulti_req;
- dl_promiscon_req_t promiscon_req;
- dl_promiscoff_req_t promiscoff_req;
- dl_phys_addr_req_t physaddr_req;
- dl_phys_addr_ack_t physaddr_ack;
- dl_set_phys_addr_req_t set_physaddr_req;
- dl_get_statistics_req_t get_statistics_req;
- dl_get_statistics_ack_t get_statistics_ack;
- dl_test_req_t test_req;
- dl_test_ind_t test_ind;
- dl_test_res_t test_res;
- dl_test_con_t test_con;
- dl_xid_req_t xid_req;
- dl_xid_ind_t xid_ind;
- dl_xid_res_t xid_res;
- dl_xid_con_t xid_con;
- dl_data_ack_req_t data_ack_req;
- dl_data_ack_ind_t data_ack_ind;
- dl_data_ack_status_ind_t data_ack_status_ind;
- dl_reply_req_t reply_req;
- dl_reply_ind_t reply_ind;
- dl_reply_status_ind_t reply_status_ind;
- dl_reply_update_req_t reply_update_req;
- dl_reply_update_status_ind_t reply_update_status_ind;
- };
- typedef union DL_primitives DL_primitives;
- enum {
- DL_INFO_REQ_SIZE = sizeof(dl_info_req_t),
- DL_INFO_ACK_SIZE = sizeof(dl_info_ack_t),
- DL_ATTACH_REQ_SIZE = sizeof(dl_attach_req_t),
- DL_DETACH_REQ_SIZE = sizeof(dl_detach_req_t),
- DL_BIND_REQ_SIZE = sizeof(dl_bind_req_t),
- DL_BIND_ACK_SIZE = sizeof(dl_bind_ack_t),
- DL_UNBIND_REQ_SIZE = sizeof(dl_unbind_req_t),
- DL_SUBS_BIND_REQ_SIZE = sizeof(dl_subs_bind_req_t),
- DL_SUBS_BIND_ACK_SIZE = sizeof(dl_subs_bind_ack_t),
- DL_SUBS_UNBIND_REQ_SIZE = sizeof(dl_subs_unbind_req_t),
- DL_OK_ACK_SIZE = sizeof(dl_ok_ack_t),
- DL_ERROR_ACK_SIZE = sizeof(dl_error_ack_t),
- DL_CONNECT_REQ_SIZE = sizeof(dl_connect_req_t),
- DL_CONNECT_IND_SIZE = sizeof(dl_connect_ind_t),
- DL_CONNECT_RES_SIZE = sizeof(dl_connect_res_t),
- DL_CONNECT_CON_SIZE = sizeof(dl_connect_con_t),
- DL_TOKEN_REQ_SIZE = sizeof(dl_token_req_t),
- DL_TOKEN_ACK_SIZE = sizeof(dl_token_ack_t),
- DL_DISCONNECT_REQ_SIZE = sizeof(dl_disconnect_req_t),
- DL_DISCONNECT_IND_SIZE = sizeof(dl_disconnect_ind_t),
- DL_RESET_REQ_SIZE = sizeof(dl_reset_req_t),
- DL_RESET_IND_SIZE = sizeof(dl_reset_ind_t),
- DL_RESET_RES_SIZE = sizeof(dl_reset_res_t),
- DL_RESET_CON_SIZE = sizeof(dl_reset_con_t),
- DL_UNITDATA_REQ_SIZE = sizeof(dl_unitdata_req_t),
- DL_UNITDATA_IND_SIZE = sizeof(dl_unitdata_ind_t),
- DL_UDERROR_IND_SIZE = sizeof(dl_uderror_ind_t),
- DL_UDQOS_REQ_SIZE = sizeof(dl_udqos_req_t),
- DL_ENABMULTI_REQ_SIZE = sizeof(dl_enabmulti_req_t),
- DL_DISABMULTI_REQ_SIZE = sizeof(dl_disabmulti_req_t),
- DL_PROMISCON_REQ_SIZE = sizeof(dl_promiscon_req_t),
- DL_PROMISCOFF_REQ_SIZE = sizeof(dl_promiscoff_req_t),
- DL_PHYS_ADDR_REQ_SIZE = sizeof(dl_phys_addr_req_t),
- DL_PHYS_ADDR_ACK_SIZE = sizeof(dl_phys_addr_ack_t),
- DL_SET_PHYS_ADDR_REQ_SIZE = sizeof(dl_set_phys_addr_req_t),
- DL_GET_STATISTICS_REQ_SIZE = sizeof(dl_get_statistics_req_t),
- DL_GET_STATISTICS_ACK_SIZE = sizeof(dl_get_statistics_ack_t),
- DL_XID_REQ_SIZE = sizeof(dl_xid_req_t),
- DL_XID_IND_SIZE = sizeof(dl_xid_ind_t),
- DL_XID_RES_SIZE = sizeof(dl_xid_res_t),
- DL_XID_CON_SIZE = sizeof(dl_xid_con_t),
- DL_TEST_REQ_SIZE = sizeof(dl_test_req_t),
- DL_TEST_IND_SIZE = sizeof(dl_test_ind_t),
- DL_TEST_RES_SIZE = sizeof(dl_test_res_t),
- DL_TEST_CON_SIZE = sizeof(dl_test_con_t),
- DL_DATA_ACK_REQ_SIZE = sizeof(dl_data_ack_req_t),
- DL_DATA_ACK_IND_SIZE = sizeof(dl_data_ack_ind_t),
- DL_DATA_ACK_STATUS_IND_SIZE = sizeof(dl_data_ack_status_ind_t),
- DL_REPLY_REQ_SIZE = sizeof(dl_reply_req_t),
- DL_REPLY_IND_SIZE = sizeof(dl_reply_ind_t),
- DL_REPLY_STATUS_IND_SIZE = sizeof(dl_reply_status_ind_t),
- DL_REPLY_UPDATE_REQ_SIZE = sizeof(dl_reply_update_req_t),
- DL_REPLY_UPDATE_STATUS_IND_SIZE = sizeof(dl_reply_update_status_ind_t)
- };
- enum {
- DL_IOC_HDR_INFO = ((MIOC_DLPI << 8) | 10) /* Fast path request */
- };
- /* ***** From the Mentat "modnames.h" ******/
- #define MI_AFU_NAME "afu"
- #define MI_AHARP_NAME "ahar"
- #define MI_AHENET_NAME "ahen"
- #define MI_ARP_NAME "arp"
- #define MI_ARPM_NAME "arpm"
- #define MI_COURMUX_NAME "courmux"
- #define MI_CLONE_NAME "clone"
- #define MI_DLB_NAME "dlb"
- #define MI_DLM_NAME "dlm"
- #define MI_DMODD_NAME "disdlpi"
- #define MI_DMODT_NAME "distpi"
- #define MI_DN_NAME "dn"
- #define MI_DNF_NAME "dnf"
- #define MI_DRVE_NAME "drve"
- #define MI_ECHO_NAME "echo"
- #define MI_ENXR_NAME "enxr"
- #define MI_RAWIP_NAME "rawip"
- #define MI_RAWIPM_NAME "rawipm"
- #define MI_HAVOC_NAME "havoc"
- #define MI_HAVOCM_NAME "havocm"
- #define MI_IP_NAME "ip"
- #define MI_IPM_NAME "ipm"
- #define MI_IPX_NAME "ipx"
- #define MI_LOG_NAME "log"
- #define MI_MODE_NAME "mode"
- #define MI_MUX_NAME "mux"
- #define MI_NECHO_NAME "necho"
- #define MI_NPEP_NAME "npep"
- #define MI_NULS_NAME "nuls"
- #define MI_NULZ_NAME "nulz"
- #define MI_PASS_NAME "pass"
- #define MI_PIPEMOD_NAME "pipemod"
- #define MI_SAD_NAME "sad"
- #define MI_SC_NAME "sc"
- #define MI_SOCKMOD_NAME "sockmod"
- #define MI_SPASS_NAME "spass"
- #define MI_SPX_NAME "spx"
- #define MI_STH_NAME "mi_sth"
- #define MI_TCP_NAME "tcp"
- #define MI_TCPM_NAME "tcpm"
- #define MI_TIMOD_NAME "timod"
- #define MI_TIRDWR_NAME "tirdwr"
- #define MI_TMOD_NAME "tmod"
- #define MI_TMUX_NAME "tmux"
- #define MI_TPIT_NAME "tpit"
- #define MI_TRSR_NAME "trsr"
- #define MI_TRXR_NAME "trxr"
- #define MI_UDP_NAME "udp"
- #define MI_UDPM_NAME "udpm"
- #define MI_WELD_NAME "mi_weld"
- #define MI_XDG_NAME "xdg"
- #define MI_XECHO_NAME "xecho"
- #define MI_XF_NAME "xf"
- #define MI_XFIPX_NAME "xfipx"
- #define MI_XFXNS_NAME "xfxns"
- #define MI_XPE_NAME "xpe"
- #define MI_XS_NAME "xs"
- #define MI_XTINDG_NAME "xtindg"
- #define MI_XTINVC_NAME "xtinvc"
- #define MI_XTM_NAME "xtm"
- #define MI_XTMIP_NAME "xtmip"
- #define MI_AFU_DEVICE "/dev/afu"
- #define MI_ARP_DEVICE "/dev/arp"
- #define MI_COURMUX_DEVICE "/dev/courmux"
- #define MI_CLONE_DEVICE "/dev/clone"
- #define MI_DLB_DEVICE "/dev/dlb"
- #define MI_DN_DEVICE "/dev/dn"
- #define MI_DNF_DEVICE "/dev/dnf"
- #define MI_DRVE_DEVICE "/dev/drve"
- #define MI_ECHO_DEVICE "/dev/echo"
- #define MI_RAWIP_DEVICE "/dev/rawip"
- #define MI_HAVOC_DEVICE "/dev/havoc"
- #define MI_IP_DEVICE "/dev/ip"
- #define MI_IPX_DEVICE "/dev/ipx"
- #define MI_LOG_DEVICE "/dev/log"
- #define MI_MODE_DEVICE "/dev/mode"
- #define MI_MUX_DEVICE "/dev/mux"
- #define MI_NECHO_DEVICE "/dev/necho"
- #define MI_NPEP_DEVICE "/dev/npep"
- #define MI_NULS_DEVICE "/dev/nuls"
- #define MI_NULZ_DEVICE "/dev/nulz"
- #define MI_SAD_DEVICE "/dev/sad"
- #define MI_SPX_DEVICE "/dev/spx"
- #define MI_TCP_DEVICE "/dev/tcp"
- #define MI_TMUX_DEVICE "/dev/tmux"
- #define MI_TMUX0_DEVICE "/dev/tmux#0"
- #define MI_TMUX1_DEVICE "/dev/tmux#1"
- #define MI_TPIT_DEVICE "/dev/tpit"
- #define MI_UDP_DEVICE "/dev/udp"
- #define MI_XDG_DEVICE "/dev/xdg"
- #define MI_XECHO_DEVICE "/dev/xecho"
- #define MI_XF_DEVICE "/dev/xf"
- #define MI_XPE_DEVICE "/dev/xpe"
- #define MI_XS_DEVICE "/dev/xs"
- #define MI_XTINDG_DEVICE "/dev/xtindg"
- #define MI_XTINVC_DEVICE "/dev/xtinvc"
- /* Streamtab entries */
- #define MI_AFU_STREAMTAB afuinfo
- #define MI_AHARP_STREAMTAB aharinfo
- #define MI_AHENET_STREAMTAB aheninfo
- #define MI_ARP_STREAMTAB arpinfo
- #define MI_ARPM_STREAMTAB arpminfo
- #define MI_COURMUX_STREAMTAB courmuxinfo
- #define MI_CLONE_STREAMTAB cloneinfo
- #define MI_DLB_STREAMTAB dlbinfo
- #define MI_DLM_STREAMTAB dlminfo
- #define MI_DMODD_STREAMTAB dmoddinfo
- #define MI_DMODT_STREAMTAB dmodtinfo
- #define MI_DN_STREAMTAB dninfo
- #define MI_DNF_STREAMTAB dnfinfo
- #define MI_DRVE_STREAMTAB drveinfo
- #define MI_ECHO_STREAMTAB echoinfo
- #define MI_ENXR_STREAMTAB enxrinfo
- #define MI_HAVOC_STREAMTAB hvcinfo
- #define MI_HAVOCM_STREAMTAB hvcminfo
- #define MI_IP_STREAMTAB ipinfo
- #define MI_IPM_STREAMTAB ipminfo
- #define MI_IPX_STREAMTAB ipxinfo
- #define MI_LOG_STREAMTAB loginfo
- #define MI_MODE_STREAMTAB modeinfo
- #define MI_MUX_STREAMTAB muxinfo
- #define MI_NECHO_STREAMTAB nechoinfo
- #define MI_NPEP_STREAMTAB npepinfo
- #define MI_NULS_STREAMTAB nulsinfo
- #define MI_NULZ_STREAMTAB nulzinfo
- #define MI_PASS_STREAMTAB passinfo
- #define MI_PIPEMOD_STREAMTAB pmodinfo
- #define MI_RAWIP_STREAMTAB rawipinfo
- #define MI_RAWIPM_STREAMTAB rawipminfo
- #define MI_SAD_STREAMTAB sadinfo
- #define MI_SC_STREAMTAB scinfo
- #define MI_SOCKMOD_STREAMTAB sockmodinfo
- #define MI_SPASS_STREAMTAB spassinfo
- #define MI_SPX_STREAMTAB spxinfo
- #define MI_STH_STREAMTAB mi_sthinfo
- #define MI_TCP_STREAMTAB tcpinfo
- #define MI_TCPM_STREAMTAB tcpminfo
- #define MI_TIMOD_STREAMTAB timodinfo
- #define MI_TIRDWR_STREAMTAB tirdwrinfo
- #define MI_TMOD_STREAMTAB tmodinfo
- #define MI_TMUX_STREAMTAB tmuxinfo
- #define MI_TPIT_STREAMTAB tpitinfo
- #define MI_TRSR_STREAMTAB trsrinfo
- #define MI_TRXR_STREAMTAB trxrinfo
- #define MI_UDP_STREAMTAB udpinfo
- #define MI_UDPM_STREAMTAB udpminfo
- #define MI_WELD_STREAMTAB mi_weldinfo
- #define MI_XDG_STREAMTAB xdginfo
- #define MI_XECHO_STREAMTAB xechoinfo
- #define MI_XF_STREAMTAB xfinfo
- #define MI_XFIPX_STREAMTAB xfipxinfo
- #define MI_XFXNS_STREAMTAB xfxnsinfo
- #define MI_XPE_STREAMTAB xpeinfo
- #define MI_XS_STREAMTAB xsinfo
- #define MI_XTINDG_STREAMTAB xtindginfo
- #define MI_XTINVC_STREAMTAB xtinvcinfo
- #define MI_XTM_STREAMTAB xtminfo
- #define MI_XTMIP_STREAMTAB xtmipinfo
- #define MI_AFU_DEVFLAG afudevflag
- #define MI_AHARP_DEVFLAG ahardevflag
- #define MI_AHENET_DEVFLAG ahendevflag
- #define MI_ARP_DEVFLAG arpdevflag
- #define MI_ARPM_DEVFLAG arpmdevflag
- #define MI_COURMUX_DEVFLAG courmuxdevflag
- #define MI_CLONE_DEVFLAG clonedevflag
- #define MI_DLB_DEVFLAG dlbdevflag
- #define MI_DLM_DEVFLAG dlmdevflag
- #define MI_DMODD_DEVFLAG dmodddevflag
- #define MI_DMODT_DEVFLAG dmodtdevflag
- #define MI_DN_DEVFLAG dndevflag
- #define MI_DNF_DEVFLAG dnfdevflag
- #define MI_DRVE_DEVFLAG drvedevflag
- #define MI_ECHO_DEVFLAG echodevflag
- #define MI_ENXR_DEVFLAG enxrdevflag
- #define MI_HAVOC_DEVFLAG hvcdevflag
- #define MI_HAVOCM_DEVFLAG hvcmdevflag
- #define MI_IP_DEVFLAG ipdevflag
- #define MI_IPM_DEVFLAG ipmdevflag
- #define MI_IPX_DEVFLAG ipxdevflag
- #define MI_LOG_DEVFLAG logdevflag
- #define MI_MODE_DEVFLAG modedevflag
- #define MI_MUX_DEVFLAG muxdevflag
- #define MI_NECHO_DEVFLAG nechodevflag
- #define MI_NPEP_DEVFLAG npepdevflag
- #define MI_NULS_DEVFLAG nulsdevflag
- #define MI_NULZ_DEVFLAG nulzdevflag
- #define MI_PASS_DEVFLAG passdevflag
- #define MI_PIPEMOD_DEVFLAG pipemoddevflag
- #define MI_RAWIP_DEVFLAG rawipdevflag
- #define MI_RAWIPM_DEVFLAG rawipmdevflag
- #define MI_SAD_DEVFLAG saddevflag
- #define MI_SC_DEVFLAG scdevflag
- #define MI_SOCKMOD_DEVFLAG sockmoddevflag
- #define MI_SPASS_DEVFLAG spassdevflag
- #define MI_SPX_DEVFLAG spxdevflag
- #define MI_TCP_DEVFLAG tcpdevflag
- #define MI_TCPM_DEVFLAG tcpmdevflag
- #define MI_TIMOD_DEVFLAG timoddevflag
- #define MI_TIRDWR_DEVFLAG tirdwrdevflag
- #define MI_TMOD_DEVFLAG tmoddevflag
- #define MI_TMUX_DEVFLAG tmuxdevflag
- #define MI_TPIT_DEVFLAG tpitdevflag
- #define MI_TRSR_DEVFLAG trsrdevflag
- #define MI_TRXR_DEVFLAG trxrdevflag
- #define MI_UDP_DEVFLAG udpdevflag
- #define MI_UDPM_DEVFLAG udpmdevflag
- #define MI_XDG_DEVFLAG xdgdevflag
- #define MI_XECHO_DEVFLAG xechodevflag
- #define MI_XF_DEVFLAG xfdevflag
- #define MI_XFIPX_DEVFLAG xfipxdevflag
- #define MI_XFXNS_DEVFLAG xfxnsdevflag
- #define MI_XPE_DEVFLAG xpedevflag
- #define MI_XS_DEVFLAG xsdevflag
- #define MI_XTINDG_DEVFLAG xtindgdevflag
- #define MI_XTINVC_DEVFLAG xtinvcdevflag
- #define MI_XTM_DEVFLAG xtmdevflag
- #define MI_XTMIP_DEVFLAG xtmipdevflag
- #define MI_AFU_SQLVL SQLVL_QUEUEPAIR
- #define MI_AHARP_SQLVL SQLVL_QUEUE
- #define MI_AHENET_SQLVL SQLVL_QUEUE
- #define MI_ARP_SQLVL SQLVL_MODULE
- #define MI_ARPM_SQLVL SQLVL_MODULE
- #define MI_COURMUX_SQLVL SQLVL_MODULE
- #define MI_CLONE_SQLVL SQLVL_MODULE
- #define MI_DLB_SQLVL SQLVL_QUEUE
- #define MI_DLM_SQLVL SQLVL_QUEUE
- #define MI_DMODD_SQLVL SQLVL_QUEUE
- #define MI_DMODT_SQLVL SQLVL_QUEUE
- #define MI_DN_SQLVL SQLVL_QUEUE
- #define MI_DNF_SQLVL SQLVL_QUEUE
- #define MI_DRVE_SQLVL SQLVL_QUEUEPAIR
- #define MI_ECHO_SQLVL SQLVL_QUEUE
- #define MI_ENXR_SQLVL SQLVL_QUEUE
- #define MI_RAWIP_SQLVL SQLVL_QUEUE
- #define MI_RAWIPM_SQLVL SQLVL_QUEUE
- #define MI_HAVOC_SQLVL SQLVL_QUEUE
- #define MI_HAVOCM_SQLVL SQLVL_QUEUE
- #define MI_IP_SQLVL SQLVL_QUEUEPAIR
- #define MI_IPM_SQLVL SQLVL_QUEUEPAIR
- #define MI_IPX_SQLVL SQLVL_QUEUE
- #define MI_LOG_SQLVL SQLVL_MODULE
- #define MI_MODE_SQLVL SQLVL_QUEUEPAIR
- #define MI_MUX_SQLVL SQLVL_MODULE
- #define MI_NECHO_SQLVL SQLVL_QUEUE
- #define MI_NPEP_SQLVL SQLVL_QUEUE
- #define MI_NULS_SQLVL SQLVL_QUEUE
- #define MI_NULZ_SQLVL SQLVL_QUEUE
- #define MI_PASS_SQLVL SQLVL_QUEUE
- #define MI_PIPEMOD_SQLVL SQLVL_QUEUE
- #define MI_SAD_SQLVL SQLVL_MODULE
- #define MI_SC_SQLVL SQLVL_QUEUE
- #define MI_SOCKMOD_SQLVL SQLVL_QUEUEPAIR
- #define MI_SPASS_SQLVL SQLVL_QUEUE
- #define MI_SPX_SQLVL SQLVL_QUEUE
- #define MI_TCP_SQLVL SQLVL_QUEUEPAIR
- #define MI_TCPM_SQLVL SQLVL_QUEUEPAIR
- #define MI_TIMOD_SQLVL SQLVL_QUEUEPAIR
- #define MI_TIRDWR_SQLVL SQLVL_QUEUE
- #define MI_TMOD_SQLVL SQLVL_QUEUEPAIR
- #define MI_TMUX_SQLVL SQLVL_MODULE
- #define MI_TPIT_SQLVL SQLVL_MODULE
- #define MI_TRSR_SQLVL SQLVL_MODULE
- #define MI_TRXR_SQLVL SQLVL_QUEUE
- #define MI_UDP_SQLVL SQLVL_QUEUE
- #define MI_UDPM_SQLVL SQLVL_QUEUE
- #define MI_XDG_SQLVL SQLVL_QUEUE
- #define MI_XECHO_SQLVL SQLVL_QUEUE
- #define MI_XF_SQLVL SQLVL_MODULE
- #define MI_XFIPX_SQLVL SQLVL_MODULE
- #define MI_XFXNS_SQLVL SQLVL_MODULE
- #define MI_XPE_SQLVL SQLVL_QUEUE
- #define MI_XS_SQLVL SQLVL_QUEUEPAIR
- #define MI_XTINDG_SQLVL SQLVL_QUEUEPAIR
- #define MI_XTINVC_SQLVL SQLVL_QUEUEPAIR
- #define MI_XTM_SQLVL SQLVL_QUEUEPAIR
- #define MI_XTMIP_SQLVL SQLVL_QUEUEPAIR
- /* ***** Raw Streams ******/
- /*
- Flags used in the fType field of OTReadInfo for functions.
- I've removed the terse and confusing comments in this header
- file. For a full description, read "Open Transport Advanced
- Client Programming".
- */
- enum {
- kOTNoMessagesAvailable = (unsigned long)0xFFFFFFFF,
- kOTAnyMsgType = (unsigned long)0xFFFFFFFE,
- kOTDataMsgTypes = (unsigned long)0xFFFFFFFC,
- kOTMProtoMsgTypes = (unsigned long)0xFFFFFFFB,
- kOTOnlyMProtoMsgTypes = (unsigned long)0xFFFFFFFA
- };
- #if !OTKERNEL
- /* StreamRef is an opaque reference to a raw stream.*/
- typedef struct OpaqueStreamRef* StreamRef;
- #define kOTInvalidStreamRef ((StreamRef)0L)
- /* PollRef structure is used with the OTStreamPoll function.*/
- struct PollRef {
- SInt32 filler; /* holds a file descriptor an a UNIX system, replaced by ref (at end of structure) under OT*/
- SInt16 events;
- SInt16 revents;
- StreamRef ref;
- };
- typedef struct PollRef PollRef;
- /* OTReadInfo structure is used with the various functions that read and peek at the stream head.*/
- struct OTReadInfo {
- UInt32 fType;
- OTCommand fCommand;
- UInt32 fFiller; /* For compatibility with OT 1.0 and 1.1 */
- ByteCount fBytes;
- OSStatus fError;
- };
- typedef struct OTReadInfo OTReadInfo;
- /* Opening and closing raw streams*/
- #if CALL_NOT_IN_CARBON
- EXTERN_API( StreamRef )
- OTStreamOpen (const char * name,
- OTOpenFlags oFlags,
- OSStatus * errPtr);
- EXTERN_API( OSStatus )
- OTAsyncStreamOpen (const char * name,
- OTOpenFlags oFlags,
- OTNotifyUPP proc,
- void * contextPtr);
- EXTERN_API( StreamRef )
- OTCreateStream (OTConfigurationRef cfig,
- OTOpenFlags oFlags,
- OSStatus * errPtr);
- EXTERN_API( OSStatus )
- OTAsyncCreateStream (OTConfigurationRef cfig,
- OTOpenFlags oFlags,
- OTNotifyUPP proc,
- void * contextPtr);
- EXTERN_API( OSStatus )
- OTStreamClose (StreamRef strm);
- /* Polling a stream for activity*/
- EXTERN_API( OTResult )
- OTStreamPoll (PollRef * fds,
- UInt32 nfds,
- OTTimeout timeout);
- EXTERN_API( OTResult )
- OTAsyncStreamPoll (PollRef * fds,
- UInt32 nfds,
- OTTimeout timeout,
- OTNotifyUPP proc,
- void * contextPtr);
- /* Classic UNIX file descriptor operations*/
- EXTERN_API( OTResult )
- OTStreamRead (StreamRef strm,
- void * buf,
- OTByteCount len);
- EXTERN_API( OTResult )
- OTStreamWrite (StreamRef strm,
- void * buf,
- OTByteCount len);
- EXTERN_API( OTResult )
- OTStreamIoctl (StreamRef strm,
- UInt32 cmd,
- void * data);
- EXTERN_API( OTResult )
- OTStreamPipe (StreamRef streamsToPipe[]);
- /* there can be only 2!*/
- /* Notifiers and modes of operation*/
- EXTERN_API( OSStatus )
- OTStreamInstallNotifier (StreamRef strm,
- OTNotifyUPP proc,
- void * contextPtr);
- EXTERN_API( void )
- OTStreamRemoveNotifier (StreamRef strm);
- EXTERN_API( OSStatus )
- OTStreamUseSyncIdleEvents (StreamRef strm,
- Boolean useEvents);
- EXTERN_API( void )
- OTStreamSetBlocking (StreamRef strm);
- EXTERN_API( void )
- OTStreamSetNonBlocking (StreamRef strm);
- EXTERN_API( Boolean )
- OTStreamIsBlocking (StreamRef strm);
- EXTERN_API( void )
- OTStreamSetSynchronous (StreamRef strm);
- EXTERN_API( void )
- OTStreamSetAsynchronous (StreamRef strm);
- EXTERN_API( Boolean )
- OTStreamIsSynchronous (StreamRef strm);
- /* STREAMS primitives*/
- EXTERN_API( OTResult )
- OTStreamGetMessage (StreamRef strm,
- strbuf * ctlbuf,
- strbuf * databuf,
- OTFlags * flags);
- EXTERN_API( OTResult )
- OTStreamGetPriorityMessage (StreamRef strm,
- strbuf * ctlbuf,
- strbuf * databuf,
- OTBand * band,
- OTFlags * flags);
- EXTERN_API( OSStatus )
- OTStreamPutMessage (StreamRef strm,
- const strbuf * ctlbuf,
- const strbuf * databuf,
- OTFlags flags);
- EXTERN_API( OSStatus )
- OTStreamPutPriorityMessage (StreamRef strm,
- const strbuf * ctlbuf,
- const strbuf * databuf,
- OTBand band,
- OTFlags flags);
- /* Miscellaneous stuff*/
- EXTERN_API( void )
- OTStreamSetControlMask (StreamRef strm,
- UInt32 mask,
- Boolean setClear);
- /*
- Opening endpoints and mappers on a Stream - these calls are synchronous, and may
- only be used at System Task time. Once the stream has been installed into a provider
- or endpoint, you should not continue to use STREAMS APIs on it
- */
- EXTERN_API( ProviderRef )
- OTOpenProviderOnStream (StreamRef strm,
- OSStatus * errPtr);
- EXTERN_API( EndpointRef )
- OTOpenEndpointOnStream (StreamRef strm,
- OSStatus * errPtr);
- /*
- To quote an earlier version of this header file:
- Some functions that should only be used if
- you really know what you're doing.
- */
- EXTERN_API( StreamRef )
- OTRemoveStreamFromProvider (ProviderRef ref);
- EXTERN_API( OSStatus )
- OTPeekMessage (StreamRef strm,
- OTReadInfo * readInfo);
- EXTERN_API( OTBuffer *)
- OTReadMessage (StreamRef strm,
- OTReadInfo * readInfo);
- EXTERN_API( void )
- OTPutBackBuffer (StreamRef strm,
- OTBuffer * buffer);
- EXTERN_API( void )
- OTPutBackPartialBuffer (StreamRef strm,
- OTBufferInfo * readInfo,
- OTBuffer * buffer);
- #endif /* CALL_NOT_IN_CARBON */
- #endif /* !OTKERNEL */
- #endif /* CALL_NOT_IN_CARBON */
- /* ***** Port Utilities ******/
- #if !OTKERNEL
- /*
- These types and routines are used during sophisticated
- port management. High-level clients may get involved
- for things like request a port to be yielding, but typically
- this stuff is used by protocol infrastructure.
- */
- /*
- OTPortCloseStruct is used when processing the kOTClosePortRequest
- and kOTYieldPortRequest events.
- */
- struct OTPortCloseStruct {
- OTPortRef fPortRef; /* The port requested to be closed.*/
- ProviderRef fTheProvider; /* The provider using the port.*/
- OSStatus fDenyReason; /* Set to a negative number to deny the request*/
- };
- typedef struct OTPortCloseStruct OTPortCloseStruct;
- /* OTClientList structure is used with the OTYieldPortRequest function.*/
- struct OTClientList {
- ItemCount fNumClients;
- UInt8 fBuffer[4];
- };
- typedef struct OTClientList OTClientList;
- /*
- Returns a buffer containing all of the clients that refused to yield the port.
- "size" is the total number of bytes @ buffer, including the fNumClients field.
- */
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( OSStatus )
- OTYieldPortRequest (ProviderRef ref,
- OTPortRef portRef,
- OTClientList * buffer,
- OTByteCount size);
- /* Send a notification to all Open Transport registered clients*/
- EXTERN_API_C( void )
- OTNotifyAllClients (OTEventCode code,
- OTResult result,
- void * cookie);
- /* Determine if "child" is a child port of "parent"*/
- EXTERN_API_C( Boolean )
- OTIsDependentPort (OTPortRef parent,
- OTPortRef child);
- #endif /* CALL_NOT_IN_CARBON */
- #endif /* !OTKERNEL */
- /* ***** Timers ***** */
- /*
- STREAMS plug-ins code should not use these timers, instead
- they should use timer messages, ie mi_timer etc.
- */
- #if !OTKERNEL
- typedef long OTTimerTask;
- /*
- Under Carbon, OTCreateTimerTask takes a client context pointer. Applications may pass NULL
- after calling InitOpenTransport(kInitOTForApplicationMask, ...). Non-applications must always pass a
- valid client context.
- */
- EXTERN_API( long )
- OTCreateTimerTaskInContext (OTProcessUPP upp,
- void * arg,
- OTClientContextPtr clientContext);
- #if CALL_NOT_IN_CARBON
- EXTERN_API( OTTimerTask )
- OTCreateTimerTask (OTProcessUPP proc,
- void * arg);
- #endif /* CALL_NOT_IN_CARBON */
- EXTERN_API( Boolean )
- OTCancelTimerTask (OTTimerTask timerTask);
- EXTERN_API( void )
- OTDestroyTimerTask (OTTimerTask timerTask);
- EXTERN_API( Boolean )
- OTScheduleTimerTask (OTTimerTask timerTask,
- OTTimeout milliSeconds);
- #if OTCARBONAPPLICATION
- /* The following macro may be used by applications only.*/
- #define OTCreateTimerTask(upp, arg) OTCreateTimerTaskInContext(upp, arg, NULL)
- #endif /* OTCARBONAPPLICATION */
- #endif /* !OTKERNEL */
- /* ***** Miscellaneous Helpful Functions ******/
- #if !OTKERNEL
- /*
- These routines allow you to manipulate OT's buffer structures.
- If you use no-copy receives (described in "OpenTransport.h")
- you will need some of these routines, and may choose to use others.
- See "Open Tranport Advanced Client Programming" for documentation.
- */
- EXTERN_API_C( OTByteCount )
- OTBufferDataSize (OTBuffer * buffer);
- EXTERN_API_C( Boolean )
- OTReadBuffer (OTBufferInfo * buffer,
- void * dest,
- OTByteCount * len);
- EXTERN_API_C( void )
- OTReleaseBuffer (OTBuffer * buffer);
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( Boolean )
- StoreIntoNetbuf (TNetbuf * netBuf,
- void * source,
- SInt32 len);
- EXTERN_API_C( Boolean )
- StoreMsgIntoNetbuf (TNetbuf * netBuf,
- OTBuffer * buffer);
- #endif /* CALL_NOT_IN_CARBON */
- #endif /* !OTKERNEL */
- /* ***** OTConfiguration ******/
- #if CALL_NOT_IN_CARBON
- #if !OTKERNEL
- /*
- As promised in "OpenTransport.h", here are the routines
- for advanced operations on configurations.
- */
- /* Manipulating a configuration*/
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( OTConfigurationRef )
- OTCfigNewConfiguration (const char * path);
- EXTERN_API_C( void )
- OTCfigDeleteConfiguration (OTConfigurationRef cfig);
- EXTERN_API_C( OTConfigurationRef )
- OTCfigCloneConfiguration (OTConfigurationRef cfig);
- EXTERN_API_C( OTConfigurationRef )
- OTCfigPushNewSingleChild (OTConfigurationRef cfig,
- const char * path,
- OSStatus * errPtr);
- EXTERN_API_C( OTConfigurationRef )
- OTCfigPushParent (OTConfigurationRef cfig,
- const char * path,
- OSStatus * errPtr);
- EXTERN_API_C( OTConfigurationRef )
- OTCfigPushChild (OTConfigurationRef cfig,
- OTItemCount index,
- const char * path,
- OSStatus * errPtr);
- EXTERN_API_C( OSStatus )
- OTCfigPopChild (OTConfigurationRef cfig,
- OTItemCount index);
- EXTERN_API_C( OTConfigurationRef )
- OTCfigGetChild (OTConfigurationRef cfig,
- OTItemCount index);
- EXTERN_API_C( OSStatus )
- OTCfigSetPath (OTConfigurationRef cfig,
- const char * path);
- EXTERN_API_C( OTConfigurationRef )
- OTCfigNewChild (OTConfigurationRef cfig,
- const char * path,
- OSStatus * errPtr);
- EXTERN_API_C( OSStatus )
- OTCfigAddChild (OTConfigurationRef cfig,
- OTConfigurationRef child);
- EXTERN_API_C( OTConfigurationRef )
- OTCfigRemoveChild (OTConfigurationRef cfig,
- OTItemCount index);
- EXTERN_API_C( void )
- OTCfigSetPortRef (OTConfigurationRef cfig,
- OTPortRef portRef);
- EXTERN_API_C( void )
- OTCfigChangeProviderName (OTConfigurationRef cfig,
- const char * name);
- /* Query a configuration*/
- EXTERN_API_C( UInt16 )
- OTCfigNumberOfChildren (OTConfigurationRef cfig);
- EXTERN_API_C( OTConfigurationRef )
- OTCfigGetParent (OTConfigurationRef cfig);
- EXTERN_API_C( TNetbuf *)
- OTCfigGetOptionNetbuf (OTConfigurationRef cfig);
- EXTERN_API_C( OTPortRef )
- OTCfigGetPortRef (OTConfigurationRef cfig);
- EXTERN_API_C( UInt32 )
- OTCfigGetInstallFlags (OTConfigurationRef cfig);
- EXTERN_API_C( const char *)
- OTCfigGetProviderName (OTConfigurationRef cfig);
- EXTERN_API_C( Boolean )
- OTCfigIsPort (OTConfigurationRef cfig);
- #endif /* CALL_NOT_IN_CARBON */
- #endif /* !OTKERNEL */
- /* ***** Configurators ******/
- /*
- The kOTConfiguratorInterfaceID define is what you need to add to your
- export file for the "interfaceID = " clause to export a configurator
- for ASLM. Similarly, kOTConfiguratorCFMTag is used for CFM-based
- configurators.
- */
- #define kOTConfiguratorInterfaceID kOTClientPrefix "cfigMkr"
- #define kOTConfiguratorCFMTag kOTClientPrefix "cfigMkr"
- #if !OTKERNEL
- #ifdef __cplusplus
- class TOTConfigurator;
- typedef class TOTConfigurator* TOTConfiguratorRef;
- #else
- typedef struct TOTConfigurator TOTConfigurator;
- typedef TOTConfigurator* TOTConfiguratorRef;
- #endif
- /*
- Typedef for the OTCanConfigure function, and the enum for which pass we're doing.
- The first (kOTSpecificConfigPass) is to give configurators a shot at the configuration
- before we start allowing the generic configurators to get into the act.
- */
- enum {
- kOTSpecificConfigPass = 0,
- kOTGenericConfigPass = 1
- };
- typedef CALLBACK_API_C( Boolean , OTCanConfigureProcPtr )(OTConfigurationRef cfig, UInt32 pass);
- /* Typedef for the function to create and return a configurator object*/
- typedef CALLBACK_API_C( OSStatus , OTCreateConfiguratorProcPtr )(TOTConfiguratorRef *cfigor);
- /*
- Typedef for the "OTSetupConfigurator" function that your configurator library must export.
- The enum is for the type of configurator that it is.
- */
- #define kOTSetupConfiguratorID "OTSetupConfigurator"
- enum {
- kOTDefaultConfigurator = 0,
- kOTProtocolFamilyConfigurator = 1,
- kOTLinkDriverConfigurator = 2
- };
- typedef CALLBACK_API_C( OSStatus , OTSetupConfiguratorProcPtr )(OTCanConfigureProcPtr *canConfigure, OTCreateConfiguratorProcPtr *createConfigurator, UInt8 *configuratorType);
- /*
- Procedure pointer definitions for the three key callbacks associated
- with a configurator, as established by OTNewConfigurator.
- */
- typedef CALLBACK_API_C( OSStatus , OTCFConfigureProcPtr )(TOTConfiguratorRef cfigor, OTConfigurationRef cfig);
- typedef CALLBACK_API_C( OSStatus , OTCFCreateStreamProcPtr )(TOTConfiguratorRef cfigor, OTConfigurationRef cfig, OTOpenFlags oFlags, OTNotifyUPP proc, void *contextPtr);
- typedef CALLBACK_API_C( void , OTCFHandleSystemEventProcPtr )(TOTConfiguratorRef cfigor, OTEventCode code, OTResult result, void *cookie);
- /*
- Determine if this instance of your configurator is the "master"
- (the one that can create and destroy control streams)
- */
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( Boolean )
- OTIsMasterConfigurator (TOTConfiguratorRef cfigor);
- /* Get back the userData you passed in to OTNewConfigurator*/
- EXTERN_API_C( void *)
- OTGetConfiguratorUserData (TOTConfiguratorRef cfigor);
- /* Create a configurator object for use by Open Transport*/
- EXTERN_API_C( TOTConfiguratorRef )
- OTNewConfigurator (void * userData,
- OTCFConfigureProcPtr configure,
- OTCFCreateStreamProcPtr createStream,
- OTCFHandleSystemEventProcPtr handleEvent);
- /* Delete a configurator object created by OTNewConfigurator*/
- EXTERN_API_C( void )
- OTDeleteConfigurator (TOTConfiguratorRef cfigor);
- /*
- A utility function to send notifications to the user - it takes care of calls
- from deferred tasks
- */
- EXTERN_API_C( OSStatus )
- OTNotifyUser (FSSpec * theFile,
- SInt32 rsrcID,
- OTItemCount index,
- char * parm1,
- char * parm2);
- /* Call when the configurator unloads from memory*/
- EXTERN_API_C( void )
- OTConfiguratorUnloaded (TOTConfiguratorRef cfigor);
- /*
- Call to create your control stream if you're not the master
- configurator. You can also use the state machine function
- OTSMCreateControlStream(OTStateMachine*, OTConfigurationRef, TOTConfiguratorRef cfigor).
- */
- EXTERN_API_C( OSStatus )
- OTCreateControlStream (OTConfigurationRef cfig,
- TOTConfiguratorRef cfigor,
- OTNotifyUPP proc,
- void * contextPtr);
- /*
- A helpful function for the configurators to
- be able to recursively configure the children.
- */
- EXTERN_API_C( OSStatus )
- OTConfigureChildren (OTConfigurationRef cfig);
- /* Allocate a bit in the system-wide control mask for streams.*/
- EXTERN_API_C( UInt32 )
- OTNewControlMask (void);
- /* Warning: These 2 APIs is going away*/
- EXTERN_API_C( void )
- OTCloseProvidersByUseCount (SInt32 * useCount,
- OTResult reason,
- OTBooleanParam doneDeal);
- EXTERN_API_C( void )
- OTCloseProvidersByPortRef (OTPortRef ref,
- OTResult reason,
- OTBooleanParam doneDeal);
- /* These are the "real" APIs*/
- EXTERN_API_C( void )
- OTCloseProviderByStream (StreamRef ref,
- OTResult reason,
- OTBooleanParam doneDeal);
- EXTERN_API_C( void )
- OTCloseMatchingProviders (UInt32 mask,
- OTPortRef port,
- OTResult reason,
- OTBooleanParam doneDeal);
- #endif /* CALL_NOT_IN_CARBON */
- #endif /* !OTKERNEL */
- #endif /* CALL_NOT_IN_CARBON */
- /* ***** OTStateMachine ******/
- #if CALL_NOT_IN_CARBON
- /*
- This utility set allows you to write an asynchronous chain of code that looks
- somewhat like it is synchronous. This is primarily used for plumbing
- streams asynchronously, especially in configurators
- */
- #if !OTKERNEL
- /* Alas, the state machine is only available to client code. Sorry.*/
- /*
- There are 12 or 8 bytes of reserved space at the front of
- the OTStateMachine structure, depending on whether you're
- building PowerPC or 68K code.. The OTStateMachineDataPad
- type compensates for this.
- */
- #if TARGET_CPU_PPC
- typedef UInt8 OTStateMachineDataPad[12];
- #else
- typedef UInt8 OTStateMachineDataPad[8];
- #endif /* TARGET_CPU_PPC */
- /*
- Forward define OTStateMachine so that OTStateProcPtr has
- access to it.
- */
- typedef struct OTStateMachine OTStateMachine;
- /*
- This type is is the required prototype of a state machine
- entry point.
- */
- typedef CALLBACK_API( void , OTStateProcPtr )(OTStateMachine *sm);
- /*
- This type defines a routine that the state machine will
- call when the top level completes.
- */
- typedef CALLBACK_API_C( void , OTSMCompleteProcPtr )(void *contextPtr);
- /* And now for the state machine structure itself.*/
- struct OTStateMachine {
- OTStateMachineDataPad fData;
- void * fCookie;
- OTEventCode fCode;
- OTResult fResult;
- #ifdef __cplusplus
- // C++ inline methods on this structure.
- void* GetClientData();
- Boolean CallStateProc(OTStateProcPtr proc, UInt32 state = 0);
- UInt16 GetState();
- void SetState(UInt32 state);
- void Complete();
- void Complete(OTResult result);
- void Complete(OTResult result, OTEventCode code, void* contextPtr);
- void CompleteToClient();
- void CompleteToClient(OTResult result);
- void CompleteToClient(OTResult result, OTEventCode code, void* contexPtr);
- void PopCallback();
- Boolean CreateStream(OTConfigurationRef cfig, OTOpenFlags flags);
- Boolean OpenStream(const char* name, OTOpenFlags flags);
- Boolean SendIoctl(StreamRef ref, UInt32 type, void* data);
- Boolean SendIoctl(StreamRef ref, UInt32 type, long data);
- Boolean PutMessage(StreamRef ref, strbuf* ctl, strbuf* data, OTFlags flags);
- Boolean GetMessage(StreamRef ref, strbuf* ctl, strbuf* data, OTFlags* flagPtr);
- OSStatus ReturnToCaller();
- #endif
- };
- #define kOTSMBufferSize(callDepth) (80 + (callDepth * 8))
- /*
- For structSize, pass the size of your structure that you want associated with
- the state machine. It can later be obtained by calling OTSMGetClientData.
- For bufSize, use the kOTSMBufferSize macro, plus the size of your structure
- to create a buffer on the stack. For synchronous calls, the stack buffer will
- be used (unless you pass in NULL). The callDepth is the depth level of nested
- calls using OTSMCallStateProc.
- */
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( OTStateMachine *)
- OTCreateStateMachine (void * buf,
- OTByteCount bufSize,
- OTByteCount structSize,
- OTNotifyUPP proc,
- void * contextPtr);
- EXTERN_API_C( void )
- OTDestroyStateMachine (OTStateMachine * sm);
- /*
- OTSMCallStateProc used to take a parameter of type UInt16_p,
- which was defined to be the same as UInt32. In an attempt
- to reduce the number of wacky types defined by the OT
- interfaces, we've changed these routines to just take a
- straight UInt32. You should be warned that the current
- implementation does not support values outside of the
- range 0..32767. The same applies to OTSMSetState.
- */
- EXTERN_API_C( Boolean )
- OTSMCallStateProc (OTStateMachine * sm,
- OTStateProcPtr proc,
- UInt32 state);
- EXTERN_API_C( UInt16 )
- OTSMGetState (OTStateMachine * sm);
- EXTERN_API_C( void )
- OTSMSetState (OTStateMachine * sm,
- UInt32 state);
- /* Fill out the fCookie, fCode, and fResult fields before calling!*/
- EXTERN_API_C( void )
- OTSMComplete (OTStateMachine * sm);
- EXTERN_API_C( void )
- OTSMPopCallback (OTStateMachine * sm);
- EXTERN_API_C( Boolean )
- OTSMWaitForComplete (OTStateMachine * sm);
- EXTERN_API_C( Boolean )
- OTSMCreateStream (OTStateMachine * sm,
- OTConfigurationRef cfig,
- OTOpenFlags flags);
- EXTERN_API_C( Boolean )
- OTSMOpenStream (OTStateMachine * sm,
- const char * name,
- OTOpenFlags flags);
- EXTERN_API_C( Boolean )
- OTSMIoctl (OTStateMachine * sm,
- StreamRef strm,
- UInt32 cmd,
- long data);
- EXTERN_API_C( Boolean )
- OTSMPutMessage (OTStateMachine * sm,
- StreamRef strm,
- strbuf * ctlbuf,
- strbuf * databuf,
- OTFlags flags);
- EXTERN_API_C( Boolean )
- OTSMGetMessage (OTStateMachine * sm,
- StreamRef strm,
- strbuf * ctlbuf,
- strbuf * databuf,
- OTFlags * flagsPtr);
- EXTERN_API_C( OSStatus )
- OTSMReturnToCaller (OTStateMachine * sm);
- EXTERN_API_C( void *)
- OTSMGetClientData (OTStateMachine * sm);
- EXTERN_API_C( void )
- OTSMInstallCompletionProc (OTStateMachine * sm,
- OTSMCompleteProcPtr completeProc,
- void * contextPtr);
- EXTERN_API_C( Boolean )
- OTSMCreateControlStream (OTStateMachine * sm,
- OTConfigurationRef cfig,
- TOTConfiguratorRef cfigor);
- #ifdef __cplusplus
- inline void* OTStateMachine::GetClientData() { return OTSMGetClientData(this); }
- inline Boolean OTStateMachine::CallStateProc(OTStateProcPtr proc, UInt32 state)
- { return OTSMCallStateProc(this, proc, state); }
- inline UInt16 OTStateMachine::GetState() { return OTSMGetState(this); }
- inline void OTStateMachine::SetState(UInt32 state)
- { OTSMSetState(this, state); }
- inline void OTStateMachine::PopCallback() { OTSMPopCallback(this); }
- inline void OTStateMachine::Complete() { OTSMComplete(this); }
- inline void OTStateMachine::Complete(OTResult result, OTEventCode code, void* cookie)
- { fCookie = cookie; fCode = code; fResult = result; Complete(); }
- inline void OTStateMachine::Complete(OTResult result)
- { fResult = result; Complete(); }
- inline void OTStateMachine::CompleteToClient()
- { PopCallback(); Complete(); }
- inline void OTStateMachine::CompleteToClient(OTResult result)
- { fResult = result; CompleteToClient(); }
- inline void OTStateMachine::CompleteToClient(OTResult result, OTEventCode code, void* cookie)
- { fCookie = cookie; fCode = code; fResult = result; CompleteToClient(); }
- inline Boolean OTStateMachine::CreateStream(OTConfigurationRef cfig, OTOpenFlags flags)
- { return OTSMCreateStream(this, cfig, flags); }
- inline Boolean OTStateMachine::OpenStream(const char* name, OTOpenFlags flags)
- { return OTSMOpenStream(this, name, flags); }
- inline Boolean OTStateMachine::SendIoctl(StreamRef ref, UInt32 type, void* data)
- { return OTSMIoctl(this, ref, type, (long)data); }
- inline Boolean OTStateMachine::SendIoctl(StreamRef ref, UInt32 type, long data)
- { return OTSMIoctl(this, ref, type, data); }
- inline Boolean OTStateMachine::PutMessage(StreamRef ref, struct strbuf* ctl, struct strbuf* data, OTFlags flags)
- { return OTSMPutMessage(this, ref, ctl, data, flags); }
- inline Boolean OTStateMachine::GetMessage(StreamRef ref, struct strbuf* ctl, struct strbuf* data, OTFlags* flagPtr)
- { return OTSMGetMessage(this, ref, ctl, data, flagPtr); }
- inline OSStatus OTStateMachine::ReturnToCaller()
- { return OTSMReturnToCaller(this); }
- #endif
- #endif /* CALL_NOT_IN_CARBON */
- #endif /* !OTKERNEL */
- /* ***** Autopush Definitions ******/
- /*
- The autopush functionality for Open Transport is based on the names of
- devices and modules, rather than on the major number information like
- SVR4. This is so that autopush information can be set up for modules
- that are not yet loaded.
- */
- /* The name of the STREAMS driver you open and send the ioctls to.*/
- #define kSADModuleName "sad"
- /* Autopush ioctls.*/
- enum {
- I_SAD_SAP = ((MIOC_SAD << 8) | 1), /* Set autopush information */
- I_SAD_GAP = ((MIOC_SAD << 8) | 2), /* Get autopush information */
- I_SAD_VML = ((MIOC_SAD << 8) | 3) /* Validate a list of modules (uses str_list structure) */
- };
- /* Maximum number of modules autopushed on a driver.*/
- enum {
- kOTAutopushMax = 8
- };
- /* ioctl structure used for SAD_SAP and SAD_GAP commands.*/
- struct OTAutopushInfo {
- UInt32 sap_cmd;
- char sap_device_name[32];
- SInt32 sap_minor;
- SInt32 sap_lastminor;
- SInt32 sap_npush;
- char sap_list[8][32];
- };
- typedef struct OTAutopushInfo OTAutopushInfo;
- /* Command values for sap_cmd field of the above.*/
- enum {
- kSAP_ONE = 1, /* Configure a single minor device */
- kSAP_RANGE = 2, /* Configure a range of minor devices */
- kSAP_ALL = 3, /* Configure all minor devices */
- kSAP_CLEAR = 4 /* Clear autopush information */
- };
- /* ***** Configuration Helpers ******/
- /*
- These definitions are used by device driver and port scanner
- developers to provide a library giving client-side information about
- the registered ports, such as a user-visible name or an icon.
- */
- /* Configuration helper library prefix*/
- /*
- This prefix is prepended to the string found in the "fResourceInfo"
- field of the OTPortRecord to build the actual library name of the
- configuration helper library.
- */
- #define kPortConfigLibPrefix "OTPortCfg$"
- /* Get user visible port name entry point.*/
- /*
- This entry point returns the user visible name of the port. If includeSlot
- is true, a slot distinguishing suffix (eg "slot X") should be added. If
- includePort is true, a port distinguishing suffix (eg " port X") should be added for
- multiport cards.
- */
- #define kOTGetUserPortNameID "OTGetUserPortName"
- typedef CALLBACK_API_C( void , OTGetPortNameProcPtr )(OTPortRecord *port, OTBooleanParam includeSlot, OTBooleanParam includePort, Str255 userVisibleName);
- /* Get icon entry point.*/
- /*
- This entry point returns the location of the icon for the port. Return false if no
- icon is provided.
- */
- #define kOTGetPortIconID "OTGetPortIcon"
- struct OTResourceLocator {
- FSSpec fFile;
- UInt16 fResID;
- };
- typedef struct OTResourceLocator OTResourceLocator;
- typedef CALLBACK_API_C( Boolean , OTGetPortIconProcPtr )(OTPortRecord *port, OTResourceLocator *iconLocation);
- /* ***** Application Access to Configuration Helpers ******/
- #if !OTKERNEL
- /*
- These routines are used by clients to get information about ports.
- The canonical user of these routines is the OT control panel(s),
- but applications may want to use them as well (to display the list
- of available Ethernet cards, for example).
- */
- /* Returns a user friendly name for a port.*/
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( void )
- OTGetUserPortNameFromPortRef (OTPortRef ref,
- Str255 friendlyName);
- /*
- Returns the location for the icon familly representing the port.
- Returns false if the port has no icon.
- */
- EXTERN_API_C( Boolean )
- OTGetPortIconFromPortRef (OTPortRef ref,
- OTResourceLocator * iconLocation);
- #endif /* CALL_NOT_IN_CARBON */
- /* Returns true if the port can be used with the specified protocol.*/
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( Boolean )
- OTIsPortCompatibleWith (const OTPortRecord * port,
- char * protocolName);
- #endif /* CALL_NOT_IN_CARBON */
- #endif /* !OTKERNEL */
- #endif /* CALL_NOT_IN_CARBON */
- /* ***** Common Utilities ******/
- /*
- The utilities defined in this section are available to both client
- and kernel code. Cool huh? These utilities differ from those
- provided in "OpenTransport.h" in that they are only available to native
- architecture clients.
- */
- /* Bitmap functions*/
- /* These functions atomically deal with a bitmap that is multiple-bytes long*/
- /*
- Set the first clear bit in "bitMap", starting with bit "startBit",
- giving up after "numBits". Returns the bit # that was set, or
- a kOTNotFoundErr if there was no clear bit available
- */
- EXTERN_API_C( OTResult )
- OTSetFirstClearBit (UInt8 * bitMap,
- OTByteCount startBit,
- OTByteCount numBits);
- /* Standard clear, set and test bit functions*/
- EXTERN_API_C( Boolean )
- OTClearBit (UInt8 * bitMap,
- OTByteCount bitNo);
- EXTERN_API_C( Boolean )
- OTSetBit (UInt8 * bitMap,
- OTByteCount bitNo);
- EXTERN_API_C( Boolean )
- OTTestBit (UInt8 * bitMap,
- OTByteCount bitNo);
- /* OTHashList*/
- /*
- This implements a simple, but efficient hash list. It is not
- thread-safe.
- */
- typedef CALLBACK_API_C( UInt32 , OTHashProcPtr )(OTLink *linkToHash);
- typedef CALLBACK_API_C( Boolean , OTHashSearchProcPtr )(const void *ref, OTLink *linkToCheck);
- struct OTHashList {
- OTHashProcPtr fHashProc;
- ByteCount fHashTableSize;
- OTLink ** fHashBuckets;
- #ifdef __cplusplus
- // C++ inline methods on this structure.
- void Add(OTLink* toAdd);
- Boolean RemoveLink(OTLink* toRemove);
- OTLink* Remove(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hashValue);
- Boolean IsInList(OTLink* toFind);
- OTLink* FindLink(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hash);
- #endif
- };
- typedef struct OTHashList OTHashList;
- /*
- Return the number of bytes of memory needed to create a hash list
- of at least "numEntries" entries.
- */
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( OTByteCount )
- OTCalculateHashListMemoryNeeds (OTItemCount numEntries);
- /*
- Create an OTHashList from "memory". Return an error if it
- couldn't be done.
- */
- EXTERN_API_C( OTResult )
- OTInitHashList (void * memory,
- OTByteCount numBytes,
- OTHashProcPtr hashProc);
- EXTERN_API_C( void )
- OTAddToHashList (OTHashList * hashList,
- OTLink * linkToAdd);
- EXTERN_API_C( Boolean )
- OTRemoveLinkFromHashList (OTHashList * hashList,
- OTLink * linkToRemove);
- EXTERN_API_C( Boolean )
- OTIsInHashList (OTHashList * hashList,
- OTLink * link);
- EXTERN_API_C( OTLink *)
- OTFindInHashList (OTHashList * hashList,
- OTHashSearchProcPtr searchProc,
- const void * refPtr,
- UInt32 hashValue);
- EXTERN_API_C( OTLink *)
- OTRemoveFromHashList (OTHashList * hashList,
- OTHashSearchProcPtr searchProc,
- const void * refPtr,
- UInt32 hashValue);
- #ifdef __cplusplus
- // C++ inline methods on this structure.
- inline void OTHashList::Add(OTLink* toAdd) { OTAddToHashList(this, toAdd); }
- inline Boolean OTHashList::RemoveLink(OTLink* toRemove)
- { return OTRemoveLinkFromHashList(this, toRemove); }
- inline OTLink* OTHashList::Remove(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hashValue)
- { return OTRemoveFromHashList(this, proc, refPtr, hashValue); }
- inline Boolean OTHashList::IsInList(OTLink* toFind)
- { return OTIsInHashList(this, toFind); }
- inline OTLink* OTHashList::FindLink(OTHashSearchProcPtr proc, const void* refPtr, UInt32 hash)
- { return OTFindInHashList(this, proc, refPtr, hash); }
- #endif
- /* Random functions*/
- /*
- These implement a very simple random number generator, suitable
- for protocol implementations but not "cryptographically" random.
- */
- EXTERN_API_C( UInt32 )
- OTGetRandomSeed (void);
- EXTERN_API_C( UInt32 )
- OTGetRandomNumber (UInt32 * seed,
- UInt32 lo,
- UInt32 hi);
- /* Concurrency Control*/
- /*
- OTGate implements a cool concurrency control primitive.
- You're not going to understand it without reading the documentation!
- See "Open Transport Advanced Client Programming" for details.
- WARNING:
- This structure must be on a 4-byte boundary.
- */
- #endif /* CALL_NOT_IN_CARBON */
- typedef CALLBACK_API_C( Boolean , OTGateProcPtr )(OTLink *thisLink);
- struct OTGate {
- OTLIFO fLIFO;
- OTList fList;
- OTGateProcPtr fProc;
- SInt32 fNumQueued;
- SInt32 fInside;
- };
- typedef struct OTGate OTGate;
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( void )
- OTInitGate (OTGate * gate,
- OTGateProcPtr proc);
- EXTERN_API_C( Boolean )
- OTEnterGate (OTGate * gate,
- OTLink * withLink);
- EXTERN_API_C( Boolean )
- OTLeaveGate (OTGate * gate);
- /* ***** Shared Library Bonus Extras ******/
- #endif /* CALL_NOT_IN_CARBON */
- #if CALL_NOT_IN_CARBON
- /*
- These routines provide addition shared library support beyond
- that provided by the base shared library mechanism.
- */
- /*
- Some flags which can be passed to the "loadFlags" parameter of the
- various CFM routines. Not all flags can be used with all routines.
- See "Open Transport Advanced Client Programming" for details.
- */
- enum {
- kOTGetDataSymbol = 0,
- kOTGetCodeSymbol = 1,
- kOTLoadNewCopy = 2,
- kOTLoadACopy = 4,
- kOTFindACopy = 8,
- kOTLibMask = kOTLoadNewCopy | kOTLoadACopy | kOTFindACopy,
- kOTLoadLibResident = 0x20
- };
- /* Finding all matching CFM libraries.*/
- /*
- The routine OTFindCFMLibraries allows you to find all CFM libraries
- that match specific criteria. The result is placed in a list
- of CFMLibraryInfo structures. OT allocates those structures using
- a routine of type OTAllocMemProcPtr that you pass to OTFindCFMLibraries.
- */
- /*
- A list of CFMLibraryInfo structures is returned by the OTFindCFMLibraries routine.
- The list is created out of the data that is passed to the function.
- IMPORTANT:
- Only the first 3 fields are valid when using OT 1.2 and older.
- */
- struct CFMLibraryInfo {
- OTLink link; /* To link them all up on a list */
- char * libName; /* "C" String which is fragment name */
- StringPtr intlName; /* Pascal String which is internationalized name */
- FSSpec * fileSpec; /* location of fragment's file */
- StringPtr pstring2; /* Secondary string from extended cfrg */
- StringPtr pstring3; /* Extra info from extended cfrg */
- };
- typedef struct CFMLibraryInfo CFMLibraryInfo;
- /*
- You must pass a routine of type OTAllocMemProcPtr to OTFindCFMLibraries
- which it calls to allocate memory for the CFMLibraryInfo structures.
- */
- typedef CALLBACK_API_C( void *, OTAllocMemProcPtr )(OTByteCount size);
- /* Find CFM libraries of the specified kind and type*/
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( OSStatus )
- OTFindCFMLibraries (OSType libKind,
- const char * libType,
- OTList * theList,
- OTAllocMemProcPtr allocator);
- /* Loading libraries and connecting to symbols.*/
- /* Load a CFM library by name*/
- EXTERN_API_C( OSStatus )
- OTLoadCFMLibrary (const char * libName,
- UInt32 * connID,
- UInt32 loadFlags);
- /* Load a CFM library and get a named pointer from it*/
- EXTERN_API_C( void *)
- OTGetCFMPointer (const char * libName,
- const char * entryName,
- UInt32 * connID,
- UInt32 loadFlags);
- /* Get a named pointer from a CFM library that's already loaded*/
- EXTERN_API_C( void *)
- OTGetCFMSymbol (const char * entryName,
- UInt32 connID,
- UInt32 loadFlags);
- /* Release a connection to a CFM library*/
- EXTERN_API_C( void )
- OTReleaseCFMConnection (UInt32 * connID);
- #endif /* CALL_NOT_IN_CARBON */
- #if !TARGET_CPU_68K
- /*
- You can call these routines in your CFM initialisation and termination
- routines to hold or unhold your libraries sections.
- */
- /*
- Used in a CFM InitProc, will hold the executable code, if applicable.
- This can also be the InitProc of the library
- */
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( OSStatus )
- OTHoldThisCFMLibrary (const CFragInitBlock * initBlock);
- /*
- Used in a CFM terminate proc, will unhold the executable code, if applicable.
- This can also be the terminate proc of the library
- */
- EXTERN_API_C( void )
- OTUnholdThisCFMLibrary (void);
- #endif /* CALL_NOT_IN_CARBON */
- #endif /* !TARGET_CPU_68K */
- /* ASLM Utilities*/
- /* Load an ASLM library*/
- #if CALL_NOT_IN_CARBON
- EXTERN_API_C( OSStatus )
- OTLoadASLMLibrary (const char * libName);
- /* Unload an ASLM library*/
- EXTERN_API_C( void )
- OTUnloadASLMLibrary (const char * libName);
- /*
- This is an ASLM utility routine. You can get it by including
- "LibraryManagerUtilities.h", but since we only use a few ASLM utilities,
- we put the prototype here for convenience.
- */
- EXTERN_API_C( void )
- UnloadUnusedLibraries (void);
- #endif /* CALL_NOT_IN_CARBON */
- #if !OTKERNEL
- /*******************************************************************************
- ** A few C++ objects for C++ fans
- ********************************************************************************/
- #if CALL_NOT_IN_CARBON
- #ifdef __cplusplus
- } // Terminate C definitions
- class OTConfiguration
- {
- public:
- OTConfigurationRef Clone()
- { return OTCfigCloneConfiguration(this); }
- //
- // The Path for PushChild and PushParent must be a single module
- //
- OTConfigurationRef PushChild(const char* path, OSStatus* errPtr)
- { return OTCfigPushNewSingleChild(this, path, errPtr); }
- OTConfigurationRef PushParent(const char* path, OSStatus* errPtr)
- { return OTCfigPushParent(this, path, errPtr); }
- OTConfigurationRef PushNthChild(OTItemCount index, const char* path,
- OSStatus* errPtr)
- { return OTCfigPushChild(this, index, path, errPtr); }
- OSStatus PopChild(OTItemCount index)
- { return OTCfigPopChild(this, index); }
- OTConfigurationRef GetChild(OTItemCount index = 0)
- { return OTCfigGetChild(this, index); }
- OTConfigurationRef GetParent()
- { return OTCfigGetParent(this); }
- OSStatus AddChild(OTConfigurationRef child)
- { return OTCfigAddChild(this, child); }
- OTConfigurationRef NewChild(const char* path, OSStatus* errPtr)
- { return OTCfigNewChild(this, path, errPtr); }
- OSStatus SetPath(const char* path)
- { return OTCfigSetPath(this, path); }
- Boolean HasOptions()
- { return OTCfigGetOptionNetbuf(this)->len != 0; }
- };
- /* -------------------------------------------------------------------------
- Class TOTConfigurator
- This class is subclassed to do configuration for a protocol or protocol stack.
- Of course, you can also use OTNewConfigurator to do it from C.
- If you subclass it using C++, you MUST have a UInt32 field as the first
- field of your object that you do not touch or use.
- ------------------------------------------------------------------------- */
- #if TARGET_CPU_68K && !defined(__SC__) && !defined(THINK_CPLUS)
- class TOTConfigurator : public SingleObject
- #else
- class TOTConfigurator
- #endif
- {
- #if defined(__SC__) || defined(THINK_CPLUS) || defined(__MRC__)
- private:
- virtual void DummyVirtualFunction();
- #endif
- public:
- void* operator new(OTByteCount size)
- { return OTAllocSharedClientMem(size); }
- void operator delete(void* mem)
- { OTFreeSharedClientMem(mem); };
- _MDECL TOTConfigurator();
- virtual ~ _MDECL TOTConfigurator();
- virtual void _MDECL HandleSystemEvent(OTEventCode event, OTResult result,
- void* cookie) = 0;
- virtual OSStatus _MDECL Configure(OTConfigurationRef) = 0;
- virtual OSStatus _MDECL CreateStream(OTConfigurationRef, OTOpenFlags,
- OTNotifyUPP, void* contextPtr) = 0;
- };
- extern "C" { // resume C definitions
- #endif /*__cplusplus*/
- #endif /* CALL_NOT_IN_CARBON */
- #endif /* !OTKERNEL */
- #endif /* CALL_NOT_IN_CARBON */
- #if defined(__MWERKS__) && TARGET_CPU_68K
- #pragma pop
- #endif
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=reset
- #elif PRAGMA_STRUCT_PACKPUSH
- #pragma pack(pop)
- #elif PRAGMA_STRUCT_PACK
- #pragma pack()
- #endif
- #ifdef PRAGMA_IMPORT_OFF
- #pragma import off
- #elif PRAGMA_IMPORT
- #pragma import reset
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif /* __OPENTRANSPORTPROTOCOL__ */