realtimenetprots/sipfw/ClientResolver/Server/inc/CSIPCRRoutingTable.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          : CSIPCRRoutingTable.h
       
    16 * Part of       : SIP Client Resolver
       
    17 * Version       : 1.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #ifndef CSIPCRROUTINGTABLE_H
       
    24 /**
       
    25 * @internalComponent
       
    26 */
       
    27 #define CSIPCRROUTINGTABLE_H
       
    28 
       
    29 // INCLUDES
       
    30 #include <e32base.h>
       
    31 #include "CSIPCRRoutingEntry.h"
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 
       
    35 // CLASS DEFINITIONS
       
    36 /**
       
    37 * Class implements a routing table for SIP client UIDs.
       
    38 * There can be SIP clients serving other SIP clients.
       
    39 * These associations are stored in this table. 
       
    40 *
       
    41 *  @lib siprsvsrv.exe
       
    42 */
       
    43 class CSIPCRRoutingTable : public CBase
       
    44     {
       
    45     public: // Constructors and destructor
       
    46 
       
    47         /**
       
    48         * Static constructor.
       
    49         *
       
    50         * @return An initialized instance of this class.
       
    51         */
       
    52         static CSIPCRRoutingTable* NewL();
       
    53 
       
    54         /// Destructor.
       
    55         ~CSIPCRRoutingTable();
       
    56 
       
    57     public: // New functions
       
    58 
       
    59         /**
       
    60         * Adds a top-level client to the routing table.
       
    61         *
       
    62         * @param aUid the UID to be added
       
    63         */
       
    64         void AddL( const TUid& aUid );
       
    65 
       
    66         /**
       
    67         * Associates a UID with an existing routing table entry.
       
    68         * This may require moving the associated entry as
       
    69         * a child of an existing routing entry, 
       
    70         * if the associated entry is already in the routing table.
       
    71         *
       
    72         * @param aUid the UID of an existing routing table entry
       
    73         * @param aAssociatedUid a UID to be associated with the existing entry.
       
    74         */
       
    75         void AssociateL( const TUid& aUid, const TUid& aAssociatedUid );
       
    76 
       
    77         /**
       
    78         * Removes a UID from the routing table.
       
    79         * If this is a non-leaf UID, all the associated UIDs are also removed.
       
    80         * @param aUid the UID to be removed
       
    81         * @return KErrNone if the routing table entry has been 
       
    82         *         succesfully removed. Otherwise a system wide error code.
       
    83         */
       
    84         TInt Remove( const TUid& aUid );
       
    85 
       
    86         /**
       
    87         * Finds the next-hop entry associated with the given UID.
       
    88         *
       
    89         * @param aUid the UID of an existing leaf level routing table entry
       
    90         * @param aParentUid the UID of a parent or grand-parent 
       
    91         *        of the leaf-level UID
       
    92         * @param aNextHopUid on return contains the next-hop UID
       
    93         * @return ETrue if a match was found. Otherwise EFalse.
       
    94         */
       
    95         TBool FindMatch( const TUid& aClientUid, 
       
    96                          const TUid& aParentUid, 
       
    97                          TUid& aNextHopUid );
       
    98                          
       
    99         /**
       
   100         * Checks whether the client UID is present in the routing table. 
       
   101         * @param aUid the UID of the client
       
   102         * @return ETrue if a match was found. Otherwise EFalse.
       
   103         */
       
   104         TBool HasUid( const TUid& aClientUid );                         
       
   105 
       
   106     private: // Data
       
   107     
       
   108         RPointerArray<CSIPCRRoutingEntry> iTable;
       
   109         CSIPCRRoutingEntry*               iFindEntry;            
       
   110 
       
   111     private: // methods
       
   112     
       
   113         // default constructor
       
   114         CSIPCRRoutingTable();
       
   115         
       
   116         // Find requested entry index
       
   117         TInt FindEntryIndex(const TUid& aUid);
       
   118 
       
   119         /**
       
   120         * Finds the top-level entry associated with the given UID.
       
   121         *
       
   122         * @param aUid the UID of an existing routing table entry
       
   123         * @param aTopLevelUid on return contains the top-level UID
       
   124         * @return ETrue if a match was found. Otherwise EFalse.
       
   125         */
       
   126         TBool FindToplevelMatch( const TUid& aUid, TUid& aTopLevelUid );
       
   127         
       
   128         // construct the CSIPCRRoutingTable object
       
   129         void ConstructL();
       
   130         
       
   131         
       
   132     private: // For testing purposes
       
   133 
       
   134 	    UNIT_TEST(CSIPCRRoutingTableTest)
       
   135     };
       
   136 
       
   137 #endif // CSIPCRROUTINGTABLE_H
       
   138