reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
DigestStream.hxx
Go to the documentation of this file.
1#if !defined(RESIP_DigestSTREAM_HXX)
2#define RESIP_DigestSTREAM_HXX
3
4#include <iostream>
5#include "rutil/Data.hxx"
6
7namespace resip
8{
9
11{
13 SHA1
14#ifdef USE_SSL
18#endif
19};
20
24class DigestBuffer : public std::streambuf
25{
26public:
27 DigestBuffer(DigestType digestType = MD5);
28 virtual ~DigestBuffer();
29
31 Data getHex();
32
34 const Data& getBin();
35
36 size_t bytesTaken() { return mBytesTaken; }
37
38protected:
39 virtual int sync();
40 virtual int overflow(int c = -1);
41
42private:
43 DigestType mDigestType;
44 char mBuf[64];
45 void* mContext;
46 size_t mBytesTaken;
47 Data mFinalBin;
48};
49
54class DigestStream : private DigestBuffer, public std::ostream
55{
56public:
57 DigestStream(DigestType digestType = MD5);
63 Data getHex();
64 const Data& getBin();
65
66 size_t bytesTaken();
67
68 static const Data& getDigestName(DigestType digestType);
69};
70
71}
72
73#endif
74/* ====================================================================
75 * The Vovida Software License, Version 1.0
76 *
77 * Copyright (c) 2026 SIP Spectrum, Inc. https://www.sipspectrum.com
78 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
79 *
80 * Redistribution and use in source and binary forms, with or without
81 * modification, are permitted provided that the following conditions
82 * are met:
83 *
84 * 1. Redistributions of source code must retain the above copyright
85 * notice, this list of conditions and the following disclaimer.
86 *
87 * 2. Redistributions in binary form must reproduce the above copyright
88 * notice, this list of conditions and the following disclaimer in
89 * the documentation and/or other materials provided with the
90 * distribution.
91 *
92 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
93 * and "Vovida Open Communication Application Library (VOCAL)" must
94 * not be used to endorse or promote products derived from this
95 * software without prior written permission. For written
96 * permission, please contact vocal@vovida.org.
97 *
98 * 4. Products derived from this software may not be called "VOCAL", nor
99 * may "VOCAL" appear in their name, without prior written
100 * permission of Vovida Networks, Inc.
101 *
102 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
103 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
104 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
105 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
106 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
107 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
108 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
109 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
110 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
111 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
112 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
113 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
114 * DAMAGE.
115 *
116 * ====================================================================
117 *
118 * This software consists of voluntary contributions made by Vovida
119 * Networks, Inc. and many individuals on behalf of Vovida Networks,
120 * Inc. For more information on Vovida Networks, Inc., please see
121 * <http://www.vovida.org/>.
122 *
123 */
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
Implementation of std::streambuf used to back the DigestStream.
virtual int overflow(int c=-1)
const Data & getBin()
Used to accumlate data written to the stream in a DigestBuffer and convert the data to Digest.
Data getHex()
Calls flush() on itself and returns the Digest data in hex format.
static const Data & getDigestName(DigestType digestType)
const Data & getBin()
dcm! – add UnusedChecking(_enum) below;