3
// Test RPC to server, with PING message, which exists for no other purpose than this test.
10
#include "cci_debugging.h"
11
#include "CredentialsCache.h"
12
#include "cci_stream.h"
13
#include "win-utils.h"
15
#include "ccs_request.h"
16
#define CLIENT_REQUEST_RPC_HANDLE ccs_request_IfHandle
19
extern cc_int32 cci_os_ipc_thread_init (void);
20
extern cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server,
21
cci_stream_t in_request_stream,
23
cci_stream_t* out_reply_stream);
25
static DWORD dwTlsIndex;
27
DWORD GetTlsIndex() {return dwTlsIndex;}
29
RPC_STATUS send_test(char* endpoint) {
30
unsigned char* pszNetworkAddress = NULL;
31
unsigned char* pszOptions = NULL;
32
unsigned char* pszStringBinding = NULL;
33
unsigned char* pszUuid = NULL;
36
status = RpcStringBindingCompose(pszUuid,
39
(unsigned char*)endpoint,
42
cci_debug_printf("%s pszStringBinding = %s", __FUNCTION__, pszStringBinding);
43
if (status) {return cci_check_error(status);}
45
/* Set the binding handle that will be used to bind to the RPC server [the 'client']. */
46
status = RpcBindingFromStringBinding(pszStringBinding, &CLIENT_REQUEST_RPC_HANDLE);
47
if (status) {return cci_check_error(status);}
49
status = RpcStringFree(&pszStringBinding); // Temp var no longer needed.
53
cci_debug_printf("%s calling remote procedure 'ccs_authenticate'", __FUNCTION__);
54
status = ccs_authenticate((CC_CHAR*)"DLLMAIN TEST!");
55
cci_debug_printf(" ccs_authenticate returned %d", status);
58
status = cci_check_error(RpcExceptionCode());
63
cci_check_error(RpcBindingFree(&CLIENT_REQUEST_RPC_HANDLE));
68
int main( int argc, char *argv[]) {
70
cc_context_t context = NULL;
71
cci_stream_t send_stream = NULL;
72
cci_stream_t reply_stream = NULL;
73
char* message = "Hello, RPC!";
76
if ((dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE;
78
// send_test("krbcc.229026.0.ep");
81
err = cc_initialize(&context, ccapi_version_7, NULL, NULL);
85
err = cci_os_ipc_thread_init();
88
err = cci_stream_new (&send_stream);
89
err = cci_stream_write(send_stream, message, 1+strlen(message));
93
err = cci_os_ipc_msg(TRUE, send_stream, CCMSG_PING, &reply_stream);
96
cci_debug_printf("Try finishing async call.");
99
cci_debug_printf("main: return. err == %d", err);
106
/*********************************************************************/
107
/* MIDL allocate and free */
108
/*********************************************************************/
110
void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) {
114
void __RPC_USER midl_user_free(void __RPC_FAR * ptr) {