Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 1 | /* -*- 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 Yu | 4f32463 | 2014-01-15 18:10:03 -0800 | [diff] [blame] | 12 | #include "../interest.hpp" |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 13 | |
| 14 | namespace ndn { |
| 15 | |
Jeff Thompson | ba16b8f | 2013-12-16 13:11:47 -0800 | [diff] [blame] | 16 | /** |
| 17 | * An OnVerified function object is used to pass a callback to verifyData to report a successful verification. |
| 18 | */ |
| 19 | typedef 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 | */ |
| 24 | typedef func_lib::function<void(const ptr_lib::shared_ptr<Data>& data)> OnVerifyFailed; |
| 25 | |
| 26 | |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 27 | class ValidationRequest { |
| 28 | public: |
| 29 | ValidationRequest |
| 30 | (const ptr_lib::shared_ptr<Interest> &interest, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed, |
Jeff Thompson | 31aeed8 | 2013-11-25 15:44:45 -0800 | [diff] [blame] | 31 | int retry, int stepCount) |
Jeff Thompson | f309aa6 | 2013-10-31 17:03:54 -0700 | [diff] [blame] | 32 | : 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 |