#include <Peek.h>
Peek::Peek |
( |
std::string |
carName | ) |
|
Default constructor of class Peek.
set the attributes of the interest packet and consumer, set car name directly.
- Parameters
-
carName | the unique ID of the car |
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::string | m_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,the | interest has been sent |
data,coming | data |
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
-
the | interest has been sent |
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
-
void Peek::setMinSuffixComponents |
( |
int |
minSuffixComponents | ) |
|
ndn method
set the minist component attribute of the interest.
- Parameters
-
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::string | prefixName, 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
-
introduce kinds of attributes.
std::string Peek::currentFilterCarNumber |
|
private |
std::string Peek::haveReceived |
|
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 |
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 |
std::string Peek::thisCarNumber |
|
private |
The documentation for this class was generated from the following files: