Peekerpoke  0.1 beta
Poke Class Reference

#include <Poke.h>

Inheritance diagram for Poke:

Public Member Functions

 Poke ()
 Default constructor of class Poke. More...
 
 Poke (std::string carName)
 Default constructor of class Poke. More...
 
void usage ()
 introduce kinds of attributes. More...
 
void setForceData ()
 ndn method More...
 
void setUseDigestSha256 ()
 ndn method More...
 
void setIdentityName (char *identityName)
 ndn method More...
 
void setLastAsFinalBlockId ()
 ndn method More...
 
void setFreshnessPeriod (int freshnessPeriod)
 ndn method More...
 
void setTimeout (int timeout)
 ndn method More...
 
void setPrefixName (char *prefixName)
 ndn method More...
 
bool isDataSent () const
 tell other module whether send a packet successfully. More...
 
void onTimeout (const Interest &interest)
 ndn method More...
 
void onData (const Interest &interest, Data &data)
 ndn method More...
 
shared_ptr< Data > createDataPacket (Name GetInterestName, int SearchResult, std::string aimAtPosition)
 ndn method More...
 
int GetInformationFromMemory (int AimPosition)
 search map module and find the state of the position there. More...
 
int GetAimPosition (std::string getName)
 get aim position from interest's name. More...
 
int GetTypeOfInterest (std::string AimPosition, Interest interest)
 judget the type of the interest and make decision, common interest should not answer it. More...
 
void BroadcastData (int AimPosition)
 broadcast a interest whose name is data information. More...
 
void onInterest (const Name &name, const Interest &interest)
 ndn method More...
 
void onRegisterFailed (const Name &prefix, const std::string &reason)
 ndn method More...
 
void run ()
 ndn method More...
 
void usepeek (std::string m_interest_name)
 use peek to send a interest whose name is data information More...
 
Interest createInterestPacket (std::string m_name)
 create the interest packet according to the interest name and attributes. More...
 

Private Attributes

std::string m_payload
 
std::string m_carName
 
KeyChain m_keyChain
 
bool m_isForceDataSet
 
bool m_isUseDigestSha256Set
 
shared_ptr< Name > m_identityName
 
bool m_isLastAsFinalBlockIdSet
 
time::milliseconds m_freshnessPeriod
 
time::milliseconds m_timeout
 
Name m_prefixName
 
bool m_isDataSent
 
Face m_face
 

Constructor & Destructor Documentation

Poke::Poke ( )
explicit

Default constructor of class Poke.

set the attributes of the data packet and producer, has been replaced by Poke::Poke(std::string carName)

Poke::Poke ( std::string  carName)

Default constructor of class Poke.

set the attributes of the data packet and producer, set car name directly.

Parameters
carNamethe unique ID of the car

Member Function Documentation

void Poke::BroadcastData ( int  AimPosition)

broadcast a interest whose name is data information.

Parameters
AimPosition,aimposition.
Note
this kind of interest is "/place/74/common/1/74/20160511T089022.123456/Car1/"
shared_ptr< Data > Poke::createDataPacket ( Name  GetInterestName,
int  SearchResult,
std::string  aimAtPosition 
)

ndn method

function to create data packet according to information from map module and attributes.

Parameters
GetInterestName,theinterest name which is the same to the interest.
SearchResult,theinformation from searching the map module.
aimAtPosition,aimlocation.
Returns
the data packet.
Note
payload statistify "1/74/20160511T089022.123456/Car1/"
Interest Poke::createInterestPacket ( std::string  m_name)

create the interest packet according to the interest name and attributes.

Parameters
std::stringm_name, the data information has sent before.
Returns
the interest packet.
Note
input string must statistify "/place/74/common/1/74/20160511T089022.123456/Car1/"
int Poke::GetAimPosition ( std::string  getName)

get aim position from interest's name.

Returns
aim position.
int Poke::GetInformationFromMemory ( int  AimPosition)

search map module and find the state of the position there.

Returns
the state of the aim position.
int Poke::GetTypeOfInterest ( std::string  AimPosition,
Interest  interest 
)

judget the type of the interest and make decision, common interest should not answer it.

Parameters
AimPosition,aimposition.
interest,cominginterest.
Returns
the type of interest.
bool Poke::isDataSent ( ) const

tell other module whether send a packet successfully.

Returns
true - data send successfully.
false - data send falsed.
void Poke::onData ( const Interest &  interest,
Data &  data 
)

ndn method

function which is part of send interest, meaningless here. because the interest producer sent is only to tell others the data information, don't want to any back data. will never call this function.

void Poke::onInterest ( const Name &  name,
const Interest &  interest 
)

ndn method

receive coming interest matches root interest.

Parameters
name,interestname.
interest,cominginterest
void Poke::onRegisterFailed ( const Name &  prefix,
const std::string &  reason 
)

ndn method

call the function if register false.

Parameters
prefix
reason
void Poke::onTimeout ( const Interest &  interest)

ndn method

function which is part of send interest, meaningless here. because the interest producer sent is only to tell others the data information, don't want to any back data.

Parameters
interest,containsdata information
void Poke::run ( )

ndn method

first here, the loop continue to listen the interest. call other functions if necessary.

void Poke::setForceData ( )

ndn method

set attribute of data packet, force to send.

void Poke::setFreshnessPeriod ( int  freshnessPeriod)

ndn method

set attribute of data packet, data packet's fresh time.

Parameters
freshnessPeriod,datapacket's fresh time.
void Poke::setIdentityName ( char *  identityName)

ndn method

set attribute of data packet

void Poke::setLastAsFinalBlockId ( )

ndn method

set attribute of data packet

void Poke::setPrefixName ( char *  prefixName)

ndn method

set root interest name to be listened, if coming interest matches this root, answer it.

Parameters
prefixName,rootinterest name
Note
input string must statistify "ndn:/place"
void Poke::setTimeout ( int  timeout)

ndn method

set producer's waitting time if necessary.

Parameters
timeout,milliseconds
void Poke::setUseDigestSha256 ( )

ndn method

set attribute of data packet, whether use digital signment.

void Poke::usage ( )

introduce kinds of attributes.

void Poke::usepeek ( std::string  m_interest_name)

use peek to send a interest whose name is data information

call other functions if necessary.

Note
input string must satisfy "/place/74/common/1/74/20160511T089022.123456/Car1/"

Member Data Documentation

std::string Poke::m_carName
private
Face Poke::m_face
private
time::milliseconds Poke::m_freshnessPeriod
private
shared_ptr<Name> Poke::m_identityName
private
bool Poke::m_isDataSent
private
bool Poke::m_isForceDataSet
private
bool Poke::m_isLastAsFinalBlockIdSet
private
bool Poke::m_isUseDigestSha256Set
private
KeyChain Poke::m_keyChain
private
std::string Poke::m_payload
private
Name Poke::m_prefixName
private
time::milliseconds Poke::m_timeout
private

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