Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.2 KiB

  1. //
  2. // CallLog.h
  3. //
  4. // Created: ChrisPi 10-17-96
  5. //
  6. #ifndef _CALLLOG_H_
  7. #define _CALLLOG_H_
  8. #include <cstring.hpp>
  9. // CCallLogEntry flags:
  10. const DWORD CLEF_ACCEPTED = 0x00000001;
  11. const DWORD CLEF_REJECTED = 0x00000002;
  12. const DWORD CLEF_AUTO_ACCEPTED = 0x00000004; // call was auto-accepted
  13. const DWORD CLEF_TIMED_OUT = 0x00000008; // call was rejected due to timeout
  14. const DWORD CLEF_SECURE = 0x00000010; // call was secure
  15. const DWORD CLEF_NO_CALL = 0x40000000; // No call back information
  16. const DWORD CLEF_DELETED = 0x80000000; // Record marked for deletion
  17. // The header for a record in the call log file
  18. typedef struct _tagLogHdr {
  19. DWORD dwSize; // size of this entire record
  20. DWORD dwCLEF; // CallLogEntry Flags (CLEF_*)
  21. DWORD dwPF; // Participant flags (PF_*)
  22. DWORD cbName; // size of szName, in bytes, including NULL
  23. DWORD cbData; // size of rgData, in bytes
  24. DWORD cbCert; // size of certificate data in bytes
  25. SYSTEMTIME sysTime; // date/time of record creation
  26. // WCHAR szName; // null terminated display name (in UNICODE)
  27. // BYTE ri[]; // Roster Information
  28. } LOGHDR;
  29. typedef LOGHDR * PLOGHDR;
  30. class CCallLog;
  31. class CRosterInfo;
  32. class CCallLogEntry
  33. {
  34. protected:
  35. LPTSTR m_pszName;
  36. DWORD m_dwFlags;
  37. SYSTEMTIME m_st;
  38. CRosterInfo* m_pri;
  39. PBYTE m_pbCert;
  40. ULONG m_cbCert;
  41. DWORD m_dwFileOffset; // offset in log file
  42. friend CCallLog;
  43. public:
  44. CCallLogEntry(LPCTSTR pcszName, DWORD dwFlags, CRosterInfo* pri,
  45. LPVOID pvRosterData, PBYTE pbCert, ULONG cbCert, LPSYSTEMTIME pst, DWORD dwFileOffset);
  46. ~CCallLogEntry();
  47. LPTSTR GetName() { return m_pszName; };
  48. DWORD GetFlags() { return m_dwFlags; };
  49. LPSYSTEMTIME GetTime() { return &m_st; };
  50. CRosterInfo* GetRosterInfo() { return m_pri; };
  51. DWORD GetFileOffset() { return m_dwFileOffset;};
  52. };
  53. class CCallLog : public CSimpleArray<CCallLogEntry*>
  54. {
  55. private:
  56. BOOL m_fUseList; // if TRUE, add data to list
  57. BOOL m_fDataRead; // if TRUE, data has been read
  58. CSTRING m_strFile; // Filename
  59. DWORD m_Expire; // Days before expiring an entry
  60. int m_cTotalEntries; // Total number of records in the log
  61. int m_cDeletedEntries; // Number of records marked for deletion
  62. int m_cMaxEntries; // Configurable max entries in file
  63. VOID InitLogData(LPCTSTR pszKey, LPCTSTR pszDefault);
  64. HANDLE OpenLogFile(VOID);
  65. BOOL ReadData(HANDLE hFile, PVOID pv, UINT cb);
  66. HRESULT WriteData(HANDLE hFile, LPDWORD pdwOffset, PVOID pv, DWORD cb);
  67. HRESULT ReadEntry(HANDLE hFile, DWORD * pdwFileOffset, CCallLogEntry** ppcle);
  68. DWORD WriteEntry(LPCTSTR pcszName, PLOGHDR pLogHdr, CRosterInfo* pri, PBYTE pbCert, ULONG cbCert);
  69. VOID LoadFileData(VOID);
  70. VOID RewriteFile(VOID);
  71. public:
  72. CCallLog(LPCTSTR pszKey, LPCTSTR pszDefault);
  73. ~CCallLog();
  74. HRESULT AddCall(LPCTSTR pcszName, PLOGHDR pLogHdr, CRosterInfo* pri, PBYTE pbCert, ULONG cbCert);
  75. private:
  76. HRESULT DeleteEntry(CCallLogEntry * pcle);
  77. };
  78. #endif // !_CALLLOG_H_