-
class
AbstractReflectSession
(Return to index)
-
This is the abstract base class that defines the server side of a client-server connection.
Type:
Include file:
../../reflector/AbstractReflectSession.h
This class contains no message routing logic of its own, but defines
the interface so that subclasses can do so.
Synopsis:
Public methods:
- public
AbstractReflectSession ()
- public status_t
AddNewSession (AbstractReflectSessionRef session, int socket)
Adds the given AbstractReflectSession to the session list.
This method is only needed in very specialized situations (e.g.
if sessions are creating new sessions).
If (socket) is less than zero, no TCP connection will be used,
and the session will be a pure server-side entity.
- public virtual status_t
AttachedToServer ()
This method is called directly after the constructor.
Various methods that weren't callable from the constructor
may be called here.
Should return B_NO_ERROR if everything is okay; something
else if there is a problem and the session should be aborted.
Default implementation does nothing and returns B_NO_ERROR.
- public void
EndSession ()
Marks this session to be terminated, as if the TCP connection had been broken.
- public PortableMessage &
GetCentralState () const
Returns a reference to a PortableMessage that is shared by all sessions
This message can be used for whatever purpose the sessions care to; it
is not used by the server itself.
- public int
GetClientPort () const
Returns the client-side port of this session
- public const char *
GetHostName () const
Returns the hostname of this session
- public status_t
GetSessionByID (const char * id, AbstractReflectSessionRef & returnRef) const
Returns a reference to the session with the given session ID, or B_ERROR.
- public virtual const char *
GetSessionIDString () const
Returns a ID string to represent this session with.
The returned string is guaranteed to be unique across
all sessions in the server.
- public const PortableQueue<AbstractReflectSessionRef> &
GetSessionsList () const
Returns an object that can be used to iterate over all the currently
connected sessions.
- public pure virtual void
MessageReceivedFromGateway (PortableMessageRef msg)
Called when a new message is received from our IO gateway.
- public pure virtual void
MessageReceivedFromNeighbor (AbstractReflectSession & from, PortableMessageRef msg, void * userData)
Called when a message is sent to us by another session (possibly this one).
(from) is the session who sent the message to us.
(msg) is a reference to the message that was sent.
(userData) is additional data that is defined by the sending subclass.
(For StorageReflectSessions, this value, if non-NULL, is a pointer to the
DataNode in this Session's node subtree that was matched by the paths in (msg))
- public status_t
ReplaceSession (AbstractReflectSessionRef newSession)
Causes this session to be terminated (similar to EndSession(),
and the session specified in (newSessionRef) to take its
place using the same socket connection & message IO gateway.
Returns B_NO_ERROR on success, B_ERROR if the new session refused
to be attached.
- public virtual
~AbstractReflectSession ()
Protected methods:
Friend methods: