Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 3 | * Copyright (c) 2013-2014, Regents of the University of California. |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
| 7 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
| 8 | * |
| 9 | * This file licensed under New BSD License. See COPYING for detailed information about |
| 10 | * ndn-cxx library copyright, permissions, and redistribution restrictions. |
| 11 | * |
| 12 | * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/> |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 13 | */ |
| 14 | |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 15 | #ifndef NDN_SECURITY_VALIDATION_REQUEST_HPP |
| 16 | #define NDN_SECURITY_VALIDATION_REQUEST_HPP |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 17 | |
Yingdi Yu | 4f32463 | 2014-01-15 18:10:03 -0800 | [diff] [blame] | 18 | #include "../interest.hpp" |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 19 | |
| 20 | namespace ndn { |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 21 | /// @brief Callback to report a successful Interest validation. |
| 22 | typedef function<void(const shared_ptr<const Interest>&)> OnInterestValidated; |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 23 | |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 24 | /// @brief Callback to report a failed Interest validation. |
| 25 | typedef function<void(const shared_ptr<const Interest>&, |
| 26 | const std::string&)> OnInterestValidationFailed; |
Yingdi Yu | 6ac9798 | 2014-01-30 14:49:21 -0800 | [diff] [blame] | 27 | |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 28 | /// @brief Callback to report a successful Data validation. |
| 29 | typedef function<void(const shared_ptr<const Data>&)> OnDataValidated; |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 30 | |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 31 | /// @brief Callback to report a failed Data validation. |
| 32 | typedef function<void(const shared_ptr<const Data>&, |
| 33 | 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 | |
Alexander Afanasyev | 2a7f720 | 2014-04-23 14:25:29 -0700 | [diff] [blame] | 36 | class ValidationRequest |
| 37 | { |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 38 | public: |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 39 | ValidationRequest(const Interest& interest, |
| 40 | const OnDataValidated& onValidated, |
| 41 | const OnDataValidationFailed& onDataValidated, |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 42 | int nRetrials, int nSteps) |
| 43 | : m_interest(interest) |
| 44 | , m_onValidated(onValidated) |
| 45 | , m_onDataValidated(onDataValidated) |
| 46 | , m_nRetrials(nRetrials) |
| 47 | , m_nSteps(nSteps) |
| 48 | { |
| 49 | } |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 50 | |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 51 | virtual |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 52 | ~ValidationRequest() |
| 53 | { |
| 54 | } |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 55 | |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 56 | Interest m_interest; // Interest for the requested data. |
| 57 | OnDataValidated m_onValidated; // Callback function on validated certificate. |
| 58 | OnDataValidationFailed m_onDataValidated; // Callback function on validation failure. |
| 59 | int m_nRetrials; // The number of retrials when interest timeout. |
| 60 | int m_nSteps; // The stepCount of next step. |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 61 | }; |
| 62 | |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 63 | } // namespace ndn |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 64 | |
Yingdi Yu | 40587c0 | 2014-02-21 16:40:48 -0800 | [diff] [blame] | 65 | #endif //NDN_SECURITY_VALIDATION_REQUEST_HPP |