networksecurity/ipsec/ipsecpolapi/src/ipsecpolapi.cpp
branchRCL_3
changeset 22 8d540f55e491
parent 21 abbed5a4b42a
equal deleted inserted replaced
21:abbed5a4b42a 22:8d540f55e491
    14 // Policy server - client interface implementation
    14 // Policy server - client interface implementation
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
    18 #include <e32math.h>
    18 #include <e32math.h>
    19 
       
    20 #include "ipsecpol.h"
    19 #include "ipsecpol.h"
    21 #include "ipsecpolapi.h"
    20 #include "ipsecpolapi.h"
    22 #include "clistatic.h"
    21 #include "clistatic.h"
    23 #include <e32base.h>
    22 #include <e32base.h>
    24 
    23 
    37     
    36     
    38 EXPORT_C TInt RIpsecPolicyServ::Connect()
    37 EXPORT_C TInt RIpsecPolicyServ::Connect()
    39 //
    38 //
    40 // Connect to the server attempting to start it if necessary
    39 // Connect to the server attempting to start it if necessary
    41 //
    40 //
    42     {
    41     {    
    43 	TInt retry=2;
    42 	TInt retry=2;
    44 	for (;;)
    43 	for (;;)
    45 		{
    44 		{
    46 		TInt r=CreateSession(KIpsecPolicyServerName,
    45 		TInt r=CreateSession(KIpsecPolicyServerName,
    47                              Version(),
    46                              Version(),
   154 	{
   153 	{
   155 	TPckg<TInt> selectorCount(aCount);
   154 	TPckg<TInt> selectorCount(aCount);
   156     SendReceive(EIpsecPolicyEnumerateSelectors, TIpcArgs(&aGateway, &selectorCount));
   155     SendReceive(EIpsecPolicyEnumerateSelectors, TIpcArgs(&aGateway, &selectorCount));
   157 	}
   156 	}
   158 
   157 
       
   158 	/**
       
   159 	 *Sets an option.
       
   160 	 *RIpsecPolicyServ implementations may provide options that can be set with this method.
       
   161 	 *Eg:- Seting SID of an appliction that is going to load policy file. Then that application
       
   162 	 *Can call this api with option name - and option level - and provide the SID value.
       
   163 	 *
       
   164 	 *@param aOptionName : An integer constant which identifies an option
       
   165 	 *@param aOptionLevel  : An integer constant which identifies level of an option 
       
   166 	 *@param aOption  : An option value
       
   167 	 *@return TInt: KErrNone if succsess 
       
   168 	 */
       
   169 EXPORT_C TInt RIpsecPolicyServ::SetOpt(TUint aOptionName, TUint aOptionLevel, const TDesC8 &aOption)
       
   170 	{
       
   171 	TPckg<TUint> optionNamePkg(aOptionName);
       
   172 	TPckg<TUint> pkgOptionLevel(aOptionLevel);
       
   173 	return SendReceive(EIpsecPolicySetOption, TIpcArgs( &optionNamePkg, &pkgOptionLevel, &aOption));	
       
   174 	}