virtual-specific implementation of the MAbstractConnection interface.
Inheritance:
Public Methods
-
CVirtualConnection(const std::string& aPrototype)
- Default constructor.
-
CVirtualConnection(const std::string& aPrototype, CThreadInfo* aThreadInfo)
- Default constructor.
-
~CVirtualConnection()
- Default Destructor.
-
bool Connect(const std::string& aAddress, int aPort)
- Creates a network specific connection
-
bool Disconnect()
- Kills the existing connection.
-
void Close()
- Explicitly closes the socket.
-
int Write(const void* aOutBuf, int aLength)
- Sends data to the other end of the connection.
-
int Read(void* aInBuf, int aLength)
- Reads data from an open connection.
-
const std::string& GetRemoteAddress()
- Returns connection's remote address.
-
int GetFd()
- Returns connection's file descriptor.
-
bool Listen()
- Sets the connection to the listening state. Not used currently.
-
bool Listen(int aPort)
- Sets the connection to the listening state. Not used currently.
-
MAbstractConnection* AcceptL()
- Accepts the incoming connection and returns a new connection object. Not used currently.
-
bool IsListening()
- Tells if the connection is listening.
-
bool IsConnected()
- Tells if the connection is established.
-
bool HasData()
- Tells if the connection has data waiting
-
void SetConnectionType(MAbstractConnection* aConnection, std::string& aPrototype, std::string& aAddress, int aPort)
- Sets the virtual connection to point to a specific technology connection object.
-
void SetConnectionType(MAbstractConnection* aConnection)
- Sets the virtual connection to point to a specific technology connection object.
Documentation
virtual-specific implementation of the MAbstractConnection interface.
CVirtualConnection(const std::string& aPrototype)
-
Default constructor, sets the initial vatiables to their default values
This method creates new technology specific connection object and points the
virtualconnection to it.
- Parameters:
- aPrototype - Prototype for new networking technology
- Returns:
- none
CVirtualConnection(const std::string& aPrototype, CThreadInfo* aThreadInfo)
-
Default constructor, sets the initial vatiables to their default values
This method creates new technology specific connection object and points the
virtualconnection to it. Method also inserts connection information to iThreadList
- Parameters:
- aPrototype - Prototype for new networking technology
aThreadInfo - Pointer to ThreadInfo container
- Returns:
- none
~CVirtualConnection()
-
Default destructor, removes the current connection from the iThreadList
- Returns:
- none
bool Connect(const std::string& aAddress, int aPort)
-
Creates a network specific connection. VirtualConnection
points to specific networking specific connection class
and calls the connect method.
- Parameters:
- aAddress - The destination address.
aPort - Target port.
- Returns:
- true if the connection could be established
bool Disconnect()
-
Kills the existing connection. VirtualConnection
points to specific networking specific connection class
and calls the disconnect method.
- Returns:
- true if the connection was dropped in a controlled manner
void Close()
-
Explicitly closes the socket without any additional state checking,
i.e. this function will execute even if there's no existing connection.
This function is used by the PeerHood engine to ensure that no file
descriptors are leaked.
- Returns:
- none
int Write(const void* aOutBuf, int aLength)
-
Sends data to the other end of the connection. Note that this
function is not endianess-safe.
- Parameters:
- aOutBuf - Buffer containing the data that should be written.
aLength - The number of bytes to be written.
- Returns:
- the number of bytes written or -1 in the case of an error
int Read(void* aInBuf, int aLength)
-
Reads data from an open connection. Just like
<code>Read</code> this function is not endianess-safe so it should be
treated more like a standard Posix sequential socket.
- Parameters:
- aInBuf - Buffer where the data is read to.
aLength - The number of bytes that should be read.
- Returns:
- the number of bytes read or -1 in the case of an error
const std::string& GetRemoteAddress()
-
Returns connection's remote address. Note that the existence of the
address doesn't mean that there's a connection established.
- Returns:
- connection's remote address
int GetFd()
-
Returns connection's file descriptor. Other classes can have a direct
access to the connection's socket (or similar entity) via this function's
return value.
- Returns:
- connection's file descriptor or -1 if one isn't available
bool Listen()
-
Sets the connection to the listening state. Not used currently.
- Returns:
- true always, except false when there is no connection.
bool Listen(int aPort)
-
Sets the connection to the listening state. Not used currently.
- Parameters:
- aPort - Not used currently.
- Returns:
- true always, except false when there is no connection.
MAbstractConnection* AcceptL()
-
Accepts the incoming connection and returns a new connection object. Not used currently.
- Returns:
- NULL always
bool IsListening()
-
Tells if the connection is in the listening state or not.
- Returns:
- true if the connection is in the listening state
bool IsConnected()
-
Tells if the connection is established or not.
- Returns:
- true if the connection is established
bool HasData()
-
Tells if the connection has data waiting.
- Returns:
- true if the data is ready
void SetConnectionType(MAbstractConnection* aConnection, std::string& aPrototype, std::string& aAddress, int aPort)
-
Sets the virtual connection to point to a specific technology connection object. This method
updates the connection information.
- Parameters:
- aConnection - Connection information which updates the old information
aPrototype - New prototype which updates the old prototype
aAddress - New address which updates the old address
aPort - New port which updates the old port
- Returns:
- none
void SetConnectionType(MAbstractConnection* aConnection)
-
Sets the virtual connection to point to a specific technology connection object.
This method updates only the connection object which the virtulconnection points to.
- Returns:
- none
- This class has no child classes.
- See Also:
- MAbstractConnection
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.