Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013 University of California, Los Angeles |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu> |
| 19 | * Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 20 | */ |
| 21 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 22 | #ifndef NDNX_VERIFIER_H |
| 23 | #define NDNX_VERIFIER_H |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 24 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 25 | #include "ndnx-common.h" |
| 26 | #include "ndnx-name.h" |
| 27 | #include "ndnx-cert.h" |
| 28 | #include "ndnx-pco.h" |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 29 | #include <map> |
Zhenkai Zhu | 746d444 | 2013-03-13 17:06:54 -0700 | [diff] [blame] | 30 | #include <boost/thread/locks.hpp> |
| 31 | #include <boost/thread/recursive_mutex.hpp> |
| 32 | #include <boost/thread/thread.hpp> |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 33 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 34 | namespace Ndnx { |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 35 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 36 | class NdnxWrapper; |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 37 | |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 38 | class Verifier |
| 39 | { |
| 40 | public: |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 41 | Verifier(NdnxWrapper *ndnx); |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 42 | ~Verifier(); |
| 43 | |
Zhenkai Zhu | d5d99be | 2013-03-13 19:15:56 -0700 | [diff] [blame] | 44 | bool verify(const PcoPtr &pco, double maxWait); |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 45 | |
| 46 | private: |
| 47 | |
| 48 | private: |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 49 | NdnxWrapper *m_ndnx; |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 50 | Hash m_rootKeyDigest; |
Zhenkai Zhu | 9dd9adc | 2013-03-13 16:12:09 -0700 | [diff] [blame] | 51 | typedef std::map<Hash, CertPtr> CertCache; |
| 52 | CertCache m_certCache; |
Zhenkai Zhu | 746d444 | 2013-03-13 17:06:54 -0700 | [diff] [blame] | 53 | typedef boost::recursive_mutex RecLock; |
| 54 | typedef boost::unique_lock<RecLock> UniqueRecLock; |
| 55 | RecLock m_cacheLock; |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 58 | } // Ndnx |
Zhenkai Zhu | dd1f14d | 2013-03-13 12:04:28 -0700 | [diff] [blame] | 59 | |
Alexander Afanasyev | 1dd37ed | 2013-08-14 18:08:09 -0700 | [diff] [blame^] | 60 | #endif // NDNX_VERIFIER_H |