libwinpr-rpc: initial commit

This commit is contained in:
Marc-André Moreau 2012-05-04 18:32:34 -04:00
parent 95b6e2e04b
commit be1e7f8291
13 changed files with 190 additions and 50 deletions

View File

@ -160,6 +160,8 @@ add_subdirectory(libfreerdp-channels)
add_subdirectory(libfreerdp-locale)
add_subdirectory(libfreerdp-core)
add_subdirectory(libwinpr-rpc)
if(NOT WIN32)
add_subdirectory(channels)
endif()

28
include/winpr/midl.h Normal file
View File

@ -0,0 +1,28 @@
/**
* WinPR: Windows Portable Runtime
* Microsoft Remote Procedure Call (MSRPC)
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_RPC_MIDL_H
#define WINPR_RPC_MIDL_H
#include <winpr/rpc.h>
WINPR_API void* MIDL_user_allocate(size_t cBytes);
WINPR_API void MIDL_user_free(void* p);
#endif /* WINPR_RPC_MIDL_H */

View File

@ -1,5 +1,5 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* WinPR: Windows Portable Runtime
* Network Data Representation (NDR)
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
@ -17,17 +17,13 @@
* limitations under the License.
*/
#ifndef FREERDP_CORE_NDR_H
#define FREERDP_CORE_NDR_H
#include "rpc.h"
#ifndef WINPR_RPC_NDR_H
#define WINPR_RPC_NDR_H
#include "config.h"
#include <freerdp/types.h>
#include <winpr/rpc.h>
#include <freerdp/wtypes.h>
#include <freerdp/utils/debug.h>
#include <freerdp/utils/stream.h>
#define __RPC_WIN32__ 1
#define TARGET_IS_NT50_OR_LATER 1
@ -526,9 +522,6 @@ typedef enum _NDR_PHASE
#define NdrFcLong(s) (byte)(s & 0xFF), (byte)((s & 0x0000FF00) >> 8), \
(byte)((s & 0x00FF0000) >> 16), (byte)(s >> 24)
CLIENT_CALL_RETURN NdrClientCall2(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ...);
WINPR_API CLIENT_CALL_RETURN RPC_VAR_ENTRY NdrClientCall2(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ...);
void* MIDL_user_allocate(size_t cBytes);
void MIDL_user_free(void* p);
#endif /* FREERDP_CORE_NDR_H */
#endif /* WINPR_RPC_NDR_H */

46
include/winpr/rpc.h Normal file
View File

@ -0,0 +1,46 @@
/**
* WinPR: Windows Portable Runtime
* Microsoft Remote Procedure Call (MSRPC)
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_RPC_H
#define WINPR_RPC_H
#include <freerdp/api.h>
#include <freerdp/wtypes.h>
#define RPC_VAR_ENTRY __cdecl
#define WINPR_API FREERDP_API
typedef long RPC_STATUS;
typedef void* I_RPC_HANDLE;
typedef I_RPC_HANDLE RPC_BINDING_HANDLE;
typedef RPC_BINDING_HANDLE handle_t;
typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE;
typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_SERIALIZE;
typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE;
typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_SERIALIZE;
void RpcRaiseException(RPC_STATUS exception);
#include <winpr/ndr.h>
#include <winpr/midl.h>
#endif /* WINPR_RPC_H */

View File

@ -41,8 +41,6 @@ set(LIBFREERDP_CORE_SRCS
rpc.h
rts.c
rts.h
ndr.c
ndr.h
input.c
input.h
license.c
@ -111,5 +109,7 @@ target_link_libraries(freerdp-core freerdp-sspi)
target_link_libraries(freerdp-core freerdp-locale)
target_link_libraries(freerdp-core ${OPENSSL_LIBRARIES})
target_link_libraries(freerdp-core winpr-rpc)
install(TARGETS freerdp-core DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -29,11 +29,6 @@
#include "rpc.h"
void RpcRaiseException(RPC_STATUS exception)
{
printf("RpcRaiseException: 0x%08X\n", exception);
}
#define NTLM_PACKAGE_NAME _T("NTLM")
boolean ntlm_client_init(rdpNtlm* ntlm, boolean confidentiality, char* user, char* domain, char* password)

View File

@ -42,8 +42,6 @@ typedef struct rdp_ntlm_http rdpNtlmHttp;
#include <freerdp/utils/memory.h>
#include <freerdp/utils/hexdump.h>
typedef long RPC_STATUS;
struct _rpc_pdu_header
{
uint8 rpc_vers;
@ -666,8 +664,6 @@ struct rdp_rpc
RpcVirtualConnection* VirtualConnection;
};
void RpcRaiseException(RPC_STATUS exception);
boolean ntlm_authenticate(rdpNtlm* ntlm);
boolean ntlm_client_init(rdpNtlm* ntlm, boolean confidentiality, char* user, char* domain, char* password);

View File

@ -29,7 +29,7 @@
#include <freerdp/utils/hexdump.h>
#include <freerdp/utils/unicode.h>
#include "ndr.h"
#include <winpr/ndr.h>
#include "tsg.h"

View File

@ -23,8 +23,10 @@
typedef struct rdp_tsg rdpTsg;
#include "transport.h"
#include "rpc.h"
#include "transport.h"
#include <winpr/rpc.h>
#include <time.h>
#include <freerdp/types.h>
@ -43,16 +45,6 @@ struct rdp_tsg
uint8 ChannelContext[16];
};
typedef void* I_RPC_HANDLE;
typedef I_RPC_HANDLE RPC_BINDING_HANDLE;
typedef RPC_BINDING_HANDLE handle_t;
typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE;
typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_SERIALIZE;
typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE;
typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_SERIALIZE;
typedef wchar_t* RESOURCENAME;
#define MAX_RESOURCE_NAMES 50

View File

@ -0,0 +1,40 @@
# WinPR: Windows Portable Runtime
# libwinpr-rpc cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(WINPR_RPC_SRCS
rpc.c
ndr.c
midl.c)
add_library(winpr-rpc ${WINPR_RPC_SRCS})
include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${ZLIB_INCLUDE_DIRS})
set_target_properties(winpr-rpc PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
if(WIN32)
target_link_libraries(winpr-rpc ws2_32)
else()
target_link_libraries(winpr-rpc ${ZLIB_LIBRARIES})
endif()
target_link_libraries(winpr-rpc ${OPENSSL_LIBRARIES})
install(TARGETS winpr-rpc DESTINATION ${CMAKE_INSTALL_LIBDIR})

33
libwinpr-rpc/midl.c Normal file
View File

@ -0,0 +1,33 @@
/**
* WinPR: Windows Portable Runtime
* Microsoft Remote Procedure Call (MSRPC)
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdlib.h>
#include <winpr/midl.h>
void* MIDL_user_allocate(size_t cBytes)
{
return (malloc(cBytes));
}
void MIDL_user_free(void* p)
{
free(p);
}

View File

@ -1,5 +1,5 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* WinPR: Windows Portable Runtime
* Network Data Representation (NDR)
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
@ -17,9 +17,7 @@
* limitations under the License.
*/
#include <freerdp/utils/memory.h>
#include "ndr.h"
#include <winpr/ndr.h>
/**
* MSRPC NDR Types Technical Overview:
@ -1976,13 +1974,3 @@ CLIENT_CALL_RETURN NdrClientCall2(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRIN
return client_call_return;
}
void* MIDL_user_allocate(size_t cBytes)
{
return (xmalloc(cBytes));
}
void MIDL_user_free(void* p)
{
xfree(p);
}

27
libwinpr-rpc/rpc.c Normal file
View File

@ -0,0 +1,27 @@
/**
* WinPR: Windows Portable Runtime
* Microsoft Remote Procedure Call (MSRPC)
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <winpr/rpc.h>
void RpcRaiseException(RPC_STATUS exception)
{
printf("RpcRaiseException: 0x%08X\n", exception);
}