hti/HtiServicePlugins/HtiIpProxyServicePlugin/inc/HtiIpProxyServicePlugin.h
branchRCL_3
changeset 59 8ad140f3dd41
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     1 /*
       
     2 * Copyright (c) 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:  Implementation of ECOM plug-in service interface providing
       
    15 *                the IP-Proxy service.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef HTIIPPROXYSERVICEPLUGIN_H__
       
    21 #define HTIIPPROXYSERVICEPLUGIN_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <HtiServicePluginInterface.h>
       
    25 #include "MSocket.h"
       
    26 #include "MHostConnection.h"
       
    27 #include "MAbstractConnection.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class MSocketObserver;
       
    31 class MIPProxyEngine;
       
    32 class CDesC8Array;
       
    33 class MHostConnectionObserver;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 /**
       
    37 * IP-Proxy plugin implementation
       
    38 */
       
    39 class CHtiIpProxyServicePlugin :
       
    40     public CHTIServicePluginInterface,
       
    41     public MAbstractConnection,
       
    42     public MSocket,
       
    43     public MHostConnection
       
    44     {
       
    45     public:
       
    46         static CHtiIpProxyServicePlugin* NewL();
       
    47 
       
    48     // Interface implementation
       
    49 
       
    50         /**
       
    51         * Called by HTI-framework to initialize this plugin
       
    52         */
       
    53         void InitL();
       
    54 
       
    55         /**
       
    56         * Return busy state status
       
    57         *
       
    58         * @return ETrue when busy otherwise EFalse
       
    59         */
       
    60         TBool IsBusy();
       
    61 
       
    62         /**
       
    63         * Process either control or data message depending on aPriority
       
    64         *
       
    65         * @param aMessage message with commands or data
       
    66         * @param aPriority indicates type of aMessage
       
    67         */
       
    68         void ProcessMessageL( const TDesC8& aMessage,
       
    69                               THtiMessagePriority aPriority );
       
    70 
       
    71         /**
       
    72         * Available memory notification from HTI-framework
       
    73         *
       
    74         * @param aAvailableMemory amount of available memory for message dispatching
       
    75         */
       
    76         void NotifyMemoryChange( TInt aAvailableMemory );
       
    77 
       
    78     public:     // From MAbstractConnection
       
    79         /**
       
    80         * Get pointer to current socket instance.
       
    81         *
       
    82         * @return Pointer to current RSocket object. The ownership always
       
    83         *  remains in the class which derives from this interface.
       
    84         */
       
    85         virtual MSocket* GetSocket();
       
    86 
       
    87         /**
       
    88         * Get pointer to current host connection instance.
       
    89         *
       
    90         * @return Pointer to current RSocket object. The ownership always
       
    91         *  remains in the class which derives from this interface.
       
    92         */
       
    93         virtual MHostConnection* GetHostConnection();
       
    94 
       
    95     public:     // From MSocket
       
    96         /**
       
    97         * @return RSocket object
       
    98         */
       
    99         virtual RSocket* GetRSocket();
       
   100 
       
   101         /**
       
   102         * @return Local TCP port.
       
   103         */
       
   104         virtual TUint LocalPort() const;
       
   105 
       
   106         /**
       
   107         * @return Remote TCP port.
       
   108         */
       
   109         virtual TUint RemotePort() const;
       
   110 
       
   111         /**
       
   112         * Sets observer.
       
   113         *
       
   114         * @param aObserver Pointer to observer.
       
   115         */
       
   116         virtual void SetObserver( MSocketObserver* aObserver );
       
   117 
       
   118         /**
       
   119         * Sets the ownership mode of RSocket object. If set ETrue
       
   120         * the socket will be closed and RSocket object will be deleted
       
   121         * in the destruction.
       
   122         *
       
   123         * @param aHasOwnership Ownership mode.
       
   124         */
       
   125         virtual void SetSocketOwnershipMode( TBool aHasOwnership );
       
   126 
       
   127         /**
       
   128         * Starts receiving data.
       
   129         */
       
   130         virtual void IssueRead();
       
   131 
       
   132         /**
       
   133         * Cancels all pending requests.
       
   134         */
       
   135         virtual void Cancel();
       
   136 
       
   137         /*
       
   138         * Returns the protocol information of the socket
       
   139         */
       
   140         virtual void SocketInfo( TProtocolDesc& aDesc ) const;
       
   141 
       
   142         /*
       
   143         * Is this a UDP socket
       
   144         */
       
   145         virtual TBool IsUDP() const;
       
   146 
       
   147     public:     // From MSocketWriter
       
   148         /**
       
   149         * Writes data to socket.
       
   150         * @param aData Data to be written.
       
   151         */
       
   152         virtual void WriteL( const TDesC8& aData );
       
   153 
       
   154     public:     // From MHostConnection
       
   155         /**
       
   156         * Starts connecting procedure to host.
       
   157         */
       
   158         virtual void IssueConnectL();
       
   159 
       
   160         /**
       
   161         * Starts disconnection procedure.
       
   162         */
       
   163         virtual void IssueDisconnect();
       
   164 
       
   165         /**
       
   166         * Sets observer.
       
   167         *
       
   168         * @param aObserver Pointer to observer.
       
   169         */
       
   170         virtual void SetObserver( MHostConnectionObserver* aObserver );
       
   171 
       
   172         /**
       
   173         * @return Connection state.
       
   174         */
       
   175         virtual TBool IsConnected();
       
   176 
       
   177         /**
       
   178         * @return Pointer to current RSocket object. The ownership always
       
   179         *
       
   180         * remains in this class.
       
   181         */
       
   182         virtual RSocket* Socket();
       
   183 
       
   184 
       
   185     protected:
       
   186         CHtiIpProxyServicePlugin();
       
   187         virtual ~CHtiIpProxyServicePlugin();
       
   188 
       
   189         void ConstructL();
       
   190 
       
   191     private:
       
   192         MSocketObserver* iSocketObserver;
       
   193         MHostConnectionObserver* iHostObserver;
       
   194         MIPProxyEngine* iProxyEngine;
       
   195         CDesC8Array* iOutgoingArray;
       
   196         TBool iBusy;
       
   197         TBool iConnected;
       
   198     };
       
   199 
       
   200 #endif // HTIIPPROXYSERVICEPLUGIN_H__
       
   201 
       
   202 // End of File