//========================================================================== // PRODUCT: RusRoute - MaaSoftware routing firewall software driver // (C) Copyright Moiseenko A.A., MaaSoftware, 2003-2008. All Rights Reserved. // http://www.maasoftware.ru http://www.maasoftware.com // http://www.rusroute.ru http://www.rusroute.com // support@maasoftware.ru //========================================================================== // FILE: Library.h // // AUTHOR: Andrey A. Moiseenko // // OVERVIEW Driver library of the base functions. // ~~~~~~~~ // DATE: 15.10.2003 //========================================================================== //--------------------------------------------------------------------------- //#ifdef __cplusplus // extern "C" { //#endif //--------------------------------------------------------------------------- #ifdef _WINNT inline _word htons ( int x ) { return ( x << 8 ) | ( ( x >> 8 ) & 0xff ); } #endif class CMaaGetCheckIrql { #ifdef _WINNT KIRQL m_Irql; const char * m_szPoint; int m_PointN; #endif public: CMaaGetCheckIrql ( const char * szPoint = NULL ); ~CMaaGetCheckIrql (); }; void Memset(void * p, char c, int bytes ); #ifndef _MaaRF_INTERNAL_BUILD #define Memcpy(a,b,c) memcpy(a,b,c) #define Memcmp(a,b,c) memcmp(a,b,c) #define Memzero(a,b) memset(a,0,b) #else #define Memcpy(a,b,c) memcpy(a,b,c) //#define Memcmp(a,b,c) memcmp(a,b,c) #define Memzero(a,b) memset(a,0,b) extern size_t gMemoryAllocated; char * KillCrLf ( char * str ); #ifndef __unix__ //void Memcpy ( void * destination, const void * source, int bytes ); int Memcmp ( const void * ptr1, const void * ptr2, int bytes ); void Memmove ( void * destination, const void * source, int bytes ); //void Memzero( void * destination, int bytes ); unsigned int Strlen ( const char * string ); int Strcmp ( const void * str1, const void * str2 ); int Stricmp ( const void * str1, const void * str2 ); void Strcat ( char * str1, const char * str2, int MaxStr1Size ); #define Strcpy( d, s ) Memcpy ( d, s, Strlen ( s ) + 1 ) //int Text_2_IP ( char *txt, unsigned long *IP_Out ); void * NdisAlloc ( unsigned Size ); void NdisFree ( void * Ptr, unsigned Size ); #ifndef _WINNT #define memcpy Memcpy #define memmove Memmove #define strcmp Strcmp #define strlen Strlen #endif #define memcmp Memcmp //#define memset(ptr,zero,sz) Memzero(ptr,sz) //--------------------------------------------------------------------------- //#ifdef __cplusplus // } //#endif //--------------------------------------------------------------------------- #ifndef __unix__ #define ntohs htons #define ntohl htonl _word _stdcall htons ( _word Param ); _dword _stdcall htonl ( _dword Param ); #endif #ifdef _WINNT void * malloc ( size_t Size ); void * calloc ( size_t Size ); void free ( void * ptr ); void * __cdecl operator new ( size_t Size ); void __cdecl operator delete ( void * ptr ); #endif //--------------------------------------------------------------------------- #ifndef _WINNT #define OUT_DEBUG_STRING( x ) Out_Debug_String ( x ) #else #define OUT_DEBUG_STRING( x ) DbgPrint ( x ) #endif //--------------------------------------------------------------------------- char * CDrvSprintfAlloc(const char * format, ...); void CDrvSprintf ( char * buff, const char * format, ... ); char * CDrvSprintf_ ( const char * __format, va_list list ); void MaaPrint ( const char * __format, ... ); inline void MaaPrint_Supress ( const char * __format, ... ) {} #ifdef _DEBUG #define PrintDbg MaaPrint #else #ifdef DRV_USE_DEBUG_STRING_BUFFERS #define PrintDbg MaaPrint #else #define PrintDbg MaaPrint_Supress #endif #endif #ifdef DRV_SUPRESS_DEBUG_OUT #undef PrintDbg #define PrintDbg MaaPrint_Supress #endif #define MAX_IP_TEXT 16 char * Ip2Text ( char * txt, _IP Ip ); #endif //!__unix__ #endif //_MaaRF_INTERNAL_BUILD //---------------------------------------------------------------------------