www.pudn.com > Chord-Source-Code.rar > route_secchord.h
#ifndef _ROUTE_SECCHORD_H_
#define _ROUTE_SECCHORD_H_
// XXX route.h should only contain the interface for the route superclasses
#include "route.h"
#include "skiplist.h"
class location;
/**
* A secure variant of Chord routing, utilizing successor lists at each hop.
* The route returned by path contains a subset of the actual nodes contacted.
*
* This is only a moderately good fit for the route_iterator interface. It
* has some issues with when upcalls should be sent and really wants to be
* able to return successor lists to the caller at each hop.
*/
class route_secchord : public route_iterator {
struct node {
chordID n_;
ptr cn_;
u_int count_;
sklist_entry sortlink_;
node (ptr l);
};
skiplist nexthops_;
size_t nsucc_;
// An indicator used to ensure that any upcall is delivered to the
// actual successor of a key.
bool lasthop_;
// Has some node returned a pair of nodes bracketing the key yet?
u_int bracketed_key_;
// Do we have the required number of successors?
bool sufficient_successors ();
void clear_nexthops ();
u_int outstanding_; // number of outstanding RPCs for this hop.
void next_hop_cb (ptr del, chord_nodelistres *res, clnt_stat err);
void send_hop_cb (bool done);
public:
route_secchord (ptr vi, chordID xi);
route_secchord (ptr vi, chordID xi,
rpc_program uc_prog,
int uc_procno,
ptr uc_args);
~route_secchord ();
void print ();
void send (ptr guess);
void first_hop (cbhop_t cb, ptr guess);
void next_hop ();
ptr pop_back ();
};
#endif /* !_ROUTE_SECCHORD_H_ */