linklayercontrol/networkinterfacemgr/agentprcore/inc/agentmessages.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Support for sending provisioning information, retrieved from Agent, to the CFProtocol
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21  @prototype
       
    22 */
       
    23 
       
    24 
       
    25 #ifndef SYMBIAN_AGENTMESSAGES_H
       
    26 #define SYMBIAN_AGENTMESSAGES_H
       
    27 
       
    28 #include <comms-infras/ss_tiermanagerutils.h>
       
    29 #include <comms-infras/linkmessages.h>
       
    30 #include <comms-infras/nifprvar.h>
       
    31 #include <comms-infras/agentprconst.h>
       
    32 #include <comms-infras/metadata.h>
       
    33 #include <cdblen.h>
       
    34 #include <nifman.h>
       
    35 
       
    36 #include <comms-infras/nifprvar_internal.h>
       
    37 
       
    38 class CAgentSubConnectionProvider;
       
    39 class CCredentialsConfig;
       
    40 class CAgentAdapter;
       
    41 
       
    42 
       
    43 
       
    44 /**
       
    45 Base class for notification handlers for Agents
       
    46 */
       
    47 class CAgentNotificationHandler : public CBase
       
    48    {
       
    49    friend class CAgentSubConnectionProvider;
       
    50 
       
    51 public:
       
    52     void Initialise (CAgentSubConnectionProvider* aAgentSCPr);
       
    53 
       
    54     // Upcalls from the agent
       
    55     IMPORT_C virtual void ConnectCompleteL ();
       
    56     IMPORT_C virtual TInt NotificationFromAgent (TAgentToFlowEventType aEvent, TAny* aInfo);
       
    57     IMPORT_C virtual void ServiceStarted ();
       
    58 
       
    59     // Notification received from the flow, bound for the agent
       
    60     IMPORT_C virtual TInt NotificationFromFlow (TFlowToAgentEventType aEvent);
       
    61 
       
    62 protected:
       
    63     IMPORT_C CAgentNotificationHandler ();
       
    64     IMPORT_C void AppendExtensionL(const Meta::SMetaData* aExtension);
       
    65     IMPORT_C const Meta::SMetaData* GetExtension(const Meta::STypeId& aType) const;
       
    66 
       
    67 
       
    68     // Utility calls to the agent
       
    69     IMPORT_C TInt ReadPortName (TDes& aPortName);
       
    70     IMPORT_C TInt ReadIfParams (TDes& aIfParams);
       
    71     IMPORT_C TInt ReadIfNetworks (TDes& aIfNetworks);
       
    72     IMPORT_C TInt ReadExcessData (TDes8& aBuffer);
       
    73     IMPORT_C TInt ReadNifName (TDes& aNifName);
       
    74     IMPORT_C TInt QueryIsDialIn();
       
    75     IMPORT_C TInt NotificationToAgent (TFlowToAgentEventType aEvent, TAny* aInfo);
       
    76 
       
    77     // Utility calls for posting messages
       
    78     IMPORT_C TInt PostMessageToFlow(const Messages::TRuntimeCtxId& aSender, Messages::TSignatureBase& aMessage);
       
    79     IMPORT_C TInt AnonPostMessageToFlow(const Messages::TSignatureBase& aMessage);
       
    80 
       
    81 private:
       
    82     static CAgentNotificationHandler* NewL();   // Only for use by the AgentSCPr
       
    83     CAgentSubConnectionProvider* iAgentSCPr;
       
    84     };
       
    85 
       
    86 
       
    87 
       
    88 /**
       
    89 Information to be provisioned to Agent SCPr's by MCPr's
       
    90 */
       
    91 class CAgentProvisionInfo : public CBase, public Meta::SMetaData
       
    92 	{
       
    93 public:
       
    94     /**
       
    95     EPromptForReconnect - When the link is lost unexpectedly with the possibility to
       
    96     reconnect prompt the user to make the decision
       
    97 
       
    98     EDoNotAttemptReconnect - When the link is lost unexpectedly with the possibility to
       
    99     reconnect never attempt reconnection and Error the Cpr
       
   100 
       
   101     EAttemptReconnect - When the link is lost unexpectedly with the possibility to
       
   102     reconnect always perform the reconnection.
       
   103     */
       
   104     enum TAgentReconnectOption
       
   105         {
       
   106         EPromptForReconnect = -1,
       
   107         EDoNotAttemptReconnect = 0,
       
   108         EAttemptReconnect = 1,
       
   109         };
       
   110 
       
   111 public:
       
   112     enum
       
   113     {
       
   114     EUid = 0x10281E07,
       
   115     ETypeId = 1,
       
   116     };
       
   117 
       
   118 	IMPORT_C ~CAgentProvisionInfo();
       
   119 
       
   120 	inline CAgentProvisionInfo()
       
   121 	    : iAgentNotificationHandler(NULL),
       
   122 		iAgentAdapter(NULL),
       
   123 		iCredentials(NULL),
       
   124 		iIapId(0),
       
   125 		iBearerSet(0),
       
   126 		iReconnectOption(EPromptForReconnect), // this is the same as the legacy behaviour
       
   127 		iReconnectAttempts(0)
       
   128 		{
       
   129 		}
       
   130 
       
   131 	inline const TDesC& AgentName () const;
       
   132 	inline TInt SetAgentName (const TDesC& aAgentName);
       
   133 
       
   134 	inline TUint32 IapId() const;
       
   135 	inline void SetIapId(TUint32 aIap);
       
   136 
       
   137 	inline TUint32 NetworkId() const;
       
   138 	inline void SetNetworkId(TUint32 aNetId);
       
   139 
       
   140 	inline TInt BearerSet() const;
       
   141 	inline void SetBearerSet(TUint32 aBearerSet);
       
   142 
       
   143 	inline CAgentNotificationHandler* AgentNotificationHandler() const;
       
   144 	inline void SetAgentNotificationHandler (CAgentNotificationHandler* aAgentNotificationHandler);
       
   145 
       
   146 	inline CCredentialsConfig* Credentials() const;
       
   147 	inline void SetCredentials (CCredentialsConfig* aCredentials);
       
   148 
       
   149 	inline CAgentAdapter* AgentAdapter() const;
       
   150 	inline void SetAgentAdapter (CAgentAdapter* aAgentAdapter);
       
   151 
       
   152 	inline CAgentProvisionInfo::TAgentReconnectOption ReconnectOption() const;
       
   153 	inline void SetReconnectOption(CAgentProvisionInfo::TAgentReconnectOption aOption);
       
   154 
       
   155 	inline TUint32 ReconnectAttempts() const;
       
   156 	inline void SetReconnectAttempts(TUint32 aAttempts);
       
   157 
       
   158 private:
       
   159 	RBuf iAgentName;
       
   160 	CAgentNotificationHandler* iAgentNotificationHandler;
       
   161 	CAgentAdapter* iAgentAdapter;
       
   162 
       
   163 	// iCredentials pointer contains information associated with an
       
   164 	// AuthenticationResponse message sent to the Flow.
       
   165 	CCredentialsConfig* iCredentials;
       
   166 	TUint32 iIapId;
       
   167 	TUint32 iNetworkId;
       
   168 	TUint32 iBearerSet;
       
   169 	TAgentReconnectOption iReconnectOption;
       
   170 	TUint32 iReconnectAttempts;
       
   171 
       
   172 public:
       
   173 	DATA_VTABLE
       
   174 	};
       
   175 
       
   176 
       
   177 class CCredentialsConfig : public CBase, public Meta::SMetaData
       
   178 /**
       
   179 
       
   180 @internalTechnology
       
   181 @released Since 9.4
       
   182 */
       
   183 	{
       
   184 public:
       
   185     enum
       
   186     {
       
   187     EUid = 0x10281E07,
       
   188     ETypeId = 2,
       
   189     };
       
   190 
       
   191     inline TInt Initialise(const TDesC& aUserName, const TDesC& aPassword, TInt aResult);
       
   192     static IMPORT_C CCredentialsConfig* NewLC(ESock::CCommsDatIapView* aIapView);
       
   193     inline ~CCredentialsConfig();
       
   194 
       
   195     //getters
       
   196     inline const TDesC& GetUserName() const;
       
   197     inline const TDesC& GetPassword() const;
       
   198     inline TInt  GetResult() const;
       
   199 
       
   200     //setters
       
   201     inline TInt  SetUserName(const TDesC& aUserName);
       
   202     inline void  SetUserName(HBufC* aUserName);
       
   203     inline TInt  SetPassword(const TDesC& aPassword);
       
   204     inline void  SetPassword(HBufC* aUserName);
       
   205     inline void  SetResult(TInt aResult);
       
   206 
       
   207 protected:
       
   208     inline CCredentialsConfig();
       
   209 
       
   210     RBuf iUserName;
       
   211     RBuf iPassword;
       
   212     TInt iResult;
       
   213 public:
       
   214 	DATA_VTABLE
       
   215 };
       
   216 
       
   217 #include <comms-infras/agentmessages.inl>
       
   218 
       
   219 #endif
       
   220 // SYMBIAN_AGENTMESSAGES_H
       
   221 
       
   222 
       
   223