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 "win-utils.h"
14 #include "ccs_request.h"
15 #define CLIENT_REQUEST_RPC_HANDLE ccs_request_IfHandle
18 extern cc_int32 cci_os_ipc_thread_init (void);
19 extern cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server,
20 k5_ipc_stream in_request_stream,
22 k5_ipc_stream* out_reply_stream);
24 static DWORD dwTlsIndex;
26 DWORD GetTlsIndex() {return dwTlsIndex;}
28 RPC_STATUS send_test(char* endpoint) {
29 unsigned char* pszNetworkAddress = NULL;
30 unsigned char* pszOptions = NULL;
31 unsigned char* pszStringBinding = NULL;
32 unsigned char* pszUuid = NULL;
35 status = RpcStringBindingCompose(pszUuid,
38 (unsigned char*)endpoint,
41 cci_debug_printf("%s pszStringBinding = %s", __FUNCTION__, pszStringBinding);
42 if (status) {return cci_check_error(status);}
44 /* Set the binding handle that will be used to bind to the RPC server [the 'client']. */
45 status = RpcBindingFromStringBinding(pszStringBinding, &CLIENT_REQUEST_RPC_HANDLE);
46 if (status) {return cci_check_error(status);}
48 status = RpcStringFree(&pszStringBinding); // Temp var no longer needed.
52 cci_debug_printf("%s calling remote procedure 'ccs_authenticate'", __FUNCTION__);
53 status = ccs_authenticate((CC_CHAR*)"DLLMAIN TEST!");
54 cci_debug_printf(" ccs_authenticate returned %d", status);
57 status = cci_check_error(RpcExceptionCode());
62 cci_check_error(RpcBindingFree(&CLIENT_REQUEST_RPC_HANDLE));
67 int main( int argc, char *argv[]) {
69 cc_context_t context = NULL;
70 k5_ipc_stream send_stream = NULL;
71 k5_ipc_stream reply_stream = NULL;
72 char* message = "Hello, RPC!";
75 if ((dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE;
77 // send_test("krbcc.229026.0.ep");
80 err = cc_initialize(&context, ccapi_version_7, NULL, NULL);
84 err = cci_os_ipc_thread_init();
87 err = krb5int_ipc_stream_new (&send_stream);
88 err = krb5int_ipc_stream_write(send_stream, 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) {