1 /* ccapi/common/win/tls.h */ 2 /* 3 * Copyright 2008 Massachusetts Institute of Technology. 4 * All Rights Reserved. 5 * 6 * Export of this software from the United States of America may 7 * require a specific license from the United States Government. 8 * It is the responsibility of any person or organization contemplating 9 * export to obtain such a license before exporting. 10 * 11 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 12 * distribute this software and its documentation for any purpose and 13 * without fee is hereby granted, provided that the above copyright 14 * notice appear in all copies and that both that copyright notice and 15 * this permission notice appear in supporting documentation, and that 16 * the name of M.I.T. not be used in advertising or publicity pertaining 17 * to distribution of the software without specific, written prior 18 * permission. Furthermore if you modify this software you must label 19 * your software as modified software and not distribute it in such a 20 * fashion that it might be confused with the original M.I.T. software. 21 * M.I.T. makes no representations about the suitability of 22 * this software for any purpose. It is provided "as is" without express 23 * or implied warranty. 24 */ 25 26 /* Thread local storage for client threads. */ 27 28 #ifndef _tls_h 29 #define _tls_h 30 31 #include "windows.h" 32 #include "time.h" 33 #include "rpc.h" 34 35 #include "k5-ipc_stream.h" 36 37 #define UUID_SIZE 128 38 39 /* The client code can be run in any client thread. 40 The thread-specific data is defined here. 41 */ 42 43 struct tspdata { 44 BOOL _listening; 45 BOOL _CCAPI_Connected; 46 RPC_ASYNC_STATE* _rpcState; 47 HANDLE _replyEvent; 48 time_t _sst; 49 k5_ipc_stream _stream; 50 char _uuid[UUID_SIZE]; 51 }; 52 53 void tspdata_setListening (struct tspdata* p, BOOL b); 54 void tspdata_setConnected (struct tspdata* p, BOOL b); 55 void tspdata_setReplyEvent(struct tspdata* p, HANDLE h); 56 void tspdata_setRpcAState (struct tspdata* p, RPC_ASYNC_STATE* rpcState); 57 void tspdata_setSST (struct tspdata* p, time_t t); 58 void tspdata_setStream (struct tspdata* p, k5_ipc_stream s); 59 void tspdata_setUUID (struct tspdata* p, unsigned char __RPC_FAR* uuidString); 60 HANDLE tspdata_getReplyEvent(const struct tspdata* p); 61 62 BOOL tspdata_getListening(const struct tspdata* p); 63 BOOL tspdata_getConnected(const struct tspdata* p); 64 RPC_ASYNC_STATE* tspdata_getRpcAState(const struct tspdata* p); 65 time_t tspdata_getSST (const struct tspdata* p); 66 k5_ipc_stream tspdata_getStream (const struct tspdata* p); 67 char* tspdata_getUUID (const struct tspdata* p); 68 69 BOOL WINAPI GetTspData(DWORD tlsIndex, struct tspdata** pdw); 70 71 #endif _tls_h 72