Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenrpc_async.c
Go to the documentation of this file.
00001 /* 00002 * Asynchronous Call Support Functions 00003 * 00004 * Copyright 2007 Robert Shearman (for CodeWeavers) 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 * 00020 */ 00021 00022 #include <stdarg.h> 00023 00024 #include "rpc.h" 00025 #include "rpcndr.h" 00026 #include "rpcasync.h" 00027 00028 #include "wine/debug.h" 00029 00030 #include "rpc_binding.h" 00031 #include "rpc_message.h" 00032 #include "ndr_stubless.h" 00033 00034 WINE_DEFAULT_DEBUG_CHANNEL(rpc); 00035 00036 #define RPC_ASYNC_SIGNATURE 0x43595341 00037 00038 static inline BOOL valid_async_handle(PRPC_ASYNC_STATE pAsync) 00039 { 00040 return pAsync->Signature == RPC_ASYNC_SIGNATURE; 00041 } 00042 00043 /*********************************************************************** 00044 * RpcAsyncInitializeHandle [RPCRT4.@] 00045 * 00046 * Initialises an asynchronous state so it can be used in other asynchronous 00047 * functions and for use in asynchronous calls. 00048 * 00049 * PARAMS 00050 * pAsync [I] Asynchronous state to initialise. 00051 * Size [I] Size of the memory pointed to by pAsync. 00052 * 00053 * RETURNS 00054 * Success: RPC_S_OK. 00055 * Failure: Any error code. 00056 */ 00057 RPC_STATUS WINAPI RpcAsyncInitializeHandle(PRPC_ASYNC_STATE pAsync, unsigned int Size) 00058 { 00059 TRACE("(%p, %d)\n", pAsync, Size); 00060 00061 if (Size != sizeof(*pAsync)) 00062 { 00063 ERR("invalid Size %d\n", Size); 00064 return ERROR_INVALID_PARAMETER; 00065 } 00066 00067 pAsync->Size = sizeof(*pAsync); 00068 pAsync->Signature = RPC_ASYNC_SIGNATURE; 00069 pAsync->Lock = 0; 00070 pAsync->Flags = 0; 00071 pAsync->StubInfo = NULL; 00072 pAsync->RuntimeInfo = NULL; 00073 memset(pAsync->Reserved, 0, sizeof(*pAsync) - FIELD_OFFSET(RPC_ASYNC_STATE, Reserved)); 00074 00075 return RPC_S_OK; 00076 } 00077 00078 /*********************************************************************** 00079 * RpcAsyncGetCallStatus [RPCRT4.@] 00080 * 00081 * Retrieves the current status of the asynchronous call taking place. 00082 * 00083 * PARAMS 00084 * pAsync [I] Asynchronous state to initialise. 00085 * 00086 * RETURNS 00087 * RPC_S_OK - The call was successfully completed. 00088 * RPC_S_INVALID_ASYNC_HANDLE - The asynchronous structure is not valid. 00089 * RPC_S_ASYNC_CALL_PENDING - The call is still in progress and has not been completed. 00090 * Any other error code - The call failed. 00091 */ 00092 RPC_STATUS WINAPI RpcAsyncGetCallStatus(PRPC_ASYNC_STATE pAsync) 00093 { 00094 FIXME("(%p): stub\n", pAsync); 00095 return RPC_S_INVALID_ASYNC_HANDLE; 00096 } 00097 00098 /*********************************************************************** 00099 * RpcAsyncCompleteCall [RPCRT4.@] 00100 * 00101 * Completes a client or server asynchronous call. 00102 * 00103 * PARAMS 00104 * pAsync [I] Asynchronous state to initialise. 00105 * Reply [I] The return value of the asynchronous function. 00106 * 00107 * RETURNS 00108 * Success: RPC_S_OK. 00109 * Failure: Any error code. 00110 */ 00111 RPC_STATUS WINAPI RpcAsyncCompleteCall(PRPC_ASYNC_STATE pAsync, void *Reply) 00112 { 00113 TRACE("(%p, %p)\n", pAsync, Reply); 00114 00115 if (!valid_async_handle(pAsync)) 00116 return RPC_S_INVALID_ASYNC_HANDLE; 00117 00118 /* FIXME: check completed */ 00119 00120 return NdrpCompleteAsyncClientCall(pAsync, Reply); 00121 } 00122 00123 /*********************************************************************** 00124 * RpcAsyncAbortCall [RPCRT4.@] 00125 * 00126 * Aborts the asynchronous server call taking place. 00127 * 00128 * PARAMS 00129 * pAsync [I] Asynchronous server state to abort. 00130 * ExceptionCode [I] Exception code to return to the client in a fault packet. 00131 * 00132 * RETURNS 00133 * Success: RPC_S_OK. 00134 * Failure: Any error code. 00135 */ 00136 RPC_STATUS WINAPI RpcAsyncAbortCall(PRPC_ASYNC_STATE pAsync, ULONG ExceptionCode) 00137 { 00138 FIXME("(%p, %d/0x%x): stub\n", pAsync, ExceptionCode, ExceptionCode); 00139 return RPC_S_INVALID_ASYNC_HANDLE; 00140 } 00141 00142 /*********************************************************************** 00143 * RpcAsyncCancelCall [RPCRT4.@] 00144 * 00145 * Cancels the asynchronous client call taking place. 00146 * 00147 * PARAMS 00148 * pAsync [I] Asynchronous client state to abort. 00149 * fAbortCall [I] If TRUE, then send a cancel to the server, otherwise 00150 * just wait for the call to complete. 00151 * 00152 * RETURNS 00153 * Success: RPC_S_OK. 00154 * Failure: Any error code. 00155 */ 00156 RPC_STATUS WINAPI RpcAsyncCancelCall(PRPC_ASYNC_STATE pAsync, BOOL fAbortCall) 00157 { 00158 FIXME("(%p, %s): stub\n", pAsync, fAbortCall ? "TRUE" : "FALSE"); 00159 return RPC_S_INVALID_ASYNC_HANDLE; 00160 } Generated on Sun May 27 2012 04:26:03 for ReactOS by
1.7.6.1
|