blob: 7471065efc12f18f505fe0796a9dd88de61c9805 [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 {
15
Jeff Thompsonba16b8f2013-12-16 13:11:47 -080016/**
17 * An OnVerified function object is used to pass a callback to verifyData to report a successful verification.
18 */
19typedef func_lib::function<void(const ptr_lib::shared_ptr<Data>& data)> OnVerified;
20
21/**
22 * An OnVerifyFailed function object is used to pass a callback to verifyData to report a failed verification.
23 */
24typedef func_lib::function<void(const ptr_lib::shared_ptr<Data>& data)> OnVerifyFailed;
25
26
Jeff Thompsonf309aa62013-10-31 17:03:54 -070027class ValidationRequest {
28public:
29 ValidationRequest
30 (const ptr_lib::shared_ptr<Interest> &interest, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed,
Jeff Thompson31aeed82013-11-25 15:44:45 -080031 int retry, int stepCount)
Jeff Thompsonf309aa62013-10-31 17:03:54 -070032 : interest_(interest), onVerified_(onVerified), onVerifyFailed_(onVerifyFailed), retry_(retry), stepCount_(stepCount)
33 {
34 }
35
36 virtual
37 ~ValidationRequest() {}
38
39 ptr_lib::shared_ptr<Interest> interest_; // An interest packet to fetch the requested data.
40 OnVerified onVerified_; // A callback function if the requested certificate has been validated.
41 OnVerifyFailed onVerifyFailed_; // A callback function if the requested certificate cannot be validated.
42 int retry_; // The number of retrials when there is an interest timeout.
43 int stepCount_;
44};
45
46}
47
48#endif