blob: 88466365ca385d2fbf622e08468f0d4f08b6156a [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
30class ValidationRequest {
31public:
Alexander Afanasyevfdbfc6d2014-04-14 15:12:11 -070032 ValidationRequest(const Interest& interest,
33 const OnDataValidated& onValidated,
34 const OnDataValidationFailed& onDataValidated,
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070035 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 Afanasyevfdbfc6d2014-04-14 15:12:11 -070043
Jeff Thompsonf309aa62013-10-31 17:03:54 -070044 virtual
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070045 ~ValidationRequest()
46 {
47 }
Jeff Thompsonf309aa62013-10-31 17:03:54 -070048
Yingdi Yu4b8c6a22014-04-15 23:00:54 -070049 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 Thompsonf309aa62013-10-31 17:03:54 -070054};
55
Yingdi Yu40587c02014-02-21 16:40:48 -080056} // namespace ndn
Jeff Thompsonf309aa62013-10-31 17:03:54 -070057
Yingdi Yu40587c02014-02-21 16:40:48 -080058#endif //NDN_SECURITY_VALIDATION_REQUEST_HPP