class TSockAddr : public TBuf8< KMaxSockAddrSize > |
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.
Public Member Functions | |
---|---|
TSockAddr() | |
TSockAddr(TUint) | |
IMPORT_C TBool | CmpPort(const TSockAddr &) |
IMPORT_C TUint | Family() |
IMPORT_C TInt | GetUserLen() |
IMPORT_C TUint | Port() |
IMPORT_C void | SetFamily(TUint) |
IMPORT_C void | SetPort(TUint) |
Protected Member Functions | |
---|---|
IMPORT_C void | SetUserLen(TInt) |
TUint8 * | UserPtr() |
Private Member Functions | |
---|---|
SSockAddr * | BasePtr() |
Inherited Attributes | |
---|---|
TBuf8< KMaxSockAddrSize >::iBuf | |
TDes8::__DECLARE_TEST | |
TDes8::iMaxLength |
IMPORT_C | TSockAddr | ( | TUint | aFamily | ) |
Constructs the address with the family member data specified.
.
TUint aFamily | Address family Id. |
SSockAddr * | BasePtr | ( | ) | const [private, inline] |
This function returns the end point to a connection.
IMPORT_C TBool | CmpPort | ( | const TSockAddr & | anAddr | ) | const |
Compare two ports.
Compares ports in two addresses
const TSockAddr & anAddr |
IMPORT_C TUint | Family | ( | ) | const |
Gets the address family and thereby the type of address. The family may be used to effect 'down-casting'.
IMPORT_C TInt | GetUserLen | ( | ) |
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.
IMPORT_C void | SetFamily | ( | TUint | aFamily | ) |
Sets the address family of an address.
TUint aFamily | Address family Id. |
IMPORT_C void | SetPort | ( | TUint | aPort | ) |
Sets the address port of an address.
TUint aPort | New port value for address |
IMPORT_C void | SetUserLen | ( | TInt | aLen | ) | [protected] |
Sets the length of data it appends after the base class' data. This function is mainly intended for use in derived classes.
TInt aLen | New length for appended data. |
TUint8 * | UserPtr | ( | ) | const [protected, inline] |
Gets an offset to place data after the base class data. This function is mainly intended for use in derived classes.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.