Jeff Thompson | 3f3cfd3 | 2013-09-27 11:46:52 -0700 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * @author: Yingdi Yu <yingdi@cs.ucla.edu> |
| 5 | * @author: Jeff Thompson <jefft0@remap.ucla.edu> |
| 6 | * See COPYING for copyright and distribution information. |
| 7 | */ |
| 8 | |
| 9 | #ifndef NDN_NO_VERIFY_POLICY_MANAGER_HPP |
| 10 | #define NDN_NO_VERIFY_POLICY_MANAGER_HPP |
| 11 | |
| 12 | #include "policy-manager.hpp" |
| 13 | |
| 14 | namespace ndn { |
| 15 | |
| 16 | class NoVerifyPolicyManager : public PolicyManager { |
| 17 | public: |
| 18 | /** |
| 19 | * The virtual destructor. |
| 20 | */ |
| 21 | virtual |
| 22 | ~NoVerifyPolicyManager(); |
| 23 | |
| 24 | /** |
| 25 | * Override to always skip verification and trust as valid. |
| 26 | * @param data The received data packet. |
| 27 | * @return true. |
| 28 | */ |
| 29 | virtual bool |
| 30 | skipVerifyAndTrust(const Data& data); |
| 31 | |
| 32 | /** |
| 33 | * Override to return false for no verification rule for the received data. |
| 34 | * @param data The received data packet. |
| 35 | * @return false. |
| 36 | */ |
| 37 | virtual bool |
| 38 | requireVerify(const Data& data); |
| 39 | |
| 40 | /** |
| 41 | * Override to call onVerified(data) and to indicate no further verification step. |
| 42 | * @param data The Data object with the signature to check. |
| 43 | * @param stepCount The number of verification steps that have been done, used to track the verification progress. |
| 44 | * @param onVerified This does override to call onVerified(data). |
| 45 | * @param onVerifyFailed Override to ignore this. |
| 46 | * @return null for no further step. |
| 47 | */ |
| 48 | virtual ptr_lib::shared_ptr<ValidationRequest> |
| 49 | checkVerificationPolicy |
| 50 | (const ptr_lib::shared_ptr<Data>& data, const int& stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed); |
| 51 | |
| 52 | /** |
| 53 | * Override to always indicate that the signing certificate name and data name satisfy the signing policy. |
| 54 | * @param dataName The name of data to be signed. |
| 55 | * @param certificateName The name of signing certificate. |
| 56 | * @return true to indicate that the signing certificate can be used to sign the data. |
| 57 | */ |
| 58 | virtual bool |
| 59 | checkSigningPolicy(const Name& dataName, const Name& certificateName); |
| 60 | |
| 61 | /** |
| 62 | * Override to indicate that the signing identity cannot be inferred. |
| 63 | * @param dataName The name of data to be signed. |
| 64 | * @return An empty name because cannot infer. |
| 65 | */ |
| 66 | virtual Name |
| 67 | inferSigningIdentity(const Name& dataName); |
| 68 | }; |
| 69 | |
| 70 | } |
| 71 | |
| 72 | #endif |