Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -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_VALIDATION_REQUEST_HPP |
| 10 | #define NDN_VALIDATION_REQUEST_HPP |
| 11 | |
Yingdi Yu | 4f32463 | 2014-01-15 18:10:03 -0800 | [diff] [blame] | 12 | #include "../interest.hpp" |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 13 | |
| 14 | namespace ndn { |
| 15 | |
| 16 | class ValidationRequest { |
| 17 | public: |
Yingdi Yu | e07e339 | 2014-01-28 10:29:27 -0800 | [diff] [blame] | 18 | /** |
| 19 | * An OnCertVerified function object is used to pass a callback to to report a successful verification. |
| 20 | */ |
| 21 | typedef func_lib::function<void(const ptr_lib::shared_ptr<Data>&)> OnCertVerified; |
| 22 | |
| 23 | /** |
| 24 | * An OnCertVerifyFailed function object is used to pass a callback to to report a failed verification. |
| 25 | */ |
| 26 | typedef func_lib::function<void(const ptr_lib::shared_ptr<Data>&)> OnCertVerifyFailed; |
| 27 | |
| 28 | |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 29 | ValidationRequest |
Yingdi Yu | e07e339 | 2014-01-28 10:29:27 -0800 | [diff] [blame] | 30 | (const ptr_lib::shared_ptr<Interest> &interest, const OnCertVerified& onVerified, const OnCertVerifyFailed& onVerifyFailed, |
Jeff Thompson | 31aeed8 | 2013-11-25 15:44:45 -0800 | [diff] [blame] | 31 | int retry, int stepCount) |
Yingdi Yu | e07e339 | 2014-01-28 10:29:27 -0800 | [diff] [blame] | 32 | : m_interest(interest), m_onVerified(onVerified), m_onVerifyFailed(onVerifyFailed), m_retry(retry), m_stepCount(stepCount) |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 33 | { |
| 34 | } |
| 35 | |
| 36 | virtual |
| 37 | ~ValidationRequest() {} |
| 38 | |
Yingdi Yu | e07e339 | 2014-01-28 10:29:27 -0800 | [diff] [blame] | 39 | ptr_lib::shared_ptr<Interest> m_interest; // An interest packet to fetch the requested data. |
| 40 | OnCertVerified m_onVerified; // A callback function if the requested certificate has been validated. |
| 41 | OnCertVerifyFailed m_onVerifyFailed; // A callback function if the requested certificate cannot be validated. |
| 42 | int m_retry; // The number of retrials when there is an interest timeout. |
| 43 | int m_stepCount; |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | } |
| 47 | |
| 48 | #endif |