Mixe for Privacy and Anonymity in the Internet
CAMsg.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2000, The JAP-Team
3 All rights reserved.
4 Redistribution and use in source and binary forms, with or without modification,
5 are permitted provided that the following conditions are met:
6 
7  - Redistributions of source code must retain the above copyright notice,
8  this list of conditions and the following disclaimer.
9 
10  - Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation and/or
12  other materials provided with the distribution.
13 
14  - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors
15  may be used to endorse or promote products derived from this software without specific
16  prior written permission.
17 
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
20 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
22 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
27 */
28 #include "StdAfx.h"
29 #include "CAMsg.hpp"
30 #include "CACmdLnOptions.hpp"
31 #include "CAASymCipher.hpp"
32 #include "CASymCipher.hpp"
33 #include "CAUtil.hpp"
34 #include "CABase64.hpp"
35 #include "CALibProxytest.hpp"
36 
37 #define FILENAME_ENCRYPTEDLOG "/encrypted_messages"
38 #define FILENAME_INFOLOG "/messages"
39 #define FILENAME_INFOLOG_GZ "/messages.gz"
40 
41 #define MAX_MSG_SIZE 8192
42 
43 CAMsg* CAMsg::pMsg=NULL;
44 
45 const char* const CAMsg::m_strMsgTypes[6]={", error ] ",", critical] ",", info ] ",", debug ] ",", special ] ",", warning ] "}; //all same size!
46 #define STRMSGTYPES_SIZE 12
47 
48 
50  {
51  m_pcsPrint=new CAMutex();
52  m_logLevel = LOG_DEBUG;
56  m_hFileInfo=-1;
58  m_strLogFile=new char[1024];
59  m_strMsgBuff[0]='[';
60 #ifdef COMPRESSED_LOGS
61  m_gzFileInfo=NULL;
62 #endif
63  m_pCipher=NULL;
65  m_alreadyOpened = false;
66  }
67 
69  {
70  closeLog();
71 #ifndef ONLY_LOCAL_PROXY
73 #endif
74  delete[] m_strMsgBuff;
75  m_strMsgBuff = NULL;
76  delete[] m_strLogFile;
77  m_strLogFile = NULL;
78  delete m_pcsPrint;
79  m_pcsPrint = NULL;
80  }
81 
83 {
84  const char* strLogAtPath = " at path '%s'";
85  char* strLogFile = NULL;
86 
87 
88  if ((opt & MSG_FILE) == MSG_FILE || (opt & MSG_COMPRESSED_FILE) == MSG_COMPRESSED_FILE)
89  {
90  if (pMsg->m_strLogFile != NULL)
91  {
92  strLogFile = new char[strlen(strLogAtPath) + strlen(pMsg->m_strLogFile) + 1];
93  sprintf(strLogFile, strLogAtPath, pMsg->m_strLogFile);
94  }
95  }
96  if (strLogFile == NULL)
97  {
98  strLogFile = new char[1];
99  strLogFile[0] = '\0';
100  }
101  return strLogFile;
102 }
103 
105 {
106  const char* strLogAtPath = " Please also check if the directory '%s' exists and create or change it if it does not.";
107  char* strLogFile = NULL;
108 
109 
110  if ((opt & MSG_FILE) == MSG_FILE || (opt & MSG_COMPRESSED_FILE) == MSG_COMPRESSED_FILE)
111  {
112  if (pMsg->m_strLogDir != NULL)
113  {
114  strLogFile = new char[strlen(strLogAtPath) + strlen(pMsg->m_strLogDir) + 1];
115  sprintf(strLogFile, strLogAtPath, pMsg->m_strLogDir);
116  }
117  }
118  if (strLogFile == NULL)
119  {
120  strLogFile = new char[1];
121  strLogFile[0] = '\0';
122  }
123  return strLogFile;
124 }
125 
126 
128 {
129  if (a_logLevel == LOG_DEBUG ||
130  a_logLevel == LOG_INFO ||
131  a_logLevel == LOG_WARNING ||
132  a_logLevel == LOG_ERR ||
133  a_logLevel == LOG_CRIT)
134  {
135  pMsg->m_logLevel = a_logLevel;
136  return E_SUCCESS;
137  }
138  return E_UNKNOWN;
139 }
140 
141 const char* const CAMsg::ms_arStrLogLevels[5] = { "CRITICAL","ERROR","WARNING","INFO","DEBUG" };
142 
143 const char* const CAMsg::getLogLevelStr()
144  {
145  switch (pMsg->m_uLogType)
146  {
147  case LOG_CRIT:
148  return ms_arStrLogLevels[0];
149  case LOG_ERR:
150  return ms_arStrLogLevels[1];
151  case LOG_WARNING:
152  return ms_arStrLogLevels[2];
153  case LOG_INFO:
154  return ms_arStrLogLevels[3];
155  case LOG_DEBUG:
156  return ms_arStrLogLevels[4];
157  }
158  return NULL;
159  }
160 
162  {
163  SINT32 ret;
164  const char* strLogOpened = "Message log opened%s%s.\n";
165  const char* strLogErrorMsg = "Could not open message log%s%s!%s Do you have write permissions?%s\n";
166  const char* strReasonMsg = " Reason: %s (%u)";
167  char* strLogFile = NULL;
168  char* strLogDir = NULL;
169  char* strReason = NULL;
170  char* strBuff;
171  const char* strLogType = "";
172 
173 
174  if(pMsg->m_uLogType==opt)
175  {
176  return E_SUCCESS;
177  }
178 
179 
180  if (opt == MSG_LOG)
181  {
182  strLogType = " as Syslog";
183  }
184  else if ((opt & MSG_LOG) == MSG_LOG)
185  {
186  strLogType = " as Syslog and";
187  }
188 
189  if ((opt & MSG_FILE) == MSG_FILE)
190  {
191  strLogType = " as file";
192  }
193  else if ((opt & MSG_COMPRESSED_FILE) == MSG_COMPRESSED_FILE)
194  {
195  strLogType = " as compressed file";
196  }
197 
198 
199 
200  if((ret = pMsg->openLog(opt))==E_SUCCESS)
201  {
202  strLogFile = pMsg->createLogFileMessage(opt);
203  strBuff = new char[strlen(strLogOpened) + strlen(strLogType) + strlen(strLogFile) + 1];
204  sprintf(strBuff, strLogOpened, strLogType, strLogFile);
205  delete[] strLogFile;
206  printMsg(LOG_DEBUG, strBuff);
207  delete[] strBuff;
208 
209  pMsg->closeLog(); //closes the OLD Log!
210  pMsg->m_uLogType=opt;
211 
212 
213  return E_SUCCESS;
214  }
215 
216 
217  strLogFile = pMsg->createLogFileMessage(opt);
218 
219  strLogDir = pMsg->createLogDirMessage(opt);
220 
221  if (ret == E_FILE_OPEN)
222  {
223  strReason = new char[strlen(strReasonMsg) + strlen(GET_NET_ERROR_STR(GET_NET_ERROR)) + 5 + 1];
224  sprintf(strReason, strReasonMsg, GET_NET_ERROR_STR(GET_NET_ERROR), GET_NET_ERROR);
225  }
226  else
227  {
228  strReason = new char[1];
229  strReason[0] = '\0';
230  }
231 
232  strBuff = new char[strlen(strLogErrorMsg) + strlen(strLogType) + strlen(strLogFile) + strlen(strReason) + strlen(strLogDir) + 1];
233 
234  sprintf(strBuff, strLogErrorMsg, strLogType, strLogFile, strReason, strLogDir);
235  //snprintf(strBuff, strlen(strLogErrorMsg) + strlen(strLogFile) + strlen(strReason) + 1, strLogErrorMsg, strLogFile, strReason);
236  delete[] strLogFile;
237  delete[] strReason;
238 
239  printMsg(LOG_CRIT, strBuff);
240 
241  delete[] strBuff;
242  return ret;
243  }
251 SINT32 CAMsg::printMsg(UINT32 type,const char* format,...)
252  {
253  if (pMsg->m_uLogType == MSG_NOLOG)
254  {
255  return E_SUCCESS;
256  }
257 
258  if(pMsg != NULL)
259  {
260  pMsg->m_pcsPrint->lock();
261  va_list ap;
262  va_start(ap,format);
263  SINT32 ret=E_SUCCESS;
264 
265  //Date is: yyyy/mm/dd-hh:mm:ss -- the size is: 19
266  time_t currtime=time(NULL);
267  strftime(pMsg->m_strMsgBuff+1,255,"%Y/%m/%d-%H:%M:%S",localtime(&currtime));
268  switch(type)
269  {
270  case LOG_DEBUG:
271  if (pMsg->m_logLevel != LOG_DEBUG)
272  {
273  ret = E_UNKNOWN;
274  }
275  strcat(pMsg->m_strMsgBuff,pMsg->m_strMsgTypes[3]);
276  break;
277  case LOG_INFO:
278  if (pMsg->m_logLevel == LOG_WARNING || pMsg->m_logLevel == LOG_ERR || pMsg->m_logLevel == LOG_CRIT)
279  {
280  ret = E_UNKNOWN;
281  }
282  strcat(pMsg->m_strMsgBuff,pMsg->m_strMsgTypes[2]);
283  break;
284  case LOG_CRIT:
285  strcat(pMsg->m_strMsgBuff,pMsg->m_strMsgTypes[1]);
286  break;
287  case LOG_ERR:
288  if (pMsg->m_logLevel == LOG_CRIT)
289  {
290  ret = E_UNKNOWN;
291  }
292  strcat(pMsg->m_strMsgBuff,pMsg->m_strMsgTypes[0]);
293  break;
294  case LOG_ENCRYPTED:
295  strcat(pMsg->m_strMsgBuff,pMsg->m_strMsgTypes[4]);
296  break;
297  case LOG_WARNING:
298  if (pMsg->m_logLevel == LOG_ERR || pMsg->m_logLevel == LOG_CRIT)
299  {
300  ret = E_UNKNOWN;
301  }
302  strcat(pMsg->m_strMsgBuff,pMsg->m_strMsgTypes[5]);
303  break;
304  default:
305  va_end(ap);
306  pMsg->m_pcsPrint->unlock();
307  return E_UNKNOWN;
308  }
309  #ifdef HAVE_VSNPRINTF
310  vsnprintf(pMsg->m_strMsgBuff+20+STRMSGTYPES_SIZE,MAX_MSG_SIZE,format,ap);
311  #else
312  trio_vsnprintf(pMsg->m_strMsgBuff+20+STRMSGTYPES_SIZE,MAX_MSG_SIZE,format,ap);
313  #endif
314  va_end(ap);
315  if (ret != E_SUCCESS)
316  {
317  pMsg->m_pcsPrint->unlock();
318  return ret;
319  }
320  if(type==LOG_ENCRYPTED)
321  {
322  ret=strlen(pMsg->m_strMsgBuff);
323  if( pMsg->m_pCipher==NULL)
324  {
325  ret=E_UNKNOWN;
326  }
327  else
328  {
329  UINT8 bp[MAX_MSG_SIZE];
330  AES_ofb128_encrypt((UINT8*)pMsg->m_strMsgBuff,
331  bp,ret,
332  &(pMsg->m_pCipher->oKey),
333  pMsg->m_pCipher->iv,
334  &(pMsg->m_pCipher->iv_off));
335  if(myfilewrite(pMsg->m_hFileEncrypted,bp,ret)!=ret)
336  ret=E_UNKNOWN;
337  }
338  }
339  else
340  {
341  if ((pMsg->m_uLogType & MSG_LOG) == MSG_LOG)
342  {
343  #ifndef _WIN32
344  syslog(type,pMsg->m_strMsgBuff);
345  #endif
346  }
347  #ifdef COMPRESSED_LOGS
349  {
350  if(pMsg->m_gzFileInfo!=NULL)
351  {
352  if(gzwrite(pMsg->m_gzFileInfo,pMsg->m_strMsgBuff,strlen(pMsg->m_strMsgBuff))==-1)
353  ret=E_UNKNOWN;
354  }
355  }
356  #endif
357  else if ((pMsg->m_uLogType & MSG_FILE) == MSG_FILE)
358  {
359 /* if(pMsg->m_hFileInfo==-1)
360  {
361  pMsg->m_hFileInfo=open(pMsg->m_strLogFile,O_APPEND|O_CREAT|O_WRONLY|O_NONBLOCK|O_LARGEFILE|O_SYNC,S_IREAD|S_IWRITE);
362  }
363 */// if(pMsg->m_hFileInfo!=-1)
364 // {
365  #ifdef PSEUDO_LOG
366  char buff[255];
367  sprintf(buff,"%.15s mix AnonMix: ",ctime(&currtime)+4);
368  write(pMsg->m_hFileInfo,buff,strlen(buff));
369  #endif
371  ret=E_UNKNOWN;
372  pMsg->m_NrOfWrites++;
373  if( //(pMsg->m_NrOfWrites > 10000) &&
376  {
377  pMsg->closeLog();
379  }
380 // }
381  }
382  if ((pMsg->m_uLogType & MSG_STDOUT) == MSG_STDOUT)
383  {
384  printf("%s",pMsg->m_strMsgBuff);
385  }
386  }
387  pMsg->m_pcsPrint->unlock();
388  return ret;
389  }
390  else
391  {
392  printf("Warning logger is not active!\n");
393  return E_UNKNOWN;
394  }
395  }
396 
398  {
399  if ((pMsg->m_uLogType & MSG_LOG) == MSG_LOG)
400  {
401 #ifndef _WIN32
402  ::closelog();
403 #endif
404  }
405 #ifdef COMPRESSED_LOGS
407  {
408  if(m_gzFileInfo!=NULL)
409  gzclose(m_gzFileInfo);
410  m_gzFileInfo=NULL;
411  }
412 #endif
413  else if ((pMsg->m_uLogType & MSG_FILE) == MSG_FILE)
414  {
415  if(m_hFileInfo!=-1)
416  close(m_hFileInfo);
417  m_hFileInfo=-1;
418  }
419  return E_SUCCESS;
420  }
421 
423 {
425  {
426  // TODO
427  }
428  else if ((pMsg->m_uLogType & MSG_FILE) == MSG_FILE)
429  {
430 
431  char logFileSaveName[1026];
432  memset(logFileSaveName, 0, 1026);
433  //memcpy(logFileSave, m_strMsgBuff, 1024);
434  snprintf(logFileSaveName, 1025, "%s%u", m_strLogFile, m_lastLogFileNumber);
436  rename(m_strLogFile, logFileSaveName);
437  /*if(m_hFileInfo!=-1)
438  close(m_hFileInfo);
439  m_hFileInfo=-1;*/
440  }
441 
442  return E_SUCCESS;
443 }
444 
446  {
447  if ((type & MSG_LOG) == MSG_LOG)
448  {
449 #ifndef _WIN32
450  openlog("AnonMix",0,LOG_USER);
451 #endif
452  }
453 #ifdef COMPRESSED_LOGS
455  {
456  char logdir[255];
457  char buff[1024];
458  if(CALibProxytest::getOptions()->getLogDir((UINT8*)logdir,255)!=E_SUCCESS)
459  return E_UNKNOWN;
460  strcpy(buff,logdir);
461  strcat(buff,FILENAME_INFOLOG_GZ);
462  tmpHandle=open(buff,O_APPEND|O_CREAT|O_WRONLY,S_IREAD|S_IWRITE);
463  if (tmpHandle == -1)
464  {
465  return E_FILE_OPEN;
466  }
467  m_gzFileInfo=gzdopen(tmpHandle,"wb9");
468  if(m_gzFileInfo==NULL)
469  {
470  SINT32 iError = GET_NET_ERROR;
471  close(tmpHandle);
472  SET_NET_ERROR(iError);
473  return E_FILE_OPEN;
474  }
475  }
476 #endif
477  else if ((type & MSG_FILE) == MSG_FILE)
478  {
479  if(CALibProxytest::getOptions()->getLogDir((UINT8*)m_strLogFile,1024)!=E_SUCCESS)
480  {
481  return E_UNKNOWN;
482  }
483  m_strLogDir = new char[strlen(m_strLogFile) + 1];
484  strcpy(m_strLogDir, m_strLogFile);
486  if(CALibProxytest::getOptions()->getMaxLogFileSize()>0)
487  {
488  if(m_alreadyOpened)
489  {
490  rotateLog();
491  }
492 
493  setMaxLogFileSize(CALibProxytest::getOptions()->getMaxLogFileSize());
494  m_alreadyOpened = true;
495  }
496  m_NrOfWrites=0;
497  m_hFileInfo=open(m_strLogFile,O_APPEND|O_CREAT|O_WRONLY|O_NONBLOCK|O_LARGEFILE,S_IREAD|S_IWRITE);
498  if (m_hFileInfo == -1)
499  {
500  return E_FILE_OPEN;
501  }
502  }
503  return E_SUCCESS;
504  }
505 
506 #ifndef ONLY_LOCAL_PROXY
521  {
523  if(pCert==NULL)
524  return E_UNKNOWN;
525  CAASymCipher oRSA;
526  SINT32 ret=oRSA.setPublicKey(pCert);
527  delete pCert;
528  pCert = NULL;
529  if(ret!=E_SUCCESS)
530  return E_UNKNOWN;
531  UINT8 buff[1024];
532  if(CALibProxytest::getOptions()->getEncryptedLogDir(buff,1024)!=E_SUCCESS)
533  if(CALibProxytest::getOptions()->getLogDir(buff,1024)!=E_SUCCESS)
534  return E_UNKNOWN;
535  strcat((char*)buff,FILENAME_ENCRYPTEDLOG);
536  pMsg->m_hFileEncrypted=open((char*)buff,O_APPEND|O_CREAT|O_WRONLY|O_LARGEFILE|O_BINARY,S_IREAD|S_IWRITE);
537  if(pMsg->m_hFileEncrypted<=0)
538  {
540  return E_UNKNOWN;
541  }
542  //create sym enc key and write it to the file (enc with pub enc key)
543  myfilewrite(pMsg->m_hFileEncrypted, "\n----Start of EncryptionKey----\n", 32);
544  UINT8 keyandiv[128];
545  getRandom(keyandiv,128);
546  keyandiv[0]&=0x7F;
548  AES_set_encrypt_key(keyandiv+50,128,&pMsg->m_pCipher->oKey);
549  memcpy(pMsg->m_pCipher->iv,keyandiv+66,16);
550  pMsg->m_pCipher->iv_off=0;
551  UINT8 out[255];
552  UINT32 outlen=255;
553  oRSA.encrypt(keyandiv,keyandiv);
554  CABase64::encode(keyandiv,128,out,&outlen);
555  myfilewrite(pMsg->m_hFileEncrypted, out, outlen);
556  myfilewrite(pMsg->m_hFileEncrypted, "-----End of EncryptionKey-----\n", 31);
557  return E_SUCCESS;
558  }
559 
561  {
562  if(pMsg->m_hFileEncrypted>=0)
563  {
564  close(pMsg->m_hFileEncrypted);
565  }
566  delete pMsg->m_pCipher;
567  pMsg->m_pCipher=NULL;
569  return E_SUCCESS;
570  }
571 #endif //ONLY_LOCAL_PROXY
#define MAX_MSG_SIZE
Definition: CAMsg.cpp:41
#define STRMSGTYPES_SIZE
Definition: CAMsg.cpp:46
#define FILENAME_INFOLOG
Definition: CAMsg.cpp:38
#define FILENAME_ENCRYPTEDLOG
Definition: CAMsg.cpp:37
#define FILENAME_INFOLOG_GZ
Definition: CAMsg.cpp:39
#define LOG_ENCRYPTED
Definition: CAMsg.hpp:46
#define MSG_FILE
Definition: CAMsg.hpp:36
#define MSG_NOLOG
Definition: CAMsg.hpp:33
#define MSG_LOG
Definition: CAMsg.hpp:35
#define MSG_STDOUT
Definition: CAMsg.hpp:34
#define MSG_COMPRESSED_FILE
Definition: CAMsg.hpp:37
S_LOGENCCIPHER t_LogEncCipher
Definition: CAMsg.hpp:59
SINT32 getRandom(UINT32 *val)
Gets 32 random bits.
Definition: CAUtil.cpp:346
void setZero64(UINT64 &op1)
Definition: CAUtil.hpp:355
SINT64 filesize64(int handle)
Definition: CAUtil.hpp:85
bool isZero64(UINT64 &op1)
Definition: CAUtil.hpp:464
bool isGreater64(UINT64 &op1, UINT64 &op2)
Definition: CAUtil.hpp:416
#define myfilewrite
Definition: StdAfx.h:493
#define O_LARGEFILE
Definition: StdAfx.h:635
#define GET_NET_ERROR
Definition: StdAfx.h:469
#define GET_NET_ERROR_STR(x)
Definition: StdAfx.h:471
#define S_IWRITE
Definition: StdAfx.h:491
#define SET_NET_ERROR(x)
Definition: StdAfx.h:470
#define S_IREAD
Definition: StdAfx.h:488
signed int SINT32
Definition: basetypedefs.h:132
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
SINT32 encrypt(const UINT8 *from, UINT8 *to)
Encrypts exactly one block which is stored in from.
SINT32 setPublicKey(const CACertificate *pCert)
Sets the public key which is used for encryption to the contained in the provided certificate.
static SINT32 encode(const UINT8 *in, UINT32 len, UINT8 *out, UINT32 *outlen)
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
Definition: CABase64.cpp:102
CACertificate * getLogEncryptionKey()
Returns a certificate which contains a key which could be used for log encryption.
UINT32 getMaxLogFiles()
static CACmdLnOptions * getOptions()
Definition: CAMsg.hpp:62
static CAMsg * pMsg
Definition: CAMsg.hpp:65
char * m_strLogFile
Definition: CAMsg.hpp:122
static SINT32 openEncryptedLog()
Open a log, where the logged messages are store encrypted.
Definition: CAMsg.cpp:520
static const char *const getLogLevelStr()
Definition: CAMsg.cpp:143
SINT32 openLog(UINT32 type)
Definition: CAMsg.cpp:445
char * createLogDirMessage(UINT32 opt)
Definition: CAMsg.cpp:104
UINT32 m_NrOfWrites
Definition: CAMsg.hpp:109
static SINT32 setMaxLogFileSize(UINT64 size)
Definition: CAMsg.hpp:90
bool m_alreadyOpened
Definition: CAMsg.hpp:118
static SINT32 setLogOptions(UINT32 options)
Definition: CAMsg.cpp:161
char * m_strLogDir
Definition: CAMsg.hpp:123
CAMsg()
Definition: CAMsg.cpp:49
SINT64 m_maxLogFileSize
Definition: CAMsg.hpp:108
SINT32 rotateLog()
Definition: CAMsg.cpp:422
t_LogEncCipher * m_pCipher
Definition: CAMsg.hpp:129
static SINT32 setLogLevel(UINT32 a_logLevel)
Definition: CAMsg.cpp:127
~CAMsg()
Definition: CAMsg.cpp:68
UINT32 m_lastLogFileNumber
Definition: CAMsg.hpp:117
char * createLogFileMessage(UINT32 opt)
Definition: CAMsg.cpp:82
int m_hFileEncrypted
Definition: CAMsg.hpp:119
SINT32 closeLog()
Definition: CAMsg.cpp:397
char * m_strMsgBuff
Definition: CAMsg.hpp:121
static const char *const m_strMsgTypes[6]
Definition: CAMsg.hpp:124
static const char *const ms_arStrLogLevels[5]
Definition: CAMsg.hpp:66
CAMutex * m_pcsPrint
Definition: CAMsg.hpp:125
int m_hFileInfo
Definition: CAMsg.hpp:120
UINT32 m_uLogType
Definition: CAMsg.hpp:115
UINT32 m_logLevel
Definition: CAMsg.hpp:116
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.
Definition: CAMsg.cpp:251
static SINT32 closeEncryptedLog()
Definition: CAMsg.cpp:560
SINT32 unlock()
Definition: CAMutex.hpp:52
SINT32 lock()
Definition: CAMutex.hpp:41
#define O_BINARY
Definition: config.h:179
const SINT32 E_SUCCESS
Definition: errorcodes.hpp:2
#define E_FILE_OPEN
Definition: errorcodes.hpp:19
#define E_UNKNOWN
Definition: errorcodes.hpp:3
AES_KEY oKey
Definition: CAMsg.hpp:56
UINT8 iv[16]
Definition: CAMsg.hpp:54
UINT8 type
Definition: typedefs.hpp:1