-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#include <windows.h>\r
-\r
-#include "cci_debugging.h"\r
-#include "util.h"\r
-\r
-BOOL isNT() {\r
- OSVERSIONINFO osvi;\r
- DWORD status = 0;\r
- BOOL bSupportedVersion = FALSE;\r
- BOOL bIsNT = FALSE;\r
-\r
- memset(&osvi, 0, sizeof(osvi));\r
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);\r
-\r
- status = !GetVersionEx(&osvi); // Returns a boolean. Invert to 0 is OK.\r
-\r
- if (!status) {\r
- switch(osvi.dwPlatformId) {\r
- case VER_PLATFORM_WIN32_WINDOWS:\r
- bIsNT = FALSE;\r
- bSupportedVersion = TRUE;\r
- break;\r
- case VER_PLATFORM_WIN32_NT:\r
- bIsNT = TRUE;\r
- bSupportedVersion = TRUE;\r
- break;\r
- case VER_PLATFORM_WIN32s:\r
- default:\r
- bIsNT = FALSE;\r
- break;\r
- }\r
- \r
- if (!bSupportedVersion) {\r
- cci_debug_printf("%s Running on an unsupported version of Windows", __FUNCTION__);\r
- status = 1;\r
- }\r
- }\r
-\r
- return (!status && bIsNT && bSupportedVersion);\r
- }\r
-\r
-char* allocEventName(char* uuid_string, char* suffix) {\r
- LPSTR event_name = NULL;\r
- cc_int32 err = ccNoError;\r
-\r
- event_name = malloc(strlen(uuid_string) + strlen(suffix) + 3);\r
- if (!event_name) err = cci_check_error(ccErrNoMem);\r
-\r
- if (!err) {\r
- strcpy(event_name, uuid_string);\r
- strcat(event_name, "_");\r
- strcat(event_name, suffix);\r
- }\r
-\r
- return event_name;\r
- }\r
-\r
-HANDLE createThreadEvent(char* uuid, char* suffix) {\r
- LPSTR event_name = NULL;\r
- HANDLE hEvent = NULL;\r
- PSECURITY_ATTRIBUTES psa = 0; // Everything having to do with\r
- SECURITY_ATTRIBUTES sa = { 0 }; // sa, psa, security is copied\r
- DWORD status = 0; // from the previous implementation.\r
-\r
- psa = isNT() ? &sa : 0;\r
-\r
- if (isNT()) {\r
- sa.nLength = sizeof(sa);\r
- status = alloc_own_security_descriptor_NT(&sa.lpSecurityDescriptor);\r
- cci_check_error(status);\r
- }\r
-\r
- if (!status) {\r
- event_name = allocEventName(uuid, suffix);\r
- if (!event_name) status = cci_check_error(ccErrNoMem);\r
- }\r
- cci_debug_printf("%s event_name:%s", __FUNCTION__, event_name);\r
- \r
- if (!status) {\r
- hEvent = CreateEvent(psa, FALSE, FALSE, event_name);\r
- if (!hEvent) status = cci_check_error(GetLastError());\r
- }\r
-\r
- if (!status) ResetEvent(hEvent);\r
-\r
- \r
- if (event_name) free(event_name);\r
- if (isNT()) free(sa.lpSecurityDescriptor);\r
-\r
- return hEvent;\r
- }\r
-\r
-HANDLE openThreadEvent(char* uuid, char* suffix) {\r
- LPSTR event_name = NULL;\r
- HANDLE hEvent = NULL;\r
- DWORD status = 0;\r
-\r
- event_name = allocEventName(uuid, suffix);\r
- if (!event_name) status = cci_check_error(ccErrNoMem);\r
- cci_debug_printf("%s event_name:%s", __FUNCTION__, event_name);\r
-\r
- if (!status) {\r
- hEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, event_name);\r
- if (!hEvent) status = cci_check_error(GetLastError());\r
- }\r
-\r
- if (event_name) free(event_name);\r
-\r
- return hEvent;\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#include <windows.h>
+
+#include "cci_debugging.h"
+#include "util.h"
+
+BOOL isNT() {
+ OSVERSIONINFO osvi;
+ DWORD status = 0;
+ BOOL bSupportedVersion = FALSE;
+ BOOL bIsNT = FALSE;
+
+ memset(&osvi, 0, sizeof(osvi));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+
+ status = !GetVersionEx(&osvi); // Returns a boolean. Invert to 0 is OK.
+
+ if (!status) {
+ switch(osvi.dwPlatformId) {
+ case VER_PLATFORM_WIN32_WINDOWS:
+ bIsNT = FALSE;
+ bSupportedVersion = TRUE;
+ break;
+ case VER_PLATFORM_WIN32_NT:
+ bIsNT = TRUE;
+ bSupportedVersion = TRUE;
+ break;
+ case VER_PLATFORM_WIN32s:
+ default:
+ bIsNT = FALSE;
+ break;
+ }
+
+ if (!bSupportedVersion) {
+ cci_debug_printf("%s Running on an unsupported version of Windows", __FUNCTION__);
+ status = 1;
+ }
+ }
+
+ return (!status && bIsNT && bSupportedVersion);
+ }
+
+char* allocEventName(char* uuid_string, char* suffix) {
+ LPSTR event_name = NULL;
+ cc_int32 err = ccNoError;
+
+ event_name = malloc(strlen(uuid_string) + strlen(suffix) + 3);
+ if (!event_name) err = cci_check_error(ccErrNoMem);
+
+ if (!err) {
+ strcpy(event_name, uuid_string);
+ strcat(event_name, "_");
+ strcat(event_name, suffix);
+ }
+
+ return event_name;
+ }
+
+HANDLE createThreadEvent(char* uuid, char* suffix) {
+ LPSTR event_name = NULL;
+ HANDLE hEvent = NULL;
+ PSECURITY_ATTRIBUTES psa = 0; // Everything having to do with
+ SECURITY_ATTRIBUTES sa = { 0 }; // sa, psa, security is copied
+ DWORD status = 0; // from the previous implementation.
+
+ psa = isNT() ? &sa : 0;
+
+ if (isNT()) {
+ sa.nLength = sizeof(sa);
+ status = alloc_own_security_descriptor_NT(&sa.lpSecurityDescriptor);
+ cci_check_error(status);
+ }
+
+ if (!status) {
+ event_name = allocEventName(uuid, suffix);
+ if (!event_name) status = cci_check_error(ccErrNoMem);
+ }
+ cci_debug_printf("%s event_name:%s", __FUNCTION__, event_name);
+
+ if (!status) {
+ hEvent = CreateEvent(psa, FALSE, FALSE, event_name);
+ if (!hEvent) status = cci_check_error(GetLastError());
+ }
+
+ if (!status) ResetEvent(hEvent);
+
+
+ if (event_name) free(event_name);
+ if (isNT()) free(sa.lpSecurityDescriptor);
+
+ return hEvent;
+ }
+
+HANDLE openThreadEvent(char* uuid, char* suffix) {
+ LPSTR event_name = NULL;
+ HANDLE hEvent = NULL;
+ DWORD status = 0;
+
+ event_name = allocEventName(uuid, suffix);
+ if (!event_name) status = cci_check_error(ccErrNoMem);
+ cci_debug_printf("%s event_name:%s", __FUNCTION__, event_name);
+
+ if (!status) {
+ hEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, event_name);
+ if (!hEvent) status = cci_check_error(GetLastError());
+ }
+
+ if (event_name) free(event_name);
+
+ return hEvent;
}
\ No newline at end of file
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#ifndef __CCUTILS_H__\r
-#define __CCUTILS_H__\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-#if 0\r
-}\r
-#endif\r
-\r
-#define REPLY_SUFFIX (char*)"reply"\r
-#define LISTEN_SUFFIX (char*)"listen"\r
-\r
-BOOL isNT();\r
-char* allocEventName (char* uuid, char* suffix);\r
-HANDLE createThreadEvent(char* uuid, char* suffix);\r
-HANDLE openThreadEvent (char* uuid, char* suffix);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* __CCUTILS_H__ */\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#ifndef __CCUTILS_H__
+#define __CCUTILS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+#define REPLY_SUFFIX (char*)"reply"
+#define LISTEN_SUFFIX (char*)"listen"
+
+BOOL isNT();
+char* allocEventName (char* uuid, char* suffix);
+HANDLE createThreadEvent(char* uuid, char* suffix);
+HANDLE openThreadEvent (char* uuid, char* suffix);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CCUTILS_H__ */
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#pragma once\r
-\r
-#ifdef _WIN64\r
-#define CCAPI_MODULE "krbcc64"\r
-#else\r
-#define CCAPI_MODULE "krbcc32"\r
-#endif\r
-#define CCAPI_DLL CCAPI_MODULE ".dll"\r
-#define CCAPI_EXE CCAPI_MODULE "s.exe"\r
-\r
-#define CCAPI_DLL "ccapi.dll"\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#pragma once
+
+#ifdef _WIN64
+#define CCAPI_MODULE "krbcc64"
+#else
+#define CCAPI_MODULE "krbcc32"
+#endif
+#define CCAPI_DLL CCAPI_MODULE ".dll"
+#define CCAPI_EXE CCAPI_MODULE "s.exe"
+
+#define CCAPI_DLL "ccapi.dll"
#define CCAPI_EXE "ccapiserver.exe"
\ No newline at end of file
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#ifndef __UTIL_H__\r
-#define __UTIL_H__\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-#if 0\r
-}\r
-#endif\r
-\r
-BOOL isNT();\r
-\r
-void*\r
-user_allocate(\r
- size_t size\r
- );\r
-\r
-void\r
-user_free(\r
- void* ptr\r
- );\r
-\r
-void\r
-free_alloc_p(\r
- void* pptr\r
- );\r
-\r
-DWORD\r
-alloc_name(\r
- LPSTR* pname,\r
- LPSTR postfix,\r
- BOOL isNT\r
- );\r
-\r
-DWORD\r
-alloc_own_security_descriptor_NT(\r
- PSECURITY_DESCRIPTOR* ppsd\r
- );\r
-\r
-DWORD\r
-alloc_module_dir_name(\r
- char* module,\r
- char** pname\r
- );\r
-\r
-DWORD\r
-alloc_module_dir_name_with_file(\r
- char* module,\r
- char* file,\r
- char** pname\r
- );\r
-\r
-DWORD alloc_cmdline_2_args(\r
- char* prog,\r
- char* arg1,\r
- char* arg2,\r
- char** pname);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* __UTIL_H__ */\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#ifndef __UTIL_H__
+#define __UTIL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+BOOL isNT();
+
+void*
+user_allocate(
+ size_t size
+ );
+
+void
+user_free(
+ void* ptr
+ );
+
+void
+free_alloc_p(
+ void* pptr
+ );
+
+DWORD
+alloc_name(
+ LPSTR* pname,
+ LPSTR postfix,
+ BOOL isNT
+ );
+
+DWORD
+alloc_own_security_descriptor_NT(
+ PSECURITY_DESCRIPTOR* ppsd
+ );
+
+DWORD
+alloc_module_dir_name(
+ char* module,
+ char** pname
+ );
+
+DWORD
+alloc_module_dir_name_with_file(
+ char* module,
+ char* file,
+ char** pname
+ );
+
+DWORD alloc_cmdline_2_args(
+ char* prog,
+ char* arg1,
+ char* arg2,
+ char** pname);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UTIL_H__ */
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#include <stdio.h> \r
-#include <stdarg.h>\r
-\r
-#include "cci_os_debugging.h"\r
-#include "win-utils.h"\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-void cci_os_debug_vprintf (const char *in_format, va_list in_args) {\r
- printf ( "%s %ld ", timestamp(), GetCurrentThreadId() );\r
- vprintf ( in_format, in_args );\r
- printf ( "\n" );\r
- }\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "cci_os_debugging.h"
+#include "win-utils.h"
+
+/* ------------------------------------------------------------------------ */
+
+void cci_os_debug_vprintf (const char *in_format, va_list in_args) {
+ printf ( "%s %ld ", timestamp(), GetCurrentThreadId() );
+ vprintf ( in_format, in_args );
+ printf ( "\n" );
+ }
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#include "cci_common.h"\r
-#include "cci_os_identifier.h"\r
-\r
-#include <rpc.h>\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-cc_int32 cci_os_identifier_new_uuid (cci_uuid_string_t *out_uuid_string) {\r
- cc_int32 err = ccNoError;\r
- UUID uuid;\r
- char* uuidStringTemp;\r
-\r
- err = UuidCreate(&uuid);\r
-\r
- if (!err) {\r
- err = UuidToString(&uuid, &uuidStringTemp);\r
- }\r
-\r
- if (!err) {\r
- *out_uuid_string = malloc(1+strlen(uuidStringTemp));\r
-\r
- if (*out_uuid_string) {\r
- strcpy(*out_uuid_string, uuidStringTemp);\r
- }\r
-\r
- RpcStringFree(&uuidStringTemp);\r
- }\r
-\r
- cci_debug_printf("cci_os_identifier_new_uuid returning %s", *out_uuid_string);\r
-\r
- return cci_check_error (err);\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#include "cci_common.h"
+#include "cci_os_identifier.h"
+
+#include <rpc.h>
+
+/* ------------------------------------------------------------------------ */
+
+cc_int32 cci_os_identifier_new_uuid (cci_uuid_string_t *out_uuid_string) {
+ cc_int32 err = ccNoError;
+ UUID uuid;
+ char* uuidStringTemp;
+
+ err = UuidCreate(&uuid);
+
+ if (!err) {
+ err = UuidToString(&uuid, &uuidStringTemp);
+ }
+
+ if (!err) {
+ *out_uuid_string = malloc(1+strlen(uuidStringTemp));
+
+ if (*out_uuid_string) {
+ strcpy(*out_uuid_string, uuidStringTemp);
+ }
+
+ RpcStringFree(&uuidStringTemp);
+ }
+
+ cci_debug_printf("cci_os_identifier_new_uuid returning %s", *out_uuid_string);
+
+ return cci_check_error (err);
}
\ No newline at end of file
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#include "string.h"\r
-\r
-#include "tls.h"\r
-\r
-struct tspdata* new_tspdata(char* uuid, time_t sst) {\r
- struct tspdata* p = (struct tspdata*)malloc(sizeof(struct tspdata));\r
- if (p) {\r
- memset(p, 0, sizeof(struct tspdata));\r
- p->_sst = sst;\r
- if (uuid) {strncpy(p->_uuid, uuid, UUID_SIZE-1);}\r
- }\r
- return p;\r
- }\r
-\r
-void delete_tspdata(struct tspdata* p) {\r
- if (p) free(p);\r
- }\r
-\r
-void tspdata_setUUID(struct tspdata* p, unsigned char __RPC_FAR* uuidString) {\r
- strncpy(p->_uuid, uuidString, UUID_SIZE-1);\r
- };\r
-\r
-void tspdata_setConnected (struct tspdata* p, BOOL b) {p->_CCAPI_Connected = b;}\r
-\r
-void tspdata_setReplyEvent(struct tspdata* p, HANDLE h) {p->_replyEvent = h;}\r
-\r
-void tspdata_setRpcAState (struct tspdata* p, RPC_ASYNC_STATE* rpcState) {\r
- p->_rpcState = rpcState;}\r
-\r
-void tspdata_setSST (struct tspdata* p, time_t t) {p->_sst = t;}\r
-\r
-void tspdata_setStream (struct tspdata* p, cci_stream_t s) {p->_stream = s;}\r
-\r
-\r
-BOOL tspdata_getConnected (struct tspdata* p) {return p->_CCAPI_Connected;}\r
-\r
-HANDLE tspdata_getReplyEvent(struct tspdata* p) {return p->_replyEvent;}\r
-\r
-time_t tspdata_getSST (const struct tspdata* p) {return p->_sst;}\r
-\r
-cci_stream_t tspdata_getStream (const struct tspdata* p) {return p->_stream;}\r
-\r
-char* tspdata_getUUID (const struct tspdata* p) {return p->_uuid;}\r
-\r
-RPC_ASYNC_STATE* tspdata_getRpcAState (const struct tspdata* p) {return p->_rpcState;}\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#include "string.h"
+
+#include "tls.h"
+
+struct tspdata* new_tspdata(char* uuid, time_t sst) {
+ struct tspdata* p = (struct tspdata*)malloc(sizeof(struct tspdata));
+ if (p) {
+ memset(p, 0, sizeof(struct tspdata));
+ p->_sst = sst;
+ if (uuid) {strncpy(p->_uuid, uuid, UUID_SIZE-1);}
+ }
+ return p;
+ }
+
+void delete_tspdata(struct tspdata* p) {
+ if (p) free(p);
+ }
+
+void tspdata_setUUID(struct tspdata* p, unsigned char __RPC_FAR* uuidString) {
+ strncpy(p->_uuid, uuidString, UUID_SIZE-1);
+ };
+
+void tspdata_setConnected (struct tspdata* p, BOOL b) {p->_CCAPI_Connected = b;}
+
+void tspdata_setReplyEvent(struct tspdata* p, HANDLE h) {p->_replyEvent = h;}
+
+void tspdata_setRpcAState (struct tspdata* p, RPC_ASYNC_STATE* rpcState) {
+ p->_rpcState = rpcState;}
+
+void tspdata_setSST (struct tspdata* p, time_t t) {p->_sst = t;}
+
+void tspdata_setStream (struct tspdata* p, cci_stream_t s) {p->_stream = s;}
+
+
+BOOL tspdata_getConnected (struct tspdata* p) {return p->_CCAPI_Connected;}
+
+HANDLE tspdata_getReplyEvent(struct tspdata* p) {return p->_replyEvent;}
+
+time_t tspdata_getSST (const struct tspdata* p) {return p->_sst;}
+
+cci_stream_t tspdata_getStream (const struct tspdata* p) {return p->_stream;}
+
+char* tspdata_getUUID (const struct tspdata* p) {return p->_uuid;}
+
+RPC_ASYNC_STATE* tspdata_getRpcAState (const struct tspdata* p) {return p->_rpcState;}
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-/* Thread local storage for client threads. */\r
-\r
-#ifndef _tls_h\r
-#define _tls_h\r
-\r
-#include "windows.h"\r
-#include "time.h"\r
-\r
-#include "cci_stream.h"\r
-\r
-#define UUID_SIZE 128\r
-\r
-/* The client code can be run in any client thread. The thread-specific data\r
- is defined here.\r
- */\r
-\r
-struct tspdata {\r
- BOOL _CCAPI_Connected;\r
- RPC_ASYNC_STATE* _rpcState;\r
- HANDLE _replyEvent;\r
- time_t _sst;\r
- cci_stream_t _stream;\r
- char _uuid[UUID_SIZE];\r
- };\r
-\r
-struct tspdata* new_tspdata (char* uuid, time_t sst);\r
-void delete_tspdata (struct tspdata* p);\r
-\r
-void tspdata_setConnected (struct tspdata* p, BOOL b);\r
-void tspdata_setReplyEvent(struct tspdata* p, HANDLE h);\r
-void tspdata_setRpcAState (struct tspdata* p, RPC_ASYNC_STATE* rpcState);\r
-void tspdata_setSST (struct tspdata* p, time_t t);\r
-void tspdata_setStream (struct tspdata* p, cci_stream_t s);\r
-void tspdata_setUUID (struct tspdata* p, unsigned char __RPC_FAR* uuidString);\r
-HANDLE tspdata_getReplyEvent(const struct tspdata* p);\r
-\r
-BOOL tspdata_getConnected(const struct tspdata* p);\r
-RPC_ASYNC_STATE* tspdata_getRpcAState(const struct tspdata* p);\r
-time_t tspdata_getSST (const struct tspdata* p);\r
-cci_stream_t tspdata_getStream (const struct tspdata* p);\r
-char* tspdata_getUUID (const struct tspdata* p);\r
-\r
-\r
-#endif _tls_h\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+/* Thread local storage for client threads. */
+
+#ifndef _tls_h
+#define _tls_h
+
+#include "windows.h"
+#include "time.h"
+
+#include "cci_stream.h"
+
+#define UUID_SIZE 128
+
+/* The client code can be run in any client thread. The thread-specific data
+ is defined here.
+ */
+
+struct tspdata {
+ BOOL _CCAPI_Connected;
+ RPC_ASYNC_STATE* _rpcState;
+ HANDLE _replyEvent;
+ time_t _sst;
+ cci_stream_t _stream;
+ char _uuid[UUID_SIZE];
+ };
+
+struct tspdata* new_tspdata (char* uuid, time_t sst);
+void delete_tspdata (struct tspdata* p);
+
+void tspdata_setConnected (struct tspdata* p, BOOL b);
+void tspdata_setReplyEvent(struct tspdata* p, HANDLE h);
+void tspdata_setRpcAState (struct tspdata* p, RPC_ASYNC_STATE* rpcState);
+void tspdata_setSST (struct tspdata* p, time_t t);
+void tspdata_setStream (struct tspdata* p, cci_stream_t s);
+void tspdata_setUUID (struct tspdata* p, unsigned char __RPC_FAR* uuidString);
+HANDLE tspdata_getReplyEvent(const struct tspdata* p);
+
+BOOL tspdata_getConnected(const struct tspdata* p);
+RPC_ASYNC_STATE* tspdata_getRpcAState(const struct tspdata* p);
+time_t tspdata_getSST (const struct tspdata* p);
+cci_stream_t tspdata_getStream (const struct tspdata* p);
+char* tspdata_getUUID (const struct tspdata* p);
+
+
+#endif _tls_h
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <time.h>\r
-#include "windows.h"\r
-\r
-#include "win-utils.h"\r
-#include "cci_debugging.h"\r
-\r
-#pragma warning (disable : 4996)\r
-\r
-#define UUID_SIZE 128\r
-\r
-char* clientPrefix = "CCAPI_CLIENT_";\r
-char* serverPrefix = "CCS_LISTEN_";\r
-unsigned char* pszProtocolSequence = "ncalrpc";\r
-\r
-#define MAX_TIMESTAMP 40\r
-char _ts[MAX_TIMESTAMP];\r
-\r
-char* clientEndpoint(const char* UUID) {\r
- char* _clientEndpoint = (char*)malloc(strlen(UUID) + strlen(clientPrefix) + 2);\r
- strcpy(_clientEndpoint, clientPrefix);\r
- strncat(_clientEndpoint, UUID, UUID_SIZE);\r
-// cci_debug_printf("%s returning %s", __FUNCTION__, _clientEndpoint);\r
- return _clientEndpoint;\r
- } \r
-\r
-char* serverEndpoint(const char* user) {\r
- char* _serverEndpoint = (char*)malloc(strlen(user) + strlen(serverPrefix) + 2);\r
- strcpy(_serverEndpoint, serverPrefix);\r
- strncat(_serverEndpoint, user, UUID_SIZE);\r
- return _serverEndpoint;\r
- } \r
-\r
-char* timestamp() {\r
- SYSTEMTIME _stime;\r
- GetSystemTime(&_stime);\r
- GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, &_stime, "HH:mm:ss", _ts, sizeof(_ts)-1);\r
- return _ts;\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include "windows.h"
+
+#include "win-utils.h"
+#include "cci_debugging.h"
+
+#pragma warning (disable : 4996)
+
+#define UUID_SIZE 128
+
+char* clientPrefix = "CCAPI_CLIENT_";
+char* serverPrefix = "CCS_LISTEN_";
+unsigned char* pszProtocolSequence = "ncalrpc";
+
+#define MAX_TIMESTAMP 40
+char _ts[MAX_TIMESTAMP];
+
+char* clientEndpoint(const char* UUID) {
+ char* _clientEndpoint = (char*)malloc(strlen(UUID) + strlen(clientPrefix) + 2);
+ strcpy(_clientEndpoint, clientPrefix);
+ strncat(_clientEndpoint, UUID, UUID_SIZE);
+// cci_debug_printf("%s returning %s", __FUNCTION__, _clientEndpoint);
+ return _clientEndpoint;
+ }
+
+char* serverEndpoint(const char* user) {
+ char* _serverEndpoint = (char*)malloc(strlen(user) + strlen(serverPrefix) + 2);
+ strcpy(_serverEndpoint, serverPrefix);
+ strncat(_serverEndpoint, user, UUID_SIZE);
+ return _serverEndpoint;
+ }
+
+char* timestamp() {
+ SYSTEMTIME _stime;
+ GetSystemTime(&_stime);
+ GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, &_stime, "HH:mm:ss", _ts, sizeof(_ts)-1);
+ return _ts;
}
\ No newline at end of file
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#ifndef _win_utils_h\r
-#define _win_utils_h\r
-\r
-#ifndef TRUE\r
-#define TRUE (1==1)\r
-#endif\r
-\r
-#ifndef FALSE\r
-#define FALSE (1==0)\r
-#endif\r
-\r
-static enum ccapiMsgType {\r
- CCMSG_INVALID = 0,\r
- CCMSG_CONNECT,\r
- CCMSG_REQUEST,\r
- CCMSG_CONNECT_REPLY,\r
- CCMSG_REQUEST_REPLY,\r
- CCMSG_DISCONNECT,\r
- CCMSG_LISTEN,\r
- CCMSG_PING\r
- };\r
-\r
-char* clientEndpoint(const char* UUID);\r
-char* serverEndpoint(const char* UUID);\r
-extern unsigned char* pszProtocolSequence;\r
-\r
-char* timestamp();\r
-\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#ifndef _win_utils_h
+#define _win_utils_h
+
+#ifndef TRUE
+#define TRUE (1==1)
+#endif
+
+#ifndef FALSE
+#define FALSE (1==0)
+#endif
+
+static enum ccapiMsgType {
+ CCMSG_INVALID = 0,
+ CCMSG_CONNECT,
+ CCMSG_REQUEST,
+ CCMSG_CONNECT_REPLY,
+ CCMSG_REQUEST_REPLY,
+ CCMSG_DISCONNECT,
+ CCMSG_LISTEN,
+ CCMSG_PING
+ };
+
+char* clientEndpoint(const char* UUID);
+char* serverEndpoint(const char* UUID);
+extern unsigned char* pszProtocolSequence;
+
+char* timestamp();
+
#endif // _win_utils_h
\ No newline at end of file
-\r
-\r
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */\r
-\r
-\r
- /* File created by MIDL compiler version 6.00.0366 */\r
-/* at Fri Nov 30 10:06:16 2007\r
- */\r
-/* Compiler settings for ccapi.idl:\r
- Oic, W1, Zp8, env=Win32 (32b run)\r
- protocol : dce , ms_ext, c_ext, oldnames\r
- error checks: allocation ref bounds_check enum stub_data \r
- VC __declspec() decoration level: \r
- __declspec(uuid()), __declspec(selectany), __declspec(novtable)\r
- DECLSPEC_UUID(), MIDL_INTERFACE()\r
-*/\r
-//@@MIDL_FILE_HEADING( )\r
-\r
-#pragma warning( disable: 4049 ) /* more than 64k source lines */\r
-\r
-\r
-/* verify that the <rpcndr.h> version is high enough to compile this file*/\r
-#ifndef __REQUIRED_RPCNDR_H_VERSION__\r
-#define __REQUIRED_RPCNDR_H_VERSION__ 440\r
-#endif\r
-\r
-#include "rpc.h"\r
-#include "rpcndr.h"\r
-\r
-#ifndef __ccapi_h__\r
-#define __ccapi_h__\r
-\r
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)\r
-#pragma once\r
-#endif\r
-\r
-/* Forward Declarations */ \r
-\r
-#ifdef __cplusplus\r
-extern "C"{\r
-#endif \r
-\r
-void * __RPC_USER MIDL_user_allocate(size_t);\r
-void __RPC_USER MIDL_user_free( void * ); \r
-\r
-#ifndef __ccapi_INTERFACE_DEFINED__\r
-#define __ccapi_INTERFACE_DEFINED__\r
-\r
-/* interface ccapi */\r
-/* [implicit_handle][unique][version][uuid] */ \r
-\r
-typedef /* [context_handle] */ struct opaque_handle_CTX *HCTX;\r
-\r
-typedef /* [context_handle] */ struct opaque_handle_CACHE *HCACHE;\r
-\r
-typedef /* [context_handle] */ struct opaque_handle_CACHE_ITER *HCACHE_ITER;\r
-\r
-typedef /* [context_handle] */ struct opaque_handle_CRED_ITER *HCRED_ITER;\r
-\r
-typedef unsigned char CC_CHAR;\r
-\r
-typedef unsigned char CC_UCHAR;\r
-\r
-typedef int CC_INT32;\r
-\r
-typedef unsigned int CC_UINT32;\r
-\r
-typedef CC_INT32 CC_TIME_T;\r
-\r
-\r
-enum __MIDL_ccapi_0001\r
- { STK_AFS = 0,\r
- STK_DES = 1\r
- } ;\r
-\r
-enum __MIDL_ccapi_0002\r
- { CC_API_VER_1 = 1,\r
- CC_API_VER_2 = 2\r
- } ;\r
-\r
-enum __MIDL_ccapi_0003\r
- { KRB_NAME_SZ = 40,\r
- KRB_INSTANCE_SZ = 40,\r
- KRB_REALM_SZ = 40,\r
- MAX_V4_CRED_LEN = 1250\r
- } ;\r
-typedef struct _NC_INFO\r
- {\r
- /* [string] */ CC_CHAR *name;\r
- /* [string] */ CC_CHAR *principal;\r
- CC_INT32 vers;\r
- } NC_INFO;\r
-\r
-typedef struct _NC_INFO_LIST\r
- {\r
- CC_UINT32 length;\r
- /* [size_is] */ NC_INFO *info;\r
- } NC_INFO_LIST;\r
-\r
-typedef struct _V4_CRED\r
- {\r
- CC_UCHAR kversion;\r
- CC_CHAR principal[ 41 ];\r
- CC_CHAR principal_instance[ 41 ];\r
- CC_CHAR service[ 41 ];\r
- CC_CHAR service_instance[ 41 ];\r
- CC_CHAR realm[ 41 ];\r
- CC_UCHAR session_key[ 8 ];\r
- CC_INT32 kvno;\r
- CC_INT32 str_to_key;\r
- CC_INT32 issue_date;\r
- CC_INT32 lifetime;\r
- CC_UINT32 address;\r
- CC_INT32 ticket_sz;\r
- CC_UCHAR ticket[ 1250 ];\r
- } V4_CRED;\r
-\r
-typedef struct _CC_DATA\r
- {\r
- CC_UINT32 type;\r
- CC_UINT32 length;\r
- /* [size_is] */ CC_UCHAR *data;\r
- } CC_DATA;\r
-\r
-typedef struct _CC_DATA_LIST\r
- {\r
- CC_UINT32 count;\r
- /* [size_is] */ CC_DATA *data;\r
- } CC_DATA_LIST;\r
-\r
-typedef struct _V5_CRED\r
- {\r
- /* [string] */ CC_CHAR *client;\r
- /* [string] */ CC_CHAR *server;\r
- CC_DATA keyblock;\r
- CC_TIME_T authtime;\r
- CC_TIME_T starttime;\r
- CC_TIME_T endtime;\r
- CC_TIME_T renew_till;\r
- CC_UINT32 is_skey;\r
- CC_UINT32 ticket_flags;\r
- CC_DATA_LIST addresses;\r
- CC_DATA ticket;\r
- CC_DATA second_ticket;\r
- CC_DATA_LIST authdata;\r
- } V5_CRED;\r
-\r
-typedef /* [switch_type] */ union _CRED_PTR_UNION\r
- {\r
- /* [case()] */ V4_CRED *pV4Cred;\r
- /* [case()] */ V5_CRED *pV5Cred;\r
- } CRED_PTR_UNION;\r
-\r
-typedef struct _CRED_UNION\r
- {\r
- CC_INT32 cred_type;\r
- /* [switch_is] */ CRED_PTR_UNION cred;\r
- } CRED_UNION;\r
-\r
-CC_INT32 rcc_initialize( \r
- /* [out] */ HCTX *pctx);\r
-\r
-CC_INT32 rcc_shutdown( \r
- /* [out][in] */ HCTX *pctx);\r
-\r
-CC_INT32 rcc_get_change_time( \r
- /* [in] */ HCTX ctx,\r
- /* [out] */ CC_TIME_T *time);\r
-\r
-CC_INT32 rcc_create( \r
- /* [in] */ HCTX ctx,\r
- /* [string][in] */ const CC_CHAR *name,\r
- /* [string][in] */ const CC_CHAR *principal,\r
- /* [in] */ CC_INT32 vers,\r
- /* [in] */ CC_UINT32 flags,\r
- /* [out] */ HCACHE *pcache);\r
-\r
-CC_INT32 rcc_open( \r
- /* [in] */ HCTX ctx,\r
- /* [string][in] */ const CC_CHAR *name,\r
- /* [in] */ CC_INT32 vers,\r
- /* [in] */ CC_UINT32 flags,\r
- /* [out] */ HCACHE *pcache);\r
-\r
-CC_INT32 rcc_close( \r
- /* [out][in] */ HCACHE *pcache);\r
-\r
-CC_INT32 rcc_destroy( \r
- /* [out][in] */ HCACHE *pcache);\r
-\r
-CC_INT32 rcc_seq_fetch_NCs_begin( \r
- /* [in] */ HCTX ctx,\r
- /* [out] */ HCACHE_ITER *piter);\r
-\r
-CC_INT32 rcc_seq_fetch_NCs_end( \r
- /* [out][in] */ HCACHE_ITER *piter);\r
-\r
-CC_INT32 rcc_seq_fetch_NCs_next( \r
- /* [in] */ HCACHE_ITER iter,\r
- /* [out] */ HCACHE *pcache);\r
-\r
-CC_INT32 rcc_seq_fetch_NCs( \r
- /* [in] */ HCTX ctx,\r
- /* [out][in] */ HCACHE_ITER *piter,\r
- /* [out] */ HCACHE *pcache);\r
-\r
-CC_INT32 rcc_get_NC_info( \r
- /* [in] */ HCTX ctx,\r
- /* [out] */ NC_INFO_LIST **info_list);\r
-\r
-CC_INT32 rcc_get_name( \r
- /* [in] */ HCACHE cache,\r
- /* [string][out] */ CC_CHAR **name);\r
-\r
-CC_INT32 rcc_set_principal( \r
- /* [in] */ HCACHE cache,\r
- /* [in] */ CC_INT32 vers,\r
- /* [string][in] */ const CC_CHAR *principal);\r
-\r
-CC_INT32 rcc_get_principal( \r
- /* [in] */ HCACHE cache,\r
- /* [string][out] */ CC_CHAR **principal);\r
-\r
-CC_INT32 rcc_get_cred_version( \r
- /* [in] */ HCACHE cache,\r
- /* [out] */ CC_INT32 *vers);\r
-\r
-CC_INT32 rcc_lock_request( \r
- /* [in] */ HCACHE cache,\r
- /* [in] */ CC_INT32 lock_type);\r
-\r
-CC_INT32 rcc_store( \r
- /* [in] */ HCACHE cache,\r
- /* [in] */ CRED_UNION cred);\r
-\r
-CC_INT32 rcc_remove_cred( \r
- /* [in] */ HCACHE cache,\r
- /* [in] */ CRED_UNION cred);\r
-\r
-CC_INT32 rcc_seq_fetch_creds( \r
- /* [in] */ HCACHE cache,\r
- /* [out][in] */ HCRED_ITER *piter,\r
- /* [out] */ CRED_UNION **cred);\r
-\r
-CC_INT32 rcc_seq_fetch_creds_begin( \r
- /* [in] */ HCACHE cache,\r
- /* [out] */ HCRED_ITER *piter);\r
-\r
-CC_INT32 rcc_seq_fetch_creds_end( \r
- /* [out][in] */ HCRED_ITER *piter);\r
-\r
-CC_INT32 rcc_seq_fetch_creds_next( \r
- /* [in] */ HCRED_ITER iter,\r
- /* [out] */ CRED_UNION **cred);\r
-\r
-CC_UINT32 Connect( \r
- /* [string][in] */ CC_CHAR *name);\r
-\r
-void Shutdown( void);\r
-\r
-\r
-extern handle_t ccapi_IfHandle;\r
-\r
-\r
-extern RPC_IF_HANDLE ccapi_ClientIfHandle;\r
-extern RPC_IF_HANDLE ccapi_ServerIfHandle;\r
-#endif /* __ccapi_INTERFACE_DEFINED__ */\r
-\r
-/* Additional Prototypes for ALL interfaces */\r
-\r
-void __RPC_USER HCTX_rundown( HCTX );\r
-void __RPC_USER HCACHE_rundown( HCACHE );\r
-void __RPC_USER HCACHE_ITER_rundown( HCACHE_ITER );\r
-void __RPC_USER HCRED_ITER_rundown( HCRED_ITER );\r
-\r
-/* end of Additional Prototypes */\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
-\r
-\r
+
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 6.00.0366 */
+/* at Fri Nov 30 10:06:16 2007
+ */
+/* Compiler settings for ccapi.idl:
+ Oic, W1, Zp8, env=Win32 (32b run)
+ protocol : dce , ms_ext, c_ext, oldnames
+ error checks: allocation ref bounds_check enum stub_data
+ VC __declspec() decoration level:
+ __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+ DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+//@@MIDL_FILE_HEADING( )
+
+#pragma warning( disable: 4049 ) /* more than 64k source lines */
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 440
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __ccapi_h__
+#define __ccapi_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+void * __RPC_USER MIDL_user_allocate(size_t);
+void __RPC_USER MIDL_user_free( void * );
+
+#ifndef __ccapi_INTERFACE_DEFINED__
+#define __ccapi_INTERFACE_DEFINED__
+
+/* interface ccapi */
+/* [implicit_handle][unique][version][uuid] */
+
+typedef /* [context_handle] */ struct opaque_handle_CTX *HCTX;
+
+typedef /* [context_handle] */ struct opaque_handle_CACHE *HCACHE;
+
+typedef /* [context_handle] */ struct opaque_handle_CACHE_ITER *HCACHE_ITER;
+
+typedef /* [context_handle] */ struct opaque_handle_CRED_ITER *HCRED_ITER;
+
+typedef unsigned char CC_CHAR;
+
+typedef unsigned char CC_UCHAR;
+
+typedef int CC_INT32;
+
+typedef unsigned int CC_UINT32;
+
+typedef CC_INT32 CC_TIME_T;
+
+
+enum __MIDL_ccapi_0001
+ { STK_AFS = 0,
+ STK_DES = 1
+ } ;
+
+enum __MIDL_ccapi_0002
+ { CC_API_VER_1 = 1,
+ CC_API_VER_2 = 2
+ } ;
+
+enum __MIDL_ccapi_0003
+ { KRB_NAME_SZ = 40,
+ KRB_INSTANCE_SZ = 40,
+ KRB_REALM_SZ = 40,
+ MAX_V4_CRED_LEN = 1250
+ } ;
+typedef struct _NC_INFO
+ {
+ /* [string] */ CC_CHAR *name;
+ /* [string] */ CC_CHAR *principal;
+ CC_INT32 vers;
+ } NC_INFO;
+
+typedef struct _NC_INFO_LIST
+ {
+ CC_UINT32 length;
+ /* [size_is] */ NC_INFO *info;
+ } NC_INFO_LIST;
+
+typedef struct _V4_CRED
+ {
+ CC_UCHAR kversion;
+ CC_CHAR principal[ 41 ];
+ CC_CHAR principal_instance[ 41 ];
+ CC_CHAR service[ 41 ];
+ CC_CHAR service_instance[ 41 ];
+ CC_CHAR realm[ 41 ];
+ CC_UCHAR session_key[ 8 ];
+ CC_INT32 kvno;
+ CC_INT32 str_to_key;
+ CC_INT32 issue_date;
+ CC_INT32 lifetime;
+ CC_UINT32 address;
+ CC_INT32 ticket_sz;
+ CC_UCHAR ticket[ 1250 ];
+ } V4_CRED;
+
+typedef struct _CC_DATA
+ {
+ CC_UINT32 type;
+ CC_UINT32 length;
+ /* [size_is] */ CC_UCHAR *data;
+ } CC_DATA;
+
+typedef struct _CC_DATA_LIST
+ {
+ CC_UINT32 count;
+ /* [size_is] */ CC_DATA *data;
+ } CC_DATA_LIST;
+
+typedef struct _V5_CRED
+ {
+ /* [string] */ CC_CHAR *client;
+ /* [string] */ CC_CHAR *server;
+ CC_DATA keyblock;
+ CC_TIME_T authtime;
+ CC_TIME_T starttime;
+ CC_TIME_T endtime;
+ CC_TIME_T renew_till;
+ CC_UINT32 is_skey;
+ CC_UINT32 ticket_flags;
+ CC_DATA_LIST addresses;
+ CC_DATA ticket;
+ CC_DATA second_ticket;
+ CC_DATA_LIST authdata;
+ } V5_CRED;
+
+typedef /* [switch_type] */ union _CRED_PTR_UNION
+ {
+ /* [case()] */ V4_CRED *pV4Cred;
+ /* [case()] */ V5_CRED *pV5Cred;
+ } CRED_PTR_UNION;
+
+typedef struct _CRED_UNION
+ {
+ CC_INT32 cred_type;
+ /* [switch_is] */ CRED_PTR_UNION cred;
+ } CRED_UNION;
+
+CC_INT32 rcc_initialize(
+ /* [out] */ HCTX *pctx);
+
+CC_INT32 rcc_shutdown(
+ /* [out][in] */ HCTX *pctx);
+
+CC_INT32 rcc_get_change_time(
+ /* [in] */ HCTX ctx,
+ /* [out] */ CC_TIME_T *time);
+
+CC_INT32 rcc_create(
+ /* [in] */ HCTX ctx,
+ /* [string][in] */ const CC_CHAR *name,
+ /* [string][in] */ const CC_CHAR *principal,
+ /* [in] */ CC_INT32 vers,
+ /* [in] */ CC_UINT32 flags,
+ /* [out] */ HCACHE *pcache);
+
+CC_INT32 rcc_open(
+ /* [in] */ HCTX ctx,
+ /* [string][in] */ const CC_CHAR *name,
+ /* [in] */ CC_INT32 vers,
+ /* [in] */ CC_UINT32 flags,
+ /* [out] */ HCACHE *pcache);
+
+CC_INT32 rcc_close(
+ /* [out][in] */ HCACHE *pcache);
+
+CC_INT32 rcc_destroy(
+ /* [out][in] */ HCACHE *pcache);
+
+CC_INT32 rcc_seq_fetch_NCs_begin(
+ /* [in] */ HCTX ctx,
+ /* [out] */ HCACHE_ITER *piter);
+
+CC_INT32 rcc_seq_fetch_NCs_end(
+ /* [out][in] */ HCACHE_ITER *piter);
+
+CC_INT32 rcc_seq_fetch_NCs_next(
+ /* [in] */ HCACHE_ITER iter,
+ /* [out] */ HCACHE *pcache);
+
+CC_INT32 rcc_seq_fetch_NCs(
+ /* [in] */ HCTX ctx,
+ /* [out][in] */ HCACHE_ITER *piter,
+ /* [out] */ HCACHE *pcache);
+
+CC_INT32 rcc_get_NC_info(
+ /* [in] */ HCTX ctx,
+ /* [out] */ NC_INFO_LIST **info_list);
+
+CC_INT32 rcc_get_name(
+ /* [in] */ HCACHE cache,
+ /* [string][out] */ CC_CHAR **name);
+
+CC_INT32 rcc_set_principal(
+ /* [in] */ HCACHE cache,
+ /* [in] */ CC_INT32 vers,
+ /* [string][in] */ const CC_CHAR *principal);
+
+CC_INT32 rcc_get_principal(
+ /* [in] */ HCACHE cache,
+ /* [string][out] */ CC_CHAR **principal);
+
+CC_INT32 rcc_get_cred_version(
+ /* [in] */ HCACHE cache,
+ /* [out] */ CC_INT32 *vers);
+
+CC_INT32 rcc_lock_request(
+ /* [in] */ HCACHE cache,
+ /* [in] */ CC_INT32 lock_type);
+
+CC_INT32 rcc_store(
+ /* [in] */ HCACHE cache,
+ /* [in] */ CRED_UNION cred);
+
+CC_INT32 rcc_remove_cred(
+ /* [in] */ HCACHE cache,
+ /* [in] */ CRED_UNION cred);
+
+CC_INT32 rcc_seq_fetch_creds(
+ /* [in] */ HCACHE cache,
+ /* [out][in] */ HCRED_ITER *piter,
+ /* [out] */ CRED_UNION **cred);
+
+CC_INT32 rcc_seq_fetch_creds_begin(
+ /* [in] */ HCACHE cache,
+ /* [out] */ HCRED_ITER *piter);
+
+CC_INT32 rcc_seq_fetch_creds_end(
+ /* [out][in] */ HCRED_ITER *piter);
+
+CC_INT32 rcc_seq_fetch_creds_next(
+ /* [in] */ HCRED_ITER iter,
+ /* [out] */ CRED_UNION **cred);
+
+CC_UINT32 Connect(
+ /* [string][in] */ CC_CHAR *name);
+
+void Shutdown( void);
+
+
+extern handle_t ccapi_IfHandle;
+
+
+extern RPC_IF_HANDLE ccapi_ClientIfHandle;
+extern RPC_IF_HANDLE ccapi_ServerIfHandle;
+#endif /* __ccapi_INTERFACE_DEFINED__ */
+
+/* Additional Prototypes for ALL interfaces */
+
+void __RPC_USER HCTX_rundown( HCTX );
+void __RPC_USER HCACHE_rundown( HCACHE );
+void __RPC_USER HCACHE_ITER_rundown( HCACHE_ITER );
+void __RPC_USER HCRED_ITER_rundown( HCRED_ITER );
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#ifndef __DLL_CLIENT_H__\r
-#define __DLL_CLIENT_H__\r
-\r
-#include "autolock.hxx"\r
-#include "init.hxx"\r
-\r
-class Client {\r
-public:\r
- static DWORD Initialize(char* ep OPTIONAL);\r
- static DWORD Cleanup();\r
- static DWORD Reconnect(char* ep OPTIONAL);\r
-\r
- static bool Initialized() { return s_init; }\r
-\r
- static CcOsLock sLock;\r
-\r
-private:\r
- static bool s_init;\r
-\r
- static DWORD Disconnect();\r
- static DWORD Connect(char* ep OPTIONAL);\r
- };\r
-\r
-#define CLIENT_INIT_EX(trap, error) \\r
-do \\r
-{ \\r
- INIT_INIT_EX(trap, error); \\r
- if (!Client::Initialized()) \\r
- { \\r
- DWORD status = Client::Initialize(0); \\r
- if (status) return (trap) ? (error) : status; \\r
- } \\r
-} while(0)\r
-\r
-#endif\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#ifndef __DLL_CLIENT_H__
+#define __DLL_CLIENT_H__
+
+#include "autolock.hxx"
+#include "init.hxx"
+
+class Client {
+public:
+ static DWORD Initialize(char* ep OPTIONAL);
+ static DWORD Cleanup();
+ static DWORD Reconnect(char* ep OPTIONAL);
+
+ static bool Initialized() { return s_init; }
+
+ static CcOsLock sLock;
+
+private:
+ static bool s_init;
+
+ static DWORD Disconnect();
+ static DWORD Connect(char* ep OPTIONAL);
+ };
+
+#define CLIENT_INIT_EX(trap, error) \
+do \
+{ \
+ INIT_INIT_EX(trap, error); \
+ if (!Client::Initialized()) \
+ { \
+ DWORD status = Client::Initialize(0); \
+ if (status) return (trap) ? (error) : status; \
+ } \
+} while(0)
+
+#endif
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <windows.h>\r
-\r
-#include "cci_debugging.h"\r
-#include "ccs_reply.h" /* generated by MIDL compiler */\r
-#include "ccutils.h"\r
-#include "tls.h"\r
-#include "win-utils.h"\r
-\r
-\r
-void ccs_rpc_request_reply(\r
- const long rpcmsg, /* Message type */\r
- const char tspHandle[], /* Client's tspdata* */\r
- const char* uuid, /* uuid for making thread-specific event name */\r
- const long srvStartTime, /* Server Start Time */\r
- const long cbIn, /* Length of buffer */\r
- const char* chIn, /* Data buffer */\r
- long* ret_status ) { /* Return code */\r
-\r
- HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX);\r
- DWORD* p = (DWORD*)(tspHandle);\r
- struct tspdata* tsp = (struct tspdata*)*p;\r
- cci_stream_t stream;\r
- long status = 0;\r
-\r
- cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid);\r
- cci_debug_printf(" payload:<%s>", chIn);\r
- cci_debug_printf(" uuid from handle:<%s>", tspdata_getUUID(tsp));\r
-\r
- if (!status) { \r
- status = cci_stream_new (&stream); /* Create a stream for the request data */\r
- }\r
-\r
- if (!status) { /* Put the data into the stream */\r
- status = cci_stream_write (stream, chIn, cbIn);\r
- }\r
-\r
- if (!status) { /* Put the data into the stream */\r
- tspdata_setStream(tsp, stream);\r
- }\r
-\r
- SetEvent(hEvent);\r
- CloseHandle(hEvent);\r
- *ret_status = status;\r
- }\r
-\r
-void ccs_rpc_connect_reply(\r
- const long rpcmsg, /* Message type */\r
- const char tspHandle[], /* Client's tspdata* */\r
- const char* uuid, /* uuid for making thread-specific event name */\r
- const long srvStartTime, /* Server Start Time */\r
- long* status ) { /* Return code */\r
-\r
- HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX);\r
- DWORD* p = (DWORD*)(tspHandle);\r
-\r
- cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid);\r
-\r
- SetEvent(hEvent);\r
- CloseHandle(hEvent);\r
- }\r
-\r
-void ccapi_listen(\r
- RPC_ASYNC_STATE* rpcState,\r
- handle_t hBinding,\r
- const long rpcmsg, /* Message type */\r
- long* status ) { /* Return code */\r
-\r
- cci_debug_printf("%s %s!", __FUNCTION__, rpcState->UserInfo);\r
- *status = 0;\r
- }\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+
+#include "cci_debugging.h"
+#include "ccs_reply.h" /* generated by MIDL compiler */
+#include "ccutils.h"
+#include "tls.h"
+#include "win-utils.h"
+
+
+void ccs_rpc_request_reply(
+ const long rpcmsg, /* Message type */
+ const char tspHandle[], /* Client's tspdata* */
+ const char* uuid, /* uuid for making thread-specific event name */
+ const long srvStartTime, /* Server Start Time */
+ const long cbIn, /* Length of buffer */
+ const char* chIn, /* Data buffer */
+ long* ret_status ) { /* Return code */
+
+ HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX);
+ DWORD* p = (DWORD*)(tspHandle);
+ struct tspdata* tsp = (struct tspdata*)*p;
+ cci_stream_t stream;
+ long status = 0;
+
+ cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid);
+ cci_debug_printf(" payload:<%s>", chIn);
+ cci_debug_printf(" uuid from handle:<%s>", tspdata_getUUID(tsp));
+
+ if (!status) {
+ status = cci_stream_new (&stream); /* Create a stream for the request data */
+ }
+
+ if (!status) { /* Put the data into the stream */
+ status = cci_stream_write (stream, chIn, cbIn);
+ }
+
+ if (!status) { /* Put the data into the stream */
+ tspdata_setStream(tsp, stream);
+ }
+
+ SetEvent(hEvent);
+ CloseHandle(hEvent);
+ *ret_status = status;
+ }
+
+void ccs_rpc_connect_reply(
+ const long rpcmsg, /* Message type */
+ const char tspHandle[], /* Client's tspdata* */
+ const char* uuid, /* uuid for making thread-specific event name */
+ const long srvStartTime, /* Server Start Time */
+ long* status ) { /* Return code */
+
+ HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX);
+ DWORD* p = (DWORD*)(tspHandle);
+
+ cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid);
+
+ SetEvent(hEvent);
+ CloseHandle(hEvent);
+ }
+
+void ccapi_listen(
+ RPC_ASYNC_STATE* rpcState,
+ handle_t hBinding,
+ const long rpcmsg, /* Message type */
+ long* status ) { /* Return code */
+
+ cci_debug_printf("%s %s!", __FUNCTION__, rpcState->UserInfo);
+ *status = 0;
+ }
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#ifndef _dll_h\r
-#define _dll_h\r
-\r
-#include "windows.h"\r
-\r
-enum EndpointType {EPT_SERVER=0, EPT_CLIENT};\r
-\r
-#ifdef __cplusplus // If used by C++ code, \r
-extern "C" { // we need to export the C interface\r
-#endif\r
-__declspec(dllexport) BOOL WINAPI PutTspData(struct tspdata* p);\r
-__declspec(dllexport) BOOL WINAPI GetTspData(struct tspdata** p);\r
-\r
-//__declspec(dllexport) char* WINAPI getEndpoint(enum EndpointType);\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#ifndef _dll_h
+#define _dll_h
+
+#include "windows.h"
+
+enum EndpointType {EPT_SERVER=0, EPT_CLIENT};
+
+#ifdef __cplusplus // If used by C++ code,
+extern "C" { // we need to export the C interface
+#endif
+__declspec(dllexport) BOOL WINAPI PutTspData(struct tspdata* p);
+__declspec(dllexport) BOOL WINAPI GetTspData(struct tspdata** p);
+
+//__declspec(dllexport) char* WINAPI getEndpoint(enum EndpointType);
+#ifdef __cplusplus
+}
+#endif
+
#endif _dll_h
\ No newline at end of file
-/*\r
- * $Header$\r
- *\r
- * Copyright 2007 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#ifndef _work_queue_h\r
-#define _work_queue_h\r
-\r
-#include "windows.h"\r
-#include "cci_stream.h"\r
-#include "ccs_pipe.h"\r
-\r
-EXTERN_C BOOL worklist_isEmpty();\r
-\r
-EXTERN_C void worklist_add( const long rpcmsg,\r
- const ccs_pipe_t pipe,\r
- const cci_stream_t stream,\r
- const time_t serverStartTime);\r
-\r
-EXTERN_C int worklist_remove(long* rpcmsg,\r
- ccs_pipe_t* pipe,\r
- cci_stream_t* stream,\r
- time_t* serverStartTime);\r
-\r
+/*
+ * $Header$
+ *
+ * Copyright 2007 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#ifndef _work_queue_h
+#define _work_queue_h
+
+#include "windows.h"
+#include "cci_stream.h"
+#include "ccs_pipe.h"
+
+EXTERN_C BOOL worklist_isEmpty();
+
+EXTERN_C void worklist_add( const long rpcmsg,
+ const ccs_pipe_t pipe,
+ const cci_stream_t stream,
+ const time_t serverStartTime);
+
+EXTERN_C int worklist_remove(long* rpcmsg,
+ ccs_pipe_t* pipe,
+ cci_stream_t* stream,
+ time_t* serverStartTime);
+
#endif // _work_queue_h
\ No newline at end of file
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#include "ccs_common.h"\r
-#include "ccs_os_pipe.h"\r
-#include "ccs_win_pipe.h"\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-/* On Windows, a pipe is a struct. See ccs_win_pipe.h for details. */\r
- \r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-cc_int32 ccs_os_pipe_valid (ccs_pipe_t in_pipe) {\r
- return ccs_win_pipe_valid(in_pipe);\r
- }\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-cc_int32 ccs_os_pipe_copy (ccs_pipe_t* out_pipe, ccs_pipe_t in_pipe) {\r
- return ccs_win_pipe_copy(\r
- out_pipe, \r
- in_pipe);\r
- }\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-cc_int32 ccs_os_pipe_release (ccs_pipe_t io_pipe) {\r
- return ccs_win_pipe_release(io_pipe);\r
- }\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-cc_int32 ccs_os_pipe_compare (ccs_pipe_t pipe_1,\r
- ccs_pipe_t pipe_2,\r
- cc_uint32 *out_equal) {\r
-\r
- return ccs_win_pipe_compare(pipe_1, pipe_2, out_equal);\r
- }\r
-\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#include "ccs_common.h"
+#include "ccs_os_pipe.h"
+#include "ccs_win_pipe.h"
+
+/* ------------------------------------------------------------------------ */
+
+/* On Windows, a pipe is a struct. See ccs_win_pipe.h for details. */
+
+
+/* ------------------------------------------------------------------------ */
+
+cc_int32 ccs_os_pipe_valid (ccs_pipe_t in_pipe) {
+ return ccs_win_pipe_valid(in_pipe);
+ }
+
+/* ------------------------------------------------------------------------ */
+
+cc_int32 ccs_os_pipe_copy (ccs_pipe_t* out_pipe, ccs_pipe_t in_pipe) {
+ return ccs_win_pipe_copy(
+ out_pipe,
+ in_pipe);
+ }
+
+/* ------------------------------------------------------------------------ */
+
+cc_int32 ccs_os_pipe_release (ccs_pipe_t io_pipe) {
+ return ccs_win_pipe_release(io_pipe);
+ }
+
+/* ------------------------------------------------------------------------ */
+
+cc_int32 ccs_os_pipe_compare (ccs_pipe_t pipe_1,
+ ccs_pipe_t pipe_2,
+ cc_uint32 *out_equal) {
+
+ return ccs_win_pipe_compare(pipe_1, pipe_2, out_equal);
+ }
+
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-\r
-#include "ccs_request.h" // header file generated by MIDL compiler\r
-#include "cci_debugging.h"\r
-#include "WorkQueue.h"\r
-#include "win-utils.h"\r
-#include "ccs_win_pipe.h"\r
-\r
-void ccs_rpc_request(\r
- const long rpcmsg, /* Message type */\r
- const char tspHandle[], /* Client's tspdata* */\r
- const char* pszUUID, /* Where client will listen for the reply */\r
- const long lenRequest, /* Length of buffer */\r
- const char pbRequest[], /* Data buffer */\r
- const long serverStartTime, /* Which server session we're talking to */\r
- long* return_status ) { /* Return code */\r
-\r
- cc_int32 status = 0;\r
- cci_stream_t stream;\r
- DWORD* p = (DWORD*)(tspHandle);\r
- WIN_PIPE* pipe = NULL;\r
-\r
- cci_debug_printf("%s rpcmsg:%d; UUID:<%s> SST:<%s>", \r
- __FUNCTION__, rpcmsg, pszUUID, serverStartTime);\r
-\r
- status = (rpcmsg != CCMSG_REQUEST) && (rpcmsg != CCMSG_PING);\r
- \r
- if (!status) { \r
- status = cci_stream_new (&stream); /* Create a stream for the request data */\r
- }\r
-\r
- if (!status) { /* Put the data into the stream */\r
- status = cci_stream_write (stream, pbRequest, lenRequest);\r
- }\r
-\r
- pipe = ccs_win_pipe_new(pszUUID, *p); \r
- worklist_add(rpcmsg, pipe, stream, serverStartTime);\r
- *return_status = status;\r
- }\r
-\r
-\r
-void ccs_rpc_connect(\r
- const long rpcmsg, /* Message type */\r
- const char tspHandle[], /* Client's tspdata* */\r
- const char* pszUUID, /* Data buffer */\r
- long* return_status ) { /* Return code */\r
-\r
- DWORD* p = (DWORD*)(tspHandle);\r
- WIN_PIPE* pipe = ccs_win_pipe_new(pszUUID, *p);\r
-\r
- cci_debug_printf("%s; rpcmsg:%d; UUID: <%s>", __FUNCTION__, rpcmsg, pszUUID);\r
-\r
- worklist_add( rpcmsg, \r
- pipe,\r
- NULL, /* No payload with connect request */\r
- (const time_t)0 ); /* No server session number with connect request */\r
- }\r
-\r
-\r
-// 'Authentication' is client setting a value in a file and the server\r
-// returning that value plus one.\r
-CC_UINT32 ccs_authenticate(const CC_CHAR* name) {\r
- HANDLE hMap = 0;\r
- PDWORD pvalue = 0;\r
- CC_UINT32 result = 0;\r
- DWORD status = 0;\r
-\r
- cci_debug_printf("%s ( %s )", __FUNCTION__, name);\r
-\r
- hMap = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, (LPSTR)name);\r
- status = !hMap;\r
-\r
- if (!status) {\r
- pvalue = (PDWORD)MapViewOfFile(hMap, FILE_MAP_WRITE, 0, 0, 0);\r
- status = !pvalue;\r
- }\r
-\r
- if (!status) {\r
- *pvalue += 1;\r
- result = *pvalue;\r
- }\r
-\r
- if (pvalue) {\r
- UnmapViewOfFile(pvalue);\r
- }\r
-\r
- if (hMap) CloseHandle(hMap);\r
- return result;\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "ccs_request.h" // header file generated by MIDL compiler
+#include "cci_debugging.h"
+#include "WorkQueue.h"
+#include "win-utils.h"
+#include "ccs_win_pipe.h"
+
+void ccs_rpc_request(
+ const long rpcmsg, /* Message type */
+ const char tspHandle[], /* Client's tspdata* */
+ const char* pszUUID, /* Where client will listen for the reply */
+ const long lenRequest, /* Length of buffer */
+ const char pbRequest[], /* Data buffer */
+ const long serverStartTime, /* Which server session we're talking to */
+ long* return_status ) { /* Return code */
+
+ cc_int32 status = 0;
+ cci_stream_t stream;
+ DWORD* p = (DWORD*)(tspHandle);
+ WIN_PIPE* pipe = NULL;
+
+ cci_debug_printf("%s rpcmsg:%d; UUID:<%s> SST:<%s>",
+ __FUNCTION__, rpcmsg, pszUUID, serverStartTime);
+
+ status = (rpcmsg != CCMSG_REQUEST) && (rpcmsg != CCMSG_PING);
+
+ if (!status) {
+ status = cci_stream_new (&stream); /* Create a stream for the request data */
+ }
+
+ if (!status) { /* Put the data into the stream */
+ status = cci_stream_write (stream, pbRequest, lenRequest);
+ }
+
+ pipe = ccs_win_pipe_new(pszUUID, *p);
+ worklist_add(rpcmsg, pipe, stream, serverStartTime);
+ *return_status = status;
+ }
+
+
+void ccs_rpc_connect(
+ const long rpcmsg, /* Message type */
+ const char tspHandle[], /* Client's tspdata* */
+ const char* pszUUID, /* Data buffer */
+ long* return_status ) { /* Return code */
+
+ DWORD* p = (DWORD*)(tspHandle);
+ WIN_PIPE* pipe = ccs_win_pipe_new(pszUUID, *p);
+
+ cci_debug_printf("%s; rpcmsg:%d; UUID: <%s>", __FUNCTION__, rpcmsg, pszUUID);
+
+ worklist_add( rpcmsg,
+ pipe,
+ NULL, /* No payload with connect request */
+ (const time_t)0 ); /* No server session number with connect request */
+ }
+
+
+// 'Authentication' is client setting a value in a file and the server
+// returning that value plus one.
+CC_UINT32 ccs_authenticate(const CC_CHAR* name) {
+ HANDLE hMap = 0;
+ PDWORD pvalue = 0;
+ CC_UINT32 result = 0;
+ DWORD status = 0;
+
+ cci_debug_printf("%s ( %s )", __FUNCTION__, name);
+
+ hMap = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, (LPSTR)name);
+ status = !hMap;
+
+ if (!status) {
+ pvalue = (PDWORD)MapViewOfFile(hMap, FILE_MAP_WRITE, 0, 0, 0);
+ status = !pvalue;
+ }
+
+ if (!status) {
+ *pvalue += 1;
+ result = *pvalue;
+ }
+
+ if (pvalue) {
+ UnmapViewOfFile(pvalue);
+ }
+
+ if (hMap) CloseHandle(hMap);
+ return result;
}
\ No newline at end of file
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#include "assert.h"\r
-\r
-#include "ccs_win_pipe.h"\r
-#include "cci_debugging.h"\r
-\r
-/* Ref:\r
-struct ccs_win_pipe_t {\r
- char* uuid;\r
- HANDLE clientHandle;\r
- }\r
- */\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-struct ccs_win_pipe_t* ccs_win_pipe_new (const char* uuid, const HANDLE h) {\r
-\r
- cc_int32 err = ccNoError;\r
- struct ccs_win_pipe_t* out_pipe = NULL;\r
- char* uuidCopy = NULL;\r
-\r
- if (!err) {\r
- if (!uuid) {err = cci_check_error(ccErrBadParam);}\r
- }\r
-\r
- if (!err) {\r
- uuidCopy = (char*)malloc(1+strlen(uuid));\r
- if (!uuidCopy) {err = cci_check_error(ccErrBadParam);}\r
- strcpy(uuidCopy, uuid);\r
- }\r
- \r
- if (!err) {\r
- out_pipe = (struct ccs_win_pipe_t*)malloc(sizeof(struct ccs_win_pipe_t));\r
- if (!out_pipe) {err = cci_check_error(ccErrBadParam);}\r
- out_pipe->uuid = uuidCopy;\r
- out_pipe->clientHandle = h;\r
- }\r
-\r
- cci_debug_printf("0x%X = %s(%s, 0x%X)", out_pipe, __FUNCTION__, uuid, h);\r
-\r
- return out_pipe;\r
- }\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-cc_int32 ccs_win_pipe_copy (WIN_PIPE** out_pipe, \r
- const WIN_PIPE* in_pipe) {\r
-\r
- *out_pipe = \r
- ccs_win_pipe_new(\r
- ccs_win_pipe_getUuid (in_pipe),\r
- ccs_win_pipe_getHandle(in_pipe) );\r
-\r
- return (*out_pipe) ? ccNoError : ccErrBadParam;\r
- }\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-cc_int32 ccs_win_pipe_release(const WIN_PIPE* in_pipe) {\r
-\r
- cc_int32 err = ccNoError;\r
-\r
- if (!ccs_win_pipe_valid(in_pipe)) {err = cci_check_error(ccErrBadParam);}\r
-\r
- if (!err) {\r
- if (!in_pipe->uuid) free(in_pipe->uuid);\r
- if (!in_pipe) free(in_pipe);\r
- }\r
-\r
- return err;\r
- }\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-cc_int32 ccs_win_pipe_valid (const WIN_PIPE* in_pipe) {\r
-\r
- if (!in_pipe) {\r
- cci_check_error(ccErrBadParam);\r
- return FALSE;\r
- }\r
-\r
- if (!in_pipe->uuid) {\r
- cci_check_error(ccErrBadParam);\r
- return FALSE;\r
- }\r
-\r
- return TRUE;\r
- }\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-cc_int32 ccs_win_pipe_compare (const WIN_PIPE* in_pipe_1,\r
- const WIN_PIPE* in_pipe_2,\r
- cc_uint32 *out_equal) {\r
-\r
- cc_int32 err = ccNoError;\r
- int seq = 0;\r
- *out_equal = FALSE;\r
-\r
- if (!ccs_win_pipe_valid(in_pipe_1)) {err = cci_check_error(ccErrBadParam);}\r
- if (!ccs_win_pipe_valid(in_pipe_2)) {err = cci_check_error(ccErrBadParam);}\r
- if (!out_equal) {err = cci_check_error(ccErrBadParam);}\r
-\r
- /* A disconnect doesn't have a tls* with it -- only the uuid. SO only\r
- compare the uuids.\r
- */\r
- if (!err) {\r
- seq = strcmp( ccs_win_pipe_getUuid(in_pipe_1),\r
- ccs_win_pipe_getUuid(in_pipe_2) );\r
- *out_equal = (seq == 0);\r
- }\r
-\r
- return err;\r
- }\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-char* ccs_win_pipe_getUuid (const WIN_PIPE* in_pipe) {\r
-\r
- char* result = NULL;\r
-\r
- if (!ccs_win_pipe_valid(in_pipe)) {cci_check_error(ccErrBadParam);}\r
- else {result = in_pipe->uuid;}\r
-\r
- return result;\r
- }\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-HANDLE ccs_win_pipe_getHandle (const WIN_PIPE* in_pipe) {\r
-\r
- HANDLE result = NULL;\r
-\r
- if (!ccs_win_pipe_valid(in_pipe)) {cci_check_error(ccErrBadParam);}\r
- else {result = in_pipe->clientHandle;}\r
-\r
- return result;\r
- }\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#include "assert.h"
+
+#include "ccs_win_pipe.h"
+#include "cci_debugging.h"
+
+/* Ref:
+struct ccs_win_pipe_t {
+ char* uuid;
+ HANDLE clientHandle;
+ }
+ */
+
+/* ------------------------------------------------------------------------ */
+
+struct ccs_win_pipe_t* ccs_win_pipe_new (const char* uuid, const HANDLE h) {
+
+ cc_int32 err = ccNoError;
+ struct ccs_win_pipe_t* out_pipe = NULL;
+ char* uuidCopy = NULL;
+
+ if (!err) {
+ if (!uuid) {err = cci_check_error(ccErrBadParam);}
+ }
+
+ if (!err) {
+ uuidCopy = (char*)malloc(1+strlen(uuid));
+ if (!uuidCopy) {err = cci_check_error(ccErrBadParam);}
+ strcpy(uuidCopy, uuid);
+ }
+
+ if (!err) {
+ out_pipe = (struct ccs_win_pipe_t*)malloc(sizeof(struct ccs_win_pipe_t));
+ if (!out_pipe) {err = cci_check_error(ccErrBadParam);}
+ out_pipe->uuid = uuidCopy;
+ out_pipe->clientHandle = h;
+ }
+
+ cci_debug_printf("0x%X = %s(%s, 0x%X)", out_pipe, __FUNCTION__, uuid, h);
+
+ return out_pipe;
+ }
+
+/* ------------------------------------------------------------------------ */
+
+cc_int32 ccs_win_pipe_copy (WIN_PIPE** out_pipe,
+ const WIN_PIPE* in_pipe) {
+
+ *out_pipe =
+ ccs_win_pipe_new(
+ ccs_win_pipe_getUuid (in_pipe),
+ ccs_win_pipe_getHandle(in_pipe) );
+
+ return (*out_pipe) ? ccNoError : ccErrBadParam;
+ }
+
+/* ------------------------------------------------------------------------ */
+
+cc_int32 ccs_win_pipe_release(const WIN_PIPE* in_pipe) {
+
+ cc_int32 err = ccNoError;
+
+ if (!ccs_win_pipe_valid(in_pipe)) {err = cci_check_error(ccErrBadParam);}
+
+ if (!err) {
+ if (!in_pipe->uuid) free(in_pipe->uuid);
+ if (!in_pipe) free(in_pipe);
+ }
+
+ return err;
+ }
+
+/* ------------------------------------------------------------------------ */
+
+cc_int32 ccs_win_pipe_valid (const WIN_PIPE* in_pipe) {
+
+ if (!in_pipe) {
+ cci_check_error(ccErrBadParam);
+ return FALSE;
+ }
+
+ if (!in_pipe->uuid) {
+ cci_check_error(ccErrBadParam);
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
+/* ------------------------------------------------------------------------ */
+
+cc_int32 ccs_win_pipe_compare (const WIN_PIPE* in_pipe_1,
+ const WIN_PIPE* in_pipe_2,
+ cc_uint32 *out_equal) {
+
+ cc_int32 err = ccNoError;
+ int seq = 0;
+ *out_equal = FALSE;
+
+ if (!ccs_win_pipe_valid(in_pipe_1)) {err = cci_check_error(ccErrBadParam);}
+ if (!ccs_win_pipe_valid(in_pipe_2)) {err = cci_check_error(ccErrBadParam);}
+ if (!out_equal) {err = cci_check_error(ccErrBadParam);}
+
+ /* A disconnect doesn't have a tls* with it -- only the uuid. SO only
+ compare the uuids.
+ */
+ if (!err) {
+ seq = strcmp( ccs_win_pipe_getUuid(in_pipe_1),
+ ccs_win_pipe_getUuid(in_pipe_2) );
+ *out_equal = (seq == 0);
+ }
+
+ return err;
+ }
+
+/* ------------------------------------------------------------------------ */
+
+char* ccs_win_pipe_getUuid (const WIN_PIPE* in_pipe) {
+
+ char* result = NULL;
+
+ if (!ccs_win_pipe_valid(in_pipe)) {cci_check_error(ccErrBadParam);}
+ else {result = in_pipe->uuid;}
+
+ return result;
+ }
+
+/* ------------------------------------------------------------------------ */
+
+HANDLE ccs_win_pipe_getHandle (const WIN_PIPE* in_pipe) {
+
+ HANDLE result = NULL;
+
+ if (!ccs_win_pipe_valid(in_pipe)) {cci_check_error(ccErrBadParam);}
+ else {result = in_pipe->clientHandle;}
+
+ return result;
+ }
-/*\r
- * $Header$\r
- *\r
- * Copyright 2008 Massachusetts Institute of Technology.\r
- * All Rights Reserved.\r
- *\r
- * Export of this software from the United States of America may\r
- * require a specific license from the United States Government.\r
- * It is the responsibility of any person or organization contemplating\r
- * export to obtain such a license before exporting.\r
- *\r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and\r
- * distribute this software and its documentation for any purpose and\r
- * without fee is hereby granted, provided that the above copyright\r
- * notice appear in all copies and that both that copyright notice and\r
- * this permission notice appear in supporting documentation, and that\r
- * the name of M.I.T. not be used in advertising or publicity pertaining\r
- * to distribution of the software without specific, written prior\r
- * permission. Furthermore if you modify this software you must label\r
- * your software as modified software and not distribute it in such a\r
- * fashion that it might be confused with the original M.I.T. software.\r
- * M.I.T. makes no representations about the suitability of\r
- * this software for any purpose. It is provided "as is" without express\r
- * or implied warranty.\r
- */\r
-\r
-#ifndef _ccs_win_pipe_h_\r
-#define _ccs_win_pipe_h_\r
-\r
-#include "windows.h"\r
-\r
-#include "CredentialsCache.h"\r
-\r
-/* ------------------------------------------------------------------------ */\r
-\r
-/* On Windows, a pipe is a struct containing a UUID and a handle. Both the \r
- UUID and handle are supplied by the client. \r
- \r
- The UUID is used to build the client's reply endpoint. \r
- \r
- The handle is to the requesting client thread's thread local storage struct,\r
- so that the client's one and only reply handler can put reply data where\r
- the requesting thread will be able to see it.\r
- */\r
- \r
-struct ccs_win_pipe_t {\r
- char* uuid;\r
- HANDLE clientHandle;\r
- };\r
-\r
-typedef struct ccs_win_pipe_t WIN_PIPE;\r
-\r
-struct ccs_win_pipe_t* ccs_win_pipe_new(const char* uuid, const HANDLE h);\r
-\r
-cc_int32 ccs_win_pipe_release (const WIN_PIPE* io_pipe);\r
-\r
-cc_int32 ccs_win_pipe_compare (const WIN_PIPE* win_pipe_1,\r
- const WIN_PIPE* win_pipe_2,\r
- cc_uint32 *out_equal);\r
-\r
-cc_int32 ccs_win_pipe_copy (WIN_PIPE** out_pipe, \r
- const WIN_PIPE* in_pipe);\r
-\r
-cc_int32 ccs_win_pipe_valid (const WIN_PIPE* in_pipe);\r
-\r
-char* ccs_win_pipe_getUuid (const WIN_PIPE* in_pipe);\r
-HANDLE ccs_win_pipe_getHandle (const WIN_PIPE* in_pipe);\r
-\r
+/*
+ * $Header$
+ *
+ * Copyright 2008 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ */
+
+#ifndef _ccs_win_pipe_h_
+#define _ccs_win_pipe_h_
+
+#include "windows.h"
+
+#include "CredentialsCache.h"
+
+/* ------------------------------------------------------------------------ */
+
+/* On Windows, a pipe is a struct containing a UUID and a handle. Both the
+ UUID and handle are supplied by the client.
+
+ The UUID is used to build the client's reply endpoint.
+
+ The handle is to the requesting client thread's thread local storage struct,
+ so that the client's one and only reply handler can put reply data where
+ the requesting thread will be able to see it.
+ */
+
+struct ccs_win_pipe_t {
+ char* uuid;
+ HANDLE clientHandle;
+ };
+
+typedef struct ccs_win_pipe_t WIN_PIPE;
+
+struct ccs_win_pipe_t* ccs_win_pipe_new(const char* uuid, const HANDLE h);
+
+cc_int32 ccs_win_pipe_release (const WIN_PIPE* io_pipe);
+
+cc_int32 ccs_win_pipe_compare (const WIN_PIPE* win_pipe_1,
+ const WIN_PIPE* win_pipe_2,
+ cc_uint32 *out_equal);
+
+cc_int32 ccs_win_pipe_copy (WIN_PIPE** out_pipe,
+ const WIN_PIPE* in_pipe);
+
+cc_int32 ccs_win_pipe_valid (const WIN_PIPE* in_pipe);
+
+char* ccs_win_pipe_getUuid (const WIN_PIPE* in_pipe);
+HANDLE ccs_win_pipe_getHandle (const WIN_PIPE* in_pipe);
+
#endif // _ccs_win_pipe_h_
\ No newline at end of file
-#ifndef __WorkItem\r
-#define __WorkItem\r
-\r
-#include <list>\r
-#include "windows.h"\r
-\r
-extern "C" {\r
- #include "cci_stream.h"\r
- #include "ccs_pipe.h"\r
- }\r
-\r
-class WorkItem {\r
-private:\r
- cci_stream_t _buf;\r
- WIN_PIPE* _pipe;\r
- const long _rpcmsg;\r
- const long _sst;\r
-public:\r
- WorkItem( cci_stream_t buf, \r
- WIN_PIPE* pipe, \r
- const long type, \r
- const long serverStartTime);\r
- WorkItem( const WorkItem&);\r
- WorkItem();\r
- ~WorkItem();\r
-\r
- const cci_stream_t payload() const {return _buf;}\r
- const cci_stream_t take_payload();\r
- WIN_PIPE* take_pipe();\r
- WIN_PIPE* pipe() const {return _pipe;}\r
- const long type() const {return _rpcmsg;}\r
- const long sst() const {return _sst;}\r
- char* print(char* buf);\r
- };\r
-\r
-class WorkList {\r
-private:\r
- std::list <WorkItem*> wl;\r
- CRITICAL_SECTION cs;\r
-public:\r
- WorkList();\r
- ~WorkList();\r
- int add(WorkItem*);\r
- int remove(WorkItem**);\r
- bool isEmpty() {return wl.empty();}\r
- };\r
-\r
+#ifndef __WorkItem
+#define __WorkItem
+
+#include <list>
+#include "windows.h"
+
+extern "C" {
+ #include "cci_stream.h"
+ #include "ccs_pipe.h"
+ }
+
+class WorkItem {
+private:
+ cci_stream_t _buf;
+ WIN_PIPE* _pipe;
+ const long _rpcmsg;
+ const long _sst;
+public:
+ WorkItem( cci_stream_t buf,
+ WIN_PIPE* pipe,
+ const long type,
+ const long serverStartTime);
+ WorkItem( const WorkItem&);
+ WorkItem();
+ ~WorkItem();
+
+ const cci_stream_t payload() const {return _buf;}
+ const cci_stream_t take_payload();
+ WIN_PIPE* take_pipe();
+ WIN_PIPE* pipe() const {return _pipe;}
+ const long type() const {return _rpcmsg;}
+ const long sst() const {return _sst;}
+ char* print(char* buf);
+ };
+
+class WorkList {
+private:
+ std::list <WorkItem*> wl;
+ CRITICAL_SECTION cs;
+public:
+ WorkList();
+ ~WorkList();
+ int add(WorkItem*);
+ int remove(WorkItem**);
+ bool isEmpty() {return wl.empty();}
+ };
+
#endif // __WorkItem
\ No newline at end of file
-// pingtest.c\r
-//\r
-// Test RPC to server, with PING message, which exists for no other purpose than this test.\r
-\r
-#include <stdio.h>\r
-#include <stdarg.h>\r
-\r
-#include "cci_debugging.h"\r
-#include "CredentialsCache.h"\r
-#include "cci_stream.h"\r
-#include "win-utils.h"\r
-\r
-#include "ccs_request.h"\r
-#define CLIENT_REQUEST_RPC_HANDLE ccs_request_IfHandle\r
-\r
-\r
-extern cc_int32 cci_os_ipc_thread_init (void);\r
-extern cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server,\r
- cci_stream_t in_request_stream,\r
- cc_int32 in_msg,\r
- cci_stream_t* out_reply_stream);\r
-\r
-RPC_STATUS send_test(char* endpoint) {\r
- unsigned char* pszNetworkAddress = NULL;\r
- unsigned char* pszOptions = NULL;\r
- unsigned char* pszStringBinding = NULL;\r
- unsigned char* pszUuid = NULL;\r
- RPC_STATUS status;\r
- \r
- status = RpcStringBindingCompose(pszUuid,\r
- (RPC_CSTR)"ncalrpc",\r
- pszNetworkAddress,\r
- (unsigned char*)endpoint,\r
- pszOptions,\r
- &pszStringBinding);\r
- cci_debug_printf("%s pszStringBinding = %s", __FUNCTION__, pszStringBinding);\r
- if (status) {return cci_check_error(status);}\r
-\r
- /* Set the binding handle that will be used to bind to the RPC server [the 'client']. */\r
- status = RpcBindingFromStringBinding(pszStringBinding, &CLIENT_REQUEST_RPC_HANDLE);\r
- if (status) {return cci_check_error(status);}\r
-\r
- status = RpcStringFree(&pszStringBinding); // Temp var no longer needed.\r
-\r
- if (!status) {\r
- RpcTryExcept {\r
- cci_debug_printf("%s calling remote procedure 'ccs_authenticate'", __FUNCTION__);\r
- status = ccs_authenticate((CC_CHAR*)"DLLMAIN TEST!");\r
- cci_debug_printf(" ccs_authenticate returned %d", status);\r
- }\r
- RpcExcept(1) {\r
- status = cci_check_error(RpcExceptionCode());\r
- }\r
- RpcEndExcept\r
- }\r
-\r
- cci_check_error(RpcBindingFree(&CLIENT_REQUEST_RPC_HANDLE));\r
-\r
- return (status);\r
- }\r
-\r
-int main( int argc, char *argv[]) {\r
- cc_int32 err = 0;\r
- cc_context_t context = NULL;\r
- cci_stream_t send_stream = NULL;\r
- cci_stream_t reply_stream = NULL;\r
- char* message = "Hello, RPC!";\r
-\r
-\r
-// send_test("krbcc.229026.0.ep");\r
-\r
-#if 0\r
- err = cc_initialize(&context, ccapi_version_7, NULL, NULL);\r
-#endif\r
-\r
- if (!err) {\r
- err = cci_os_ipc_thread_init();\r
- }\r
- if (!err) {\r
- err = cci_stream_new (&send_stream);\r
- err = cci_stream_write(send_stream, message, 1+strlen(message));\r
- }\r
-\r
- if (!err) {\r
- err = cci_os_ipc_msg(TRUE, send_stream, CCMSG_PING, &reply_stream); \r
- }\r
- Sleep(10*1000);\r
- cci_debug_printf("Try finishing async call.");\r
-\r
- Sleep(INFINITE);\r
- cci_debug_printf("main: return. err == %d", err);\r
- \r
- return 0;\r
- }\r
-\r
-\r
-\r
-/*********************************************************************/\r
-/* MIDL allocate and free */\r
-/*********************************************************************/\r
-\r
-void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) {\r
- return(malloc(len));\r
- }\r
-\r
-void __RPC_USER midl_user_free(void __RPC_FAR * ptr) {\r
- free(ptr);\r
- }\r
+// 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);
+ }