Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

strmod::strmod::SockListenModule Class Reference

A class that accepts connections on a particular socket. More...

#include <StrMod/SockListenModule.h>

Inheritance diagram for strmod::strmod::SockListenModule:

Inheritance graph
[legend]
List of all members.

Public Methods

 SockListenModule (const ehnet::SocketAddress &bind_addr, unievent::Dispatcher &disp, unievent::UnixEventRegistry &ureg, int qlen=1)
 What address am I going to listen on, and what's the length of the pending connection queue?

virtual ~SockListenModule ()
 Closes the socket being listened to.

virtual int AreYouA (const lcore::ClassIdent &cid) const
 Asks if a class is of a particular type, or publicly derived from that type.

virtual bool canCreate (int side=0) const
 Can a plug be created on the given side?

SLPlugmakePlug (int side=0)
 Attempts to create a plug on the given side.

virtual bool ownsPlug (const Plug *plug) const
 Does the module own this plug?

virtual bool deletePlug (Plug *plug)
 Please delete this plug.

bool hasError () const throw ()
 Has there been an error of any kind?

const unievent::UNIXErrorgetError () const throw ()
 What was the error, if any?

void clearError () throw ()
 Pretend no error happened.

const ehnet::SocketAddressGetBoundAddress () const
 What's the local address for this socket?


Static Public Attributes

const STR_ClassIdent identifier
 A unique identifier for this class.


Protected Methods

virtual const lcore::ClassIdent * i_GetIdent () const
 Returns the class identifier for the class the object actually is.

virtual Plug * i_MakePlug (int side)
 Makes a plug on the given side.

SocketModule * makeSocketModule (int fd, ehnet::SocketAddress *peer, unievent::Dispatcher &disp, unievent::UnixEventRegistry &ureg)
 Make a socket module once I've done the accept.

void setError (const unievent::UNIXError &err) throw ()
 Set an error so that hasError and getError return something.

SocketModule * getNewModule ()
 Return the new module (if any) and try to 'accept' another connection.


Friends

class FDPollEv
class FDPollRdEv
class FDPollErEv
class SLPlug

Detailed Description

A class that accepts connections on a particular socket.

This class creates instances of SocketModules and wraps them up in a SocketModuleChunk.

Definition at line 123 of file SockListenModule.h.


Member Function Documentation

int strmod::strmod::SockListenModule::AreYouA const lcore::ClassIdent &    cid const [inline, virtual]
 

Asks if a class is of a particular type, or publicly derived from that type.

Overriden in every derived class (with a static identifier member) to compare against the identifier, then call the AreYouA methods of all the superclasses.

Parameters:
cid Usually <class>::identifier for the class you want to ask if the object is an instance of.

Reimplemented from strmod::strmod::StreamModule.

Definition at line 257 of file SockListenModule.h.

bool strmod::strmod::SockListenModule::deletePlug Plug *    plug [inline, virtual]
 

Please delete this plug.

Modules are supposed to own plugs, so you aren't supposed to delete them yourself.

Returns false on failure. Failure could happen because module does not own the plug.

Implements strmod::strmod::StreamModule.

Definition at line 277 of file SockListenModule.h.

virtual const lcore::ClassIdent* strmod::strmod::SockListenModule::i_GetIdent   const [inline, protected, virtual]
 

Returns the class identifier for the class the object actually is.

Should always be overridden in any class that has a static identifier member.

Reimplemented from strmod::strmod::StreamModule.

Definition at line 199 of file SockListenModule.h.

StreamModule::Plug * strmod::strmod::SockListenModule::i_MakePlug int    side [inline, protected, virtual]
 

Makes a plug on the given side.

Guaranteed to never be called if canCreate would return false. Must NEVER return 0 (NULL).

Implements strmod::strmod::StreamModule.

Definition at line 291 of file SockListenModule.h.

SockListenModule::SLPlug * strmod::strmod::SockListenModule::makePlug int    side = 0 [inline]
 

Attempts to create a plug on the given side.

When writing a derived class, your MakePlug function should ALWAYS call CanCreate first before calling i_MakePlug.

Returns 0 (NULL) on failure. Only fails if CanCreate would return false.

Reimplemented from strmod::strmod::StreamModule.

Definition at line 267 of file SockListenModule.h.

SocketModule * strmod::strmod::SockListenModule::makeSocketModule int    fd,
ehnet::SocketAddress   peer,
unievent::Dispatcher   disp,
unievent::UnixEventRegistry   ureg
[inline, protected]
 

Make a socket module once I've done the accept.

Note, ownership of peer is being passed here.

Definition at line 303 of file SockListenModule.h.


The documentation for this class was generated from the following files:
Generated on Wed Jan 29 00:32:55 2003 for libNet by doxygen1.3-rc1