NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
nfd::TcpFactory Class Reference

#include <tcp-factory.hpp>

Inheritance diagram for nfd::TcpFactory:
Collaboration diagram for nfd::TcpFactory:

Classes

class  Error
 Exception of TcpFactory. More...
 

Public Member Functions

shared_ptr< TcpChannelcreateChannel (const tcp::Endpoint &localEndpoint)
 Create TCP-based channel using tcp::Endpoint. More...
 
shared_ptr< TcpChannelcreateChannel (const std::string &localIp, const std::string &localPort)
 Create TCP-based channel using specified IP address and port number. More...
 
virtual void createFace (const FaceUri &uri, ndn::nfd::FacePersistency persistency, const FaceCreatedCallback &onCreated, const FaceCreationFailedCallback &onConnectFailed) 1
 Try to create Face using the supplied FaceUri. More...
 
virtual std::vector< shared_ptr< const Channel > > getChannels () const 1
 

Detailed Description

Definition at line 34 of file tcp-factory.hpp.

Member Function Documentation

§ createChannel() [1/2]

shared_ptr< TcpChannel > nfd::TcpFactory::createChannel ( const tcp::Endpoint localEndpoint)

Create TCP-based channel using tcp::Endpoint.

tcp::Endpoint is really an alias for boost::asio::ip::tcp::endpoint.

If this method called twice with the same endpoint, only one channel will be created. The second call will just retrieve the existing channel.

Returns
always a valid pointer to a TcpChannel object, an exception is thrown if it cannot be created.
Exceptions
TcpFactory::Error
See also
http://www.boost.org/doc/libs/1_42_0/doc/html/boost_asio/reference/ip__tcp/endpoint.html for details on ways to create tcp::Endpoint

Definition at line 77 of file tcp-factory.cpp.

References NFD_LOG_DEBUG.

Referenced by createChannel(), and nfd::TcpFactory::Error::Error().

§ createChannel() [2/2]

shared_ptr< TcpChannel > nfd::TcpFactory::createChannel ( const std::string &  localIp,
const std::string &  localPort 
)

Create TCP-based channel using specified IP address and port number.

This method is just a helper that converts a string representation of localIp and port to tcp::Endpoint and calls the other createChannel overload.

Exceptions
TcpFactory::Erroror std::runtime_error

Definition at line 92 of file tcp-factory.cpp.

References createChannel().

§ createFace()

void nfd::TcpFactory::createFace ( const FaceUri uri,
ndn::nfd::FacePersistency  persistency,
const FaceCreatedCallback onCreated,
const FaceCreationFailedCallback onConnectFailed 
)
virtual

Try to create Face using the supplied FaceUri.

This method should automatically choose channel, based on supplied FaceUri and create face.

Exceptions
ErrorFactory does not support connect operation
Errorspecified persistency is not supported

Implements nfd::ProtocolFactory.

Definition at line 100 of file tcp-factory.cpp.

References ndn::nfd::FACE_PERSISTENCY_PERSISTENT, ndn::util::FaceUri::getHost(), ndn::util::FaceUri::getPort(), and ndn::util::FaceUri::isCanonical().

Referenced by nfd::TcpFactory::Error::Error().

§ getChannels()

std::vector< shared_ptr< const Channel > > nfd::TcpFactory::getChannels ( ) const
virtual

Implements nfd::ProtocolFactory.

Definition at line 133 of file tcp-factory.cpp.

Referenced by nfd::TcpFactory::Error::Error().


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