DCEPORT.H
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:33k
源码类别:

Windows编程

开发平台:

Visual C++

  1. /*++
  2. Copyright (c) 1993-1997 Microsoft Corporation
  3. Module Name:
  4.     dceport.h
  5. Abstract:
  6.     Include file defining types and macros which map DCE RPC APIs to
  7.     Microsoft RPC APIs.  Useful when porting DCE RPC applications to MS RPC.
  8. --*/
  9. #ifndef DCEPORT_H
  10. #define DCEPORT_H
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. /*
  15. ** Define various idl types
  16. */
  17. #define idl_char                unsigned char
  18. #define idl_boolean             unsigned char
  19. #define idl_byte                unsigned char
  20. #define idl_small_int           char
  21. #define idl_usmall_int          unsigned char
  22. #define idl_short_int           signed short
  23. #define idl_ushort_int          unsigned short
  24. #define idl_long_int            long
  25. #define idl_ulong_int           unsigned long
  26. #define boolean32               unsigned long
  27. #define unsigned32              unsigned long
  28. #define unsigned16              unsigned short
  29. #define idl_true                1
  30. #define idl_false               0
  31. #define unsigned_char_t         unsigned char
  32. typedef unsigned char __RPC_FAR *unsigned_char_p_t;
  33. typedef void __RPC_FAR          *idl_void_p_t;
  34. #ifndef _ERROR_STATUS_T_DEFINED
  35. typedef unsigned long error_status_t;
  36. #define _ERROR_STATUS_T_DEFINED
  37. #endif
  38. /*
  39. ** Define various DCE RPC types
  40. */
  41. #define rpc_if_handle_t             RPC_IF_HANDLE
  42. #define rpc_ns_handle_t             RPC_NS_HANDLE
  43. #define rpc_authz_handle_t          RPC_AUTHZ_HANDLE
  44. #define rpc_auth_identity_handle_t  RPC_AUTH_IDENTITY_HANDLE
  45. #define rpc_sm_thread_handle_t      RPC_SS_THREAD_HANDLE
  46. #define rpc_mgr_epv_t               RPC_MGR_EPV __RPC_FAR *
  47. #define rpc_object_inq_fn_t         RPC_OBJECT_INQ_FN __RPC_FAR *
  48. #define rpc_auth_key_retrieval_fn_t RPC_AUTH_KEY_RETRIEVAL_FN
  49. #define rpc_mgmt_authorization_fn_t RPC_MGMT_AUTHORIZATION_FN
  50. /*
  51. ** Define rpc_binding_vector_t to match DCE
  52. */
  53. #ifdef rpc_binding_vector_t
  54. #undef rpc_binding_vector_t
  55. #endif
  56. typedef struct
  57. {
  58.      unsigned long           count;
  59.      handle_t                binding_h[1];
  60. } rpc_binding_vector_t, __RPC_FAR *rpc_binding_vector_p_t;
  61. /*
  62. ** Define rpc_protseq_vector_t to match DCE
  63. */
  64. typedef struct
  65. {
  66.     unsigned long           count;
  67.     unsigned char *         protseq[1];
  68. } rpc_protseq_vector_t, __RPC_FAR *rpc_protseq_vector_p_t;
  69. /*
  70. ** Define rpc_stats_vector_t to match DCE
  71. */
  72. typedef struct
  73. {
  74.     unsigned long           count;
  75.     unsigned long           stats[1];
  76. } rpc_stats_vector_t, __RPC_FAR *rpc_stats_vector_p_t;
  77. /*
  78. ** Define uuid_t to match DCE
  79. */
  80. #ifdef uuid_t
  81. #undef uuid_t
  82. #endif
  83. typedef struct
  84. {
  85.     unsigned long            time_low;
  86.     unsigned short           time_mid;
  87.     unsigned short           time_hi_and_version;
  88.     unsigned char            clock_seq_hi_and_reserved;
  89.     unsigned char            clock_seq_low;
  90.     unsigned char            node[6];
  91. } uuid_t, __RPC_FAR *uuid_p_t;
  92. /*
  93. ** Define uuid_vector_t to match DCE
  94. */
  95. #ifdef uuid_vector_t
  96. #undef uuid_vector_t
  97. #endif
  98. typedef struct
  99. {
  100.      unsigned long           count;
  101.      uuid_p_t                uuid[1];
  102. } uuid_vector_t, __RPC_FAR *uuid_vector_p_t;
  103. /*
  104. ** Define rpc_if_id_t and rpc_if_id_p_t to match DCE
  105. */
  106. typedef struct
  107. {
  108.     uuid_t                   uuid;
  109.     unsigned short           vers_major;
  110.     unsigned short           vers_minor;
  111. } rpc_if_id_t, __RPC_FAR *rpc_if_id_p_t;
  112. /*
  113. ** Define rpc_if_id_vector_t to match DCE
  114. */
  115. typedef struct
  116. {
  117.     unsigned long           count;
  118.     rpc_if_id_p_t           if_id[1];
  119. } rpc_if_id_vector_t, __RPC_FAR *rpc_if_id_vector_p_t;
  120. /*
  121. ** The MinThreads parameters to RpcServerListen()
  122. ** is not part of the DCE API rpc_server_listen().
  123. ** This is the default value.
  124. */
  125. #define rpc_c_listen_min_threads_default 1
  126. /*
  127. ** Define various constants
  128. */
  129. #define rpc_c_ns_syntax_default            RPC_C_NS_SYNTAX_DEFAULT
  130. #define rpc_c_ns_syntax_dce                RPC_C_SYNTAX_DCE
  131. #define rpc_c_ns_default_exp_age           RPC_C_DEFAULT_EXP_AGE
  132. #define rpc_c_protseq_max_reqs_default     RPC_C_PROTSEQ_MAX_REQS_DEFAULT
  133. #define rpc_c_protseq_max_calls_default    RPC_C_PROTSEQ_MAX_REQS_DEFAULT
  134. #define rpc_c_listen_max_calls_default     RPC_C_LISTEN_MAX_CALLS_DEFAULT
  135. #define rpc_c_ep_all_elts                  RPC_C_EP_ALL_ELTS
  136. #define rpc_c_ep_match_by_if               RPC_C_EP_MATCH_BY_IF
  137. #define rpc_c_ep_match_by_obj              RPC_C_EP_MATCH_BY_OBJ
  138. #define rpc_c_ep_match_by_both             RPC_C_EP_MATCH_BY_BOTH
  139. #define rpc_c_vers_all                     RPC_C_VERS_ALL
  140. #define rpc_c_vers_compatible              RPC_C_VERS_COMPATIBLE
  141. #define rpc_c_vers_exact                   RPC_C_VERS_EXACT
  142. #define rpc_c_vers_major_only              RPC_C_VERS_MAJOR_ONLY
  143. #define rpc_c_vers_upto                    RPC_C_VERS_UPTO
  144. #define rpc_c_profile_default_elt          RPC_C_PROFILE_DEFAULT_ELT
  145. #define rpc_c_profile_all_elts             RPC_C_PROFILE_ALL_ELTS
  146. #define rpc_c_profile_match_by_if          RPC_C_PROFILE_MATCH_BY_IF
  147. #define rpc_c_profile_match_by_mbr         RPC_C_PROFILE_MATCH_BY_MBR
  148. #define rpc_c_profile_match_by_both        RPC_C_PROFILE_MATCH_BY_BOTH
  149. #define rpc_c_binding_min_timeout          RPC_C_BINDING_MIN_TIMEOUT
  150. #define rpc_c_binding_default_timeout      RPC_C_BINDING_DEFAULT_TIMEOUT
  151. #define rpc_c_binding_max_timeout          RPC_C_BINDING_MAX_TIMEOUT
  152. #define rpc_c_binding_infinite_timeout     RPC_C_BINDING_INFINITE_TIMEOUT
  153. #define rpc_c_stats_calls_in               RPC_C_STATS_CALLS_IN
  154. #define rpc_c_stats_calls_out              RPC_C_STATS_CALLS_OUT
  155. #define rpc_c_stats_pkts_in                RPC_C_STATS_PKTS_IN
  156. #define rpc_c_stats_pkts_out               RPC_C_STATS_PKTS_OUT
  157. #define rpc_c_mgmt_inq_if_ids              RPC_C_MGMT_INQ_IF_IDS
  158. #define rpc_c_mgmt_inq_princ_name          RPC_C_MGMT_INQ_PRINC_NAME
  159. #define rpc_c_mgmt_inq_stats               RPC_C_MGMT_INQ_STATS
  160. #define rpc_c_mgmt_inq_server_listen       RPC_C_MGMT_INQ_SERVER_LISTEN
  161. #define rpc_c_mgmt_stop_server_listen      RPC_C_MGMT_STOP_SERVER_LISTEN
  162. #define rpc_c_mgmt_cancel_infinite_timeout RPC_C_CANCEL_INFINITE_TIMEOUT
  163. /*
  164. ** Define DCE API equivalents
  165. */
  166. #define rpc_binding_copy(source,dest,status) 
  167.                 *(status) = RpcBindingCopy(source,dest)
  168. #define rpc_binding_free(binding,status) *(status) = RpcBindingFree(binding)
  169. #define rpc_binding_from_string_binding(string_binding,binding,status) 
  170.                 *(status) = RpcBindingFromStringBinding(string_binding,binding)
  171. #define rpc_binding_inq_auth_client(binding,privs,princ_name,protect_level, 
  172.                 authn_svc,authz_svc,status) 
  173.                 *(status) = RpcBindingInqAuthClient(binding,privs,princ_name, 
  174.                 protect_level,authn_svc,authz_svc)
  175. #define rpc_binding_inq_auth_info(binding,princ_name,protect_level,
  176.                 authn_svc,auth_identity,authz_svc,status) 
  177.                 *(status) = RpcBindingInqAuthInfo(binding,princ_name, 
  178.                 protect_level,authn_svc,auth_identity,authz_svc)
  179. #define rpc_binding_inq_object(binding,object_uuid,status) 
  180.                 *(status) = RpcBindingInqObject(binding,
  181.                 (UUID __RPC_FAR *)object_uuid)
  182. #define rpc_binding_reset(binding,status) *(status) = RpcBindingReset(binding)
  183. #define rpc_binding_server_from_client(cbinding,sbinding,status) 
  184.                 *(status) = RpcBindingServerFromClient(cbinding,sbinding)
  185. #define rpc_binding_set_auth_info(binding,princ_name,protect_level,
  186.                 authn_svc,auth_identity,authz_svc,status) 
  187.                 *(status) = RpcBindingSetAuthInfo(binding,princ_name,
  188.                 protect_level,authn_svc,auth_identity,authz_svc)
  189. #define rpc_binding_set_object(binding,object_uuid,status) 
  190.                 *(status) = RpcBindingSetObject(binding,
  191.                 (UUID __RPC_FAR *)object_uuid)
  192. #define rpc_binding_to_string_binding(binding,string_binding,status) 
  193.                 *(status) = RpcBindingToStringBinding(binding,string_binding)
  194. #define rpc_binding_vector_free(binding_vector,status) 
  195.                 *(status) = RpcBindingVectorFree(
  196.                 (RPC_BINDING_VECTOR __RPC_FAR * __RPC_FAR *)binding_vector)
  197. #define rpc_ep_register(if_spec,binding_vec,object_uuid_vec,annotation,
  198.                 status)
  199.                 *(status) = RpcEpRegister(if_spec,
  200.                 (RPC_BINDING_VECTOR __RPC_FAR *)binding_vec, 
  201.                 (UUID_VECTOR __RPC_FAR *)object_uuid_vec, annotation)
  202. #define rpc_ep_register_no_replace(if_spec,binding_vec,object_uuid_vec,
  203.                 annotation,status) 
  204.                 *(status) = RpcEpRegisterNoReplace(if_spec,
  205.                 (RPC_BINDING_VECTOR __RPC_FAR *)binding_vec,
  206.                 (UUID_VECTOR __RPC_FAR *)object_uuid_vec,annotation)
  207. #define rpc_ep_resolve_binding(binding_h,if_spec,status) 
  208.                 *(status) = RpcEpResolveBinding(binding_h,if_spec)
  209. #define rpc_ep_unregister(if_spec,binding_vec,object_uuid_vec,status) 
  210.                 *(status) = RpcEpUnregister(if_spec,
  211.                 (RPC_BINDING_VECTOR __RPC_FAR *)binding_vec,
  212.                 (UUID_VECTOR __RPC_FAR *)object_uuid_vec)
  213. #define rpc_if_id_vector_free(if_id_vector,status) 
  214.                 *(status) = RpcIfIdVectorFree(
  215.                 (RPC_IF_ID_VECTOR __RPC_FAR * __RPC_FAR *)if_id_vector)
  216. #define rpc_if_inq_id(if_spec,if_id,status) 
  217.                 *(status) = RpcIfInqId(if_spec,(RPC_IF_ID __RPC_FAR *)if_id)
  218. #define rpc_if_register_auth_info(if_spec,princ_name,protect_level,
  219.                 authn_svc,auth_identity,authz_svc,status) 
  220.                 *(status) = RpcIfRegisterAuthInfo(if_spec,princ_name,
  221.                 protect_level,authn_svc,auth_identity,authz_svc)
  222. #define rpc_mgmt_ep_elt_inq_begin(ep_binding,inquiry_type,if_id,vers_option,
  223.                 object_uuid,inquiry_context,status) 
  224.                 *(status) = RpcMgmtEpEltInqBegin(ep_binding,inquiry_type,if_id,
  225.                 vers_option,object_uuid,inquiry_context)
  226. #define rpc_mgmt_ep_elt_inq_done(inquiry_context,status) 
  227.                 *(status) = RpcMgmtEpEltInqDone(inquiry_context)
  228. #define rpc_mgmt_ep_elt_inq_next(inquiry_context,if_id,binding,object_uuid,
  229.                 annotation,status) 
  230.                 *(status) = RpcMgmtEpEltInqNext(inquiry_context,if_id,binding,
  231.                 object_uuid,annotation)
  232. #define rpc_mgmt_ep_unregister(ep_binding,if_id,binding,object_uuid,status) 
  233.                 *(status) = RpcMgmtEpUnregister(ep_binding,if_id,binding,
  234.                 object_uuid)
  235. #define rpc_mgmt_inq_com_timeout(binding,timeout,status) 
  236.                 *(status) = RpcMgmtInqComTimeout(binding,timeout)
  237. #define rpc_mgmt_inq_dflt_protect_level(authn_svc,level,status) 
  238.                 *(status) = RpcMgmtInqDefaultProtectLevel(authn_svc,level)
  239. #define rpc_mgmt_inq_if_ids(binding,if_id_vector,status) 
  240.                 *(status) = RpcMgmtInqIfIds((bindings),
  241.                 (RPC_IF_ID_VECTOR __RPC_FAR * __RPC_FAR *)(if_id_vector))
  242. #define rpc_mgmt_inq_server_princ_name(binding,authn_svc,princ_name,status) 
  243.                 *(status) = RpcMgmtInqServerPrincName(binding,authn_svc,
  244.                 princ_name)
  245. #define rpc_mgmt_inq_stats(binding,statistics,status) 
  246.                 *(status) = RpcMgmtInqStats(binding,
  247.                 (RPC_STATS_VECTOR __RPC_FAR * __RPC_FAR *)statistics)
  248. #define rpc_mgmt_is_server_listening(binding,status) 
  249.                 ( ((*(status) = RpcMgmtIsServerListening(binding)) == RPC_S_OK) 
  250.                 ? (1) : (*(status) == RPC_S_NOT_LISTENING) 
  251.                 ? (*(status) = RPS_S_OK, 0) : (0) )
  252. #define rpc_mgmt_set_authorization_fn(authz_fn,status) 
  253.                 *(status) = RpcMgmtSetAuthorizathionFn(authz_fn)
  254. #define rpc_mgmt_set_cancel_timeout(seconds,status) 
  255.                 *(status) = RpcMgmtSetCancelTimeout(seconds)
  256. #define rpc_mgmt_set_com_timeout(binding,timeout,status) 
  257.                 *(status) = RpcMgmtSetComTimeout(binding,timeout)
  258. #define rpc_mgmt_set_server_stack_size(size,status) 
  259.                 *(status) = RpcMgmtSetServerStackSize(size)
  260. #define rpc_mgmt_stats_vector_free(stats,status) 
  261.                 *(status) = RpcMgmtStatsVectorFree(
  262.                 (RPC_STATS_VECTOR __RPC_FAR * __RPC_FAR *)stats)
  263. #define rpc_mgmt_stop_server_listening(binding,status) 
  264.                 *(status) = RpcMgmtStopServerListening(binding)
  265. #define rpc_network_inq_protseqs(prots,status) 
  266.                 *(status) = RpcNetworkInqProtseqs(
  267.                 (RPC_PROTSEQ_VECTOR __RPC_FAR * __RPC_FAR *)prots)
  268. #define rpc_network_is_protseq_valid(protseq,status) 
  269.                 *(status) = RpcNetworkIsProtseqValid(protseq)
  270. /*
  271. ** Define NSI equivalents
  272. */
  273. #define rpc_ns_binding_export(name_syntax,entry_name,if_spec,
  274.                 binding_vector, uuid_vector,status) 
  275.                 *(status) = RpcNsBindingExport(name_syntax,entry_name,
  276.                 if_spec, (RPC_BINDING_VECTOR *)binding_vector,
  277.                 (UUID_VECTOR __RPC_FAR *)uuid_vector)
  278. #define rpc_ns_binding_import_begin(name_syntax,entry_name,if_spec,
  279.                 object_uuid,import_context,status) 
  280.                 *(status) = RpcNsBindingImportBegin(name_syntax,entry_name,
  281.                 if_spec,(UUID __RPC_FAR *)object_uuid,import_context)
  282. #define rpc_ns_binding_import_done(import_context,status) 
  283.                 *(status) = RpcNsBindingImportDone(import_context)
  284. #define rpc_ns_binding_import_next(import_context,binding,status) 
  285.                 *(status) = RpcNsBindingImportNext(import_context,binding)
  286. #define rpc_ns_binding_inq_entry_name(binding,name_syntax,entry_name,status)
  287.                 *(status) = RpcNsBindingInqEntryName(binding,name_syntax,
  288.                 entry_name)
  289. #define rpc_ns_binding_lookup_begin(name_syntax,entry_name,if_spec,
  290.                 object_uuid,max_count,lookup_context,status) 
  291.                 *(status) = RpcNsBindingLookupBegin(name_syntax,entry_name,
  292.                 if_spec,(UUID __RPC_FAR *)object_uuid,max_count,lookup_context)
  293. #define rpc_ns_binding_lookup_done(lookup_context,status) 
  294.                 *(status) = RpcNsBindingLookupDone(lookup_context)
  295. #define rpc_ns_binding_lookup_next(lookup_context,binding_vector,status) 
  296.                 *(status) = RpcNsBindingLookupNext(lookup_context, 
  297.                 (RPC_BINDING_VECTOR __RPC_FAR * __RPC_FAR *)binding_vector)
  298. #define rpc_ns_binding_select(binding_vector,binding,status) 
  299.                 *(status) = RpcNsBindingSelect(
  300.                 (RPC_BINDING_VECTOR __RPC_FAR *)binding_vector,binding)
  301. #define rpc_ns_binding_unexport(name_syntax,entry_name,if_spec,
  302.                 uuid_vector,status) 
  303.                 *(status) = RpcNsBindingUnexport(name_syntax,entry_name,
  304.                 if_spec, (UUID_VECTOR __RPC_FAR *)uuid_vector)
  305. #define rpc_ns_entry_expand_name(name_syntax,entry_name,expanded_name,
  306.                 status)
  307.                 *(status) = RpcNsEntryExpandName(name_syntax,entry_name,
  308.                 expanded_name)
  309. #define rpc_ns_entry_object_inq_begin(name_syntax,entry_name,
  310.                 inquiry_context,status)
  311.                 *(status) = RpcNsEntryObjectInqBegin(name_syntax,
  312.                 entry_name,inquiry_context)
  313. #define rpc_ns_entry_object_inq_done(inquiry_context,status) 
  314.                 *(status) = RpcNsEntryObjectInqDone(inquiry_context)
  315. #define rpc_ns_entry_object_inq_next(inquiry_context,object_uuid,status) 
  316.                 *(status) = RpcNsEntryObjectInqNext(inquiry_context,
  317.                 (UUID __RPC_FAR *)object_uuid)
  318. #define rpc_ns_group_delete(name_syntax,group_name,status) 
  319.                 *(status) = RpcNsGroupDelete(name_syntax,group_name)
  320. #define rpc_ns_group_mbr_add(name_syntax,group_name,member_name_syntax,
  321.                 member_name,status) 
  322.                 *(status) = RpcNsGroupMbrAdd(name_syntax,group_name,
  323.                 member_name_syntax,member_name)
  324. #define rpc_ns_group_mbr_inq_begin(name_syntax,group_name,member_name_syntax,
  325.                 inquiry_context,status) 
  326.                 *(status) = RpcNsGroupMbrInqBegin(name_syntax,group_name,
  327.                 member_name_syntax,inquiry_context)
  328. #define rpc_ns_group_mbr_inq_done(inquiry_context,status) 
  329.                 *(status) = RpcNsGroupMbrInqDone(inquiry_context)
  330. #define rpc_ns_group_mbr_inq_next(inquiry_context,member_name,status) 
  331.                 *(status) = RpcNsGroupMbrInqNext(inquiry_context,member_name)
  332. #define rpc_ns_group_mbr_remove(name_syntax,group_name,member_name_syntax,
  333.                 member_name,status) 
  334.                 *(status) = RpcNsGroupMbrRemove(name_syntax,group_name,
  335.                 member_name_syntax,member_name)
  336. #define rpc_ns_mgmt_binding_unexport(name_syntax,entry_name,if_id,vers_option,
  337.                 uuid_vector,status) 
  338.                 *(status) = RpcNsMgmtBindingUnexport(name_syntax,entry_name,
  339.                 (RPC_IF_ID __RPC_FAR *)if_id,vers_option,
  340.                 (UUID_VECTOR __RPC_FAR *)uuid_vector)
  341. #define rpc_ns_mgmt_entry_create(name_syntax,entry_name,status) 
  342.                 *(status) = RpcNsMgmtEntryCreate(name_syntax,entry_name)
  343. #define rpc_ns_mgmt_entry_delete(name_syntax,entry_name,status) 
  344.                 *(status) = RpcNsMgmtEntryDelete(name_syntax,entry_name)
  345. #define rpc_ns_mgmt_entry_inq_if_ids(name_syntax,entry_name,if_id_vector,
  346.                 status) 
  347.                 *(status) = RpcNsMgmtEntryInqIfIds(name_syntax,entry_name,
  348.                 (RPC_IF_ID_VECTOR __RPC_FAR * __RPC_FAR *)if_id_vector)
  349. #define rpc_ns_mgmt_handle_set_exp_age(ns_handle,expiration_age,status) 
  350.                 *(status) = RpcNsMgmtHandleSetExpAge(ns_handle,expiration_age)
  351. #define rpc_ns_mgmt_inq_exp_age(expiration_age,status) 
  352.                 *(status) = RpcNsMgmtInqExpAge(expiration_age)
  353. #define rpc_ns_mgmt_set_exp_age(expiration_age,status) 
  354.                 *(status) = RpcNsMgmtSetExpAge(expiration_age)
  355. #define rpc_ns_profile_delete(name_syntax,profile_name,status) 
  356.                 *(status) = RpcNsProfileDelete(name_syntax,profile_name)
  357. #define rpc_ns_profile_elt_add(name_syntax,profile_name,if_id,
  358.                 member_name_syntax,member_name,priority,annotation,status) 
  359.                 *(status) = RpcNsProfileEltAdd(name_syntax,profile_name,
  360.                 (RPC_IF_ID __RPC_FAR *)if_id,member_name_syntax,member_name,
  361.                 priority,annotation)
  362. #define rpc_ns_profile_elt_inq_begin(name_syntax,profile_name,inquiry_type,
  363.                 if_id,if_vers_option,member_name_syntax,
  364.                 member_name,inquiry_context,status) 
  365.                 *(status) = RpcNsProfileEltInqBegin(name_syntax,profile_name,
  366.                 inquiry_type,(RPC_IF_ID __RPC_FAR *)if_id,if_vers_option,
  367.                 member_name_syntax,member_name,inquiry_context)
  368. #define rpc_ns_profile_elt_inq_done(inquiry_context,status) 
  369.                 *(status) = RpcNsProfileEltInqDone(inquiry_context)
  370. #define rpc_ns_profile_elt_inq_next(inquiry_context,if_id,member_name,
  371.                 priority,annotation,status) 
  372.                 *(status) = RpcNsProfileEltInqNext(inquiry_context,
  373.                 (RPC_IF_ID __RPC_FAR *)if_id,member_name,priority,annotation)
  374. #define rpc_ns_profile_elt_remove(name_syntax,profile_name,if_id,
  375.                 member_name_syntax,member_name,status) 
  376.                 *(status) = RpcNsProfileEltRemove(name_syntax,profile_name,
  377.                 (RPC_IF_ID __RPC_FAR *)if_id,member_name_syntax,member_name)
  378. #define rpc_object_inq_type(object_uuid,type_uuid,status) 
  379.                 *(status) = RpcObjectInqType((UUID __RPC_FAR *)object_uuid,
  380.                 (UUID __RPC_FAR *)type_uuid)
  381. #define rpc_object_set_inq_fn(inq_fn,status) 
  382.                 *(status) = RpcObjectSetInqFn(inq_fn)
  383. #define rpc_object_set_type(object_uuid,type_uuid,status) 
  384.                 *(status) = RpcObjectSetType((UUID __RPC_FAR *)object_uuid,
  385.                 (UUID __RPC_FAR *)type_uuid)
  386. #define rpc_protseq_vector_free(protseq_vector,status) 
  387.                 *(status) = RpcProtseqVectorFree( 
  388.                 (RPC_PROTSEQ_VECTOR __RPC_FAR * __RPC_FAR *)protseq_vector)
  389. #define rpc_server_inq_bindings(binding_vector,status) 
  390.                 *(status) = RpcServerInqBindings(
  391.                 (RPC_BINDING_VECTOR __RPC_FAR * __RPC_FAR *)binding_vector)
  392. #define rpc_server_inq_if(if_spec,type_uuid,mgr_epv,status) 
  393.                 *(status) = RpcServerInqIf(if_spec,(UUID __RPC_FAR *)type_uuid,
  394.                 (RPC_MGR_EPV __RPC_FAR *)mgr_epv)
  395. #define rpc_server_listen(max_calls,status) 
  396.                 *(status) = RpcServerListen(rpc_c_listen_min_threads_default,
  397.                 max_calls,0)
  398. #define rpc_server_register_auth_info(princ_name,auth_svc,get_key_func,arg,
  399.                 status) 
  400.                 *(status) = RpcServerRegisterAuthInfo(princ_name,auth_svc,
  401.                 get_key_func,arg)
  402. #define rpc_server_register_if(if_spec,type_uuid,mgr_epv,status) 
  403.                 *(status) = RpcServerRegisterIf(if_spec,
  404.                 (UUID __RPC_FAR *)type_uuid,(RPC_MGR_EPV __RPC_FAR *)mgr_epv)
  405. #define rpc_server_unregister_if(if_spec,type_uuid,status) 
  406.                 *(status) = RpcServerUnregisterIf(if_spec,(UUID *)type_uuid,0)
  407. #define rpc_server_use_all_protseqs(max_call_requests,status) 
  408.                 *(status) = RpcServerUseAllProtseqs(max_call_requests,0)
  409. #define rpc_server_use_all_protseqs_if(max_call_requests,if_spec,status) 
  410.                 *(status) = RpcServerUseAllProtseqsIf(max_call_requests,
  411.                 if_spec,0)
  412. #define rpc_server_use_protseq(protseq,max_call_requests,status) 
  413.                 *(status) = RpcServerUseProtseq(protseq,max_call_requests,0)
  414. #define rpc_server_use_protseq_ep(protseq,max_call_requests,endpoint,status)
  415.                 *(status) = RpcServerUseProtseqEp(protseq,max_call_requests,
  416.                 endpoint,0)
  417. #define rpc_server_use_protseq_if(protseq,max_call_requests,if_spec,status) 
  418.                 *(status) = RpcServerUseProtseqIf(protseq,max_call_requests,
  419.                 if_spec,0)
  420. #define rpc_sm_alloce(size,status) *(status) = RpcSmAllocate(size)
  421. #define rpc_sm_client_free(ptr,status) *(status) = RpcSmClientFree(ptr)
  422. #define rpc_sm_destroy_client_context(context,status) 
  423.                 *(status) = RpcSmDestroyClientContext(context)
  424. #define rpc_sm_disable_allocate(status) *(status) = RpcSmDisableAllocate()
  425. #define rpc_sm_enable_allocate(status) *(status) = RpcSmEnableAllocate()
  426. #define rpc_sm_free(ptr,status) *(status) = RpcSmFree(ptr)
  427. #define rpc_sm_get_thread_handle(status) RpcSmGetThreadHandle(status)
  428. #define rpc_sm_set_client_alloc_free(alloc,free,status) 
  429.                 *(status) = RpcSmSetClientAllocFree(alloc,free)
  430. #define rpc_sm_set_thread_handle(id,status) 
  431.                 *(status) = RpcSmSetThreadHandle(id)
  432. #define rpc_sm_swap_client_alloc_free(alloc,free,old_alloc,old_free,status) 
  433.                 *(status) = RpcSmSwapClientAllocFree(alloc,free 
  434.                 old_alloc, old_free)
  435. #define rpc_string_binding_compose(object_uuid,protseq,netaddr,endpoint,
  436.                 options,binding,status) 
  437.                 *(status) = RpcStringBindingCompose(object_uuid,protseq,
  438.                 netaddr,endpoint,options,binding)
  439. #define rpc_string_binding_parse(string_binding,object_uuid,protseq,netaddr,
  440.                 endpoint,options,status) 
  441.                 *(status) = RpcStringBindingParse(string_binding,
  442.                 object_uuid,protseq,netaddr,endpoint,options)
  443. #define rpc_string_free(string,status) *(status) = RpcStringFree(string)
  444. #define uuid_compare(uuid1,uuid2,status) 
  445.                 UuidCompare((UUID __RPC_FAR *)(uuid1),
  446.                             (UUID __RPC_FAR *)(uuid2),(status))
  447. #define uuid_create(uuid,status) 
  448.                 *(status) = UuidCreate((UUID __RPC_FAR *)uuid)
  449. #define uuid_create_nil(uuid,status) 
  450.                 *(status) = UuidCreateNil((UUID __RPC_FAR *)uuid)
  451. #define uuid_equal(uuid1,uuid2,status) 
  452.                 UuidEqual((UUID __RPC_FAR *)(uuid1), 
  453.                           (UUID __RPC_FAR *)(uuid2), (status))
  454. #define uuid_from_string(string,uuid,status) 
  455.                 *(status) = UuidFromString(string,(UUID __RPC_FAR *)uuid)
  456. #define uuid_hash(uuid,status) 
  457.                 UuidHash((UUID __RPC_FAR *)(uuid),(status))
  458. #define uuid_is_nil(uuid,status) 
  459.                 UuidIsNil((UUID __RPC_FAR *)(uuid), (status))
  460. #define uuid_to_string(uuid,string,status)
  461.                 *(status) = UuidToString((UUID __RPC_FAR *)uuid,string)
  462. #define true  1
  463. #define false 0
  464. /*
  465. ** Define exception handling equivalents
  466. **
  467. */
  468. #if defined (__RPC_WIN16__) || defined (__RPC_DOS__)
  469. #define TRY                                       
  470.     {                                                
  471.     int _exception_mode_finally;                     
  472.     int _exception_code;                             
  473.     ExceptionBuff exception;                         
  474.     _exception_code = RpcSetException(&exception);   
  475.     if (!_exception_code)                            
  476.     {
  477. #define CATCH_ALL                                 
  478.         _exception_mode_finally = false;             
  479.         RpcLeaveException();                         
  480.         }                                            
  481.         else                                         
  482.         {
  483. /*
  484.  * #define CATCH(X)                               
  485.  *   }else if ((unsigned long)RpcExceptionCode()==(unsigned long)X) {
  486.  */
  487. #define FINALLY                                   
  488.         _exception_mode_finally = true;              
  489.         RpcLeaveException();                         
  490.         } {
  491. #define ENDTRY                                    
  492.           }                                               
  493.         if (_exception_mode_finally && _exception_code)  
  494.             RpcRaiseException(_exception_code);           
  495.         }
  496. #endif /* WIN16 or DOS */
  497. #if defined (__RPC_WIN32__)
  498. #define TRY             try {
  499. /*
  500.  * #define CATCH(X)        
  501.  *                      } except (GetExceptionCode() == X ? 
  502.  *                        EXCEPTION_EXECUTE_HANDLER : 
  503.  *                        EXCEPTION_CONTINUE_SEARCH) {
  504.  */
  505. #define CATCH_ALL       } except (EXCEPTION_EXECUTE_HANDLER) {
  506. #define FINALLY         } finally {
  507. #define ENDTRY          }
  508. #endif /* WIN32 */
  509. #define RAISE(v)   RpcRaiseException(v)
  510. #define RERAISE    RpcRaiseException(RpcExceptionCode())
  511. #define THIS_CATCH RpcExceptionCode()
  512. /*
  513. ** DCE Status code mappings
  514. */
  515. #ifndef rpc_s_ok
  516. #define rpc_s_ok                        RPC_S_OK
  517. #endif
  518. #ifndef error_status_ok
  519. #define error_status_ok                 RPC_S_OK
  520. #endif
  521. #define ept_s_cant_perform_op           EPT_S_CANT_PERFORM_OP
  522. #define ept_s_invalid_entry             EPT_S_INVALID_ENTRY
  523. #define ept_s_not_registered            EPT_S_NOT_REGISTERED
  524. #define rpc_s_already_listening         RPC_S_ALREADY_LISTENING
  525. #define rpc_s_already_registered        RPC_S_ALREADY_REGISTERED
  526. #define rpc_s_binding_has_no_auth       RPC_S_BINDING_HAS_NO_AUTH
  527. #define rpc_s_binding_imcomplete        RPC_S_BINDING_IMCOMPLETE
  528. #define rpc_s_call_cancelled            RPC_S_CALL_CANCELLED
  529. #define rpc_s_call_failed               RPC_S_CALL_FAILED
  530. #define rpc_s_cant_bind_socket          RPC_S_CANNOT_BIND
  531. #define rpc_s_cant_create_socket        RPC_S_CANT_CREATE_ENDPOINT
  532. #define rpc_s_comm_failure              RPC_S_COMM_FAILURE
  533. #define rpc_s_connect_no_resources      RPC_S_OUT_OF_RESOURCES
  534. #define rpc_s_cthread_create_failed     RPC_S_OUT_OF_THREADS
  535. #define rpc_s_endpoint_not_found        RPC_S_NO_ENDPOINT_FOUND
  536. #define rpc_s_entry_already_exists      RPC_S_ENTRY_ALREADY_EXISTS
  537. #define rpc_s_entry_not_found           RPC_S_ENTRY_NOT_FOUND
  538. #define rpc_s_fault_addr_error          RPC_S_ADDRESS_ERROR
  539. #define rpc_s_fault_fp_div_by_zero      RPC_S_FP_DIV_ZERO
  540. #define rpc_s_fault_fp_overflow         RPC_S_FP_OVERFLOW
  541. #define rpc_s_fault_fp_underflow        RPC_S_FP_UNDERFLOW
  542. #define rpc_s_fault_int_div_by_zero     RPC_S_ZERO_DIVIDE
  543. #define rpc_s_fault_invalid_bound       RPC_S_INVALID_BOUND
  544. #define rpc_s_fault_invalid_tag         RPC_S_INVALID_TAG
  545. #define rpc_s_fault_remote_no_memory    RPC_S_SERVER_OUT_OF_MEMORY
  546. #define rpc_s_fault_unspec              RPC_S_CALL_FAILED
  547. #define rpc_s_incomplete_name           RPC_S_INCOMPLETE_NAME
  548. #define rpc_s_interface_not_found       RPC_S_INTERFACE_NOT_FOUND
  549. #define rpc_s_internal_error            RPC_S_INTERNAL_ERROR
  550. #define rpc_s_inval_net_addr            RPC_S_INVALID_NET_ADDR
  551. #define rpc_s_invalid_arg               RPC_S_INVALID_ARG
  552. #define rpc_s_invalid_binding           RPC_S_INVALID_BINDING
  553. #define rpc_s_invalid_endpoint_format   RPC_S_INVALID_ENDPOINT_FORMAT
  554. #define rpc_s_invalid_naf_id            RPC_S_INVALID_NAF_IF
  555. #define rpc_s_invalid_name_syntax       RPC_S_INVALID_NAME_SYNTAX
  556. #define rpc_s_invalid_rpc_protseq       RPC_S_INVALID_RPC_PROTSEQ
  557. #define rpc_s_invalid_string_binding    RPC_S_INVALID_STRING_BINDING
  558. #define rpc_s_invalid_timeout           RPC_S_INVALID_TIMEOUT
  559. #define rpc_s_invalid_vers_option       RPC_S_INVALID_VERS_OPTION
  560. #define rpc_s_max_calls_too_small       RPC_S_MAX_CALLS_TOO_SMALL
  561. #define rpc_s_mgmt_op_disallowed        RPC_S_ACCESS_DENIED
  562. #define rpc_s_name_service_unavailable  RPC_S_NAME_SERVICE_UNAVAILABLE
  563. #define rpc_s_no_bindings               RPC_S_NO_BINDINGS
  564. #define rpc_s_no_entry_name             RPC_S_NO_ENTRY_NAME
  565. #define rpc_s_no_interfaces             RPC_S_NO_INTERFACES
  566. #define rpc_s_no_interfaces_exported    RPC_S_NO_INTERFACES_EXPORTED
  567. #define rpc_s_no_memory                 RPC_S_OUT_OF_MEMORY
  568. #define rpc_s_no_more_elements          RPC_X_NO_MORE_ENTRIES
  569. #define rpc_s_no_more_bindings          RPC_S_NO_MORE_BINDINGS
  570. #define rpc_s_no_more_members           RPC_S_NO_MORE_MEMBERS
  571. #define rpc_s_no_ns_permission          RPC_S_ACCESS_DENIED
  572. #define rpc_s_no_princ_name             RPC_S_NO_PRINC_NAME
  573. #define rpc_s_no_protseqs               RPC_S_NO_PROTSEQS
  574. #define rpc_s_no_protseqs_registered    RPC_S_NO_PROTSEQS_REGISTERED
  575. #define rpc_s_not_rpc_tower             RPC_S_CANNOT_SUPPORT
  576. #define rpc_s_not_supported             RPC_S_CANNOT_SUPPORT
  577. #define rpc_s_not_authorized            RPC_S_ACCESS_DENIED
  578. #define rpc_s_nothing_to_unexport       RPC_S_NOTHING_TO_UNEXPORT
  579. #define rpc_s_object_not_found          RPC_S_OBJECT_NOT_FOUND
  580. #define rpc_s_protocol_error            RPC_S_PROTOCOL_ERROR
  581. #define rpc_s_protseq_not_supported     RPC_S_PROTSEQ_NOT_SUPPORTED
  582. #define rpc_s_server_too_busy           RPC_S_SERVER_TOO_BUSY
  583. #define rpc_s_string_too_long           RPC_S_STRING_TOO_LONG
  584. #define rpc_s_type_already_registered   RPC_S_TYPE_ALREADY_REGISTERED
  585. #define rpc_s_unknown_authn_service     RPC_S_UNKNOWN_AUTHN_SERVICE
  586. #define rpc_s_unknown_authz_service     RPC_S_UNKNOWN_AUTHZ_SERVICE
  587. #define rpc_s_unknown_if                RPC_S_UNKNOWN_IF
  588. #define rpc_s_unknown_mgr_type          RPC_S_UNKNOWN_MGR_TYPE
  589. #define rpc_s_unknown_reject            RPC_S_CALL_FAILED_DNE
  590. #define rpc_s_unsupported_name_syntax   RPC_S_UNSUPPORTED_NAME_SYNTAX
  591. #define rpc_s_unsupported_type          RPC_S_UNSUPPORTED_TYPE
  592. #define rpc_s_wrong_boot_time           RPC_S_CALL_FAILED_DNE
  593. #define rpc_s_wrong_kind_of_binding     RPC_S_WRONG_KIND_OF_BINDING
  594. #define uuid_s_ok                       RPC_S_OK
  595. #define uuid_s_internal_error           RPC_S_INTERNAL_ERROR
  596. #define uuid_s_invalid_string_uuid      RPC_S_INVALID_STRING_UUID
  597. #define uuid_s_no_address               RPC_S_UUID_NO_ADDRESS
  598. /*
  599. ** DCE Exception mappings
  600. */
  601. #define rpc_x_comm_failure              RPC_S_COMM_FAILURE
  602. #define rpc_x_connect_no_resources      RPC_S_OUT_OF_RESOURCES
  603. #define rpc_x_entry_not_found           RPC_S_ENTRY_NOT_FOUND
  604. #define rpc_x_incomplete_name           RPC_S_INCOMPLETE_NAME
  605. #define rpc_x_invalid_arg               RPC_S_INVALID_ARG
  606. #define rpc_x_invalid_binding           RPC_S_INVALID_BINDING
  607. #define rpc_x_invalid_bound             RPC_X_INVALID_BOUND
  608. #define rpc_x_invalid_endpoint_format   RPC_S_INVALID_ENDPOINT_FORMAT
  609. #define rpc_x_invalid_naf_id            RPC_S_INVALID_NAF_IF
  610. #define rpc_x_invalid_name_syntax       RPC_S_INVALID_NAME_SYNTAX
  611. #define rpc_x_invalid_rpc_protseq       RPC_S_INVALID_RPC_PROTSEQ
  612. #define rpc_x_invalid_tag               RPC_X_INVALID_TAG
  613. #define rpc_x_invalid_timeout           RPC_S_INVALID_TIMEOUT
  614. #define rpc_x_no_memory                 RPC_X_NO_MEMORY
  615. #define rpc_x_object_not_found          RPC_S_OBJECT_NOT_FOUND
  616. #define rpc_x_protocol_error            RPC_S_PROTOCOL_ERROR
  617. #define rpc_x_protseq_not_supported     RPC_S_PROTSEQ_NOT_SUPPORTED
  618. #define rpc_x_server_too_busy           RPC_S_SERVER_TOO_BUSY
  619. #define rpc_x_ss_char_trans_open_fail   RPC_X_SS_CHAR_TRANS_OPEN_FAIL
  620. #define rpc_x_ss_char_trans_short_file  RPC_X_SS_CHAR_TRANS_SHORT_FILE
  621. #define rpc_x_ss_context_damaged        RPC_X_SS_CONTEXT_DAMAGED
  622. #define rpc_x_ss_context_mismatch       RPC_X_SS_CONTEXT_MISMATCH
  623. #define rpc_x_ss_in_null_context        RPC_X_SS_IN_NULL_CONTEXT
  624. #define rpc_x_string_too_long           RPC_S_STRING_TOO_LONG
  625. #define rpc_x_unknown_if                RPC_S_UNKNOWN_IF
  626. #define rpc_x_unknown_mgr_type          RPC_S_UNKNOWN_MGR_TYPE
  627. #define rpc_x_unsupported_name_syntax   RPC_S_UNSUPPORTED_NAME_SYNTAX
  628. #define rpc_x_unsupported_type          RPC_S_UNSUPPORTED_TYPE
  629. #define rpc_x_wrong_boot_time           RPC_S_CALL_FAILED_DNE
  630. #define rpc_x_wrong_kind_of_binding     RPC_S_WRONG_KIND_OF_BINDING
  631. #define uuid_x_internal_error           RPC_S_INTERNAL_ERROR
  632. #ifdef __cplusplus
  633. }
  634. #endif
  635. #endif /* DCEPORT_H */