tcpiputils/dnd/Test/te_dnssuffix/src/te_dnssuffixtestwrapper.cpp
branchRCL_3
changeset 63 425d8f4f7fa5
parent 53 7e41d162e158
equal deleted inserted replaced
58:8d540f55e491 63:425d8f4f7fa5
    34  * 
    34  * 
    35  * 
    35  * 
    36  */
    36  */
    37 #define KIPAddrLen 39
    37 #define KIPAddrLen 39
    38 
    38 
    39 #define DISABLE_TUNDRIVER
       
    40 
       
    41 // Used for handle the multiple hosts in same test cases. @See TC006
    39 // Used for handle the multiple hosts in same test cases. @See TC006
    42 #define KMaxHosts 8
    40 #define KMaxHosts 8
    43 
    41 
    44 // Commands
    42 // Commands
    45 _LIT(KInitDNSSuffixTesting, "InitDNSSuffixTesting");
    43 _LIT(KInitDNSSuffixTesting, "InitDNSSuffixTesting");
   274         SetError(err);
   272         SetError(err);
   275         return err;
   273         return err;
   276         }
   274         }
   277         
   275         
   278     INFO_PRINTF2(_L("First connection started successfully - IAP: %D"),iapId);        
   276     INFO_PRINTF2(_L("First connection started successfully - IAP: %D"),iapId);        
   279     
   277         
   280 #ifndef DISABLE_TUNDRIVER
       
   281     iapId = GetSecondIapId();
   278     iapId = GetSecondIapId();
   282              
   279              
   283     if ((TInt)iapId == KErrNotFound)
   280     if ((TInt)iapId == KErrNotFound)
   284         {       
   281         {       
   285         aConn1.Close();
   282         aConn1.Close();
   293         ERR_PRINTF1(_L("Failed to start second connection"));
   290         ERR_PRINTF1(_L("Failed to start second connection"));
   294         aConn1.Close();
   291         aConn1.Close();
   295         return err;
   292         return err;
   296         }
   293         }
   297         
   294         
   298     INFO_PRINTF2(_L("Second connection started successfully - IAP: %D"),iapId);
   295     INFO_PRINTF2(_L("Second connection started successfully - IAP: %D"),iapId);        
   299 #endif
       
   300             
   296             
   301     INFO_PRINTF1(_L("StartConnections - Exit"));
   297     INFO_PRINTF1(_L("StartConnections - Exit"));
   302     return KErrNone;
   298     return KErrNone;
   303     }
   299     }
   304 
   300 
   581         }
   577         }
   582     INFO_PRINTF1(_L("Started the connections successfully"));
   578     INFO_PRINTF1(_L("Started the connections successfully"));
   583     
   579     
   584     INFO_PRINTF1(_L("Close the connections"));
   580     INFO_PRINTF1(_L("Close the connections"));
   585    
   581    
   586 #ifndef DISABLE_TUNDRIVER
       
   587     if (vTunConn.SubSessionHandle())
   582     if (vTunConn.SubSessionHandle())
   588         vTunConn.Close();
   583         vTunConn.Close();
   589 #endif
       
   590 
   584 
   591     if (firstConn.SubSessionHandle())
   585     if (firstConn.SubSessionHandle())
   592         firstConn.Close();
   586         firstConn.Close();
   593     
   587     
   594     SetError(err);      
   588     SetError(err);      
  1942         ERR_PRINTF1(_L("Failed get the name of the interface (ethernet)"));    
  1936         ERR_PRINTF1(_L("Failed get the name of the interface (ethernet)"));    
  1943         SetError(KErrNotFound);
  1937         SetError(KErrNotFound);
  1944         return;
  1938         return;
  1945         }
  1939         }
  1946     
  1940     
  1947 #ifndef DISABLE_TUNDRIVER
       
  1948     err = GetSecondInterfaceNameL(vTunInterface);
  1941     err = GetSecondInterfaceNameL(vTunInterface);
  1949     
  1942     
  1950     if (KErrNone != err)
  1943     if (KErrNone != err)
  1951         { 
  1944         { 
  1952         ERR_PRINTF1(_L("Failed get the name of the interface (vTun)"));    
  1945         ERR_PRINTF1(_L("Failed get the name of the interface (vTun)"));    
  1953         SetError(KErrNotFound);
  1946         SetError(KErrNotFound);
  1954         return;
  1947         return;
  1955         }
  1948         }
  1956 #endif
       
  1957    
  1949    
  1958     INFO_PRINTF1(_L("Setting suffix list on interface:"));
  1950     INFO_PRINTF1(_L("Setting suffix list on interface:"));
  1959     
  1951     
  1960     iSuffixList2.Reset();
  1952     iSuffixList2.Reset();
  1961     
  1953     
  2008         return;
  2000         return;
  2009         }
  2001         }
  2010     
  2002     
  2011     INFO_PRINTF2(_L("Set suffix list on %S successfully"),&ethernetInterface);
  2003     INFO_PRINTF2(_L("Set suffix list on %S successfully"),&ethernetInterface);
  2012     
  2004     
  2013 #ifndef DISABLE_TUNDRIVER
       
  2014     err = SetDNSSuffixListOnInterface(iSocketServ,vTunConn,vTunInterface,iSuffixList2);
  2005     err = SetDNSSuffixListOnInterface(iSocketServ,vTunConn,vTunInterface,iSuffixList2);
  2015                
  2006                
  2016     if (KErrNone != err)
  2007     if (KErrNone != err)
  2017         {
  2008         {
  2018         ERR_PRINTF3(_L("Failed Setting the suffix list on %S with errror : %D"),&vTunInterface,err);
  2009         ERR_PRINTF3(_L("Failed Setting the suffix list on %S with errror : %D"),&vTunInterface,err);
  2022         CloseSocketSrv();
  2013         CloseSocketSrv();
  2023         return;
  2014         return;
  2024         }
  2015         }
  2025     
  2016     
  2026     INFO_PRINTF2(_L("Set suffix list on %S successfully"),&vTunInterface);        
  2017     INFO_PRINTF2(_L("Set suffix list on %S successfully"),&vTunInterface);        
  2027 #endif
       
  2028     
  2018     
  2029     INFO_PRINTF1(_L("Opening implicit resolver"));
  2019     INFO_PRINTF1(_L("Opening implicit resolver"));
  2030     // Open implicit resolver.
  2020     // Open implicit resolver.
  2031     RHostResolver resolver;
  2021     RHostResolver resolver;
  2032     INFO_PRINTF1(_L("Creating implicit resolver"));
  2022     INFO_PRINTF1(_L("Creating implicit resolver"));
  2070       }    
  2060       }    
  2071     
  2061     
  2072     INFO_PRINTF1(_L("Closing implicit host resolver"));
  2062     INFO_PRINTF1(_L("Closing implicit host resolver"));
  2073     resolver.Close(); 
  2063     resolver.Close(); 
  2074         
  2064         
  2075 #ifndef DISABLE_TUNDRIVER
       
  2076     if (err == KErrNone)
  2065     if (err == KErrNone)
  2077         {
  2066         {
  2078         // Open explicit resolver.
  2067         // Open explicit resolver.
  2079         RHostResolver resolver2;
  2068         RHostResolver resolver2;
  2080         INFO_PRINTF1(_L("Creating explicit resolver"));
  2069         INFO_PRINTF1(_L("Creating explicit resolver"));
  2107           }      
  2096           }      
  2108         
  2097         
  2109         INFO_PRINTF1(_L("Closing explicit host resolver"));
  2098         INFO_PRINTF1(_L("Closing explicit host resolver"));
  2110         resolver2.Close();    
  2099         resolver2.Close();    
  2111         }
  2100         }
  2112 #endif
       
  2113     
  2101     
  2114     SetError(err);
  2102     SetError(err);
  2115     
  2103     
  2116     INFO_PRINTF1(_L("Closing connections and socket serv session"));
  2104     INFO_PRINTF1(_L("Closing connections and socket serv session"));
  2117     firstConn.Close();
  2105     firstConn.Close();
  2157      * @Santosh K Patil        
  2145      * @Santosh K Patil        
  2158      * @note: start multiple interfaces
  2146      * @note: start multiple interfaces
  2159      * Set suffix lists on vTunnel interface    
  2147      * Set suffix lists on vTunnel interface    
  2160      * Open explicit connection on other interface
  2148      * Open explicit connection on other interface
  2161      */
  2149      */
  2162      TInt err = KErrNone;
  2150     
  2163 #ifndef DISABLE_TUNDRIVER
       
  2164     TFileName vTunInterface;
  2151     TFileName vTunInterface;
  2165     err = GetSecondInterfaceNameL(vTunInterface);
  2152     TInt err = GetSecondInterfaceNameL(vTunInterface);
  2166     
  2153     
  2167     if (KErrNone != err)
  2154     if (KErrNone != err)
  2168         { 
  2155         { 
  2169         ERR_PRINTF1(_L("Failed get the name of the interface (vTun)"));    
  2156         ERR_PRINTF1(_L("Failed get the name of the interface (vTun)"));    
  2170         SetError(KErrNotFound);
  2157         SetError(KErrNotFound);
  2185     else
  2172     else
  2186         {
  2173         {
  2187         INFO_PRINTF2(_L("Suffix list: %S"),&suffixList);
  2174         INFO_PRINTF2(_L("Suffix list: %S"),&suffixList);
  2188         FillSuffixList(iSuffixList,suffixList);
  2175         FillSuffixList(iSuffixList,suffixList);
  2189         }
  2176         }
  2190 #endif
  2177     
  2191 
       
  2192     if ( (err = iSocketServ.Connect()) != KErrNone)
  2178     if ( (err = iSocketServ.Connect()) != KErrNone)
  2193        {
  2179        {
  2194        ERR_PRINTF1(_L("Failed Connecting to socket server"));
  2180        ERR_PRINTF1(_L("Failed Connecting to socket server"));
  2195        SetError(err);
  2181        SetError(err);
  2196        return;
  2182        return;
  2211       return;
  2197       return;
  2212       }
  2198       }
  2213     
  2199     
  2214     INFO_PRINTF1(_L("Connections started successfully"));
  2200     INFO_PRINTF1(_L("Connections started successfully"));
  2215     
  2201     
  2216 #ifndef DISABLE_TUNDRIVER
       
  2217     err = SetDNSSuffixListOnInterface(iSocketServ,vTunConn,vTunInterface,iSuffixList);
  2202     err = SetDNSSuffixListOnInterface(iSocketServ,vTunConn,vTunInterface,iSuffixList);
  2218                    
  2203                    
  2219     if (KErrNone != err)
  2204     if (KErrNone != err)
  2220         {
  2205         {
  2221         ERR_PRINTF3(_L("Failed Setting the suffix list on %S with errror : %D"),&vTunInterface,err);
  2206         ERR_PRINTF3(_L("Failed Setting the suffix list on %S with errror : %D"),&vTunInterface,err);
  2225         CloseSocketSrv();
  2210         CloseSocketSrv();
  2226         return;
  2211         return;
  2227         }
  2212         }
  2228     
  2213     
  2229     INFO_PRINTF2(_L("Set suffix list on %S successfully"),&vTunInterface);  
  2214     INFO_PRINTF2(_L("Set suffix list on %S successfully"),&vTunInterface);  
  2230 #endif
       
  2231 
  2215 
  2232     INFO_PRINTF1(_L("Opening explicit resolver"));
  2216     INFO_PRINTF1(_L("Opening explicit resolver"));
  2233     // Open implicit resolver.
  2217     // Open implicit resolver.
  2234     RHostResolver resolver;
  2218     RHostResolver resolver;
  2235     INFO_PRINTF1(_L("Creating explicit resolver"));
  2219     INFO_PRINTF1(_L("Creating explicit resolver"));