blob: 0065d87622717dace68a229d182b2d072dca5771 [file] [log] [blame]
Jeff Thompsonfa306642013-06-17 15:06:57 -07001/* -*- 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
22#ifndef NDN_VERIFIER_H
23#define NDN_VERIFIER_H
24
25#include "ndn.cxx/common.h"
26#include "ndn.cxx/name.h"
27#include "ndn.cxx/cert.h"
28#include "ndn.cxx/pco.h"
29#include <map>
30#include <boost/thread/locks.hpp>
31#include <boost/thread/recursive_mutex.hpp>
32#include <boost/thread/thread.hpp>
33
34namespace ndn {
35
36class Wrapper;
37
38class Verifier
39{
40public:
41 Verifier(Wrapper *ccnx);
42 ~Verifier();
43
44 bool verify(PcoPtr pco, double maxWait);
45
46private:
47
48private:
49 Wrapper *m_ccnx;
50 Hash m_rootKeyDigest;
51 typedef std::map<Hash, CertPtr> CertCache;
52 CertCache m_certCache;
53 typedef boost::recursive_mutex RecLock;
54 typedef boost::unique_lock<RecLock> UniqueRecLock;
55 RecLock m_cacheLock;
56};
57
58} // ndn
59
60#endif // NDN_VERIFIER_H