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