615 // Returns the event manager instance used by the stack |
615 // Returns the event manager instance used by the stack |
616 inline MEventService *EventManager() const { return iEventManager; } |
616 inline MEventService *EventManager() const { return iEventManager; } |
617 |
617 |
618 // Wrap a packet into ICMP error reply |
618 // Wrap a packet into ICMP error reply |
619 void IcmpSend(RMBufChain &aPacket, const TIcmpTypeCode aIcmp, const TUint32 aParameter = 0, const TInt aMC = 0); |
619 void IcmpSend(RMBufChain &aPacket, const TIcmpTypeCode aIcmp, const TUint32 aParameter = 0, const TInt aMC = 0); |
620 |
620 |
621 private: |
621 private: |
622 # ifdef WEAK_ES |
622 # ifdef WEAK_ES |
623 TUint32 IsForMe(const TIp6Addr &aAddr, const CIp6Interface *const aSrcIf, |
623 TUint32 IsForMe(const TIp6Addr &aAddr, const CIp6Interface *const aSrcIf, |
624 const TUint32 aScopeId, const TScopeType aType) const; |
624 const TUint32 aScopeId, const TScopeType aType) const; |
625 # else |
625 # else |
665 // |
665 // |
666 // Unconditional removal of the interface |
666 // Unconditional removal of the interface |
667 // |
667 // |
668 void RemoveInterface(CIp6Interface *aIf); |
668 void RemoveInterface(CIp6Interface *aIf); |
669 // |
669 // |
670 // Modify Inet Interface information (SetOption part!) for TSoInet6InterfaceInfo input |
670 // Modify Inet Interface information (SetOption part!) |
671 // |
671 // |
672 TInt InetInterfaceOption(TUint aName, const TSoInet6InterfaceInfo &aInfo, const TInetSuffix* aDomainSuffix); |
672 TInt InetInterfaceOption(TUint aName, const TSoInet6InterfaceInfo &aInfo); |
673 // |
|
674 // Modify Inet Interface information (SetOption part!) for TSoInetInterfaceInfoExtnDnsSuffix input |
|
675 // To support supplementary interface fields i.e. domain search list for an interface |
|
676 // |
|
677 TInt InetInterfaceOption(TUint aName, const TSoInetInterfaceInfoExtnDnsSuffix &aInfo); |
|
678 // |
673 // |
679 // Query Interface Information |
674 // Query Interface Information |
680 // |
675 // |
681 TInt InterfaceQueryOption(TUint aName, TSoInetIfQuery &aQuery, const TInt aLength) const; |
676 TInt InterfaceQueryOption(TUint aName, TSoInetIfQuery &aQuery, const TInt aLength) const; |
682 // |
677 // |
793 |
788 |
794 MEventService *iEventManager; //< For providing interface and route events to the plugins. |
789 MEventService *iEventManager; //< For providing interface and route events to the plugins. |
795 MDestinationCache *iDestinationCache; //< Destination cache (for transport protocol params). |
790 MDestinationCache *iDestinationCache; //< Destination cache (for transport protocol params). |
796 |
791 |
797 public: // GCC doesn't compile Linkage, if this is private! -- msa |
792 public: // GCC doesn't compile Linkage, if this is private! -- msa |
798 RTimeout iTimeout; //< Hook to the timer service (MTimeoutManager) |
793 RTimeout iTimeout; //< Hook to the timer service (MTimeoutManager) |
799 public: |
|
800 // Enumerate domain suffices on an interface and read suffix name to the reference object passed in |
|
801 virtual TInt DomainSuffixInfo(TName aActiveEnumInterface, TUint aDomainSuffixIndex, TInetSuffix &aDomainSuffix); |
|
802 }; |
794 }; |
803 |
795 |
804 // |
796 // |
805 // CIp6ManagerTimeoutLinkage |
797 // CIp6ManagerTimeoutLinkage |
806 // ************************* |
798 // ************************* |
1869 // Global flag, used while composing global address from prefix of RA (with 'A' flag set) |
1861 // Global flag, used while composing global address from prefix of RA (with 'A' flag set) |
1870 TBool iGlobalflag; |
1862 TBool iGlobalflag; |
1871 #endif //SYMBIAN_TCPIPDHCP_UPDATE |
1863 #endif //SYMBIAN_TCPIPDHCP_UPDATE |
1872 public: // GCC doesn't compile CIp6InterfaceLinkage, if this is private! -- msa |
1864 public: // GCC doesn't compile CIp6InterfaceLinkage, if this is private! -- msa |
1873 RTimeout iTimeout; //< Hook to the timer service (MTimeoutManager) |
1865 RTimeout iTimeout; //< Hook to the timer service (MTimeoutManager) |
1874 private: |
|
1875 RInetSuffixList iSuffixList; // Container to store list of optional domain search list on the interface |
|
1876 private: |
|
1877 // Process SetOpt request for updating domain suffices based on the function mode set on the structure passed in |
|
1878 void ProcessDomainSuffixL(const TInetSuffix* aSuffix); |
|
1879 }; |
1866 }; |
1880 |
1867 |
1881 // |
1868 // |
1882 // CIp6InterfaceTimeoutLinkage |
1869 // CIp6InterfaceTimeoutLinkage |
1883 // *********************** |
1870 // *********************** |
3423 } |
3410 } |
3424 #endif |
3411 #endif |
3425 TPckgBuf<TSoIfConnectionInfo> netinfo; |
3412 TPckgBuf<TSoIfConnectionInfo> netinfo; |
3426 netinfo().iIAPId = iRoute->iInterface.iScope[EScopeType_IAP]; |
3413 netinfo().iIAPId = iRoute->iInterface.iScope[EScopeType_IAP]; |
3427 netinfo().iNetworkId = iRoute->iInterface.iScope[EScopeType_NET]; |
3414 netinfo().iNetworkId = iRoute->iInterface.iScope[EScopeType_NET]; |
3428 |
|
3429 if(iInfo.iLockType == EScopeType_IAP && iInfo.iLockId != netinfo().iIAPId) |
|
3430 { |
|
3431 iInfo.iLockId = netinfo().iIAPId; |
|
3432 #ifdef _LOG |
|
3433 Log::Printf(_L("\t\tFlow[%u] Connect ConnectionInfo changed: Lock_type:%d, Lock_id:%d"),this,iInfo.iLockType, iInfo.iLockId); |
|
3434 #endif |
|
3435 } |
|
3436 |
|
3437 Bearer(netinfo); |
3415 Bearer(netinfo); |
3438 RefreshFlow(); |
3416 RefreshFlow(); |
3439 return; |
3417 return; |
3440 } |
3418 } |
3441 // |
3419 // |
5555 // value stored as ID is also *ALWAYS* a valid full address for this |
5533 // value stored as ID is also *ALWAYS* a valid full address for this |
5556 // interface (some code may depend on it!) |
5534 // interface (some code may depend on it!) |
5557 */ |
5535 */ |
5558 TInt CIp6Interface::SetId(TIp6AddressInfo &aId, const TIp6Addr &aAddr, const TInt aPrefix, const TInt aAddressType) |
5536 TInt CIp6Interface::SetId(TIp6AddressInfo &aId, const TIp6Addr &aAddr, const TInt aPrefix, const TInt aAddressType) |
5559 { |
5537 { |
|
5538 // Should this also check whether address type is same? |
|
5539 // Changing just type does not work with this code! |
|
5540 // -- msa 24.10.2003 |
5560 if (aPrefix < 0 || aPrefix > 128) |
5541 if (aPrefix < 0 || aPrefix > 128) |
5561 return 0; // Invalid length, do nothing! |
5542 return 0; // Invalid length, do nothing! |
5562 if (TIp46Addr::Cast(aAddr).IsMulticast()) |
5543 if (TIp46Addr::Cast(aAddr).IsMulticast()) |
5563 return 0; // A multicast address cannot be my own. |
5544 return 0; // A multicast address cannot be my own. |
5564 // Should this also check whether address type is same? |
|
5565 // Changing just type does not work with this code! |
|
5566 // -- msa 24.10.2003 |
|
5567 if (aId.IsSet() && aPrefix == aId.iPrefix && aAddr.IsEqual(aId.iId)) |
5545 if (aId.IsSet() && aPrefix == aId.iPrefix && aAddr.IsEqual(aId.iId)) |
5568 { |
5546 { |
5569 // Id has not changed but expecting some change in any of |
5547 // Id has not changed but expecting some change in any of |
5570 // the other interface fields. So raising a Interface change event |
5548 // the other interface fields. So raising a Interface change event |
5571 // for the subscribers to keep themselves updated |
5549 // for the subscribers to keep themselves updated |
7302 { |
7280 { |
7303 // Note: Reset does some extra inits, which |
7281 // Note: Reset does some extra inits, which |
7304 // are wasted on destructor. Should not cause |
7282 // are wasted on destructor. Should not cause |
7305 // any problems... -- msa |
7283 // any problems... -- msa |
7306 Reset(); |
7284 Reset(); |
7307 iSuffixList.Close(); |
|
7308 LOG(Log::Printf(_L("\tIF %u [%S] Deleted"), iScope[0], &iName)); |
7285 LOG(Log::Printf(_L("\tIF %u [%S] Deleted"), iScope[0], &iName)); |
7309 } |
7286 } |
7310 |
7287 |
7311 // CIp6Interface::Reset |
7288 // CIp6Interface::Reset |
7312 // ******************** |
7289 // ******************** |
9433 |
9410 |
9434 // CIp6Manager::InterfaceInfo |
9411 // CIp6Manager::InterfaceInfo |
9435 // ************************** |
9412 // ************************** |
9436 /** |
9413 /** |
9437 // Locate the next interface after aIndex and return the |
9414 // Locate the next interface after aIndex and return the |
9438 // information and assigned interface index |
9415 // information and assigned interface index. |
9439 // The structure being used is a legacy type for retreiving basic information |
9416 // |
9440 // |
|
9441 // @param aIndex index in the interface list after which we need extract the interface information |
|
9442 // @param aInfo Structure to store interface properties for the application layer to read |
|
9443 // @return |
9417 // @return |
9444 // @li = 0, if no next interface exists |
9418 // @li = 0, if no next interface exists |
9445 // @li > 0, interface index, aInfo updated to describe this interface |
9419 // @li > 0, interface index, aInfo updated to describe this interface |
9446 */ |
9420 */ |
9447 TUint CIp6Manager::InterfaceInfo(TUint aIndex, TSoInetInterfaceInfo &aInfo) const |
9421 TUint CIp6Manager::InterfaceInfo(TUint aIndex, TSoInetInterfaceInfo &aInfo) const |
9448 { |
9422 { |
9449 // ..yes, this is silly O(n!) (?) algorithm for scanning the interfaces. Each time |
9423 // ..yes, this is silly O(n!) (?) algorithm for scanning the interfaces. Each time |
9450 // this is called, it has find and count all entries that come before the specified |
9424 // this is called, it has find and count all entries that come before the specified |
9451 // aIndex. |
9425 // aIndex. |
9452 // Also, if between calls, prefixes or id's have been added or removed, the algorithm |
9426 // Also, if between calls, prefixes or id's have been added or removed, the algorithm |
9453 // fails and returns same entries multiple times or skips some that it should have |
9427 // fails and returns same entries multiple times or skips some that it should have |
9595 iface->SetAddressAndScope(aInfo.iAddress, aInfo.iAddress); |
9569 iface->SetAddressAndScope(aInfo.iAddress, aInfo.iAddress); |
9596 return i; |
9570 return i; |
9597 } |
9571 } |
9598 } |
9572 } |
9599 return 0; |
9573 return 0; |
9600 } |
9574 } |
9601 |
9575 |
9602 // CIp6Manager::DomainSuffixInfo |
|
9603 // ***************************** |
|
9604 /** |
|
9605 // Locate the next domain suffix after aDomainSuffixIndex on the interface with name aActiveEnumInterface |
|
9606 // and return the information and assigned domain suffix index. |
|
9607 // The structure being used is a new type for retreiving extended information |
|
9608 // |
|
9609 // @param aActiveEnumInterface active interface name on which enumeration is to carried out |
|
9610 // @param aDomainSuffixIndex index in the domain suffix list after which we need extract the information |
|
9611 // @param aInfoStructure to store domain suffix properties for the application layer to read |
|
9612 // @return |
|
9613 // @li = 0, if no next domain suffix exists |
|
9614 // @li > 0, interface index, aInfo updated to describe this domain suffix in the list |
|
9615 // @li = KErrNotFound, if interface does not exist (or) when no domain suffix available for the interfce |
|
9616 */ |
|
9617 TInt CIp6Manager::DomainSuffixInfo(TName aActiveEnumInterface, TUint aDomainSuffixIndex, TInetSuffix &aDomainSuffix) |
|
9618 { |
|
9619 CIp6Interface* iface = FindInterface(aActiveEnumInterface); |
|
9620 |
|
9621 if (iface == NULL) |
|
9622 { |
|
9623 return KErrNotFound; |
|
9624 } |
|
9625 |
|
9626 TInt count = iface->iSuffixList.Count(); |
|
9627 if(count == 0 || count < aDomainSuffixIndex) |
|
9628 return KErrNotFound; |
|
9629 |
|
9630 if (count == aDomainSuffixIndex) |
|
9631 return 0; |
|
9632 |
|
9633 aDomainSuffix.Copy(iface->iSuffixList[aDomainSuffixIndex]); |
|
9634 aDomainSuffix.iDomainSuffixFunction = EInetFunctionUndefined; |
|
9635 |
|
9636 return ++aDomainSuffixIndex; |
|
9637 } |
|
9638 |
9576 |
9639 TInt CIp6Manager::GetInterfaces(TDes8& aOption) const |
9577 TInt CIp6Manager::GetInterfaces(TDes8& aOption) const |
9640 { |
9578 { |
9641 TOverlayArray<TInetInterfaceInfo> info(aOption); |
9579 TOverlayArray<TInetInterfaceInfo> info(aOption); |
9642 TInt idx = 0, exceed = 0; |
9580 TInt idx = 0, exceed = 0; |
10049 return KErrNone; |
9987 return KErrNone; |
10050 } |
9988 } |
10051 |
9989 |
10052 // CIp6Manager::InetInterfaceOption |
9990 // CIp6Manager::InetInterfaceOption |
10053 // ******************************** |
9991 // ******************************** |
10054 // Modify Inet Interface information (SetOption part!) for TSoInet6InterfaceInfo input |
9992 // Modify Inet Interface information (SetOption part) |
10055 // For maintaining backward compatibility |
9993 // |
10056 // |
9994 TInt CIp6Manager::InetInterfaceOption(TUint aName, const TSoInet6InterfaceInfo &aInfo) |
10057 TInt CIp6Manager::InetInterfaceOption(TUint aName, const TSoInet6InterfaceInfo &aInfo, const TInetSuffix* aDomainSuffix) |
|
10058 { |
9995 { |
10059 #ifdef _LOG |
9996 #ifdef _LOG |
10060 TBuf<39> addressStr; |
9997 TBuf<39> addressStr; |
10061 aInfo.iAddress.Output( addressStr ); |
9998 aInfo.iAddress.Output( addressStr ); |
10062 TBuf<39> netMaskStr; |
9999 TBuf<39> netMaskStr; |
10209 return prefix; // Bad address information |
10146 return prefix; // Bad address information |
10210 if (aInfo.iMtu > 0) |
10147 if (aInfo.iMtu > 0) |
10211 iface->iSMtu = iface->iRMtu = iface->iPMtu = aInfo.iMtu; |
10148 iface->iSMtu = iface->iRMtu = iface->iPMtu = aInfo.iMtu; |
10212 if (aInfo.iSpeedMetric > 0) |
10149 if (aInfo.iSpeedMetric > 0) |
10213 iface->iSpeedMetric = aInfo.iSpeedMetric; |
10150 iface->iSpeedMetric = aInfo.iSpeedMetric; |
10214 |
|
10215 // Copy the domain search list (if any) to the interface object |
|
10216 if (aDomainSuffix) |
|
10217 { |
|
10218 TRAPD(err, iface->ProcessDomainSuffixL(aDomainSuffix)); |
|
10219 if (err != KErrNone) |
|
10220 return err; |
|
10221 } |
|
10222 |
|
10223 if (aInfo.iDoState) |
10151 if (aInfo.iDoState) |
10224 { |
10152 { |
10225 if (aInfo.iState == EIfDown) |
10153 if (aInfo.iState == EIfDown) |
10226 iface->iState = KErrNotReady; |
10154 iface->iState = KErrNotReady; |
10227 else if (aInfo.iState == EIfUp) |
10155 else if (aInfo.iState == EIfUp) |
10335 iface->GetRoute(addr, prefix, KRouteAdd_ONLINK, NULL, &lifetime); |
10263 iface->GetRoute(addr, prefix, KRouteAdd_ONLINK, NULL, &lifetime); |
10336 } |
10264 } |
10337 return KErrNone; |
10265 return KErrNone; |
10338 } |
10266 } |
10339 |
10267 |
10340 // CIp6Manager::ProcessDomainSuffixL |
|
10341 // ********************************* |
|
10342 // Process SetOpt calls with TSoInetInterfaceInfoExtnDnsSuffix which contains |
|
10343 // domain suffix information for the interface in form of TInetSuffix structure |
|
10344 // This function is responsible to perform domain suffix updates (i.e. add/delete/deleteall) |
|
10345 // to the interface based on the operation mode specified in the structure |
|
10346 void CIp6Interface::ProcessDomainSuffixL(const TInetSuffix* aSuffix) |
|
10347 { |
|
10348 if (aSuffix->iDomainSuffixFunction == EInetAddSuffix) |
|
10349 { |
|
10350 // Perform addition of the incoming suffix name to the list maintained by interface object |
|
10351 iSuffixList.AppendL(aSuffix->iSuffixName); |
|
10352 TSuffixName tmpBuf; |
|
10353 tmpBuf.Copy(iSuffixList[iSuffixList.Count()-1]); |
|
10354 LOG(Log::Printf( _L( "Added domain suffix to interface %S - %S"), &iName, &tmpBuf)); |
|
10355 } |
|
10356 else if(aSuffix->iDomainSuffixFunction == EInetDeleteSuffix) |
|
10357 { |
|
10358 // Perform deletion of the suffix name from the list of suffices in the interface object |
|
10359 TInt pos; |
|
10360 pos = iSuffixList.Find(aSuffix->iSuffixName); |
|
10361 User::LeaveIfError(pos); |
|
10362 TSuffixName tmpBuf; |
|
10363 tmpBuf.Copy(iSuffixList[pos]); |
|
10364 iSuffixList.Remove(pos); |
|
10365 LOG(Log::Printf( _L( "Removed domain suffix from interface %S - %S"), &iName, &tmpBuf)); |
|
10366 } |
|
10367 else if (aSuffix->iDomainSuffixFunction == EInetDeleteAllSuffixes) |
|
10368 { |
|
10369 // Flush out all the suffix entries in the interface |
|
10370 iSuffixList.Reset(); |
|
10371 LOG(Log::Printf( _L( "Removed all domain suffix from interface %S"), &iName)); |
|
10372 } |
|
10373 } |
|
10374 |
|
10375 // CIp6Manager::InetInterfaceOption |
|
10376 // ******************************** |
|
10377 // Modify Inet Interface information (SetOption part!) for TSoInetInterfaceInfoExtnDnsSuffix input |
|
10378 // To support supplementary fields i.e. domain search list on an interface |
|
10379 // |
|
10380 TInt CIp6Manager::InetInterfaceOption(TUint aName, const TSoInetInterfaceInfoExtnDnsSuffix &aInfo) |
|
10381 { |
|
10382 return InetInterfaceOption(aName, (TSoInet6InterfaceInfo)aInfo, &aInfo.iDomainSuffix); |
|
10383 } |
|
10384 |
|
10385 // |
10268 // |
10386 // CIpManager::InterfaceOption |
10269 // CIpManager::InterfaceOption |
10387 // *************************** |
10270 // *************************** |
10388 /** |
10271 /** |
10389 // This method implements *BOTH* SetOption and GetOption when level KSOLInterface |
10272 // This method implements *BOTH* SetOption and GetOption when level KSOLInterface |
10519 if (ret != KErrNone) |
10402 if (ret != KErrNone) |
10520 return ret; |
10403 return ret; |
10521 if (aName == KSoIpv4LinkLocal && |
10404 if (aName == KSoIpv4LinkLocal && |
10522 aOption.Length() == sizeof(TSoInetIpv4LinkLocalInfo)) |
10405 aOption.Length() == sizeof(TSoInetIpv4LinkLocalInfo)) |
10523 return SetIpv4LinkLocalOption((TSoInetIpv4LinkLocalInfo &)ref); |
10406 return SetIpv4LinkLocalOption((TSoInetIpv4LinkLocalInfo &)ref); |
10524 if (aOption.Length() == sizeof(TSoInet6InterfaceInfo)) |
10407 |
10525 { |
10408 if (aOption.Length() != sizeof(TSoInet6InterfaceInfo)) |
10526 // if the SetOpt() requested with TSoInet6InterfaceInfo structure (legacy) |
|
10527 return InetInterfaceOption(aName, (TSoInet6InterfaceInfo &)ref, NULL); |
|
10528 } |
|
10529 else if (aOption.Length() == sizeof(TSoInetInterfaceInfoExtnDnsSuffix)) |
|
10530 { |
|
10531 // if the SetOpt() requested with new TSoInetInterfaceInfoExtnDnsSuffix structure |
|
10532 return InetInterfaceOption(aName, (TSoInetInterfaceInfoExtnDnsSuffix &)ref); |
|
10533 } |
|
10534 else |
|
10535 return KErrArgument; |
10409 return KErrArgument; |
|
10410 return InetInterfaceOption(aName, (TSoInet6InterfaceInfo &)ref); |
10536 } |
10411 } |
10537 else if (aLevel == KSOLInterface) |
10412 else if (aLevel == KSOLInterface) |
10538 { |
10413 { |
10539 const TInt ret = aChecker.CheckPolicy(KPolicyNetworkControl, 0); |
10414 const TInt ret = aChecker.CheckPolicy(KPolicyNetworkControl, 0); |
10540 if (ret != KErrNone) |
10415 if (ret != KErrNone) |