From 54383345ad77587fa4eaf765eb77d20439500482 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Tue, 5 Feb 2008 18:25:28 +0000 Subject: set eol-style git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20217 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ccapi/lib/win/OldCC/ccapi.h | 568 ++++++++++++++++++------------------- src/ccapi/lib/win/OldCC/client.h | 122 ++++---- src/ccapi/lib/win/ccs_reply_proc.c | 196 ++++++------- src/ccapi/lib/win/dllmain.h | 88 +++--- 4 files changed, 487 insertions(+), 487 deletions(-) (limited to 'src/ccapi/lib') diff --git a/src/ccapi/lib/win/OldCC/ccapi.h b/src/ccapi/lib/win/OldCC/ccapi.h index 65a72edb47..c40bd11584 100644 --- a/src/ccapi/lib/win/OldCC/ccapi.h +++ b/src/ccapi/lib/win/OldCC/ccapi.h @@ -1,284 +1,284 @@ - - -/* 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 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 - - + + +/* 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 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 + + diff --git a/src/ccapi/lib/win/OldCC/client.h b/src/ccapi/lib/win/OldCC/client.h index f263ce1c0e..52be2edfbd 100644 --- a/src/ccapi/lib/win/OldCC/client.h +++ b/src/ccapi/lib/win/OldCC/client.h @@ -1,61 +1,61 @@ -/* - * $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 +/* + * $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 diff --git a/src/ccapi/lib/win/ccs_reply_proc.c b/src/ccapi/lib/win/ccs_reply_proc.c index ebac6e3cf7..f9eef87fff 100644 --- a/src/ccapi/lib/win/ccs_reply_proc.c +++ b/src/ccapi/lib/win/ccs_reply_proc.c @@ -1,98 +1,98 @@ -/* - * $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 -#include -#include - -#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; - } +/* + * $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 +#include +#include + +#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; + } diff --git a/src/ccapi/lib/win/dllmain.h b/src/ccapi/lib/win/dllmain.h index 3ce2ac230f..8c585721c0 100644 --- a/src/ccapi/lib/win/dllmain.h +++ b/src/ccapi/lib/win/dllmain.h @@ -1,45 +1,45 @@ -/* - * $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 - +/* + * $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 -- cgit