CWapFullySpecDatagramService Class Reference

#include <wapmessage.h>

Link against: wapmsgcli.lib

class CWapFullySpecDatagramService : public CBase

Inherits from

  • CWapFullySpecDatagramService
Public Member Functions
virtual ~CWapFullySpecDatagramService()
pure virtual TInt AwaitRecvDataSize(TPckg< TUint16 > &, TRequestStatus &)
pure virtual voidCancelRecv()
pure virtual TInt Connect(const TDesC8 &, Wap::TPort, Wap::TBearer, TInetAddr)
pure virtual TInt Connect(const TDesC8 &, Wap::TPort, Wap::TBearer)
pure virtual TInt GetDatagramSizes(TUint16 &, TUint16 &)
pure virtual TInt GetLocalAddress(HBufC8 *&)
pure virtual TInt GetLocalPort(Wap::TPort &)
IMPORT_C CWapFullySpecDatagramService *NewL()
IMPORT_C CWapFullySpecDatagramService *NewL(const TUid &)
pure virtual TInt Recv(TDes8 &, TBool &, TRequestStatus &, TUint32)
pure virtual TInt Send(const TDesC8 &)
Protected Member Functions
CWapFullySpecDatagramService()
IMPORT_C voidConstructL()
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()

Detailed Description

Fully-Specified WDP Sends and receives datagrams over WDP using a specified local port and a single, named remote host.

The class is an ECom plug-in interface. Clients use NewL() to request an implementation of the interface, and then call the interface's virtual functions to access the implementation's services.

The use of the plug-in architecture allows different implementations to use different underlying WAP stacks.

Functions can return system wide error codes, and also API-specific errors as defined in wapmsgerr.h.

Constructor & Destructor Documentation

CWapFullySpecDatagramService ( )

IMPORT_CCWapFullySpecDatagramService()[protected]

~CWapFullySpecDatagramService ( )

IMPORT_C~CWapFullySpecDatagramService()[virtual]

Destructor

Member Function Documentation

AwaitRecvDataSize ( TPckg< TUint16 > &, TRequestStatus & )

TInt AwaitRecvDataSize(TPckg< TUint16 > &aDataSizePckg,
TRequestStatus &aReqStatus
)[pure virtual]

Waits for a datagram to be received, and discover how large a buffer is required to retrieve it.

This asynchronous request waits for a datagram to be received and will then complete allowing the client to discover how large a buffer is needed to retrieve the entire datagram that has been received. A later call to Recv() with a buffer of sufficent size will then allow the client to retrieve the datagram fully.

Parameters
aDataSizePckgOn completion, the size of data received, in bytes
aReqStatusAsynchonrous status word, used to signal when a data size is known
Return Value
KErrNone on successful completion, or one of the system error codes on failure.

CancelRecv ( )

voidCancelRecv()[pure virtual]

Cancels a previously asynchronous Recv() or AwaitRecvDataSize() request.

If a datagram arrives at the local host, it will be discarded.

Connect ( const TDesC8 &, Wap::TPort, Wap::TBearer, TInetAddr )

TInt Connect(const TDesC8 &aRemoteHost,
Wap::TPortaRemotePort,
Wap::TBeareraBearer,
TInetAddraInetAddr
)[pure virtual]

Connects to the WAP stack, opening an endpoint that can be used to listen for subsequent incoming datagrams.

This overload of Connect() allows an IP address associated with a network interface to be specified. In multihomed systems, this can be used to specify the network interface to which the endpoint should be bound.

All CWapFullySpecDatagramService implementations must automatically close this endpoint upon destruction.

Parameters
aRemoteHostThe bearer-dependent address of the remote host with which the data will be exchanged
aRemotePortThe port on the remote host to which data will be sent
aBearerThe bearer to use. EAll cannot be used.
aInetAddrThe IP address of the network interface that should be used in a multihomed system.
Return Value
KErrNone on successful completion, or one of the system error codes on failure.

Connect ( const TDesC8 &, Wap::TPort, Wap::TBearer )

TInt Connect(const TDesC8 &aRemoteHost,
Wap::TPortaRemotePort,
Wap::TBeareraBearer
)[pure virtual]

Connects to the WAP stack, opening an endpoint that can be used to listen for subsequent incoming datagrams.

All CWapFullySpecDatagramService implementations must automatically close this endpoint upon destruction.

Parameters
aRemoteHostThe bearer-dependent address of the remote host with which the data will be exchanged
aRemotePortThe port on the remote host to which data will be sent
aBearerThe bearer to use. EAll cannot be used.
Return Value
KErrNone on successful completion, or one of the system error codes on failure.

ConstructL ( )

IMPORT_C voidConstructL()[protected]

GetDatagramSizes ( TUint16 &, TUint16 & )

TInt GetDatagramSizes(TUint16 &aMaxSize,
TUint16 &aNominalSize
)[pure virtual]

Queries the WDP bearer for its maximum datagram size and its nominal datagram size.

The nominal size is the size within which a datagram won't have to be split into smaller individual messages and then re-assembled at the other end.

Parameters
aMaxSizeOn return, the maximum datagram size
aNominalSizeOn return, the nominal datagram size
Return Value
KErrNone on successful completion, or one of the system error codes on failure.

GetLocalAddress ( HBufC8 *& )

TInt GetLocalAddress(HBufC8 *&aLocalHost)[pure virtual]

Gets the local address of this endpoint.

Parameters
aLocalHostOn return, the address of the local host. Clients must pass in a reference to a NULL HBufC8 pointer. The function allocates a new HBufC8 buffer to hold the address, and passes ownership of the buffer to the client.
Return Value
KErrNone on successful completion, or one of the system error codes on failure.

GetLocalPort ( Wap::TPort & )

TInt GetLocalPort(Wap::TPort &aPort)[pure virtual]

Gets the local port of this endpoint.

This is useful if the port was chosen automatically.

Parameters
aPortOn return, the port number
Return Value
KErrNone on successful completion, or one of the system error codes on failure.

NewL ( )

IMPORT_C CWapFullySpecDatagramService *NewL()[static]

Fully-specified WDP Allocates and creates a new CWapFullySpecDatagramService object.

Return Value
A new CWapFullySpecDatagramService object.
Leave Codes
Systemwide error codes.

NewL ( const TUid & )

IMPORT_C CWapFullySpecDatagramService *NewL(const TUid &aImplementation)[static]

Allocates and creates a new CWapFullySpecDatagramService object.

Return Value
A new CWapFullySpecDatagramService object.
Leave Codes
Systemwide error codes.

Recv ( TDes8 &, TBool &, TRequestStatus &, TUint32 )

TInt Recv(TDes8 &aBuffer,
TBool &aTruncated,
TRequestStatus &aReqStatus,
TUint32aTimeout
)[pure virtual]

Receives data on a bound port.

An asynchronous notification is sent to the client when data arrives.

Parameters
aBufferA client-allocated data buffer that, on completion, is filled with data received. Data that overflows the buffer is discarded.
aTruncatedOn completion, indicates whether the received datagram was truncated to fit in the client's supplied buffer
aReqStatusAsynchronous status word, used to notify the client that a datagram was received
aTimeoutAn optional millisecond time-out which allows a timed read to be made. If no data is received within the timeout period, the request completes with KErrTimedOut. If a value of 0 is supplied, the timeout is infinite.
Return Value
KErrNone on successful completion, or one of the system error codes on failure.

Send ( const TDesC8 & )

TInt Send(const TDesC8 &aBuffer)[pure virtual]

Sends data on a fully-specified connection.

Parameters
aBufferThe data buffer to be written over the connection
Return Value
KErrNone on successful completion, or one of the system error codes on failure.