blob: 4dc3a11a69d837f16b5e2ec2be220278cbbb2463 [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
9#ifndef NDN_VALIDATION_REQUEST_HPP
10#define NDN_VALIDATION_REQUEST_HPP
11
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 */
18typedef function< void (const shared_ptr<const Interest> &) > OnInterestValidated;
19
20/**
21 * An OnVerifyFailed function object is used to pass a callback to report a failed Interest validation.
22 */
23typedef function< void (const shared_ptr<const Interest> &) > OnInterestValidationFailed;
24
25/**
26 * An OnVerified function object is used to pass a callback to report a successful Data validation.
27 */
28typedef function< void (const shared_ptr<const Data> &) > OnDataValidated;
29
30/**
31 * An OnVerifyFailed function object is used to pass a callback to report a failed Data validation.
32 */
33typedef function< void (const shared_ptr<const Data> &) > OnDataValidationFailed;
34
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
59}
60
61#endif