blob: 4dc3a11a69d837f16b5e2ec2be220278cbbb2463 [file] [log] [blame]
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/**
* Copyright (C) 2013 Regents of the University of California.
* @author: Yingdi Yu <yingdi@cs.ucla.edu>
* @author: Jeff Thompson <jefft0@remap.ucla.edu>
* See COPYING for copyright and distribution information.
*/
#ifndef NDN_VALIDATION_REQUEST_HPP
#define NDN_VALIDATION_REQUEST_HPP
#include "../interest.hpp"
namespace ndn {
/**
* An OnVerified function object is used to pass a callback to report a successful Interest validation.
*/
typedef function< void (const shared_ptr<const Interest> &) > OnInterestValidated;
/**
* An OnVerifyFailed function object is used to pass a callback to report a failed Interest validation.
*/
typedef function< void (const shared_ptr<const Interest> &) > OnInterestValidationFailed;
/**
* An OnVerified function object is used to pass a callback to report a successful Data validation.
*/
typedef function< void (const shared_ptr<const Data> &) > OnDataValidated;
/**
* An OnVerifyFailed function object is used to pass a callback to report a failed Data validation.
*/
typedef function< void (const shared_ptr<const Data> &) > OnDataValidationFailed;
class ValidationRequest {
public:
ValidationRequest(const Interest &interest,
const OnDataValidated &onValidated,
const OnDataValidationFailed &onDataValidated,
int retry, int stepCount)
: m_interest(interest)
, m_onValidated(onValidated)
, m_onDataValidated(onDataValidated)
, m_retry(retry)
, m_stepCount(stepCount)
{}
virtual
~ValidationRequest() {}
Interest m_interest; // An interest packet to fetch the requested data.
OnDataValidated m_onValidated; // A callback function if the requested certificate is validated.
OnDataValidationFailed m_onDataValidated; // A callback function if the requested certificate validation fails.
int m_retry; // The number of retrials when there is an interest timeout.
int m_stepCount; // The stepCount of next step.
};
}
#endif