diff -r 6295dc2169f3 -r 8486d82aef45 connectivitylayer/isce/isinameservice_dll/inc/namerecords.h --- a/connectivitylayer/isce/isinameservice_dll/inc/namerecords.h Wed Apr 21 14:29:55 2010 +0300 +++ b/connectivitylayer/isce/isinameservice_dll/inc/namerecords.h Tue Oct 19 13:16:20 2010 +0300 @@ -23,40 +23,146 @@ #include // For TDesC8 #include // For DBase -NONSHARABLE_CLASS ( TNameTable ) -{ -public: - TNameTable( const TUint32 aName, const TUint16 aPhonetAddress, const TUint8 aFlags ) - :iName(aName), - iPhonetAddress(aPhonetAddress), - iFlags(aFlags) - {} +NONSHARABLE_CLASS( TNameTableEntry ) + { + public: + + TNameTableEntry( const TUint32 aName, const TUint16 aPhonetAddress, const TUint8 aFlags ) + :iName(aName), + iPhonetAddress(aPhonetAddress), + iFlags(aFlags) + {} + + TUint32 iName; + TUint16 iPhonetAddress; + TUint8 iFlags; + + }; + +NONSHARABLE_CLASS( DNameRecords ) : public DBase + { + + public: + + /* + * Assumption each function executed from single thread at the time. + * Constructor + */ + DNameRecords(); + + /* + * Assumption each function executed from single thread at the time. + * Destructor + */ + ~DNameRecords(); - TUint32 iName; - TUint16 iPhonetAddress; - TUint8 iFlags; - }; + /* + * Assumption each function executed from single thread at the time. + * @param aName, name to be added + * @param aPhonetAddress, PhoNet address of the name to be added + * @param aFlags, flags of the name to be added + * @return PN_NAME_UNKNOWN if flags value invalid, PN_NAME_NOT_ALLOWED if not changeable name + */ + TUint8 AddName( const TUint32 aName, + const TUint16 aPhonetAddress, + const TUint8 aFlags ); + + /* + * Assumption each function executed from single thread at the time. + * @param aName + * @param aPhonetAddress, modified to contain names PhoNet address if name is found + * @return KErrNone if found KErrNotFound if not + */ + TInt LookupPhonetAddress( const TUint32 aName, TUint16* aPhonetAddress ); + + /* + * Assumption each function executed from single thread at the time. + * @param aName + * @param aPhonetAddress, modified to contain names PhoNet address if name is found + * @param aFlags, modified to contain names flag if name is found + * @return KErrNone if found KErrNotFound if not + */ + TInt LookupNamePhonetAddressAndFlags( const TUint32 aName, TUint16* aPhonetAddress, TUint8* aFlags ); + + /* + * Assumption each function executed from single thread at the time. + * @param aName + * @param aMask, mask for matching names + * @param aResultsArray, array where matches are appended + */ + void NameQuery( const TUint32 aName, const TUint32 aMask, RArray *aResultsArray ); -NONSHARABLE_CLASS (DNameRecords) : public DBase -{ -public: - DNameRecords(); - ~DNameRecords(); + /* + * Assumption each function executed from single thread at the time. + * @param aName + * @return PN_NAME_UNKNOWN if name not found, PN_NAME_NOT_ALLOWED if not allowed to remove name + */ + TUint8 RemoveName( const TUint32 aName ); + + private: - RArray iNameTableArray; + /* + * Adds new name to name table. + * @param aName + * @param aPhonetAddress + * @param aFlags + * @return PN_NAME_NOT_ALLOWED if name not found or it's address was equal to own device router, otherwise PN_NAME_OK + */ + TUint8 AddNewName( const TUint32 aName, + const TUint16 aPhonetAddress, + const TUint8 aFlags ); + /* + * Ownership of the parameter not given. + * Adds existing name to the name table. + * @param aNameTableEntry + * @param aName + * @param aPhonetAddress + * @param aFlags + * @return PN_NAME_NOT_ALLOWED if not changeable PN_NAME_OK otherwise + */ + TUint8 AddExistinNameToNameTableArray( TNameTableEntry* aNameTableEntry, + const TUint32 aName, + const TUint16 aPhonetAddress, + const TUint8 aFlags ); - TUint8 AddName( const TUint32 aName, - const TUint16 aPhonetAddress, - const TUint8 aFlags ); + /* + * Adds and creates new name table entry + * @param aName + * @param aPhonetAddress + * @param aFlags + * @return PN_NAME_NOT_ALLOWED if router object tried to add PN_NAME_OK otherwise + */ + TUint8 AddNewNameToNameTableArray( const TUint32 aName, + const TUint16 aPhonetAddress, + const TUint8 aFlags ); - TUint8 RemoveName( const TUint32 aName ); + /* + * Ownership of the return value not given. + * @param aName + * @return pointer to table entry, NULL if not found + */ + TNameTableEntry* FindMatchingNameTableEntry( const TUint32 aName ); - TInt32 LookupPhonetAddress( const TUint32 aName, TUint16* aPhonetAddress ); + /* + * Ownership of the array is not given. + * @param aName + * @param aMask, mask to find name table entries + * @aResultsArray, array where found name table entries are added + */ + void FindMatchingNameTableEntriesWithMask( const TUint32 aName, + const TUint32 aMask, + RArray * aResultsArray ); - RArray * GetNameTable(); + /* + * Remove entry given as paramater. + * @param aNameEntryToRemove + */ + void RemoveUndefinedEntry( TNameTableEntry& aNameEntryToRemove ); - TInt32 NameQuery( const TUint32 aName, const TUint32 aMask, RArray *aResultsArray ); -}; + // Name table array, owned. + RArray iNameTableArray; + + }; #endif /* __NAMERECORDS_H__ */