realtimenetprots/sipfw/ClientResolver/Server/inc/CSIPCRRoutingEntry.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Name          : CSIPCRRoutingEntry.h
       
    16 * Part of       : SIP Client Resolver
       
    17 * Version       : 1.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #ifndef CSIPCRROUTINGENTRY_H
       
    24 
       
    25 /**
       
    26 * @internalComponent
       
    27 */
       
    28 #define CSIPCRROUTINGENTRY_H
       
    29 
       
    30 // INCLUDES
       
    31 #include <e32base.h>
       
    32 #include "_sipcodecdefs.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 
       
    36 // CLASS DEFINITIONS
       
    37 /**
       
    38 * Class implements a routing table entry for SIP client UIDs.
       
    39 *
       
    40 *  @lib siprsvsrv.exe
       
    41 */
       
    42 class CSIPCRRoutingEntry : public CBase
       
    43     {
       
    44     public: // Constructors and destructor
       
    45 
       
    46         /**
       
    47         * Static constructor.
       
    48         *
       
    49         * @param aUid the UID of the entry
       
    50         *
       
    51         * @return An initialized instance of this class.
       
    52         */
       
    53         static CSIPCRRoutingEntry* NewL( const TUid& aUid );
       
    54 
       
    55         /// Destructor.
       
    56         ~CSIPCRRoutingEntry();
       
    57 
       
    58     public: // New functions
       
    59 
       
    60         /**
       
    61         * Gets the reference count to this entry.
       
    62         * This means the count of times this entry has been 
       
    63         * added/associated to the routing table.
       
    64         * @return the reference count
       
    65         */
       
    66         TInt& ReferenceCount();
       
    67 
       
    68         /**
       
    69         * Gets the UID of this entry.
       
    70         * 
       
    71         * @return the UID of this entry
       
    72         */
       
    73         const TUid& UID() const;
       
    74 
       
    75         /**
       
    76         * Adds a client UID that will be served by this entry.
       
    77 		*
       
    78         * @param aUid the UID to be added
       
    79 		*/
       
    80         void AddL( const TUid& aUid );
       
    81 
       
    82         /**
       
    83         * Add an allocated uid entry object under this entry.
       
    84 		*
       
    85         * @param aUid the entry object to be added
       
    86 		*/
       
    87         void AddL( const CSIPCRRoutingEntry* aEntry );        
       
    88 
       
    89         /**
       
    90         * Removes the client UID from the list of served clients.
       
    91         * 
       
    92         * @param aUid the UID to be removed
       
    93         * @return KErrNone if the UID has been succesfully removed. 
       
    94         *         Otherwise a system wide error code.
       
    95         */
       
    96         TInt Remove( const TUid& aUid );
       
    97 
       
    98 		/**
       
    99         * Compare two CSIPCRRoutingEntry items
       
   100 		* @return ETrue, if UID id equals
       
   101         */
       
   102         static TBool Compare(const CSIPCRRoutingEntry& aItem,
       
   103 				      const CSIPCRRoutingEntry& aItem2);
       
   104 				      
       
   105         /**
       
   106         * Retrieves the requested CSIPCRRoutingEntry instance 
       
   107         * in the the whole CSIPCRRoutingEntry tree.
       
   108         * 
       
   109         * @param aUid of the requested CSIPCRRoutingEntry
       
   110         * @return requested CSIPCRRoutingEntry instance. Otherwise NULL.
       
   111         */
       
   112         CSIPCRRoutingEntry* FindEntryInTree( const TUid& aUid);
       
   113         
       
   114         /**
       
   115         * Retrieves the parent instance of the requested CSIPCRRoutingEntry.
       
   116         * 
       
   117         * @param aUid UID of the requested CSIPCRRoutingEntry
       
   118         * @return requested parent CSIPCRRoutingEntry instance. Otherwise NULL.
       
   119         */
       
   120         CSIPCRRoutingEntry* FindParent( const TUid& aUid ); 
       
   121 
       
   122         /**
       
   123         * Checks whether this routing table entry has the given UID
       
   124         * as a served client UID.
       
   125         * 
       
   126         * @param aUid the UID to be checked
       
   127         * @return ETrue if found. Otherwise EFalse.
       
   128         */
       
   129         TBool HasClient( const TUid& aUid ) const;
       
   130 
       
   131         /*
       
   132         Set UID (used in search operation)
       
   133         */
       
   134         void SetUID( const TUid& aUid );
       
   135 
       
   136         /*
       
   137         * Detach requested UID from array, and return the entry
       
   138         */
       
   139         CSIPCRRoutingEntry* Detach( const TUid& aUid );
       
   140 
       
   141     private: // methods
       
   142         /*
       
   143         default constructor
       
   144         */
       
   145         CSIPCRRoutingEntry(const TUid& aUid);
       
   146     
       
   147 		/**
       
   148         * Find requested CSIPCRRoutingEntry instance, 
       
   149         * Note! This operation temporarily switches the uid
       
   150         * of current entry object to be the searched one
       
   151         * @param aUid of the requested CSIPCRRoutingEntry
       
   152         * @ return requested CSIPCRRoutingEntry instance, otherwise NULL
       
   153         */
       
   154         CSIPCRRoutingEntry* FindEntry(const TUid& aUid);
       
   155 
       
   156 		/**
       
   157         * Find index of requested CSIPCRRoutingEntry instance, 
       
   158         * Note! This operation temporarily switches the uid
       
   159         * of current entry object to be the searched one
       
   160         * @param aUid of the requested CSIPCRRoutingEntry
       
   161         * @return RPointerArray index, otherwise KErrNotFound
       
   162         */
       
   163         TInt FindEntryIndex(const TUid& aUid);				      
       
   164 
       
   165     private: // Data
       
   166     
       
   167         TInt iReferenceCount;
       
   168         TUid iUID;
       
   169         RPointerArray<CSIPCRRoutingEntry> iServedClients;        
       
   170         
       
   171     private: // For testing purposes
       
   172 
       
   173 	    UNIT_TEST(CSIPCRRoutingEntryTest)          
       
   174     };
       
   175 
       
   176 #endif // CSIPCRROUTINGENTRY_H
       
   177