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 | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 15 | /// @brief Callback to report a successful Interest validation. |
| 16 | typedef function<void(const shared_ptr<const Interest>&)> OnInterestValidated; |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 17 | |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 18 | /// @brief Callback to report a failed Interest validation. |
| 19 | typedef function<void(const shared_ptr<const Interest>&, |
| 20 | const std::string&)> OnInterestValidationFailed; |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 21 | |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 22 | /// @brief Callback to report a successful Data validation. |
| 23 | typedef function<void(const shared_ptr<const Data>&)> OnDataValidated; |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 24 | |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 25 | /// @brief Callback to report a failed Data validation. |
| 26 | typedef function<void(const shared_ptr<const Data>&, |
| 27 | const std::string&)> OnDataValidationFailed; |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 28 | |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 29 | |
Alexander Afanasyev | 2a7f720 | 2014-04-23 14:25:29 -0700 | [diff] [blame] | 30 | class ValidationRequest |
| 31 | { |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 32 | public: |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 33 | ValidationRequest(const Interest& interest, |
| 34 | const OnDataValidated& onValidated, |
| 35 | const OnDataValidationFailed& onDataValidated, |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 36 | int nRetrials, int nSteps) |
| 37 | : m_interest(interest) |
| 38 | , m_onValidated(onValidated) |
| 39 | , m_onDataValidated(onDataValidated) |
| 40 | , m_nRetrials(nRetrials) |
| 41 | , m_nSteps(nSteps) |
| 42 | { |
| 43 | } |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 44 | |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 45 | virtual |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 46 | ~ValidationRequest() |
| 47 | { |
| 48 | } |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 49 | |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 50 | Interest m_interest; // Interest for the requested data. |
| 51 | OnDataValidated m_onValidated; // Callback function on validated certificate. |
| 52 | OnDataValidationFailed m_onDataValidated; // Callback function on validation failure. |
| 53 | int m_nRetrials; // The number of retrials when interest timeout. |
| 54 | int m_nSteps; // The stepCount of next step. |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 55 | }; |
| 56 | |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 57 | } // namespace ndn |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 58 | |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 59 | #endif //NDN_SECURITY_VALIDATION_REQUEST_HPP |