GNet::ResolverImp Class Reference

A pimple-pattern implementation class for GNet::Resolver. More...

Inheritance diagram for GNet::ResolverImp:

GNet::SimpleClient GNet::EventHandler GNet::Connection GNet::SocketProtocolSink

List of all members.

Public Member Functions

 ResolverImp (EventHandler &event_handler, Resolver &resolver, unsigned int port)
virtual ~ResolverImp ()
bool resolveReq (std::string host_part, std::string service_part, bool udp)
bool busy () const

Protected Member Functions

virtual void onConnect ()
 Called once connected.
virtual void onSendComplete ()
 Called when all residual data from send() has been sent.
virtual void onData (const char *, std::string::size_type)
 Called when data is read from the socket.
virtual void onSecure ()
 Called once the secure socket protocol has been successfully negotiated.
virtual void onException (std::exception &)
 Called when an exception is thrown out of readEvent(), writeEvent() or exceptionEvent().


Detailed Description

A pimple-pattern implementation class for GNet::Resolver.

Note that the implementation uses GNet::SimpleClient even though GNet::SimpleClient uses a resolver. This is possible because this class passes a fully-resolved ResolverInfo object to the client and the client class only instantiates a resolver when necessary.

Definition at line 49 of file gresolver_unix.cpp.


Constructor & Destructor Documentation

GNet::ResolverImp::ResolverImp ( EventHandler event_handler,
Resolver resolver,
unsigned int  port 
)

Definition at line 78 of file gresolver_unix.cpp.

GNet::ResolverImp::~ResolverImp (  )  [virtual]

Definition at line 85 of file gresolver_unix.cpp.


Member Function Documentation

bool GNet::ResolverImp::resolveReq ( std::string  host_part,
std::string  service_part,
bool  udp 
)

bool GNet::ResolverImp::busy (  )  const

Definition at line 164 of file gresolver_unix.cpp.

Referenced by GNet::Resolver::busy(), and onException().

void GNet::ResolverImp::onConnect (  )  [protected, virtual]

Called once connected.

May (unfortunately) be called from within connect().

Implements GNet::SimpleClient.

Definition at line 110 of file gresolver_unix.cpp.

References GNet::SimpleClient::send().

void GNet::ResolverImp::onSendComplete (  )  [protected, virtual]

Called when all residual data from send() has been sent.

Implements GNet::SimpleClient.

Definition at line 116 of file gresolver_unix.cpp.

void GNet::ResolverImp::onData ( const char *  ,
std::string::size_type   
) [protected, virtual]

void GNet::ResolverImp::onSecure (  )  [protected, virtual]

Called once the secure socket protocol has been successfully negotiated.

Implements GNet::SocketProtocolSink.

Definition at line 120 of file gresolver_unix.cpp.

void GNet::ResolverImp::onException ( std::exception &   )  [protected, virtual]

Called when an exception is thrown out of readEvent(), writeEvent() or exceptionEvent().

The implementation may just do a "throw" to throw the current exception out of the event loop, or a "delete this" for objects that manage themselves on the heap.

EventHandler objects or timer objects that are sub-objects of other EventHandler objects will normally have their implementation of onException() or onTimerException() delgate to the outer object's onException().

Implements GNet::EventHandler.

Definition at line 151 of file gresolver_unix.cpp.

References busy(), GNet::Address::invalidAddress(), GNet::EventHandler::onException(), and GNet::Resolver::resolveCon().


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

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5