CUpnpTcpSession Class Reference

class CUpnpTcpSession : public CBase
Since
Series60 2.6

Inherits from

Public Member Functions
CUpnpTcpSession ( RSocket &, TThreadPriority )
~CUpnpTcpSession ()
void BufferReceivedL ( TDesC8 &)
void CancelTcpReader ()
void CheckConnectionCloseL ()
void CloseSocketL ()
void DeleteServeFileL ()
void DeleteThisSessionL ( CUpnpTcpSession *)
void DisconnectRequestL ()
TBool DownloadOngoing ()
CUpnpHttpFileAccess * FileAccess ()
TBool FileServeExists ()
CUpnpHttpFileTransferReader * FileTransferReader ()
void FileTransferReaderDoneL ()
void FileTransferReaderErrorL ( TInt )
CUpnpHttpFileTransferWriter * FileTransferWriter ()
void FileTransferWriterDoneL ()
void FileTransferWriterHandleMoreL ()
void HandleErrorL ( TInt )
TInt Id ()
void InitialReceiveL ()
TBool IsConnected ()
TBool IsPersistentConnection ()
void NotifyDisconnectL ( TInetAddr )
void NotifyTimeoutL ()
void NotifyUpperLayersOnPostL ()
void PostingFileCompleteL ()
void ReceiveL ()
void ReceivingCompletedL ( TDesC8 &)
TInetAddr & RemoteHost ()
void ServerBusyL ()
TInt ServerPort ()
void ShutdownStop ()
TBool ShuttingDown ()
void SocketServerBusyL (const TInetAddr &)
void StartClosingSession ()
void StartDisconnect ( TBool )
void StartDisconnectingTimer ( TInt )
void StartTimeoutTimer ( TBool )
void TcpConstructL ( RSocket , TInt , TInt )
TInt TimeoutCurrentValue ()
void TimerCancel ()
void TimerEventL ( CUpnpNotifyTimer *)
void WaitRetryError ( TInt , TBool )
void WriteL (const TDesC8 &)
void WritingCompletedL ()
Protected Member Functions
void DestroyIt ( CUpnpTcpSession *)
void FileTransferReaderConstructL ()
void FileTransferWriterConstructL ( TInt )
Private Member Functions
TBool OutstandingWritings ()
void SetState ( TUpnpTcpSessionState )
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Member Enumerations
enum TUpnpTcpSessionState {
ENotConnected , EConnecting , EConnected , EDisconnecting , EShuttingDownWriteWait , EShuttingDownStop , EShuttingDown , EServerBusy
}
Protected Attributes
TInetAddr iAddr
TBool iContinuedMessageDownload
TBool iDisconnectNotification
TInt iExportRetryCounter
CUpnpHttpFileTransferReader * iFTReader
CUpnpHttpFileTransferWriter * iFTWriter
TInt iFileReadBufferSize
TInt iId
TThreadPriority iInitialPriority
TBool iIsPersistent
TBool iPendingPostRequests
CUpnpHttpBuffer * iReceivedMessage
TBool iSaveToFile
TInt iSessionError
TBool iSessionKeepAlive
TBool iSessionNeedsErrorReply
RSocket iSocket
CUpnpSocketShutdown * iSocketShutdown
TUpnpTcpSessionState iState
CUpnpTcpSessionReader * iTcpReader
CUpnpTcpSessionWriter * iTcpWriter
TInt iTimeoutCurrentValue
TInt iTimeoutSessionValue
CUpnpNotifyTimer * iTimeoutTimer

Constructor & Destructor Documentation

CUpnpTcpSession(RSocket &, TThreadPriority)

CUpnpTcpSession ( RSocket & aSocket,
TThreadPriority aPriority
)

Constructor for building CUpnpTcpSession . This constructor is used when connection is iniatiated from network. Second-phase construction is made by TcpConstructL() .

Parameters

RSocket & aSocket Pointer to new Socket.
TThreadPriority aPriority Priority of this session

~CUpnpTcpSession()

~CUpnpTcpSession ( ) [virtual]

Virtual destructor.

Member Functions Documentation

BufferReceivedL(TDesC8 &)

void BufferReceivedL ( TDesC8 & aBuffer ) [pure virtual]
Callback function. Called when data has been received.
Since
Series60 2.6

Parameters

TDesC8 & aBuffer Data that has been received thru session.

CancelTcpReader()

void CancelTcpReader ( )

Cancels TcpReader

CheckConnectionCloseL()

void CheckConnectionCloseL ( ) [pure virtual]
Callback function. Checks if connection uses Connection: Close header, and if so, tries to parse message and send it to upper layers.
Since
Series60 2.6

CloseSocketL()

void CloseSocketL ( )
Returns current value of the timeout
Since
Series60 3.2
Since
Series60 3.2

DeleteServeFileL()

void DeleteServeFileL ( ) [pure virtual]
Callback function. Deletes fileserve of this session.
Since
Series60 2.6

DeleteThisSessionL(CUpnpTcpSession *)

void DeleteThisSessionL ( CUpnpTcpSession * aSession ) [pure virtual]
Callback function. Deletes given session.
Since
Series60 2.6

Parameters

CUpnpTcpSession * aSession Session to delete.

DestroyIt(CUpnpTcpSession *)

void DestroyIt ( CUpnpTcpSession * aSession ) [protected, pure virtual]

Parameters

CUpnpTcpSession * aSession

DisconnectRequestL()

void DisconnectRequestL ( )
Handles disconnect request
Since
Series60 3.2

DownloadOngoing()

TBool DownloadOngoing ( )
Checks if there are outstanding sending operations.
Since
Series60 3.2

FileAccess()

CUpnpHttpFileAccess * FileAccess ( ) [pure virtual]
Returns a pointer to FileAccess object of this session.
Since
Series60 3.2

FileServeExists()

TBool FileServeExists ( ) [pure virtual]
Checks if FileServe Exists.
Since
Series60 2.6

FileTransferReader()

CUpnpHttpFileTransferReader * FileTransferReader ( )
Returns pointer to CUpnpHttpFileTransferReader
Since
Series60 3.2

FileTransferReaderConstructL()

void FileTransferReaderConstructL ( ) [protected]
Contructs file transfer reader
Since
Series60 3.2

FileTransferReaderDoneL()

void FileTransferReaderDoneL ( ) [pure virtual]
Callback function. Notifies http session when upload finished
Since
Series60 3.2

FileTransferReaderErrorL(TInt)

void FileTransferReaderErrorL ( TInt aError ) [pure virtual]
Callback function. Notifies http session when error in upload
Since
Series60 3.2

Parameters

TInt aError

FileTransferWriter()

CUpnpHttpFileTransferWriter * FileTransferWriter ( )
Returns pointer to CUpnpHttpFileTransferWriter
Since
Series60 3.2

FileTransferWriterConstructL(TInt)

void FileTransferWriterConstructL ( TInt aWriteSize ) [protected]
Contructs file transfer writer
Since
Series60 3.2

Parameters

TInt aWriteSize

FileTransferWriterDoneL()

void FileTransferWriterDoneL ( ) [pure virtual]
Callback function. Notifies http session when download finished
Since
Series60 3.2

FileTransferWriterHandleMoreL()

void FileTransferWriterHandleMoreL ( ) [pure virtual]
Callback function. Checks for outstanding downloads
Since
Series60 3.2

HandleErrorL(TInt)

void HandleErrorL ( TInt aError )
Handles possible error that can occure in the session as well as in reader and writer active objects.
Since
Series60 3.0

Parameters

TInt aError error code

Id()

TInt Id ( )
Returns the SessionId of this session.
Since
Series60 3.1

InitialReceiveL()

void InitialReceiveL ( )
Starts to receive messages to this session
Since
Series60 3.2

IsConnected()

TBool IsConnected ( )
Checks is session is connected.
Since
Series60 2.6

IsPersistentConnection()

TBool IsPersistentConnection ( )
Marked if a persistent connection
Since
Series60 3.2

NotifyDisconnectL(TInetAddr)

void NotifyDisconnectL ( TInetAddr aAddr ) [pure virtual]
Callback function. Notifies upper layers that session has been disconnected.
Since
Series60 2.6

Parameters

TInetAddr aAddr Address of remote host.

NotifyTimeoutL()

void NotifyTimeoutL ( ) [pure virtual]

NotifyUpperLayersOnPostL()

void NotifyUpperLayersOnPostL ( ) [pure virtual]
Callback function. Informs upper layers that HTTP POST has been started by sending HTTP error code 801 message to upper layers.
Since
Series60 2.6

OutstandingWritings()

TBool OutstandingWritings ( ) [private]
Checks if there are outstanding writing operations.
Since
Series60 3.2

PostingFileCompleteL()

void PostingFileCompleteL ( ) [pure virtual]
Callback function. Informs upper layers that HTTP POST has been finished
Since
Series60 2.6

ReceiveL()

void ReceiveL ( )
Receive messages to this session
Since
Series60 3.2

ReceivingCompletedL(TDesC8 &)

void ReceivingCompletedL ( TDesC8 & aBuffer )
Callback function for reader object. When the reader gets some data, it forwards it to the session with this callback.
Since
Series60 3.0

Parameters

TDesC8 & aBuffer buffer with received data.

RemoteHost()

TInetAddr & RemoteHost ( )
Returns the address that session is connected to.
Since
Series60 2.6

ServerBusyL()

void ServerBusyL ( )
Function that is used to send notification to client and disconnect the session.
Since
Series60 2.6

ServerPort()

TInt ServerPort ( ) [pure virtual]
Callback function. Returns the port number of parent HttpServer.
Since
Series60 2.6

SetState(TUpnpTcpSessionState)

void SetState ( TUpnpTcpSessionState aState ) [private]
Sets session statel.
Since
Series60 2.6

Parameters

TUpnpTcpSessionState aState new state of the session.

ShutdownStop()

void ShutdownStop ( )

ShuttingDown()

TBool ShuttingDown ( )
Checks if the session is being shutdown
Since
Series60 3.2

SocketServerBusyL(const TInetAddr &)

void SocketServerBusyL ( const TInetAddr & aAddr ) [pure virtual]
Callback function. Notifies upper layers that SocketServer is busy.
Since
Series60 2.6

Parameters

const TInetAddr & aAddr Address of remote host.

StartClosingSession()

void StartClosingSession ( )
Starts closing the session, no more message to be sent to the client
Since
Series60 3.2

StartDisconnect(TBool)

void StartDisconnect ( TBool aDisconnectNotification = EFalse )
Starts disconnect session.
Since
Series60 3.2

Parameters

TBool aDisconnectNotification = EFalse

StartDisconnectingTimer(TInt)

void StartDisconnectingTimer ( TInt aTime = 500 )
Starts the timeoutTimer for session. Session is deleted after 0.5ms by default.
Since
Series60 2.6

Parameters

TInt aTime = 500

StartTimeoutTimer(TBool)

void StartTimeoutTimer ( TBool aSessionErrorReplyNeeded )
Starts the timeoutTimer for session. If timer expires, no reply has been sent to remote host.
Since
Series60 2.6

Parameters

TBool aSessionErrorReplyNeeded ETrue, if in timeout there should be sent HTTP error 408 Server timeout.

TcpConstructL(RSocket, TInt, TInt)

void TcpConstructL ( RSocket aSocket,
TInt aReadBufferSize,
TInt aFileReadBufferSize
)

Second phase constructor for building CUpnpTcpSession . This constructor is used when connection is iniatiated from network.

Parameters

RSocket aSocket Pointer to new Socket which is already connected to remote host.
TInt aReadBufferSize
TInt aFileReadBufferSize

TimeoutCurrentValue()

TInt TimeoutCurrentValue ( )

TimerCancel()

void TimerCancel ( )
Cancel timer
Since
Series60 3.2

TimerEventL(CUpnpNotifyTimer *)

void TimerEventL ( CUpnpNotifyTimer * aTimer )
Callback function for timer expirations.
Since
Series60 2.6

Parameters

CUpnpNotifyTimer * aTimer Timer that has expired.

WaitRetryError(TInt, TBool)

void WaitRetryError ( TInt aError,
TBool aStartTimer = EFalse
)
Callback function for writer object. When the request writing is not completed due to an error, a new attempt to write is being made...
Since
Series60 3.2

Parameters

TInt aError
TBool aStartTimer = EFalse

WriteL(const TDesC8 &)

void WriteL ( const TDesC8 & aBuffer )
Writes data thru this session's socket
Since
Series60 2.6

Parameters

const TDesC8 & aBuffer Data to write.

WritingCompletedL()

void WritingCompletedL ( )
Callback function for writer object. When the request writing is completed then writer calls this function to notify session about it.
Since
Series60 3.0

Member Enumerations Documentation

Enum TUpnpTcpSessionState

State of session.
  • EnotConnected - Connection is not established yet.

  • EConnecting - TcpSession requested connection in asynchronous mode.

  • EConnected - Connection is established, TcpReader is started and TcpWriter can write to the socket.

  • EDisconnecting - Session is about to be disconnected but socket is not closed so TcpWriter can still write a response.

  • EServerBusy - Server is already occupied with processing requests so no other session can be established.

Enumerators

ENotConnected
EConnecting
EConnected
EDisconnecting
EShuttingDownWriteWait
EShuttingDownStop
EShuttingDown
EServerBusy

Member Data Documentation

TInetAddr iAddr

TInetAddr iAddr [protected]

TBool iContinuedMessageDownload

TBool iContinuedMessageDownload [protected]

TBool iDisconnectNotification

TBool iDisconnectNotification [protected]

TInt iExportRetryCounter

TInt iExportRetryCounter [protected]

CUpnpHttpFileTransferReader * iFTReader

CUpnpHttpFileTransferReader * iFTReader [protected]

CUpnpHttpFileTransferWriter * iFTWriter

CUpnpHttpFileTransferWriter * iFTWriter [protected]

TInt iFileReadBufferSize

TInt iFileReadBufferSize [protected]

TInt iId

TInt iId [protected]

TThreadPriority iInitialPriority

TThreadPriority iInitialPriority [protected]

TBool iIsPersistent

TBool iIsPersistent [protected]

TBool iPendingPostRequests

TBool iPendingPostRequests [protected]

CUpnpHttpBuffer * iReceivedMessage

CUpnpHttpBuffer * iReceivedMessage [protected]

TBool iSaveToFile

TBool iSaveToFile [protected]

TInt iSessionError

TInt iSessionError [protected]

TBool iSessionKeepAlive

TBool iSessionKeepAlive [protected]

TBool iSessionNeedsErrorReply

TBool iSessionNeedsErrorReply [protected]

RSocket iSocket

RSocket iSocket [protected]

CUpnpSocketShutdown * iSocketShutdown

CUpnpSocketShutdown * iSocketShutdown [protected]

TUpnpTcpSessionState iState

TUpnpTcpSessionState iState [protected]

CUpnpTcpSessionReader * iTcpReader

CUpnpTcpSessionReader * iTcpReader [protected]

CUpnpTcpSessionWriter * iTcpWriter

CUpnpTcpSessionWriter * iTcpWriter [protected]

TInt iTimeoutCurrentValue

TInt iTimeoutCurrentValue [protected]

TInt iTimeoutSessionValue

TInt iTimeoutSessionValue [protected]

CUpnpNotifyTimer * iTimeoutTimer

CUpnpNotifyTimer * iTimeoutTimer [protected]