Peekerpoke  0.1 beta
Peek Class Reference

#include <Peek.h>

Inheritance diagram for Peek:

Public Member Functions

 Peek ()
 Default constructor of class Peek. More...
 
 Peek (std::string carName)
 Default constructor of class Peek. More...
 
 ~Peek ()
 
void usage ()
 introduce kinds of attributes. More...
 
void setMustBeFresh ()
 
void setRightmostChildSelector ()
 ndn method More...
 
void setMinSuffixComponents (int minSuffixComponents)
 ndn method More...
 
void setMaxSuffixComponents (int maxSuffixComponents)
 ndn method More...
 
void setInterestLifetime (int interestLifetime)
 ndn method More...
 
void setPayloadOnly ()
 ndn method More...
 
void setTimeout (int timeout)
 ndn method More...
 
void setPrefixName (std::string prefixName)
 ndn method More...
 
time::milliseconds getDefaultInterestLifetime ()
 ndn method More...
 
void onTimeout (const Interest &interest)
 ndn method More...
 
bool isDataReceived ()
 tell planner module whether received data from other cars. More...
 
std::string getDataString (const Block &block)
 convert coming data block to string. More...
 
Interest createInterestPacket (std::string m_name)
 ndn method More...
 
void CollectCurrentCarNumber (const Block &block)
 analysis the coming data, find producer's car ID from it. More...
 
void onData (const Interest &interest, Data &data)
 ndn method More...
 
void run ()
 ndn method More...
 
std::string getReceivedData ()
 pass the data information to planner module. More...
 

Private Attributes

std::string thisCarNumber
 
std::string currentFilterCarNumber
 
std::string haveReceived
 
std::string m_programName
 
std::string m_prefixName
 
std::string m_received_data
 
int m_ttl
 
int m_minSuffixComponents
 
int m_maxSuffixComponents
 
bool isBroadcast
 
bool m_mustBeFresh
 
bool m_isChildSelectorRightmost
 
bool m_isPayloadOnlySet
 
bool m_isDataReceived
 
time::milliseconds m_interestLifetime
 
time::milliseconds m_timeout
 
Face m_face
 

Constructor & Destructor Documentation

Peek::Peek ( )
explicit

Default constructor of class Peek.

set the attributes of the interest packet and consumer, has been replaced by Peek::Peek(std::string carName)

Peek::Peek ( std::string  carName)

Default constructor of class Peek.

set the attributes of the interest packet and consumer, set car name directly.

Parameters
carNamethe unique ID of the car
Peek::~Peek ( )

Member Function Documentation

void Peek::CollectCurrentCarNumber ( const Block &  block)

analysis the coming data, find producer's car ID from it.

add producer's car ID into received car filter so as not to receive same data.

Parameters
Block&block, contain coming data.
Interest Peek::createInterestPacket ( std::string  m_name)

ndn method

create the interest packet according to the interest name and attributes we have set.

Parameters
std::stringm_name, the part of interest name, actually the information of received car filter and time stamp.
Returns
the interest packet.
Note
input string must statistify "/filter/Car1/Car2/Car3/123456"
std::string Peek::getDataString ( const Block &  block)

convert coming data block to string.

Parameters
Block&block, contain coming data.
Returns
the data in the form of string.
time::milliseconds Peek::getDefaultInterestLifetime ( )

ndn method

set default interest life time, 4 seconds.

std::string Peek::getReceivedData ( )

pass the data information to planner module.

Returns
information of the aim location from other cars.
bool Peek::isDataReceived ( )

tell planner module whether received data from other cars.

Returns
true - received data through sending interest.
false - Did not receive data back.
void Peek::onData ( const Interest &  interest,
Data &  data 
)

ndn method

received data, and add its producer to received car filter. set m_isDataReceived true.

Parameters
interest,theinterest has been sent
data,comingdata
void Peek::onTimeout ( const Interest &  interest)

ndn method

hasn't received data back within timeout, execute this. we don't need do something about it because we have implemented a parameter called m_isDataoReceived to tell planner module the result.

Parameters
theinterest has been sent
void Peek::run ( )

ndn method

the loop continue to send interest, receive data and modify received car filter within m_ttl. will execute here first and call other functions if necessary.

void Peek::setInterestLifetime ( int  interestLifetime)

ndn method

set the interest packet life time in case too many packets in the network.

Parameters
interestLiftetime,milliseconds
void Peek::setMaxSuffixComponents ( int  maxSuffixComponents)

ndn method

set the max component attribute of the interest.

Parameters
maxSuffixComponents
void Peek::setMinSuffixComponents ( int  minSuffixComponents)

ndn method

set the minist component attribute of the interest.

Parameters
minSuffixComponents
void Peek::setMustBeFresh ( )
void Peek::setPayloadOnly ( )

ndn method

set the interest packet attribute, analysis the payload only when receiving data.

void Peek::setPrefixName ( std::string  prefixName)

ndn method

set the main part of the interest name.

Parameters
std::stringprefixName, input string.
Note
input string must statistify "ndn:/place/74"
void Peek::setRightmostChildSelector ( )

ndn method

set the Right most Child Selector attribute of the interest. producer will select the most right child pf the prefix name.

void Peek::setTimeout ( int  timeout)

ndn method

set waitting time and m_ttl for the consumer, will execute onTimeout if it happens.

Parameters
timeout,milliseconds
void Peek::usage ( )

introduce kinds of attributes.

Member Data Documentation

std::string Peek::currentFilterCarNumber
private
std::string Peek::haveReceived
private
bool Peek::isBroadcast
private
Face Peek::m_face
private
time::milliseconds Peek::m_interestLifetime
private
bool Peek::m_isChildSelectorRightmost
private
bool Peek::m_isDataReceived
private
bool Peek::m_isPayloadOnlySet
private
int Peek::m_maxSuffixComponents
private
int Peek::m_minSuffixComponents
private
bool Peek::m_mustBeFresh
private
std::string Peek::m_prefixName
private
std::string Peek::m_programName
private
std::string Peek::m_received_data
private
time::milliseconds Peek::m_timeout
private
int Peek::m_ttl
private
std::string Peek::thisCarNumber
private

The documentation for this class was generated from the following files: