networksecurity/ipsec/ipsecpolapi/src/ipsecpolapi.cpp
branchRCL_3
changeset 57 abbed5a4b42a
parent 53 7e41d162e158
child 58 8d540f55e491
equal deleted inserted replaced
53:7e41d162e158 57:abbed5a4b42a
    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 
    19 #include "ipsecpol.h"
    20 #include "ipsecpol.h"
    20 #include "ipsecpolapi.h"
    21 #include "ipsecpolapi.h"
    21 #include "clistatic.h"
    22 #include "clistatic.h"
    22 #include <e32base.h>
    23 #include <e32base.h>
    23 
    24 
    36     
    37     
    37 EXPORT_C TInt RIpsecPolicyServ::Connect()
    38 EXPORT_C TInt RIpsecPolicyServ::Connect()
    38 //
    39 //
    39 // Connect to the server attempting to start it if necessary
    40 // Connect to the server attempting to start it if necessary
    40 //
    41 //
    41     {    
    42     {
    42 	TInt retry=2;
    43 	TInt retry=2;
    43 	for (;;)
    44 	for (;;)
    44 		{
    45 		{
    45 		TInt r=CreateSession(KIpsecPolicyServerName,
    46 		TInt r=CreateSession(KIpsecPolicyServerName,
    46                              Version(),
    47                              Version(),
   153 	{
   154 	{
   154 	TPckg<TInt> selectorCount(aCount);
   155 	TPckg<TInt> selectorCount(aCount);
   155     SendReceive(EIpsecPolicyEnumerateSelectors, TIpcArgs(&aGateway, &selectorCount));
   156     SendReceive(EIpsecPolicyEnumerateSelectors, TIpcArgs(&aGateway, &selectorCount));
   156 	}
   157 	}
   157 
   158 
   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 	}