blob: b525c27c7791df240f17a711a25e04cf4936c2fb [file] [log] [blame]
Jeff Thompsonf309aa62013-10-31 17:03:54 -07001/* -*- 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 Yu40587c02014-02-21 16:40:48 -08009#ifndef NDN_SECURITY_VALIDATION_REQUEST_HPP
10#define NDN_SECURITY_VALIDATION_REQUEST_HPP
Jeff Thompsonf309aa62013-10-31 17:03:54 -070011
Yingdi Yu4f324632014-01-15 18:10:03 -080012#include "../interest.hpp"
Jeff Thompsonf309aa62013-10-31 17:03:54 -070013
14namespace ndn {
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070015/// @brief Callback to report a successful Interest validation.
16typedef function<void(const shared_ptr<const Interest>&)> OnInterestValidated;
Alexander Afanasyevfdbfc6d2014-04-14 15:12:11 -070017
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070018/// @brief Callback to report a failed Interest validation.
19typedef function<void(const shared_ptr<const Interest>&,
20 const std::string&)> OnInterestValidationFailed;
Yingdi Yu6ac97982014-01-30 14:49:21 -080021
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070022/// @brief Callback to report a successful Data validation.
23typedef function<void(const shared_ptr<const Data>&)> OnDataValidated;
Alexander Afanasyevfdbfc6d2014-04-14 15:12:11 -070024
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070025/// @brief Callback to report a failed Data validation.
26typedef function<void(const shared_ptr<const Data>&,
27 const std::string&)> OnDataValidationFailed;
Yingdi Yu6ac97982014-01-30 14:49:21 -080028
Jeff Thompsonf309aa62013-10-31 17:03:54 -070029
Alexander Afanasyev2a7f7202014-04-23 14:25:29 -070030class ValidationRequest
31{
Jeff Thompsonf309aa62013-10-31 17:03:54 -070032public:
Alexander Afanasyevfdbfc6d2014-04-14 15:12:11 -070033 ValidationRequest(const Interest& interest,
34 const OnDataValidated& onValidated,
35 const OnDataValidationFailed& onDataValidated,
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070036 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 Afanasyevfdbfc6d2014-04-14 15:12:11 -070044
Jeff Thompsonf309aa62013-10-31 17:03:54 -070045 virtual
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070046 ~ValidationRequest()
47 {
48 }
Jeff Thompsonf309aa62013-10-31 17:03:54 -070049
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070050 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 Thompsonf309aa62013-10-31 17:03:54 -070055};
56
Yingdi Yu40587c02014-02-21 16:40:48 -080057} // namespace ndn
Jeff Thompsonf309aa62013-10-31 17:03:54 -070058
Yingdi Yu40587c02014-02-21 16:40:48 -080059#endif //NDN_SECURITY_VALIDATION_REQUEST_HPP