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 | |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 9 | #ifndef NDN_SECURITY_VALIDATION_REQUEST_HPP |
| 10 | #define NDN_SECURITY_VALIDATION_REQUEST_HPP |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 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 { |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 15 | /** |
| 16 | * An OnVerified function object is used to pass a callback to report a successful Interest validation. |
| 17 | */ |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 18 | typedef function< void (const shared_ptr<const Interest>&) > OnInterestValidated; |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 19 | |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 20 | /** |
| 21 | * An OnVerifyFailed function object is used to pass a callback to report a failed Interest validation. |
| 22 | */ |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 23 | typedef function< void (const shared_ptr<const Interest>&, const std::string&) > OnInterestValidationFailed; |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 24 | |
| 25 | /** |
| 26 | * An OnVerified function object is used to pass a callback to report a successful Data validation. |
| 27 | */ |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 28 | typedef function< void (const shared_ptr<const Data>&) > OnDataValidated; |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 29 | |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 30 | /** |
| 31 | * An OnVerifyFailed function object is used to pass a callback to report a failed Data validation. |
| 32 | */ |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 33 | typedef function< void (const shared_ptr<const Data>&, const std::string&) > OnDataValidationFailed; |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 34 | |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 35 | |
| 36 | class ValidationRequest { |
| 37 | public: |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 38 | ValidationRequest(const Interest& interest, |
| 39 | const OnDataValidated& onValidated, |
| 40 | const OnDataValidationFailed& onDataValidated, |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 41 | int retry, int stepCount) |
| 42 | : m_interest(interest) |
| 43 | , m_onValidated(onValidated) |
| 44 | , m_onDataValidated(onDataValidated) |
| 45 | , m_retry(retry) |
| 46 | , m_stepCount(stepCount) |
| 47 | {} |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 48 | |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 49 | virtual |
| 50 | ~ValidationRequest() {} |
| 51 | |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 52 | Interest m_interest; // An interest packet to fetch the requested data. |
| 53 | OnDataValidated m_onValidated; // A callback function if the requested certificate is validated. |
| 54 | OnDataValidationFailed m_onDataValidated; // A callback function if the requested certificate validation fails. |
Yingdi Yu | e07e339 | 2014-01-28 10:29:27 -0800 | [diff] [blame] | 55 | int m_retry; // The number of retrials when there is an interest timeout. |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 56 | int m_stepCount; // The stepCount of next step. |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 59 | } // namespace ndn |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 60 | |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 61 | #endif //NDN_SECURITY_VALIDATION_REQUEST_HPP |