NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ns3::ndn::ApiFace Class Reference

An application NDN face, providing richer API interface, compared to ndn::AppFace. More...

#include <ndn-api-face.h>

Inheritance diagram for ns3::ndn::ApiFace:
Collaboration diagram for ns3::ndn::ApiFace:

Public Types

typedef Callback< void, Ptr
< const Name >, Ptr< const
Interest > > 
InterestCallback
 
typedef Callback< void, Ptr
< const Interest >, Ptr< const
Data > > 
DataCallback
 
typedef Callback< void, Ptr
< const Interest > > 
TimeoutCallback
 
- Public Types inherited from ns3::ndn::Face
enum  Flags { APPLICATION = 1 }
 List of currently defined face flags. More...
 
typedef Callback< void, Ptr
< Face >, Ptr< Interest > > 
InterestHandler
 NDN protocol handlers. More...
 
typedef Callback< void, Ptr
< Face >, Ptr< Data > > 
DataHandler
 

Public Member Functions

 ApiFace (Ptr< Node > node)
 initialize the handler; a lot of things needs to be done. More...
 
virtual void Shutdown ()
 Shutdown the API face.
 
void ExpressInterest (Ptr< Interest > interest, DataCallback onData, TimeoutCallback onTimeout)
 Express Interest. More...
 
void SetInterestFilter (Ptr< const Name > prefix, InterestCallback onInterest)
 set Interest filter (specify what interest you want to receive) More...
 
void ClearInterestFilter (Ptr< const Name > prefix)
 clear Interest filter More...
 
void Put (Ptr< Data > data)
 Publish data. More...
 
virtual bool SendInterest (Ptr< const Interest > interest)
 Send out interest through the face. More...
 
virtual bool SendData (Ptr< const Data > data)
 Send out Dat packet through the face. More...
 
virtual std::ostream & Print (std::ostream &os) const
 Print information about the face into the stream. More...
 
- Public Member Functions inherited from ns3::ndn::Face
 Face (Ptr< Node > node)
 Default constructor. More...
 
Ptr< Node > GetNode () const
 Get node to which this face is associated.
 
virtual void RegisterProtocolHandlers (const InterestHandler &interestHandler, const DataHandler &dataHandler)
 Register callback to call when new packet arrives on the face. More...
 
virtual void UnRegisterProtocolHandlers ()
 Un-Register callback to call when new packet arrives on the face. More...
 
virtual bool ReceiveInterest (Ptr< Interest > interest)
 Receive interest from application or another node and forward it up to the NDN stack. More...
 
virtual bool ReceiveData (Ptr< Data > data)
 Receive Data packet from application or another node and forward it up to the NDN stack. More...
 
virtual void SetMetric (uint16_t metric)
 Assign routing/forwarding metric with face. More...
 
virtual uint16_t GetMetric (void) const
 Get routing/forwarding metric assigned to the face. More...
 
void SetUp (bool up=true)
 These are face states and may be distinct from actual lower-layer device states, such as found in real implementations (where the device may be down but ndn face state is still up). More...
 
bool IsUp () const
 Returns true if this face is enabled, false otherwise.
 
uint32_t GetFlags () const
 Get face flags. More...
 
void SetId (uint32_t id)
 Set face Id. More...
 
uint32_t GetId () const
 Get face Id. More...
 
bool operator== (const Face &face) const
 Compare two faces. More...
 
bool operator!= (const Face &face) const
 Compare two faces. More...
 
bool operator< (const Face &face) const
 Compare two faces. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ns3::ndn::Face
static TypeId GetTypeId ()
 
- Protected Member Functions inherited from ns3::ndn::Face
virtual bool Send (Ptr< Packet > packet)
 Send packet down to the stack (towards app or network)
 
virtual bool Receive (Ptr< const Packet > p)
 Send packet up to the stack (towards forwarding strategy)
 
void SetFlags (uint32_t flags)
 Set face flags.
 
- Protected Attributes inherited from ns3::ndn::Face
Ptr< Node > m_node
 Smart pointer to Node.
 

Detailed Description

An application NDN face, providing richer API interface, compared to ndn::AppFace.

See also
ndn::AppFace

Definition at line 51 of file ndn-api-face.h.

Constructor & Destructor Documentation

ns3::ndn::ApiFace::ApiFace ( Ptr< Node >  node)

initialize the handler; a lot of things needs to be done.

1) init keystore 2) init keylocator 3) start a thread to hold a loop of ccn_run

Definition at line 62 of file ndn-api-face.cc.

References ns3::ndn::Face::APPLICATION, ns3::ndn::Face::GetNode(), ns3::ndn::Face::SetFlags(), and ns3::ndn::Face::SetUp().

Member Function Documentation

void ns3::ndn::ApiFace::ClearInterestFilter ( Ptr< const Name prefix)

clear Interest filter

Parameters
prefixthe prefix of Interest

Definition at line 156 of file ndn-api-face.cc.

References ns3::ndn::ndnSIM::trie_with_policy< FullKey, PayloadTraits, PolicyTraits >::find_exact().

void ns3::ndn::ApiFace::ExpressInterest ( Ptr< Interest interest,
DataCallback  onData,
TimeoutCallback  onTimeout 
)

Express Interest.

Parameters
namethe Interest name
onDatathe callback function to deal with the returned data
onTimeoutthe callback function to deal with timeouts

Definition at line 102 of file ndn-api-face.cc.

References ns3::ndn::ndnSIM::trie_with_policy< FullKey, PayloadTraits, PolicyTraits >::find_exact(), and ns3::ndn::Face::ReceiveInterest().

std::ostream & ns3::ndn::ApiFace::Print ( std::ostream &  os) const
virtual

Print information about the face into the stream.

Parameters
osstream to write information to

Reimplemented from ns3::ndn::Face.

Definition at line 234 of file ndn-api-face.cc.

References ns3::ndn::Face::GetId().

void ns3::ndn::ApiFace::Put ( Ptr< Data data)

Publish data.

Parameters
dataData packet to publish

Definition at line 167 of file ndn-api-face.cc.

References ns3::ndn::Face::ReceiveData().

bool ns3::ndn::ApiFace::SendData ( Ptr< const Data data)
virtual

Send out Dat packet through the face.

Parameters
dataData packet to send out
packetData packet payload, can also carry packet tags
Returns
true if Data packet is considered to be send out (enqueued)

Reimplemented from ns3::ndn::Face.

Definition at line 204 of file ndn-api-face.cc.

References ns3::ndn::Face::IsUp(), and ns3::ndn::ndnSIM::trie_with_policy< FullKey, PayloadTraits, PolicyTraits >::longest_prefix_match().

bool ns3::ndn::ApiFace::SendInterest ( Ptr< const Interest interest)
virtual

Send out interest through the face.

Parameters
interestInterest to send out
packet"payload" that is attached to the interest (can carry some packet tags)
Returns
true if interest is considered to be send out (enqueued)

Reimplemented from ns3::ndn::Face.

Definition at line 180 of file ndn-api-face.cc.

References ns3::ndn::Face::IsUp(), and ns3::ndn::ndnSIM::trie_with_policy< FullKey, PayloadTraits, PolicyTraits >::longest_prefix_match().

void ns3::ndn::ApiFace::SetInterestFilter ( Ptr< const Name prefix,
InterestCallback  onInterest 
)

set Interest filter (specify what interest you want to receive)

Parameters
prefixthe prefix of Interest
onInterestthe callback function to deal with the returned data

Definition at line 134 of file ndn-api-face.cc.

References ns3::ndn::Fib::Add(), ns3::ndn::ndnSIM::trie_with_policy< FullKey, PayloadTraits, PolicyTraits >::find_exact(), ns3::ndn::Face::GetId(), and ns3::ndn::Face::GetNode().


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