connectivitylayer/isce/isinameservice_dll/inc/isinameservice.h
changeset 9 8486d82aef45
parent 7 fa67e03b87df
--- a/connectivitylayer/isce/isinameservice_dll/inc/isinameservice.h	Wed Apr 21 14:29:55 2010 +0300
+++ b/connectivitylayer/isce/isinameservice_dll/inc/isinameservice.h	Tue Oct 19 13:16:20 2010 +0300
@@ -22,6 +22,11 @@
 #include "misirouterobjectif.h"
 #include "misicommunicationmanagerif.h"
 
+#ifdef ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE
+class DISINameServiceExtended;
+#define ISCE_INTERNAL_EXTENDED_RESOURCE_ROUTING_SUPPORTED
+#endif
+
 class MISIObjectRouterIf;
 class DNameRecords;
 
@@ -48,14 +53,45 @@
         */
         void Receive( const TDesC8& aMessage );
 
-        void HandlePNSNameMessage( const TDesC8& aMessage );
-        void HandleNameQueryResp( const TDesC8& aMessage, const TUint8* msgPtr );
-        void HandleNameRemoveResp( const TDesC8& aMessage, const TUint8* msgPtr );
+        /*
+        * See comments from MISICommunicationManagerIf
+        */
+        static TBool IsValidResource( const TDesC8& aMessage );
 
         /*
         * See comments from MISICommunicationManagerIf
         */
-        static TBool IsValidResource( const TDesC8& aMessage );
+        static TUint8 GetDeviceIdentifierByResource( const TUint32 aResourceIdentifier );
+
+        /*
+        * Return device identifier for a given resource identifier
+        * @param aResourceIdentifier
+        * @return device identifier
+        */
+        TUint8 GetDeviceIdByResource( const TUint32 aResourceIdentifier );
+
+        /*
+        * Return device identifier for a given resource identifier
+        * @param aMessage, message which contains the resource to check
+        * @return ETrue if resource was valid
+        */
+        TBool HandleResourceValidationCheck( const TDesC8& aMessage );
+
+        /*
+        * Returns a pointer to self.
+        * If pointer does not exist shall assert and throw a fault.
+        * @return DISINameService*
+        */
+        static DISINameService* GetISINameServiceF();
+
+        /*
+        * Returns pointer to name records.
+        * If pointer does not exist shall assert and throws a fault.
+        * @return DNameRecords*
+        */
+        DNameRecords* GetNameRecordsF();
+
+    private:
 
         /*
         * Construct COMM_ISA_ENTITY_NOT_REACHABLE_RESP message and
@@ -63,19 +99,161 @@
         */
         void BuildAndSendCommIsaEntityNotReachableResp( const TDesC8& aMsg );
 
-        static DISINameService* iThisptr;
+        void HandlePnsNameMessage( const TDesC8& aMessage );
+        void HandleNameQueryReq( const TDesC8& aPnsNameQueryReq );
+        void HandleNameRemoveReq( const TDesC8& aPnsNameRemoveReq );
+        void HandleNameAddReq( const TDesC8& aPnsNameAddReq );
+        void HandleCommonMessage( const TDesC8& aCommonMessage );
+
+        void SendCommServiceNotIdentifiedResp( TDes8& aCommServiceNotIdentifiedRespMsg );
+        void SendCommIsiVersionGetResp( TDes8& aCommIsiVersionGetRespMsg );
+
+        // Extended resource identifier support for NameService
+        TUint32 GetResourceUsedInMessage( const TDesC8& aMessageToBeResourceRouted );
+
+        void SetIsiHeaderForCommonResp( const TDesC8& aResponseMessage,
+                                        const TDesC8& aRequestMessage );
+
+        void SetIsiHeaderForResp( const TDesC8& aResponseMessage,
+                                  const TDesC8& aRequestMessage,
+                                  const TUint8 aResponseMessageIdentifier );
+
+        void SetIsiHeaderForIndication( const TDesC8& aIndicationToModify,
+                                        const TDesC8& aPnsNameRequest,
+                                        const TUint8 aIndicationMessageIdentifier );
+
+        void TxPnsNameAddInd( const TDesC8& aPnsNameAddReq,
+                              const TUint32 aName,
+                              const TUint16 aPhoNetAddress,
+                              const TUint8 aFlags );
+
+        void TxPnsNameRemoveInd( const TDesC8& aPnsNameRemoveReq,
+                                 const TUint32 aName,
+                                 const TUint16 aPhoNetAddress,
+                                 const TUint8 aFlags );
+
+#ifdef ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE
+    public:
+#endif // ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE
+        void SendToRouter( TDes8& aMessage );
+
+     // Because accessed from MISICommunicationManagerIf::IsValidResource function.
+     public:
+
+        void LockNameServiceDMutex();
+        void FreeNameServiceDMutex();
+
+#ifdef ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE
+    private:
+        DISINameServiceExtended* iISINameServiceExtended;
+#endif // ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE
+    private:
+
+        // Not owned.
+        MISIObjectRouterIf*     iRouter;
+        // Owned
+        static DMutex*          iNameServiceMutex;
+        // Owned
+        DNameRecords*           iNameRecords;
+        // Owned
+        static DISINameService* iThisptr; 
+        TUint8                  iObjId;
+
+    };
+
+#ifdef ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE
+class DISINameService;
 
-        static DMutex*      iNameServiceMutex;
+/*
+* ISI router.
+*/
+NONSHARABLE_CLASS( DISINameServiceExtended ) : public DBase
+    {
+
+    private: 
+        
+        enum TStateOfSubscription
+            {
+            ENotSubscribed = 0,
+            ESubscribed,
+            EDone,
+            };
+
+    public:
+
+        /*
+        * Default contructor
+        */
+        DISINameServiceExtended( DISINameService* aNameService );
+
+        /*
+        * Destructor
+        */
+        ~DISINameServiceExtended();
+
+        /*
+        * Responsibility to deallocate message is transferred.
+        * @aPnsNameAddInd, message
+        */
+        void RxPnsNameAddInd( const TDesC8& aPnsNameAddInd );
 
-        DNameRecords*       iNameRecords;
+        /*
+        * Ownership of the message is not transferred.
+        * @param aMessage, message where to check the device id
+        * @return ETrue if own device
+        */
+        TBool IsRxDeviceOwnDevice( const TDesC8& aMessage );
+
+        /*
+        * Check is the ape commgr subscribe response message already received
+        * @return ETrue if not received ape commgr subscribe resp already
+        */
+        TBool ApeCommgrSubscribeRespNotReceived();
+
+        /*
+        * @return ETrue if not subsribed name add ind message
+        */
+        TBool NotSubscribedNameAddIndAlready();
+
+        /*
+        * Receive the ape commgr subscribe response.
+        * Ownership of the message is transferred.
+        * @param aMessage
+        */
+        void RxApeCommgrSubscribeResp( const TDesC8& aMessage );
+
+        /*
+        * Subscribes pns name add ind
+        */
+        void SubscribePnsNameAddInd();
+
+        /*
+        * Modifies communication manager resource to contain also device identifier
+        * [0]=PN_COMMGR [1]=Device Identifier [2]=don't care [3]=don't care
+        * @param aCommgrResource, reference to resource, which value shall be modified
+        * @param aDeviceIdentifier
+        */
+        void ModifyCommgrResource( TUint32& aCommgrResource, const TUint8 aDeviceIdentifier );
 
     private:
 
-        MISIObjectRouterIf* iRouter;
-        TUint8              iObjId;
+        void AddModemResources();
         
+        //void AddPnDevDspMainResources();
+
+        void HandleApeCommgrSubscribeResp( const TDesC8& aApeCommGrSubscribeResp );
+
+        //void HandleNameAddInd( const TDesC8& aNameAddInd );
+
+        //void SubscribeNameAddInd();
+
+        // Not owned
+        DISINameService*        iISINameService;
+        TStateOfSubscription    iShNameAddIndSubscriptionState;
 
     };
+#endif // ISCE_INTERNAL_WIDER_NAME_SERVICE_IN_USE
+
 
 #endif /* __ISINAMESERVICE_H__ */