summaryrefslogtreecommitdiffstats
path: root/src/ccapi/test/pingtest.c
diff options
context:
space:
mode:
authorKevin Koch <kpkoch@mit.edu>2008-01-22 19:14:04 +0000
committerKevin Koch <kpkoch@mit.edu>2008-01-22 19:14:04 +0000
commit7bfff83859f4bfb254c659dc0caa529735fd2507 (patch)
tree0a9f78c9ae794e3f98616b7d7f9cc59825aef216 /src/ccapi/test/pingtest.c
parentfaf9366d3111f171e157b1e45ba7b49d5a529903 (diff)
downloadkrb5-7bfff83859f4bfb254c659dc0caa529735fd2507.tar.gz
krb5-7bfff83859f4bfb254c659dc0caa529735fd2507.tar.xz
krb5-7bfff83859f4bfb254c659dc0caa529735fd2507.zip
Windows CCAPI snapshot. Should build & pass ping test
TargetVersion: 1.7 Component: krb5-libs Ticket: 5594 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20203 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi/test/pingtest.c')
-rw-r--r--src/ccapi/test/pingtest.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/ccapi/test/pingtest.c b/src/ccapi/test/pingtest.c
new file mode 100644
index 0000000000..9927725864
--- /dev/null
+++ b/src/ccapi/test/pingtest.c
@@ -0,0 +1,108 @@
+// pingtest.c
+//
+// Test RPC to server, with PING message, which exists for no other purpose than this test.
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "cci_debugging.h"
+#include "CredentialsCache.h"
+#include "cci_stream.h"
+#include "win-utils.h"
+
+#include "ccs_request.h"
+#define CLIENT_REQUEST_RPC_HANDLE ccs_request_IfHandle
+
+
+extern cc_int32 cci_os_ipc_thread_init (void);
+extern cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server,
+ cci_stream_t in_request_stream,
+ cc_int32 in_msg,
+ cci_stream_t* out_reply_stream);
+
+RPC_STATUS send_test(char* endpoint) {
+ unsigned char* pszNetworkAddress = NULL;
+ unsigned char* pszOptions = NULL;
+ unsigned char* pszStringBinding = NULL;
+ unsigned char* pszUuid = NULL;
+ RPC_STATUS status;
+
+ status = RpcStringBindingCompose(pszUuid,
+ (RPC_CSTR)"ncalrpc",
+ pszNetworkAddress,
+ (unsigned char*)endpoint,
+ pszOptions,
+ &pszStringBinding);
+ cci_debug_printf("%s pszStringBinding = %s", __FUNCTION__, pszStringBinding);
+ if (status) {return cci_check_error(status);}
+
+ /* Set the binding handle that will be used to bind to the RPC server [the 'client']. */
+ status = RpcBindingFromStringBinding(pszStringBinding, &CLIENT_REQUEST_RPC_HANDLE);
+ if (status) {return cci_check_error(status);}
+
+ status = RpcStringFree(&pszStringBinding); // Temp var no longer needed.
+
+ if (!status) {
+ RpcTryExcept {
+ cci_debug_printf("%s calling remote procedure 'ccs_authenticate'", __FUNCTION__);
+ status = ccs_authenticate((CC_CHAR*)"DLLMAIN TEST!");
+ cci_debug_printf(" ccs_authenticate returned %d", status);
+ }
+ RpcExcept(1) {
+ status = cci_check_error(RpcExceptionCode());
+ }
+ RpcEndExcept
+ }
+
+ cci_check_error(RpcBindingFree(&CLIENT_REQUEST_RPC_HANDLE));
+
+ return (status);
+ }
+
+int main( int argc, char *argv[]) {
+ cc_int32 err = 0;
+ cc_context_t context = NULL;
+ cci_stream_t send_stream = NULL;
+ cci_stream_t reply_stream = NULL;
+ char* message = "Hello, RPC!";
+
+
+// send_test("krbcc.229026.0.ep");
+
+#if 0
+ err = cc_initialize(&context, ccapi_version_7, NULL, NULL);
+#endif
+
+ if (!err) {
+ err = cci_os_ipc_thread_init();
+ }
+ if (!err) {
+ err = cci_stream_new (&send_stream);
+ err = cci_stream_write(send_stream, message, 1+strlen(message));
+ }
+
+ if (!err) {
+ err = cci_os_ipc_msg(TRUE, send_stream, CCMSG_PING, &reply_stream);
+ }
+ Sleep(10*1000);
+ cci_debug_printf("Try finishing async call.");
+
+ Sleep(INFINITE);
+ cci_debug_printf("main: return. err == %d", err);
+
+ return 0;
+ }
+
+
+
+/*********************************************************************/
+/* MIDL allocate and free */
+/*********************************************************************/
+
+void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) {
+ return(malloc(len));
+ }
+
+void __RPC_USER midl_user_free(void __RPC_FAR * ptr) {
+ free(ptr);
+ }