sipxportlib  Version 3.3
UtlCryptoData.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2008 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2008 SIPez LLC.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // Copyright (C) 2008 Mutualink, Inc.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 
14 // Author: Sergey Kostanbaev <Sergey DOT Kostanbaev AT sipez DOT com>
15 
16 #ifndef _UtlCryptoData_h_
17 #define _UtlCryptoData_h_
18 
19 // SYSTEM INCLUDES
20 #include <assert.h>
21 
22 // APPLICATION INCLUDES
23 #include "utl/UtlDefs.h"
24 #include "utl/UtlString.h"
25 
26 // DEFINES
27 // MACROS
28 // EXTERNAL FUNCTIONS
29 // EXTERNAL VARIABLES
30 // STRUCTS
31 // TYPEDEFS
32 // FORWARD DECLARATIONS
33 
38 {
39 /* //////////////////////////////// PUBLIC //////////////////////////////// */
40 public:
41 
42 /* =============================== CREATORS =============================== */
44 
45 
47  UtlCryptoData(int initSize);
48 
51 
53 
54 /* ============================= MANIPULATORS ============================= */
56 
57 
59  inline unsigned char* data();
60 
62  inline unsigned char& operator[] (int index);
63 
65 
66 /* ============================== ACCESSORS =============================== */
68 
69 
70 
72 
73 /* =============================== INQUIRY ================================ */
75 
76 
78  inline unsigned char operator[] (int index) const;
79 
81  inline int size() const;
82 
84  void resize(int newSize);
85 
87  UtlString dumpHex() const;
88 
90 
91 /* ////////////////////////////// PROTECTED /////////////////////////////// */
92 protected:
93 
94 /* /////////////////////////////// PRIVATE //////////////////////////////// */
95 private:
96  unsigned char* mData;
97  int length;
98 
99 };
100 
101 /* ============================ INLINE METHODS ============================ */
102 
103 unsigned char* UtlCryptoData::data()
104 {
105  return mData;
106 }
107 
108 unsigned char& UtlCryptoData::operator[] (int index)
109 {
110  assert((0 <= index) && (index < length));
111  return mData[index];
112 }
113 
114 unsigned char UtlCryptoData::operator[] (int index) const
115 {
116  assert((0 <= index) && (index < length));
117  return mData[index];
118 }
119 
121 {
122  return length;
123 }
124 
125 #endif // _UtlCryptoData_h_
unsigned char * data()
Get first element.
Definition: UtlCryptoData.h:103
UtlString dumpHex() const
Dump data in humane-readable hex format.
Definition: UtlCryptoData.cpp:54
Crypto data operations.
Definition: UtlCryptoData.h:37
UtlCryptoData(int initSize)
Constructor.
Definition: UtlCryptoData.cpp:31
Definition: UtlString.h:48
~UtlCryptoData()
Destructor.
Definition: UtlCryptoData.cpp:37
#define assert(exp)
Definition: WinCEFixups.h:37
unsigned char & operator[](int index)
Get index element.
Definition: UtlCryptoData.h:108
void resize(int newSize)
Shrink to actual size.
Definition: UtlCryptoData.cpp:48
int size() const
Get size of data.
Definition: UtlCryptoData.h:120