blob: f64082b54d2ef34d017ff4fb0d90d5334e515499 [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 Yu6ac97982014-01-30 14:49:21 -080015/**
16 * An OnVerified function object is used to pass a callback to report a successful Interest validation.
17 */
Yingdi Yu40587c02014-02-21 16:40:48 -080018typedef function< void (const shared_ptr<const Interest>&) > OnInterestValidated;
Yingdi Yu6ac97982014-01-30 14:49:21 -080019
20/**
21 * An OnVerifyFailed function object is used to pass a callback to report a failed Interest validation.
22 */
Yingdi Yu40587c02014-02-21 16:40:48 -080023typedef function< void (const shared_ptr<const Interest>&, const std::string&) > OnInterestValidationFailed;
Yingdi Yu6ac97982014-01-30 14:49:21 -080024
25/**
26 * An OnVerified function object is used to pass a callback to report a successful Data validation.
27 */
Yingdi Yu40587c02014-02-21 16:40:48 -080028typedef function< void (const shared_ptr<const Data>&) > OnDataValidated;
Yingdi Yu6ac97982014-01-30 14:49:21 -080029
30/**
31 * An OnVerifyFailed function object is used to pass a callback to report a failed Data validation.
32 */
Yingdi Yu40587c02014-02-21 16:40:48 -080033typedef function< void (const shared_ptr<const Data>&, const std::string&) > OnDataValidationFailed;
Yingdi Yu6ac97982014-01-30 14:49:21 -080034
Jeff Thompsonf309aa62013-10-31 17:03:54 -070035
36class ValidationRequest {
37public:
Yingdi Yu6ac97982014-01-30 14:49:21 -080038 ValidationRequest(const Interest &interest,
39 const OnDataValidated &onValidated,
40 const OnDataValidationFailed &onDataValidated,
41 int retry, int stepCount)
42 : m_interest(interest)
43 , m_onValidated(onValidated)
44 , m_onDataValidated(onDataValidated)
45 , m_retry(retry)
46 , m_stepCount(stepCount)
47 {}
Jeff Thompsonf309aa62013-10-31 17:03:54 -070048
49 virtual
50 ~ValidationRequest() {}
51
Yingdi Yu6ac97982014-01-30 14:49:21 -080052 Interest m_interest; // An interest packet to fetch the requested data.
53 OnDataValidated m_onValidated; // A callback function if the requested certificate is validated.
54 OnDataValidationFailed m_onDataValidated; // A callback function if the requested certificate validation fails.
Yingdi Yue07e3392014-01-28 10:29:27 -080055 int m_retry; // The number of retrials when there is an interest timeout.
Yingdi Yu6ac97982014-01-30 14:49:21 -080056 int m_stepCount; // The stepCount of next step.
Jeff Thompsonf309aa62013-10-31 17:03:54 -070057};
58
Yingdi Yu40587c02014-02-21 16:40:48 -080059} // namespace ndn
Jeff Thompsonf309aa62013-10-31 17:03:54 -070060
Yingdi Yu40587c02014-02-21 16:40:48 -080061#endif //NDN_SECURITY_VALIDATION_REQUEST_HPP