Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

Impala::Util::Channel Class Reference

#include <Channel.h>

Collaboration diagram for Impala::Util::Channel:

Collaboration graph
[legend]
List of all members.

Public Types

typedef void(*) FP_INFO (CString msg)
 Pointer to a function to be called for info messages in case no listener is provided.
typedef void(*) FP_ERROR (CString msg)
 Pointer to a function to be called for error messages in case no listener is provided.
typedef int(*) FP_REQUEST (char *buf, int len, int bufSize)
 Pointer to a function to be called by "Serve" upon arrival of a request in case no listener is provided.
typedef void(*) FP_IDLE ()
 Pointer to a function to be called by the non-blocking "Serve" whenever the socket is idle, in case no listener is provided.

Public Member Functions

 Channel (int port, int nrPorts, ChannelListener *listener=0)
 Constructor for the server side of the channel.
 Channel (String serverName, int port)
 Constructor for the client side of the channel.
 ~Channel ()
 Destructor.
int GetNrPorts () const
 The number of ports used by this channel.
int GetPortNumber (int idx) const
 The actual port number for the given index (range = [0.
String GetCurRequestConnection () const
 The machine that did the current request.
int GetCurRequestPort () const
 The port of the current request.
String GetServerInfo ()
 The name:port of the server.
bool Valid ()
 Indicates whether this channel has had errors.
void SetListener (ChannelListener *listener)
 Register a listener for this channel.
void SetMessageFunc (FP_INFO fpInfo, FP_ERROR fpError)
 Sets functions to be called for info&error messages in case no listener is provided.
char * Buffer ()
 THE buffer of this channel.
void Serve (FP_REQUEST fpRequest, FP_IDLE fpIdle=0)
 Start acting as a server and forward requests to listener or fpRequest.
void Serve (bool callbackOnIdle=false)
 Start acting as a server and forward requests to either mFpRequest or to the listener.
int SendRequest (int len)
 Sends the message of len bytes in THE buffer to the server and puts the answer in THE buffer.
bool LastSendHadError ()
 Indicates whether last SendRequest call resulted in an error.
void MaximizeSendRecvBuffer ()
 Maximize send and recv buffer size of the socket Hmmm, doesn't seems useful?
void Close ()
 Close the channel.

Static Public Attributes

static const int DATA_BUFFER_SIZE = 10485760
 The size of THE buffer of this channel.

Private Types

typedef int socklen_t
typedef u_long in_addr_t

Private Member Functions

void InitSocket ()
void CloseSocket (SOCKET sock)
int WaitForSocketEvent ()
 Wait for an event on one of the sockets.
int SendLarge (SOCKET sock, int nrData)
int RecvLarge (SOCKET sock)
int HandleRequest (char *buf, int len, int bufSize)
void HandleIdle ()
void HandleInfo (CString msg)
void HandleError (CString msg, bool isSockError)
void HandleDisconnect (int port)

Private Attributes

bool mIsServer
String mServerName
int mPort
int mNrPorts
std::vector< SOCKET > mSock
std::vector< bool > mSockConnected
std::vector< StringmConnection
std::vector< bool > mSockEvent
std::vector< SOCKET > mMsgSock
std::vector< bool > mMsgSockEvent
char * mBuffer
int mNrError
int mCurRequestSock
FP_INFO mFpInfo
FP_ERROR mFpError
FP_REQUEST mFpRequest
FP_IDLE mFpIdle
bool mCallbackOnIdle
ChannelListenermListener
 ILOG_VAR_DECL

Static Private Attributes

static const int CTR_HEADER_SIZE = 20

Detailed Description

Definition at line 47 of file Channel.h.


The documentation for this class was generated from the following file:
Generated on Thu Jan 13 09:24:08 2011 for ImpalaSrc by  doxygen 1.5.1