Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: ES_SOCK.H
Link against: esock.lib

Class TSockAddr

class TSockAddr : public TBuf8< KMaxSockAddrSize >;

Description

Represents an end point address.

Protocols interpret the class within the socket server to route packets and form connections. It can be used on its own or as derived by protocols. The SSockAddr class acts as an offset map for the TSockAddr class which has a family field and a port field. The family field may be used by protocols to "up-cast" the base-class to the correct derived class. The port field is provided because it is a common practice for protocols to use port equivalents in addressing.

Writing derived classes:

The two protected member functions allow further data members to be defined past the area of the base SSockAddr. In any derived constructor the length of the descriptor should be set to the length of the valid data contained in the address. Subsequent member function calls should also adjust the length if it affects valid data.

Derivation

Members

Defined in TSockAddr:
CmpPort(), Family(), GetUserLen(), Port(), SetFamily(), SetPort(), SetUserLen(), TSockAddr(), TSockAddr(), UserPtr()


Construction and destruction


TSockAddr()

IMPORT_C TSockAddr();

Description

Default constructor initialises the address to be zero-filled.


TSockAddr()

IMPORT_C TSockAddr(TUint aFamily);

Description

Constructs the address with the family member data specified.

Parameters

TUint aFamily

Address family Id.

[Top]


Member functions


Family()

IMPORT_C TUint Family() const;

Description

Gets the address family and thereby the type of address. The family may be used to effect 'down-casting'.

Return value

TUint

Address family Id.


SetFamily()

IMPORT_C void SetFamily(TUint aFamily);

Description

Sets the address family of an address.

Parameters

TUint aFamily

Address family Id.


Port()

IMPORT_C TUint Port() const;

Description

Gets the port value.

Return value

TUint

Port value


SetPort()

IMPORT_C void SetPort(TUint aPort);

Description

Sets the address port of an address.

Parameters

TUint aPort

New port value for address


CmpPort()

IMPORT_C TBool CmpPort(const TSockAddr &anAddr) const;

Description

Compare two ports.

Compares ports in two addresses

Parameters

const TSockAddr &anAddr

Return value

TBool

ETrue if the ports match and EFalse if they do not


GetUserLen()

IMPORT_C TInt GetUserLen();

Description

Gets the number of bytes a derived class has set beyond the SSockAddr part of the address. This function is mainly intended for use in derived classes.

Return value

TInt

User length


SetUserLen()

protected: IMPORT_C void SetUserLen(TInt aLen);

Description

Sets the length of data it appends after the base class' data. This function is mainly intended for use in derived classes.

Parameters

TInt aLen

New length for appended data.


UserPtr()

protected: inline TUint8 *UserPtr() const;

Description

Gets an offset to place data after the base class data. This function is mainly intended for use in derived classes.

Return value

TUint8 *

Pointer to derived class intended data area