/src/resiprocate/resip/stack/NonceHelper.hxx
Line | Count | Source (jump to first uncovered line) |
1 | | #if !defined(RESIP_NONCEHELPER_HXX) |
2 | | #define RESIP_NONCEHELPER_HXX |
3 | | |
4 | | #include "resip/stack/SipMessage.hxx" |
5 | | #include "rutil/Data.hxx" |
6 | | |
7 | | namespace resip |
8 | | { |
9 | | |
10 | | class NonceHelper |
11 | | { |
12 | | public: |
13 | | |
14 | | class Nonce |
15 | | { |
16 | | private: |
17 | | uint64_t creationTime; |
18 | | |
19 | | public: |
20 | | Nonce(uint64_t creationTime); |
21 | | virtual ~Nonce(); |
22 | 0 | uint64_t getCreationTime() { return creationTime; }; |
23 | | }; |
24 | | |
25 | | virtual ~NonceHelper()=0; |
26 | | |
27 | | // Generate a nonce string |
28 | | virtual Data makeNonce(const SipMessage& request, const Data& timestamp) = 0; |
29 | | |
30 | | // Read a nonce string into a Nonce instance, so that we can inspect |
31 | | // the un-encrypted time stamp |
32 | | virtual NonceHelper::Nonce parseNonce(const Data& nonce) = 0; |
33 | | }; |
34 | | |
35 | | } |
36 | | |
37 | | #endif |
38 | | |
39 | | |
40 | | /* ==================================================================== |
41 | | * |
42 | | * Copyright 2012 Daniel Pocock. All rights reserved. |
43 | | * |
44 | | * Redistribution and use in source and binary forms, with or without |
45 | | * modification, are permitted provided that the following conditions |
46 | | * are met: |
47 | | * |
48 | | * 1. Redistributions of source code must retain the above copyright |
49 | | * notice, this list of conditions and the following disclaimer. |
50 | | * |
51 | | * 2. Redistributions in binary form must reproduce the above copyright |
52 | | * notice, this list of conditions and the following disclaimer in |
53 | | * the documentation and/or other materials provided with the |
54 | | * distribution. |
55 | | * |
56 | | * 3. Neither the name of the author(s) nor the names of any contributors |
57 | | * may be used to endorse or promote products derived from this software |
58 | | * without specific prior written permission. |
59 | | * |
60 | | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND |
61 | | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
62 | | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
63 | | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE |
64 | | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
65 | | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
66 | | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
67 | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
68 | | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
69 | | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
70 | | * SUCH DAMAGE. |
71 | | * |
72 | | * ==================================================================== |
73 | | * |
74 | | * |
75 | | */ |
76 | | |