datacommsserver/esockserver/csock/RConnection.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2003-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 //
       
    15 
       
    16 #include <comms-infras/nifprvar.h>
       
    17 #include <es_sock.h>
       
    18 #include <comms-infras/sockmes.h>
       
    19 #include <connpref.h>
       
    20 #include "es_flog.h"
       
    21 #include <comms-infras/es_commsdataobject.h>
       
    22 #include <es_sock_partner.h>
       
    23 
       
    24 
       
    25 #ifdef _DEBUG
       
    26 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
       
    27 // (if it could happen through user error then you should give it an explicit, documented, category + code)
       
    28 _LIT(KSpecAssert_ESockCSockRCnctn, "ESockCSockRCnctn");
       
    29 #endif
       
    30 
       
    31 
       
    32 // Forward declearation
       
    33 namespace ESock
       
    34 {
       
    35 class XConnectionQueryBase;
       
    36 }
       
    37 
       
    38 EXPORT_C RConnection::RConnection()
       
    39 	: iNewISPId(0)	//lint -esym(1401, RConnection::iReserved)	// no BC issue as ctor not inlined
       
    40 /** Empty constructor. */
       
    41 	{
       
    42 	}
       
    43 
       
    44 EXPORT_C RConnection::~RConnection()
       
    45 /** Empty destructor. */
       
    46 	{
       
    47 	}
       
    48 
       
    49 EXPORT_C TInt RConnection::Open(RSocketServ& aSocketServer, TUint aConnectionType)
       
    50 /** Opens a new RConnection instance.
       
    51 
       
    52 @param aSocketServer Socket Server session.
       
    53 @param aConnectionType Reserved.
       
    54 @return KErrNone if successful, otherwise another of the system wide error
       
    55 codes. */
       
    56 	{
       
    57 	RSessionBase& s = aSocketServer;
       
    58 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tOpen() tid %d"), this, (TUint)RThread().Id()));
       
    59 	return CreateSubSession(s, ECNCreate, TIpcArgs(aConnectionType));
       
    60 	}
       
    61 
       
    62 EXPORT_C TInt RConnection::Open(RSocketServ& aSocketServer, TName& aName)
       
    63 /** Opens a new RConnection instance cloned from an existing RConnection instance.
       
    64 
       
    65 @param aSocketServer Socket Server session.
       
    66 @param aName Name of an existing RConnection (obtainable via Name() method).
       
    67 @return KErrNone if successful, otherwise another of the system wide error
       
    68 codes.
       
    69 @capability Dependent on the type of connection so deferred to PRT */
       
    70 	{
       
    71 	RSessionBase& s = aSocketServer;
       
    72 	return CreateSubSession(s, ECNCreateWithName, TIpcArgs(&aName));
       
    73 	}
       
    74 
       
    75 EXPORT_C void RConnection::Close()
       
    76 /** Closes the connection.
       
    77 
       
    78 The connection will not be dropped immediately: it will be dropped when there
       
    79 is no more data traffic on the connection. So if a client needs to graciously
       
    80 shutdown the connection, Close(), not Stop(), needs to be used after shutting
       
    81 down the socket.
       
    82 */
       
    83 	{
       
    84 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tClose() tid %d"), this, (TUint)RThread().Id()));
       
    85 	CloseSubSession(ECNClose);
       
    86 	}
       
    87 
       
    88 EXPORT_C void RConnection::Start(TRequestStatus& aStatus)
       
    89 /** Start a connection asynchonously using the default connection preferences.
       
    90 
       
    91 The request completes once the connection is fully up or an error has occurred.
       
    92 Successful completion will be accompanied by a KConnectionUp progress. 
       
    93 
       
    94 If an RConnection has been stopped or has gone down, any subsequent start will
       
    95 act in the same way as a start with a new RConnection. i.e. The preferences from
       
    96 previous starts will not be used.
       
    97 
       
    98 @param aStatus On return, the status of the request, e.g. KErrNone, KErrAlreadyExists.
       
    99 @capability Dependent on the access point implementation */
       
   100 	{
       
   101 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tStart() tid %d"), this, (TUint)RThread().Id()));
       
   102 	SendReceive(ECNStart, TIpcArgs(), aStatus);
       
   103 	}
       
   104 
       
   105 EXPORT_C void RConnection::Start(TConnPref& aPref, TRequestStatus& aStatus)
       
   106 /** Start a connection asynchonously using the connection preferences specified.
       
   107 
       
   108 The connection preferences can be of type TConnSnapPref, TCommDbConnPref,
       
   109 TCommDbMultiConnPref or TConnPrefList. See the definitions of these classes to see
       
   110 their usage. 
       
   111 
       
   112 The request completes once the connection is fully up or an error has occurred.
       
   113 Successful completion will be accompanied by a KConnectionUp progress. 
       
   114 
       
   115 If an RConnection has been stopped or has gone down, any subsequent start will
       
   116 act in the same way as a start with a new RConnection. i.e. The preferences from
       
   117 previous starts will not be used.
       
   118 
       
   119 @see TConnSnapPref
       
   120 @see TCommDbConnPref
       
   121 @see TCommDbMultiConnPref
       
   122 @see TConnPrefList
       
   123 
       
   124 @param aPref Connection preferences.
       
   125 @param aStatus On return, the status of the request, e.g. KErrNone, KErrAlreadyExists.
       
   126 
       
   127 @capability Dependent on the access point implementation */
       
   128 	{
       
   129 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tStart() with preferences, tid %d"), this, (TUint)RThread().Id()));
       
   130 	
       
   131 	if (aPref.ExtensionId() != TConnPref::EConnPrefEComList)
       
   132 		{
       
   133 		SendReceive(ECNSetStartPrefs, TIpcArgs(&aPref));
       
   134 		}
       
   135 	else
       
   136 		{
       
   137 		TConnPrefList& custPref = static_cast<TConnPrefList&>(aPref);
       
   138 		RBuf8 prefFlatteningBuffer;
       
   139 		TInt err = prefFlatteningBuffer.Create(custPref.Length());
       
   140         if (err == KErrNone)
       
   141             {
       
   142             err = custPref.Store(prefFlatteningBuffer);
       
   143             }
       
   144 		
       
   145         if (err != KErrNone)
       
   146             {
       
   147             prefFlatteningBuffer.Close();
       
   148             aStatus = err;
       
   149             return;
       
   150             }
       
   151 
       
   152         SendReceive(ECNSetStartPrefs, TIpcArgs(&prefFlatteningBuffer));
       
   153         prefFlatteningBuffer.Close();
       
   154 		}
       
   155 	
       
   156     SendReceive(ECNStart, TIpcArgs(), aStatus);
       
   157 	}
       
   158 
       
   159 EXPORT_C TInt RConnection::Start()
       
   160 /** Start a connection synchonously using the default connection preferences.
       
   161 
       
   162 The request completes once the connection is fully up or an error has occurred.
       
   163 Successful completion will be accompanied by a KConnectionUp progress. 
       
   164 
       
   165 If an RConnection has been stopped or has gone down, any subsequent start will
       
   166 act in the same way as a start with a new RConnection. i.e. The preferences from
       
   167 previous starts will not be used.
       
   168 
       
   169 @return KErrNone if successful or the connection already exists, otherwise
       
   170 another of the system wide error codes.
       
   171 @capability Dependent on the access point implementation */
       
   172 	{
       
   173 	TRequestStatus status;
       
   174 	Start(status);
       
   175 	User::WaitForRequest(status);
       
   176 	TInt ret = status.Int();
       
   177 
       
   178 	if (ret == KErrAlreadyExists)
       
   179 	    {
       
   180 	    return KErrNone;
       
   181 	    }
       
   182 
       
   183 	return ret;
       
   184 	}
       
   185 
       
   186 EXPORT_C TInt RConnection::Start(TConnPref& aPref)
       
   187 /** Start a connection synchonously using the connection preferences specified.
       
   188 
       
   189 The connection preferences can be of type TConnSnapPref, TCommDbConnPref,
       
   190 TCommDbMultiConnPref or TConnPrefList. See the definitions of these classes to see
       
   191 their usage. 
       
   192 
       
   193 The request completes once the connection is fully up or an error has occurred.
       
   194 Successful completion will be accompanied by a KConnectionUp progress. 
       
   195 
       
   196 If an RConnection has been stopped or has gone down, any subsequent start will
       
   197 act in the same way as a start with a new RConnection. i.e. The preferences from
       
   198 previous starts will not be used.
       
   199 
       
   200 @see TConnSnapPref
       
   201 @see TCommDbConnPref
       
   202 @see TCommDbMultiConnPref
       
   203 @see TConnPrefList
       
   204 
       
   205 @param aPref Connection preferences.
       
   206 @return KErrNone if successful or the connection already exists, otherwise
       
   207 another of the system wide error codes.
       
   208 @capability Dependent on the access point implementation */
       
   209 	{
       
   210 	TRequestStatus status;
       
   211 	Start(aPref, status);
       
   212 	User::WaitForRequest(status);
       
   213 	TInt ret = status.Int();
       
   214 
       
   215     if (ret == KErrAlreadyExists)
       
   216         {
       
   217         return KErrNone;
       
   218         }
       
   219 
       
   220 	return ret;
       
   221 	}
       
   222 
       
   223 EXPORT_C TInt RConnection::Stop()
       
   224 /** Stops the entire connection by disconnecting the underlying network interface
       
   225 immediately, regardless of whether other clients are using it or not.
       
   226 
       
   227 Applications using the connection will be sent the socket error code KErrCancel.
       
   228 The application generally responds with clean up operations and pop-up boxes
       
   229 alerting the user to the termination of the application.
       
   230 
       
   231 @return KErrNone if successful, otherwise another of the system wide error
       
   232 codes. */
       
   233 	{
       
   234 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tStop() tid %d"), this, (TUint)RThread().Id()));
       
   235 	return Stop(EStopNormal);
       
   236 	}
       
   237 
       
   238 EXPORT_C TInt RConnection::Stop(TConnStopType aStopType)
       
   239 /** Stops the entire connection by disconnecting the underlying network interface
       
   240 immediately, regardless of whether other clients are using it or not.
       
   241 
       
   242 If the argument is EStopNormal this is identical to calling Stop() with no
       
   243 argument. If it is EStopAuthoritative then applications using the connection
       
   244 will be sent the socket error code KErrConnectionTerminated, which generally
       
   245 results in the applications closing quietly (without pop-up boxes).
       
   246 
       
   247 @param aStopType The type of stop which is being requested.
       
   248 @return KErrNone or another of the system wide error codes; in particular KErrArgument
       
   249 if the stop type is unrecognised. */
       
   250     {
       
   251 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tStop(TConnStopType = %d) tid %d"), this, aStopType, (TUint)RThread().Id()));
       
   252 	return SendReceive(ECNStop, TIpcArgs(aStopType));
       
   253     }
       
   254 
       
   255 EXPORT_C TInt RConnection::Stop(TSubConnectionUniqueId aSubConnectionUniqueId)
       
   256 /** Stops a subconnection.
       
   257 
       
   258 Applications will be sent a socket error code to indicate that they must perform
       
   259 clean up operations.
       
   260 
       
   261 @publishedPartner
       
   262 @released since v7.0s
       
   263 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   264 @param aSubConnectionUniqueId A valid identifier for a subconnection.
       
   265 @return KErrNone if successful, otherwise another of the system wide error
       
   266 codes. */
       
   267 	{
       
   268 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tStop(TSubConnectionUniqueId = %d) tid %d"), this, aSubConnectionUniqueId, (TUint)RThread().Id()));
       
   269 	return Stop(aSubConnectionUniqueId, EStopNormal);
       
   270 	}
       
   271 
       
   272 EXPORT_C TInt RConnection::Stop(TSubConnectionUniqueId aSubConnectionUniqueId, TConnStopType aStopType)
       
   273 /**
       
   274  * Stop a subconnection on an interface
       
   275  *
       
   276  * @publishedPartner
       
   277  * @released since v7.0s
       
   278  * @pre Must be attached to a connection; either by performing a Start(), or using Attach()
       
   279  * @param aSubConnectionUniqueId A valid identifier for a subconnection
       
   280  * @param aStopType The kind of stop to do (controls what error code is reported to interface clients)
       
   281  * @return KErrNone if successful, otherwise one of the system-wide error codes
       
   282  */
       
   283 	{
       
   284 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tStop(TSubConnectionUniqueId = %d, TConnStopType = %d) tid %d"), this, aSubConnectionUniqueId, aStopType, (TUint)RThread().Id()));
       
   285 	return SendReceive(ESCPSStop, TIpcArgs(aSubConnectionUniqueId, aStopType));
       
   286 	}
       
   287 
       
   288 
       
   289 EXPORT_C TInt RConnection::WaitForIncoming(RSubConnection& aIncomingSubConnection)
       
   290 /**
       
   291  * Synchronously wait for an incoming session on this connection.
       
   292  *
       
   293  * @publishedPartner
       
   294  * @released since v9.2
       
   295  * @pre Must be attached to a connection by performing a Start().
       
   296  * @param aStatus On completion, the status of the request, e.g. KErrNone or another of the system wide error codes.
       
   297  * @param aIncomingSubConnection On completion, the subconnection representing the incoming session.
       
   298  * The incoming session can be accepted (by calling RSubConnection::Accept) or rejected (by calling RSubConnection::Stop)
       
   299  * The subconnection is implicitly started (no need to call RSubConnection::Start). aIncomingSubConnection must not
       
   300  * be open prior to calling this method.
       
   301  * @return KErrNone if successful, otherwise another of the system wide error codes.
       
   302  */
       
   303 	{
       
   304 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tWaitForIncoming() sync tid %d"), this, (TUint)RThread().Id()));
       
   305 	TRequestStatus status;
       
   306 	WaitForIncoming(aIncomingSubConnection, status);
       
   307 	User::WaitForRequest(status);
       
   308 	return status.Int();
       
   309 	}
       
   310 
       
   311 EXPORT_C void RConnection::WaitForIncoming(RSubConnection& aIncomingSubConnection, TRequestStatus& aStatus)
       
   312 /**
       
   313  * Subscribe for an incoming session on this connection.
       
   314  *
       
   315  * @publishedPartner
       
   316  * @released since v9.2
       
   317  * @pre Must be attached to a connection by performing a Start().
       
   318  * @param aStatus On completion, the status of the request, e.g. KErrNone or another of the system wide error codes.
       
   319  * @param aIncomingSubConnection On completion, the subconnection representing the incoming session.
       
   320  * The incoming session can be accepted (by calling RSubConnection::Accept) or rejected (by calling RSubConnection::Stop)
       
   321  * The subconnection is implicitly started (no need to call RSubConnection::Start). aIncomingSubConnection must not
       
   322  * be open prior to calling this method.
       
   323  */
       
   324 	{
       
   325 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tWaitForIncoming() async tid %d"), this, (TUint)RThread().Id()));
       
   326 	//============================================================================================================
       
   327 	//TODO: The statement below is really awkward and it is so, because we do not store the handle to the RSocketServ
       
   328 	//anywhere here. For the same reason we need to call RSubConnection::Open against _both_ RSocketServ and
       
   329 	//RConnection although RConnection has just been opened against the same RSocketServ.
       
   330 	//There's nothing except BC that's stopping us from doing the following changes:
       
   331 	//(1) store RSocketServ in RSubSessionBase so that it can be reused.
       
   332 	//(2) change APIs like RSubConnection::Open(RSocketServ& aServer, TSubConnType aSubConnType, RConnection& aConnection)
       
   333 	//                  to RSubConnection::Open(TSubConnType aSubConnType, RConnection& aConnection)
       
   334 	//============================================================================================================
       
   335 	const RSessionBase sessionBase = Session();
       
   336 	TInt error = aIncomingSubConnection.Open(
       
   337 	    const_cast<RSocketServ&>(static_cast<const RSocketServ&>(sessionBase)), TSubConnOpen::EWaitForIncoming, *this );
       
   338 	if (error != KErrNone)
       
   339     	{
       
   340     	TRequestStatus* statusPtr = &aStatus;
       
   341     	User::RequestComplete(statusPtr, KErrArgument);
       
   342     	return;
       
   343     	}
       
   344 	SendReceive(ECNWaitForIncoming, TIpcArgs(aIncomingSubConnection.SubSessionHandle()), aStatus);
       
   345 	}
       
   346 
       
   347 EXPORT_C void RConnection::CancelWaitForIncoming()
       
   348 /**
       
   349  * Cancel the previous subscription for an incoming session.
       
   350  *
       
   351  * @publishedPartner
       
   352  * @released since v9.2
       
   353  * @see WaitForIncoming()
       
   354  * @pre Must be attached to a connection by performing a Start().
       
   355  */
       
   356 	{
       
   357 	LOG( ESockLog::Printf(_L8("RConnection %08x:\tCancelWaitForIncoming() tid %d"), this, (TUint)RThread().Id()));
       
   358 	SendReceive(ECNCancelWaitForIncoming, TIpcArgs());
       
   359 	}
       
   360 
       
   361 
       
   362 EXPORT_C void RConnection::ProgressNotification(TNifProgressBuf& aProgress, TRequestStatus& aStatus, TUint aSelectedProgress)
       
   363 /** Requests asynchronous progress notification for the connection.
       
   364 
       
   365 @param aProgress A buffer to receive progress notification.
       
   366 @param aStatus On return, the status of the request.
       
   367 @param aSelectedProgress The type of progress to report. If set, report only
       
   368 the particular progress specified and any progress in error. If not set, report
       
   369 all progress normally. */
       
   370 	{
       
   371 	SendReceive(ECNProgressNotification, TIpcArgs(&aProgress,aSelectedProgress ), aStatus);
       
   372 	}
       
   373 
       
   374 EXPORT_C void RConnection::ProgressNotification(TSubConnectionUniqueId aSubConnectionUniqueId, TNifProgressBuf& aProgress, TRequestStatus& aStatus, TUint aSelectedProgress)
       
   375 /** Requests asynchronous progress notification for a subconnection.
       
   376 
       
   377 NOTE: This function is not supported and will correctly return KErrNotSupported.
       
   378 
       
   379 @publishedPartner
       
   380 @released since v7.0s
       
   381 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   382 @pre No outstanding request for progress notifications for this subconnection on
       
   383 this RConnection
       
   384 @param aSubConnectionUniqueId A valid identifier for a subconnection.
       
   385 @param aProgress A buffer to receive progress notification.
       
   386 @param aStatus On return, the status of the request.
       
   387 @param aSelectedProgress The type of progress to report. If set, report only
       
   388 the particular progress specified and any progress in error. If not set, report
       
   389 all progress normally.
       
   390 */
       
   391 	{
       
   392 	SendReceive(ESCPSProgressNotification, TIpcArgs(aSubConnectionUniqueId, &aProgress, aSelectedProgress), aStatus);
       
   393 	}
       
   394 
       
   395 EXPORT_C void RConnection::CancelProgressNotification()
       
   396 /** Cancels a request for progress notification for the connection, as issued by
       
   397 ProgressNotification().
       
   398 */
       
   399 	{
       
   400 	SendReceive(ECNCancelProgressNotification, TIpcArgs());
       
   401 	}
       
   402 
       
   403 EXPORT_C void RConnection::CancelProgressNotification(TSubConnectionUniqueId aSubConnectionUniqueId)
       
   404 /** Cancels a request for progress notification for a specified subconnection,
       
   405 as issued by ProgressNotification().
       
   406 
       
   407 @publishedPartner
       
   408 @released since v7.0s
       
   409 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   410 @pre An outstanding request for a progress notification on the subconnection on
       
   411 this RConnection
       
   412 
       
   413 @param aSubConnectionUniqueId The identifier for the subconnection used to make the request.
       
   414 */
       
   415 	{
       
   416 	SendReceive(ESCPSCancelProgressNotification, TIpcArgs(aSubConnectionUniqueId));
       
   417 	}
       
   418 
       
   419 EXPORT_C TInt RConnection::Progress(TNifProgress& aProgress)
       
   420 /** Obtains the current progress information for the connection.
       
   421 
       
   422 @param aProgress A buffer to receive progress information.
       
   423 @return KErrNone if successful, otherwise another of the system wide error
       
   424 codes. */
       
   425 	{
       
   426 	TPckg<TNifProgress> prog(aProgress);
       
   427 	return SendReceive(ECNProgress, TIpcArgs(&prog));
       
   428 	}
       
   429 
       
   430 EXPORT_C TInt RConnection::Progress(TSubConnectionUniqueId aSubConnectionUniqueId, TNifProgress& aProgress)
       
   431 /** Obtains the current progress information on a specified subconnection.
       
   432 
       
   433 @publishedPartner
       
   434 @released since v7.0s
       
   435 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   436 @param aSubConnectionUniqueId A valid identifier for the subconnection of
       
   437 interest.
       
   438 @param aProgress On return, progress information.
       
   439 @return KErrNone if successful, otherwise another of the system wide error
       
   440 codes. */
       
   441 	{
       
   442 	TPckg<TNifProgress> prog(aProgress);
       
   443 	return SendReceive(ESCPSProgress, TIpcArgs(aSubConnectionUniqueId, &prog));
       
   444 	}
       
   445 
       
   446 EXPORT_C TInt RConnection::LastProgressError(TNifProgress& aProgress)
       
   447 /** Obtains information about the last Progress() call which failed with an error.
       
   448 
       
   449 @param aProgress A buffer to receive progress information.
       
   450 @return KErrNone if successful, otherwise another of the system wide error
       
   451 codes. */
       
   452 	{
       
   453 	TPckg<TNifProgress> prog(aProgress);
       
   454 	return SendReceive(ECNLastProgressError, TIpcArgs(&prog));
       
   455 	}
       
   456 
       
   457 EXPORT_C void RConnection::ServiceChangeNotification(TUint32& aNewISPId, TDes& aNewServiceType, TRequestStatus& aStatus)
       
   458 /** 
       
   459  * Requests service change notification from the agent.
       
   460  * This call completes if the underlying service changes (i.e. ISP, GPRS APN
       
   461  * or LAN Service).
       
   462  * Important: It Panics if used BEFORE "RConnecion::Open(...)" being called.
       
   463  * 
       
   464  * @param aNewISPId On completion, the new ISP Id.
       
   465  * @param aNewServiceType On completion, the new service type.
       
   466  * @param aStatus On completion, "KErrNone" if succesful, "KErrNotReady" if
       
   467  * 		called before "RConnection::Start(...)" being called, "KErrInUse" if
       
   468  * 		called twice. Otherwise another of the system wide error codes. */
       
   469 	{
       
   470 	(void) ::new(&iNewISPId) TPckg<TUint32>(aNewISPId);
       
   471 
       
   472 	SendReceive(ECNServiceChangeNotification, TIpcArgs(&iNewISPId,&aNewServiceType ), aStatus);
       
   473 	}
       
   474 
       
   475 EXPORT_C void RConnection::CancelServiceChangeNotification()
       
   476 /**
       
   477  * Cancels a request for notification of change of service for the connection,
       
   478  * as issued by ServiceChangeNotification().
       
   479  * Nothing happens if called without having 
       
   480  * called "RConnection::ServiceChangeNotification(...)" before.
       
   481  * Important: It Panics if used BEFORE "RConnecion::Open(...)" being called. */
       
   482 	{
       
   483 	SendReceive(ECNCancelServiceChangeNotification,TIpcArgs()); // Ignore return value
       
   484 	}
       
   485 
       
   486 EXPORT_C TInt RConnection::GetIntSetting(const TDesC& aSettingName, TUint32& aValue)
       
   487 //
       
   488 // Get "active setting", i.e. the current default
       
   489 // or override, for the specified database field
       
   490 //
       
   491 /** Reads current CommDb settings for the active connection.
       
   492 
       
   493 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   494 @param aSettingName The CommDb table name and field name to be accessed. Of
       
   495 the form "<table name>\<field name>" (for example "IAP\Id" or "ModemBearer\PortName").
       
   496 @param aValue On return, the value of the table/field pair.
       
   497 @return KErrNone if succesful, or another of the system-wide error codes.
       
   498 @capability Dependent on table - deferred to RDBMS
       
   499 
       
   500 @deprecated Since 9.5 - For replacement functionality see GetParameters
       
   501 */
       
   502 	{
       
   503 	TPckg<TUint32> intPckg(aValue);
       
   504 	return SendReceive(ECNGetIntSetting, TIpcArgs(&aSettingName,&intPckg ));
       
   505 	}
       
   506 
       
   507 EXPORT_C TInt RConnection::GetBoolSetting(const TDesC& aSettingName, TBool& aValue)
       
   508 //
       
   509 // Get "active setting", i.e. the current default
       
   510 // or override, for the specified database field
       
   511 //
       
   512 /** Reads current CommDb settings for the active connection.
       
   513 
       
   514 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   515 @param aSettingName The CommDb table name and field name to be accessed. Of
       
   516 the form "<table name>\<field name>". (for example "IAP\Id" or "ModemBearer\PortName").
       
   517 @param aValue On return, the value of the table/field pair.
       
   518 @return KErrNone if succesful, or another of the system-wide error codes.
       
   519 @capability Dependent on table - deferred to RDBMS
       
   520 
       
   521 @deprecated Since 9.5 - For replacement functionality see GetParameters
       
   522 */
       
   523 	{
       
   524 	TPckg<TBool> boolPckg(aValue);
       
   525 
       
   526 	return SendReceive(ECNGetBoolSetting, TIpcArgs(&aSettingName,&boolPckg ));
       
   527 	}
       
   528 
       
   529 EXPORT_C TInt RConnection::GetDesSetting(const TDesC& aSettingName, TDes8& aValue)
       
   530 //
       
   531 // Get "active setting", i.e. the current default
       
   532 // or override, for the specified database field
       
   533 //
       
   534 /** Reads current CommDb settings for the active connection.
       
   535 
       
   536 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   537 
       
   538 @param aSettingName The CommDb table name and field name to be accessed. Of
       
   539 the form "<table name>\<field name>" (for example "IAP\Id" or "ModemBearer\PortName").
       
   540 @param aValue On return, the value of the table/field pair.
       
   541 @return KErrNone if succesful, or another of the system-wide error codes.
       
   542 @capability Dependent on table - deferred to RDBMS
       
   543 
       
   544 @deprecated Since 9.5 - For replacement functionality see GetParameters
       
   545 */
       
   546 	{
       
   547 	return SendReceive(ECNGetDes8Setting, TIpcArgs(&aSettingName,&aValue ));
       
   548 	}
       
   549 
       
   550 EXPORT_C TInt RConnection::GetDesSetting(const TDesC& aSettingName, TDes16& aValue)
       
   551 //
       
   552 // Get "active setting", i.e. the current default
       
   553 // or override, for the specified database field
       
   554 //
       
   555 /** Reads current CommDb settings for the active connection.
       
   556 
       
   557 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   558 
       
   559 @param aSettingName The CommDb table name and field name to be accessed. Of
       
   560 the form "<table name>\<field name>" (for example "IAP\Id" or "ModemBearer\PortName").
       
   561 @param aValue On return, the value of the table/field pair.
       
   562 @return KErrNone if succesful, or another of the system-wide error codes.
       
   563 @capability Dependent on table - deferred to RDBMS
       
   564 
       
   565 @deprecated Since 9.5 - For replacement functionality see GetParameters
       
   566 */
       
   567 	{
       
   568 	return SendReceive(ECNGetDes16Setting, TIpcArgs(&aSettingName, &aValue));
       
   569 	}
       
   570 
       
   571 EXPORT_C TInt RConnection::GetLongDesSetting(const TDesC& aSettingName, TDes& aValue)
       
   572 //
       
   573 // Get "active setting", i.e. the current default
       
   574 // or override, for the specified database field
       
   575 //
       
   576 /** Reads current CommDb settings for the active connection.
       
   577 
       
   578 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   579 
       
   580 @param aSettingName The CommDb table name and field name to be accessed. Of
       
   581 the form "<table name>\<field name>". (for example "IAP\Id" or "ModemBearer\PortName").
       
   582 @param aValue On return, the value of the table/field pair.
       
   583 @return KErrNone if succesful, or another of the system-wide error codes.
       
   584 @capability Dependent on table - deferred to RDBMS
       
   585 
       
   586 @deprecated Since 9.5 - For replacement functionality see GetParameters
       
   587 */
       
   588 	{
       
   589 	return SendReceive(ECNGetLongDesSetting, TIpcArgs(&aSettingName,&aValue));
       
   590 	}
       
   591 
       
   592 
       
   593 
       
   594 /**
       
   595 @return KErrNone		- The get parameters call was serviced successfully
       
   596 		KErrNotReady	- This error will most likely indicate that the
       
   597 						  connection has not been started						  
       
   598 		KErrNoMemory	- Failure to allocate the required memory for the retrieved
       
   599 					      query bundle
       
   600 		KErrNotFound	- The interface required by the data object was not found
       
   601                           in the connection stack
       
   602         Other system-wide error codes dependent on specific data object implementations
       
   603 */
       
   604 EXPORT_C TInt RConnection::GetParameters(ESock::CCommsDataObjectBase& aDataObject)
       
   605 	{
       
   606 	__ASSERT_DEBUG(aDataObject.iDataObject, User::Panic(KSpecAssert_ESockCSockRCnctn, 1));
       
   607 	
       
   608 	if (!aDataObject.iDataObject->IsGetSupported()) 
       
   609 		{
       
   610 		return KErrNotSupported;
       
   611 		}
       
   612 	
       
   613 	aDataObject.iDataObject->SetOperationMode(ESock::XCommsDataObject::EOperationGet);
       
   614 	
       
   615 	// Serialise the query and send
       
   616 	HBufC8* buffer = HBufC8::New(aDataObject.Length());
       
   617 	if (!buffer) 
       
   618 		{
       
   619 		return KErrNoMemory;
       
   620 		}
       
   621 
       
   622 	TPtr8 ptr = buffer->Des();
       
   623 	TInt ret = aDataObject.Store(ptr);
       
   624 	if (ret == KErrNone)
       
   625 		{
       
   626 		ret = SendReceive(ECNGetOrSetParameters, TIpcArgs(&ptr));
       
   627 		}
       
   628 	delete buffer;
       
   629 	
       
   630 	if (ret != KErrNone)
       
   631 		{
       
   632 		return ret;
       
   633 		}
       
   634 		
       
   635 	// Retrieve query response
       
   636 	TInt lengthOrError = SendReceive(ECNGetParametersResponseLength, TIpcArgs());
       
   637 	if (lengthOrError < KErrNone)
       
   638 		{
       
   639 		return lengthOrError;
       
   640 		}	
       
   641 
       
   642 	buffer = HBufC8::New(lengthOrError);
       
   643 	if (!buffer)
       
   644 		{
       
   645 		return KErrNoMemory;
       
   646 		}
       
   647 
       
   648 	ptr.Set(buffer->Des());
       
   649 	ret = SendReceive(ECNGetParametersResponse, TIpcArgs(&ptr));
       
   650 	if (ret == KErrNone)
       
   651 		{
       
   652 		TPtrC8 loadPtr(ptr.Ptr(), ptr.Length());
       
   653 		ret = aDataObject.Load(loadPtr);
       
   654 		}
       
   655 
       
   656 	delete buffer;
       
   657 	return ret;
       
   658 	}
       
   659 
       
   660 
       
   661 /**
       
   662 Speculative method - Not yet supported
       
   663 Do not call this function, it has ony been introduced for symmetry with RConnection::GetParameters
       
   664 and will be completed at a later date.
       
   665 @return KErrNotSupported
       
   666 */
       
   667 EXPORT_C TInt RConnection::SetParameters(ESock::CCommsDataObjectBase& aDataObject)
       
   668 	{
       
   669 	__ASSERT_DEBUG(aDataObject.iDataObject, User::Panic(KSpecAssert_ESockCSockRCnctn, 2));
       
   670 	(void)aDataObject;
       
   671 	return KErrNotSupported;
       
   672 	}
       
   673 
       
   674 
       
   675 EXPORT_C void RConnection::Ioctl(TUint aOptionLevel, TUint aOptionName, TRequestStatus& aStatus, TDes8* aDesc)
       
   676 /**
       
   677   * Get information on the connection in an asynchronous manner
       
   678   *
       
   679   * @publishedPartner
       
   680   * @released
       
   681   * @param aOptionLevel Option level to be used.
       
   682   * @param aOptionName Option name to be used.
       
   683   * @param aOption On return, the option value.
       
   684   * @capability Dependent on the type of operation so deferred to PRT.  See documentation
       
   685   * of constant values used in aOptionName and aOptionLevel for more information
       
   686   *
       
   687   */
       
   688 	{
       
   689 	SendReceive(ECNIoctl, TIpcArgs(aOptionLevel, aOptionName, aDesc), aStatus);
       
   690 	}
       
   691 
       
   692 EXPORT_C void RConnection::Ioctl(TUint aOptionLevel, TUint aOptionName, TRequestStatus& aStatus)
       
   693 /**
       
   694   * Get information on the connection in an asynchronous manner
       
   695   *
       
   696   * @publishedPartner
       
   697   * @released
       
   698   * @param aOptionLevel Option level to be used.
       
   699   * @param aOptionName Option name to be used.
       
   700   * @param aOption On return, the option value.
       
   701   * @capability Dependent on the type of operation so deferred to PRT.  See documentation
       
   702   * of constant values used in aOptionName and aOptionLevel for more information
       
   703   *
       
   704   */
       
   705 	{
       
   706 	Ioctl( aOptionLevel, aOptionName, aStatus, NULL);
       
   707 	}
       
   708 
       
   709 EXPORT_C void RConnection::CancelIoctl()
       
   710 /**
       
   711   * Cancel any outstanding Ioctl request
       
   712   *
       
   713   * @publishedPartner
       
   714   * @released
       
   715   */
       
   716 	{
       
   717 	SendReceive(ECNCancelIoctl, TIpcArgs());
       
   718 	}
       
   719 
       
   720 EXPORT_C TInt RConnection::Control(TUint aOptionLevel, TUint aOptionName, TDes8& aOption)
       
   721 /** Gets detailed information on connection clients and sockets.
       
   722 
       
   723 More likely to be used by system control type applications.
       
   724 
       
   725 @param aOptionLevel Option level to be used.
       
   726 @param aOptionName Option name to be used.
       
   727 @param aOption On return, the option value.
       
   728 @return KErrNone if succesful, or another of the system-wide error codes.
       
   729 @capability Dependent on the type of operation so deferred to PRT.  See documentation
       
   730 of constant values used in aOptionName and aOptionLevel for more information */
       
   731 
       
   732 // Enumeration options - not to be supported in the future:
       
   733 //
       
   734 // 1)
       
   735 // Enumerates Clients of a Connection. RConnection includes the ability to list
       
   736 // the Thread Id, Process Id and UID of all threads using particular connections.
       
   737 // The first stage is to perform the following call: Control(KCOLConnection,
       
   738 // KCoEnumerateConnectionClients, TConnEnumArgBuf&);
       
   739 //
       
   740 // The caller specifies the particular connection that they are interested in
       
   741 // through the iIndex member of the TConnectionEnumArg. The index value is the
       
   742 // same as that used with GetConnectionInfo(). On completion, the iCount member
       
   743 // of TConnectionEnumArg contains the number of clients of the connection.
       
   744 //
       
   745 // The information about each client can then be retrieved by repeatedly using
       
   746 // the following call: Control(KCOLConnection, KCoGetConnectionClientInfo, TConnGetClientInfoArgBuf&);
       
   747 //
       
   748 // 2)
       
   749 // Enumerate Sockets on a Connection if required. RConnection includes the ability
       
   750 // to list all the sockets using a connection. Firstly, the following call is
       
   751 // performed: Control(KCOLConnection, KCoEnumerateConnectionSockets, TConnEnumArgBuf&);
       
   752 // This function gathers information about the sockets currently associated with
       
   753 // a connection. The client specifies the particular connection that they are
       
   754 // interested in through the iIndex member of the TConnEnumArgBuf.
       
   755 //
       
   756 // On completion, the iCount member contains the number of sockets currently
       
   757 // associated with the connection. The information about each socket can then
       
   758 // be retrieved by repeatedly calling the following: Control(KCOLConnection,
       
   759 // KCoGetConnectionSocketInfo, TConnGetSocketInfoArgBuf&);
       
   760 	{
       
   761 	return SendReceive(ECNControl, TIpcArgs(aOptionLevel, aOptionName, &aOption));
       
   762 	}
       
   763 
       
   764 EXPORT_C TInt RConnection::SetOpt(TUint aOptionLevel, TUint aOptionName, TInt aOption)
       
   765 /** Sets an option.
       
   766 
       
   767 @param aOptionLevel Option level to be set.
       
   768 @param aOptionName Option name to be set
       
   769 @param aOption Option value.
       
   770 @return KErrNone if succesful, or another of the system-wide error codes.
       
   771 @capability Dependent on the type of operation so deferred to PRT.  See documentation
       
   772 of constant values used in aOptionName and aOptionLevel for more information */
       
   773 	{
       
   774 	TPtr8 optionDes((TUint8*)&aOption, sizeof(TInt), sizeof(TInt));
       
   775 	aOptionName &= ~KConnWriteUserDataBit;
       
   776 	return Control(aOptionLevel, aOptionName, optionDes);
       
   777 	}
       
   778 
       
   779 EXPORT_C TInt RConnection::GetOpt(TUint aOptionLevel, TUint aOptionName, TInt& aOption)
       
   780 /** Gets an option.
       
   781 
       
   782 @param aOptionLevel Option level to be queried.
       
   783 @param aOptionName Option name to be queried.
       
   784 @param aOption On return, the option value.
       
   785 @return KErrNone if succesful, or another of the system-wide error codes.
       
   786 @capability Dependent on the type of operation so deferred to PRT.  See documentation
       
   787 of constant values used in aOptionName and aOptionLevel for more information */
       
   788 	{
       
   789 	TPtr8 optionDes((TUint8*)&aOption, sizeof(TInt), sizeof(TInt));	
       
   790 	aOptionName &= ~KConnReadUserDataBit;
       
   791 	return Control(aOptionLevel, aOptionName, optionDes);
       
   792 	}
       
   793 
       
   794 EXPORT_C TInt RConnection::Name(TName& aName)
       
   795 /** Gets the unique name of an RConnection.
       
   796 
       
   797 Used to create an RConnection which is a clone of an existing RConnection (possibly in
       
   798 a different process).
       
   799 
       
   800 @param aName On return, the unique name of the RConnection.
       
   801 @return KErrNone if succesful, or another of the system-wide error codes. */
       
   802 	{
       
   803 	return SendReceive(ECNReference, TIpcArgs(&aName));
       
   804 	}
       
   805 
       
   806 TBool RConnection::SameSession(TInt aSessionHandle)
       
   807 /** Checks that the Session Handle passed is the same as that of this RConnection.
       
   808 
       
   809 Use to verify the RConnection argument passed to the RSocket and RHostResolver
       
   810 Open(..., RConnection& aConnection) methods.
       
   811 
       
   812 @param aSessionHandle The handle which is to be checked against that of this RConnection
       
   813 @returns ETrue if handle is the same, else EFalse
       
   814 @internalComponent
       
   815 */
       
   816 	{
       
   817 	return (Session().Handle() == aSessionHandle);
       
   818 	}
       
   819 
       
   820 EXPORT_C TInt RConnection::EnumerateConnections(TUint& aCount)
       
   821 /** Enumerates the number of currently active interfaces.
       
   822 
       
   823 @note This does not count the number of RConnections but the number of underlying interfaces.
       
   824 These may be attached to by varying numbers of RConnections, RSockets etc.
       
   825 @param aCount On return, contains the number of currently active interfaces on the server.
       
   826 @return KErrNone if successful, otherwise another of the system wide error
       
   827 codes. */
       
   828 	{
       
   829 	TPckg<TUint> count(aCount);
       
   830 
       
   831 	return SendReceive(ECNEnumerateConnections, TIpcArgs(&count));
       
   832 	}
       
   833 
       
   834 EXPORT_C TInt RConnection::GetConnectionInfo(TUint aIndex, TDes8& aConnectionInfo)
       
   835 /** Gets information about one of the currently active connections.
       
   836 
       
   837 Note that the actual connection information is gathered on a call to EnumerateConnections()
       
   838 and GetConnectionInfo() is simply used to return the information to the client.
       
   839 Therefore, if the state of the connections change after the EnumerateConnections()
       
   840 call, then the information returned by GetConnectionInfo() may be out of date.
       
   841 
       
   842 @param aIndex The index of the connection - must be between 1 and the value
       
   843 of aCount returned in EnumerateConnections().
       
   844 @param aConnectionInfo On return, contains a TPckg<TConnectionInfo> containing
       
   845 information about the connection.
       
   846 @return KErrNone if successful, otherwise another of the system wide error
       
   847 codes. */
       
   848 	{
       
   849 	return SendReceive(ECNGetConnectionInfo, TIpcArgs(aIndex,&aConnectionInfo ));
       
   850 	}
       
   851 
       
   852 EXPORT_C void RConnection::AllInterfaceNotification(TDes8& aNotification, TRequestStatus& aStatus)
       
   853 /** Requests asynchronous change notification for all interfaces.
       
   854 
       
   855 This allows a client to receive a notification whenever a connection in the
       
   856 system goes up or down.
       
   857 
       
   858 This allows the automatic update of the list of active network connections.
       
   859 
       
   860 @param aNotification On return, a wrapped interface change notification (TInterfaceNotification).
       
   861 @param aStatus On return, the status of the request. */
       
   862 	{
       
   863 	SendReceive(ECNAllInterfaceNotification, TIpcArgs(&aNotification), aStatus);
       
   864 	}
       
   865 
       
   866 EXPORT_C void RConnection::CancelAllInterfaceNotification()
       
   867 /** Cancels a change notification request previously issued by a call to AllInterfaceNotification(). */
       
   868 	{
       
   869 	SendReceive(ECNCancelAllInterfaceNotification, TIpcArgs());
       
   870 	}
       
   871 
       
   872 EXPORT_C TInt RConnection::Attach(const TDesC8& aConnectionInfo, TConnAttachType aAttachType)
       
   873 /** Attaches the RConnection object to an existing interface.
       
   874 
       
   875 This operation will not start an interface, as Start() does, but attaches
       
   876 to an existing interface if it exists.
       
   877 
       
   878 @param aConnectionInfo Identity of the connection to attach to. This is a
       
   879 TPckg<TConnectionInfo>& (possibly obtained from a call to GetConnectionInfo()).
       
   880 @param aAttachType Identifies the intended use of the connection.
       
   881 @return KErrNone if succesful, or another of the system-wide error codes.
       
   882 @capability dependent on the type of connection so deferred to PRT */
       
   883 	{
       
   884 	return SendReceive(ECNAttach, TIpcArgs(aAttachType,&aConnectionInfo));
       
   885 	}
       
   886 
       
   887 
       
   888 EXPORT_C TInt RConnection::EnumerateSubConnections(TUint& aCount)
       
   889 /** Asks the server to gather information on the currently active subconnections.
       
   890 
       
   891 @publishedPartner
       
   892 @released since v7.0s
       
   893 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   894 @note Unlike EnumerateConnections(), EnumerateSubConnections() does not cache the
       
   895 information about subconnections, so it is possible for a greater or fewer
       
   896 number of records to be returned through GetSubConnectionInfo()
       
   897 
       
   898 @param aCount On return, contains the number of currently active connections.
       
   899 @return KErrNone if successful, otherwise another of the system wide error
       
   900 codes. */
       
   901 	{
       
   902 	TPckg<TUint> count(aCount);
       
   903 	return(SendReceive(ECNEnumerateSubConnections, TIpcArgs(&count)));
       
   904 	}
       
   905 
       
   906 EXPORT_C TInt RConnection::GetSubConnectionInfo(TDes8& aSubConnectionInfo)
       
   907 /** Gets information about one of the currently active subconnections.
       
   908 
       
   909 This function is used when a valid TSubConnectionUniqueId has been discovered
       
   910 using the alternative form of GetSubConnectionInfo(), and the client wishes
       
   911 to update its TSubConnectionInfo-derived structure with the latest subconnection
       
   912 information.
       
   913 
       
   914 @publishedPartner
       
   915 @released since v7.0s
       
   916 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   917 
       
   918 @param aSubConnectionInfo A TPckg<TSubConnectionInfo-derived class>: the actual
       
   919 class depends upon the type of subconnection, eg. GPRS context, PPP, NCP.
       
   920 On entry, must contain a valid TSubConnectionUniqueId to indicate which of
       
   921 the subconnections it wishes to gather information about. On return, contains
       
   922 information about the subconnection.
       
   923 @return KErrNone if successful, otherwise another of the system wide error
       
   924 codes. */
       
   925 	{
       
   926 	return(GetSubConnectionInfo(KUseEmbeddedUniqueId, aSubConnectionInfo));
       
   927 	}
       
   928 
       
   929 EXPORT_C TInt RConnection::GetSubConnectionInfo(TUint aIndex, TDes8& aSubConnectionInfo)
       
   930 /** Gets information about one of the currently active subconnections.
       
   931 
       
   932 This function is intended for the initial enumeration of connections, when
       
   933 no TSubConnectionUniqueIds are available, so the client must iterate through
       
   934 the list of subconnections.
       
   935 
       
   936 @publishedPartner
       
   937 @released since v7.0s
       
   938 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   939 
       
   940 @param aIndex The index of the connection - must be between 1 and the value
       
   941 of aCount returned in EnumerateSubConnections().
       
   942 @param aSubConnectionInfo On return, contains a TPckg<TSubConnectionInfo-derived
       
   943 class> containing information about the subconnection; the actual class depends
       
   944 upon the type of subconnection, eg. GPRS context, PPP NCP.
       
   945 @return KErrNone if successful, otherwise another of the system wide error
       
   946 codes. */
       
   947 	{
       
   948 	return(SendReceive(ESCPSGetSubConnectionInfo, TIpcArgs(aIndex, &aSubConnectionInfo)));
       
   949 	}
       
   950 
       
   951 EXPORT_C void RConnection::AllSubConnectionNotification(TSubConnectionNotificationBuf& aSubConnectionNotification, TRequestStatus& aStatus)
       
   952 /**
       
   953 Requests notification of any change in the state of any of the subconnections belonging to this RConnection.
       
   954 
       
   955 @publishedPartner
       
   956 @released since v7.0s
       
   957 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   958 @pre No outstanding request for subconnection notifications for this subconnection
       
   959 on this RConnection
       
   960 
       
   961 @param &aSubConnectionNotification On return, contains the subconnection event that
       
   962 occured; this will require casting to the appropriate TSubConnectionEvent-derived
       
   963 type - the required type can be discovered by casting to a TSubConnectionEvent
       
   964 and reading the iEventType member.
       
   965 @param aStatus On return, the status of the request. */
       
   966 	{
       
   967 	SendReceive(ECNAllSubConnectionNotification, TIpcArgs(&aSubConnectionNotification), aStatus);
       
   968 	}
       
   969 
       
   970 EXPORT_C void RConnection::CancelAllSubConnectionNotification()
       
   971 /** Cancels the request for notification to changes to the state of subconnections,
       
   972 made using the AllSubConnectionNotification().
       
   973 
       
   974 @publishedPartner
       
   975 @released since v7.0s
       
   976 @pre An attached connection: as a result of performing either a Start() or an Attach()
       
   977 @pre An outstanding request for notification about changes to the state of subconnections.
       
   978 */
       
   979 	{
       
   980 	SendReceive(ECNCancelAllSubConnectionNotification, TIpcArgs());
       
   981 	}
       
   982 
       
   983 EXPORT_C void RConnection::DataTransferredRequest(TPckg<TUint>& aUplinkVolume, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus)
       
   984 /** Gets the amount of data that has been transferred by the entire connection.
       
   985 
       
   986 @publishedPartner
       
   987 @released since v7.0s
       
   988 
       
   989 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
   990 @param aUplinkVolume On return, contains the amount of data in bytes transferred
       
   991 by this connection to the remote endpoint.
       
   992 @param aDownlinkVolume On return, contains the amount of data in bytes transferred
       
   993 by this connection from the remote endpoint.
       
   994 @param aStatus On return, the status of the request. */
       
   995 	{
       
   996 	DataTransferredRequest(KNifEntireConnectionSubConnectionId, aUplinkVolume, aDownlinkVolume, aStatus);
       
   997 	}
       
   998 
       
   999 EXPORT_C void RConnection::DataTransferredRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TPckg<TUint>& aUplinkVolume, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus)
       
  1000 /** Gets the amount of data that has been transferred by the specified subconnection.
       
  1001 
       
  1002 @publishedPartner
       
  1003 @deprecated since v9.5. Replaced with RCommsDataMonitoringApiExt::RequestDataTransferred
       
  1004 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1005 @param aSubConnectionUniqueId A valid identifier for the subconnection being
       
  1006 queried.
       
  1007 @param aUplinkVolume On return, contains the amount of data in bytes transferred
       
  1008 by this connection to the remote endpoint.
       
  1009 @param aDownlinkVolume On return, contains the amount of data in bytes transferred
       
  1010 by this connection from the remote endpoint.
       
  1011 @param aStatus On return, the status of the request. */
       
  1012 	{
       
  1013 	SendReceive(ESCPSDataTransferred, TIpcArgs(aSubConnectionUniqueId, &aUplinkVolume, &aDownlinkVolume), aStatus);
       
  1014 	}
       
  1015 
       
  1016 EXPORT_C void RConnection::DataTransferredCancel()
       
  1017 /** Cancels a request for the amount of data transferred on the entire connection,
       
  1018 issued by DataTransferredRequest().
       
  1019 
       
  1020 @publishedPartner
       
  1021 @released since v7.0s
       
  1022 @pre An attached connection; either as a result of performing a Start() or an Attach()
       
  1023 @pre An outstanding request for the amount of data transferred on this connection made using GetDataTransferred()
       
  1024 */
       
  1025 	{
       
  1026 	DataTransferredCancel(KNifEntireConnectionSubConnectionId);
       
  1027 	}
       
  1028 
       
  1029 EXPORT_C void RConnection::DataTransferredCancel(TSubConnectionUniqueId aSubConnectionUniqueId)
       
  1030 /** Cancels a request for the amount of data transferred on a specified subconnection,
       
  1031 issued by DataTransferredRequest().
       
  1032 
       
  1033 @publishedPartner
       
  1034 @deprecated since v9.5. Replaced with RCommsDataMonitoringApiExt::CancelDataTransferredRequest
       
  1035 @pre An attached connection; either as a result of performing a Start() or an Attach()
       
  1036 @pre An outstanding request for the amount of data transferred on this connection made using GetDataTransferred()
       
  1037 @param aSubConnectionUniqueId The identifier for the subconnection used to make the request. */
       
  1038 	{
       
  1039 	SendReceive(ESCPSDataTransferredCancel, TIpcArgs(aSubConnectionUniqueId));
       
  1040 	}
       
  1041 
       
  1042 EXPORT_C void RConnection::DataSentNotificationRequest(TUint aThreshold, TPckg<TUint>& aUplinkVolume, TRequestStatus& aStatus)
       
  1043 /** Requests a notification after an additional aThreshold bytes have been sent
       
  1044 by the entire connection.
       
  1045 
       
  1046 Making this request with an aThreshold of zero will result in the server reading
       
  1047 the value in aUplinkVolume and producing a notification when the absolute
       
  1048 amount of data specified here has been sent.
       
  1049 
       
  1050 @publishedPartner
       
  1051 @released since v7.0s
       
  1052 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1053 @pre No outstanding request for data sent notifications on this RConnection
       
  1054 @param aThreshold The number of additional bytes to be sent by this connection
       
  1055 before the request completes.
       
  1056 @param aUplinkVolume The total number of bytes sent by this connection so far.
       
  1057 @param aStatus On return, the status of the request. */
       
  1058 	{
       
  1059 	DataSentNotificationRequest(KNifEntireConnectionSubConnectionId, aThreshold, aUplinkVolume, aStatus);
       
  1060 	}
       
  1061 
       
  1062 EXPORT_C void RConnection::DataSentNotificationRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aThreshold, TPckg<TUint>& aUplinkVolume, TRequestStatus& aStatus)
       
  1063 /** Requests a notification after an additional aThreshold bytes have been sent
       
  1064 on a specified subconnection.
       
  1065 
       
  1066 Making this request with an aThreshold of zero will result in the server reading
       
  1067 the value in aUplinkVolume and producing a notification when the absolute
       
  1068 amount of data specified here has been sent.
       
  1069 
       
  1070 @publishedPartner
       
  1071 @deprecated since v9.5. Replaced with RCommsDataMonitoringApiExt::RequestDataSentNotification
       
  1072 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1073 @pre No outstanding request for data sent notifications for this subconnection on this RConnection
       
  1074 @param aSubConnectionUniqueId A valid identifier for the subconnection of
       
  1075 interest.
       
  1076 @param aThreshold The number of additional bytes to be sent by this connection
       
  1077 before the request completes.
       
  1078 @param aUplinkVolume The total number of bytes sent by this connection so far.
       
  1079 @param aStatus On return, the status of the request. */
       
  1080 	{
       
  1081 	SendReceive(ESCPSDataSentNotificationRequest, TIpcArgs(aSubConnectionUniqueId, aThreshold, &aUplinkVolume), aStatus);
       
  1082 	}
       
  1083 
       
  1084 EXPORT_C void RConnection::DataSentNotificationCancel()
       
  1085 /** Cancels a request for the amount of data sent on this connection, as issued by
       
  1086 DataSentNotificationRequest().
       
  1087 
       
  1088 @publishedPartner
       
  1089 @released since v7.0s
       
  1090 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1091 @pre An outstanding request for the amount of data transferred on this connection,
       
  1092 made using DataSentNotificationRequest() */
       
  1093 	{
       
  1094 	DataSentNotificationCancel(KNifEntireConnectionSubConnectionId);
       
  1095 	}
       
  1096 
       
  1097 EXPORT_C void RConnection::DataSentNotificationCancel(TSubConnectionUniqueId aSubConnectionUniqueId)
       
  1098 /** Cancels a request for the amount of data sent by the specified subconnection.
       
  1099 
       
  1100 @publishedPartner
       
  1101 @deprecated since v9.5. Replaced with RCommsDataMonitoringApiExt::CancelDataSentNotificationRequest
       
  1102 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1103 @pre An outstanding request for the amount of data transferred on this subconnection,
       
  1104 made using DataSentNotificationRequest()
       
  1105 @param aSubConnectionUniqueId The identifier for the subconnection used to
       
  1106 make the request. */
       
  1107 	{
       
  1108 	SendReceive(ESCPSDataSentNotificationCancel, TIpcArgs(aSubConnectionUniqueId));
       
  1109 	}
       
  1110 
       
  1111 EXPORT_C void RConnection::DataReceivedNotificationRequest(TUint aThreshold, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus)
       
  1112 /** Requests a notification after an additional aThreshold bytes have been received
       
  1113 by this connection.
       
  1114 
       
  1115 Completes when an amount of data equal to aThreshold has been received, starting
       
  1116 from when the request is posted.
       
  1117 
       
  1118 Making this request with an aThreshold of zero will result in the server reading
       
  1119 the value in aDownlinkVolume, and producing a notification when the absolute
       
  1120 amount of data specified here has been sent.
       
  1121 
       
  1122 @publishedPartner
       
  1123 @released since v7.0s
       
  1124 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1125 @pre No outstanding request for data received notifications for this connection
       
  1126 on this RConnection
       
  1127 @param aThreshold The number of additional bytes to be received by this connection
       
  1128 before the request completes.
       
  1129 @param aDownlinkVolume The total number of bytes received by this connection so far
       
  1130 @param aStatus On return, the status of the request. */
       
  1131 	{
       
  1132 	DataReceivedNotificationRequest(KNifEntireConnectionSubConnectionId, aThreshold, aDownlinkVolume, aStatus);
       
  1133 	}
       
  1134 
       
  1135 EXPORT_C void RConnection::DataReceivedNotificationRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aThreshold, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus)
       
  1136 /** Requests notification after an additional aThreshold bytes have been received
       
  1137 by a specified subconnection.
       
  1138 
       
  1139 Completes when an amount of data equal to aThreshold has been received, starting
       
  1140 from when the request is posted.
       
  1141 
       
  1142 Making this request with an aThreshold of zero will result in the server reading
       
  1143 the value in aDownlinkVolume, and producing a notification when the absolute
       
  1144 amount of data specified here has been sent.
       
  1145 
       
  1146 @publishedPartner
       
  1147 @deprecated since v9.5. Replaced with RCommsDataMonitoringApiExt::RequestDataReceivedNotification
       
  1148 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1149 @pre No outstanding request for data received notifications for this subconnection on this RConnection
       
  1150 @param aSubConnectionUniqueId A valid identifier for a subconnection.
       
  1151 @param aThreshold The number of additional bytes to be received by this connection
       
  1152 before the request completes.
       
  1153 @param aDownlinkVolume On return, the total number of bytes received by this
       
  1154 connection so far.
       
  1155 @param aStatus On return, the status of the request. */
       
  1156 	{
       
  1157 	SendReceive(ESCPSDataReceivedNotificationRequest, TIpcArgs(aSubConnectionUniqueId, aThreshold, &aDownlinkVolume), aStatus);
       
  1158 	}
       
  1159 
       
  1160 EXPORT_C void RConnection::DataReceivedNotificationCancel()
       
  1161 /** Cancels a request (issued by DataReceivedNotificationRequest ()) for the amount
       
  1162 of data received by the entire connection.
       
  1163 
       
  1164 @publishedPartner
       
  1165 @released since v7.0s
       
  1166 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1167 @pre An outstanding request for the amount of data received on this connection made
       
  1168 using DataReceivedNotificationRequest() */
       
  1169 	{
       
  1170 	DataReceivedNotificationCancel(KNifEntireConnectionSubConnectionId);
       
  1171 	}
       
  1172 
       
  1173 EXPORT_C void RConnection::DataReceivedNotificationCancel(TSubConnectionUniqueId aSubConnectionUniqueId)
       
  1174 /** Cancels a request (issued by DataReceivedNotificationRequest ()) for the amount
       
  1175 of data received by the specified subconnection.
       
  1176 
       
  1177 
       
  1178 @publishedPartner
       
  1179 @deprecated since v9.5. Replaced with RCommsDataMonitoringApiExt::CancelDataReceivedNotificationRequest
       
  1180 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1181 @pre An outstanding request for the amount of data received on this subconnection
       
  1182 made using DataReceivedNotificationRequest()
       
  1183 
       
  1184 @param aSubConnectionUniqueId The identifier for the subconnection used to
       
  1185 make the request. */
       
  1186 	{
       
  1187 	SendReceive(ESCPSDataReceivedNotificationCancel, TIpcArgs(aSubConnectionUniqueId));
       
  1188 	}
       
  1189 
       
  1190 EXPORT_C void RConnection::IsConnectionActiveRequest(TUint aSecs, TPckg<TBool>& aConnectionActive, TRequestStatus& aStatus)
       
  1191 /**
       
  1192 Checks whether the connection is active or inactive.
       
  1193 
       
  1194 Notes whether any data is passed for aSecs after the time of call before responding.
       
  1195 If data is passed the connection is considered active; otherwise it is considered
       
  1196 inactive.
       
  1197 
       
  1198 @publishedPartner
       
  1199 @released since v7.0s
       
  1200 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1201 @pre No outstanding request for activity notifications for this connection on this RConnection
       
  1202 @see IsSubConnectionActiveRequest() for details of when this method will return.
       
  1203 @param aSecs The period for checking whether the connection is active.
       
  1204 The maximum period allowed is approximately 35 mins.
       
  1205 
       
  1206 @param aState On entry, the state the client believes the subconnection is
       
  1207 currently in; on return, contains the current state of the subconnection.
       
  1208 @param aStatus On return, the status of the request */
       
  1209 	{
       
  1210 	IsSubConnectionActiveRequest(KNifEntireConnectionSubConnectionId, aSecs, aConnectionActive, aStatus);
       
  1211 	}
       
  1212 
       
  1213 EXPORT_C void RConnection::IsConnectionActiveCancel()
       
  1214 /**
       
  1215 Cancels a request for activity notifications on the connection
       
  1216 @publishedPartner
       
  1217 @released since v7.0s
       
  1218 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1219 @pre An outstanding request for activity notification on this connection made using IsConnectionActiveRequest()
       
  1220 */
       
  1221 	{
       
  1222 	IsSubConnectionActiveCancel(KNifEntireConnectionSubConnectionId);
       
  1223 	}
       
  1224 
       
  1225 EXPORT_C void RConnection::IsSubConnectionActiveRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aSecs, TPckg<TBool>& aSubconnectionActive, TRequestStatus& aStatus)
       
  1226 /**
       
  1227 Checks whether the subconnection is active or has changed state (active/inactive)
       
  1228 
       
  1229 @publishedPartner
       
  1230 @released since v7.0s
       
  1231 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1232 @pre No outstanding request for activity notifications for this subconnection on this RConnection
       
  1233 @note The request will be completed when the aState passed in by the client is not the same as the current state,
       
  1234 but this transition can only occur in quantised periods of aSecs
       
  1235 @note The maximum period allowed is approximately 35 mins
       
  1236 @param aSubConnectionUniqueId A valid identifier for a subconnection
       
  1237 @param aSecs The quantisation period for checking whether the subconnection is active
       
  1238 @param aState The state the client believes the subconnection is currently in; on return, contains the current
       
  1239 state of the subconnection
       
  1240 @param aStatus On return, the status of the request
       
  1241 */
       
  1242 	{
       
  1243 	SendReceive(ESCPSIsSubConnectionActiveRequest, TIpcArgs(aSubConnectionUniqueId, aSecs, &aSubconnectionActive), aStatus);
       
  1244 	}
       
  1245 
       
  1246 EXPORT_C void RConnection::IsSubConnectionActiveCancel(TSubConnectionUniqueId aSubConnectionUniqueId)
       
  1247 /**
       
  1248 Cancels a request for activity notifications on the specified subconnection
       
  1249 @publishedPartner
       
  1250 @released since v7.0s
       
  1251 @pre An attached connection, as a result of performing either a Start() or an Attach()
       
  1252 @pre An outstanding request for an activity notification on this subconnection made using
       
  1253 IsSubConnectionActiveRequest()
       
  1254 @param aSubConnectionUniqueId The identifier for the subconnection used to make the request
       
  1255 */
       
  1256 	{
       
  1257 	SendReceive(ESCPSIsSubConnectionActiveCancel, TIpcArgs(aSubConnectionUniqueId));
       
  1258 	}
       
  1259 
       
  1260