Crypt-MatrixSSL

 view release on metacpan or  search on metacpan

matrixssl-1-8-6-open/src/os/osLayer.h  view on Meta::CPAN

#ifndef CLK_TCK
#define CLK_TCK		CLOCKS_PER_SEC
#endif /* CLK_TCK */

typedef pthread_mutex_t sslMutex_t;
extern int32	sslCreateMutex(sslMutex_t *mutex);
extern int32	sslLockMutex(sslMutex_t *mutex);
extern int32	sslUnlockMutex(sslMutex_t *mutex);
extern void	sslDestroyMutex(sslMutex_t *mutex);
#elif VXWORKS
#include "semLib.h"

typedef SEM_ID		sslMutex_t; 
extern int32	sslCreateMutex(sslMutex_t *mutex);
extern int32	sslLockMutex(sslMutex_t *mutex);
extern int32	sslUnlockMutex(sslMutex_t *mutex);
extern void	sslDestroyMutex(sslMutex_t *mutex);
#endif /* WIN32 || CE */

#else /* USE_MULTITHREADING */
typedef int32	sslMutex_t;
#define sslCreateMutex(M)
#define sslLockMutex(M)
#define sslUnlockMutex(M)
#define sslDestroyMutex(M)

#endif /* USE_MULTITHREADING */

/*
	Make sslTime_t an opaque time value.
	FUTURE - use high res time instead of time_t
*/
#if defined(WIN32)
#include <windows.h>
typedef LARGE_INTEGER sslTime_t;
#elif VXWORKS
typedef struct {
		long sec;
		long usec;
	} sslTime_t;
#elif (defined(USE_RDTSCLL_TIME) || defined(RDTSC))
typedef unsigned long long LARGE_INTEGER;
typedef LARGE_INTEGER sslTime_t;
#elif WINCE
#include <windows.h>

typedef LARGE_INTEGER sslTime_t;
#else
typedef struct {
		long sec;
		long usec;
	} sslTime_t;
#endif

/******************************************************************************/
/*
	We define our own stat for CE.
*/
#if WINCE

extern int32 stat(char *filename, struct stat *sbuf);

struct stat {
	unsigned long st_size;	/* file size in bytes				*/
	unsigned long st_mode;
	time_t st_atime;		/* time of last access				*/
	time_t st_mtime;		/* time of last data modification	*/
	time_t st_ctime;		/* time of last file status change	*/
};

#define			S_IFREG 0100000
#define			S_IFDIR 0040000

extern time_t time();

#endif /* WINCE */

extern int32		sslInitMsecs(sslTime_t *t);
extern int32		sslCompareTime(sslTime_t a, sslTime_t b);
extern int32		sslDiffSecs(sslTime_t then, sslTime_t now);
extern long		sslDiffMsecs(sslTime_t then, sslTime_t now);


/******************************************************************************/
/*
	Debugging functionality.  
	
	If DEBUG is defined matrixStrDebugMsg and matrixIntDebugMsg messages are
	output to stdout, sslAsserts go to stderror and call psBreak.

	In non-DEBUG builds matrixStrDebugMsg and matrixIntDebugMsg are 
	compiled out.  sslAsserts still go to stderr, but psBreak is not called.

*/

#if DEBUG
extern void psBreak(void);
extern void matrixStrDebugMsg(char *message, char *arg);
extern void matrixIntDebugMsg(char *message, int32 arg);
extern void matrixPtrDebugMsg(char *message, void *arg);
#define sslAssert(C)  if (C) ; else \
	{fprintf(stderr, "%s:%d sslAssert(%s)\n",__FILE__, __LINE__, #C); psBreak(); }
#else
#define matrixStrDebugMsg(x, y)
#define matrixIntDebugMsg(x, y)
#define matrixPtrDebugMsg(x, y)
#define sslAssert(C)  if (C) ; else \
	{fprintf(stderr, "%s:%d sslAssert(%s)\n",__FILE__, __LINE__, #C); }
#endif /* DEBUG */

#ifdef __cplusplus
}
#endif

#endif /* _h_OS_LAYER */

/******************************************************************************/



( run in 2.758 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )