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 // *********************** |
5548 // value stored as ID is also *ALWAYS* a valid full address for this |
5534 // value stored as ID is also *ALWAYS* a valid full address for this |
5549 // interface (some code may depend on it!) |
5535 // interface (some code may depend on it!) |
5550 */ |
5536 */ |
5551 TInt CIp6Interface::SetId(TIp6AddressInfo &aId, const TIp6Addr &aAddr, const TInt aPrefix, const TInt aAddressType) |
5537 TInt CIp6Interface::SetId(TIp6AddressInfo &aId, const TIp6Addr &aAddr, const TInt aPrefix, const TInt aAddressType) |
5552 { |
5538 { |
|
5539 // Should this also check whether address type is same? |
|
5540 // Changing just type does not work with this code! |
|
5541 // -- msa 24.10.2003 |
5553 if (aPrefix < 0 || aPrefix > 128) |
5542 if (aPrefix < 0 || aPrefix > 128) |
5554 return 0; // Invalid length, do nothing! |
5543 return 0; // Invalid length, do nothing! |
5555 if (TIp46Addr::Cast(aAddr).IsMulticast()) |
5544 if (TIp46Addr::Cast(aAddr).IsMulticast()) |
5556 return 0; // A multicast address cannot be my own. |
5545 return 0; // A multicast address cannot be my own. |
5557 // Should this also check whether address type is same? |
|
5558 // Changing just type does not work with this code! |
|
5559 // -- msa 24.10.2003 |
|
5560 if (aId.IsSet() && aPrefix == aId.iPrefix && aAddr.IsEqual(aId.iId)) |
5546 if (aId.IsSet() && aPrefix == aId.iPrefix && aAddr.IsEqual(aId.iId)) |
5561 { |
5547 { |
5562 // Id has not changed but expecting some change in any of |
5548 // Id has not changed but expecting some change in any of |
5563 // the other interface fields. So raising a Interface change event |
5549 // the other interface fields. So raising a Interface change event |
5564 // for the subscribers to keep themselves updated |
5550 // for the subscribers to keep themselves updated |
7295 { |
7281 { |
7296 // Note: Reset does some extra inits, which |
7282 // Note: Reset does some extra inits, which |
7297 // are wasted on destructor. Should not cause |
7283 // are wasted on destructor. Should not cause |
7298 // any problems... -- msa |
7284 // any problems... -- msa |
7299 Reset(); |
7285 Reset(); |
7300 iSuffixList.Close(); |
|
7301 LOG(Log::Printf(_L("\tIF %u [%S] Deleted"), iScope[0], &iName)); |
7286 LOG(Log::Printf(_L("\tIF %u [%S] Deleted"), iScope[0], &iName)); |
7302 } |
7287 } |
7303 |
7288 |
7304 // CIp6Interface::Reset |
7289 // CIp6Interface::Reset |
7305 // ******************** |
7290 // ******************** |
9426 |
9411 |
9427 // CIp6Manager::InterfaceInfo |
9412 // CIp6Manager::InterfaceInfo |
9428 // ************************** |
9413 // ************************** |
9429 /** |
9414 /** |
9430 // Locate the next interface after aIndex and return the |
9415 // Locate the next interface after aIndex and return the |
9431 // information and assigned interface index |
9416 // information and assigned interface index. |
9432 // The structure being used is a legacy type for retreiving basic information |
9417 // |
9433 // |
|
9434 // @param aIndex index in the interface list after which we need extract the interface information |
|
9435 // @param aInfo Structure to store interface properties for the application layer to read |
|
9436 // @return |
9418 // @return |
9437 // @li = 0, if no next interface exists |
9419 // @li = 0, if no next interface exists |
9438 // @li > 0, interface index, aInfo updated to describe this interface |
9420 // @li > 0, interface index, aInfo updated to describe this interface |
9439 */ |
9421 */ |
9440 TUint CIp6Manager::InterfaceInfo(TUint aIndex, TSoInetInterfaceInfo &aInfo) const |
9422 TUint CIp6Manager::InterfaceInfo(TUint aIndex, TSoInetInterfaceInfo &aInfo) const |
9441 { |
9423 { |
9442 // ..yes, this is silly O(n!) (?) algorithm for scanning the interfaces. Each time |
9424 // ..yes, this is silly O(n!) (?) algorithm for scanning the interfaces. Each time |
9443 // this is called, it has find and count all entries that come before the specified |
9425 // this is called, it has find and count all entries that come before the specified |
9444 // aIndex. |
9426 // aIndex. |
9445 // Also, if between calls, prefixes or id's have been added or removed, the algorithm |
9427 // Also, if between calls, prefixes or id's have been added or removed, the algorithm |
9446 // fails and returns same entries multiple times or skips some that it should have |
9428 // fails and returns same entries multiple times or skips some that it should have |
9588 iface->SetAddressAndScope(aInfo.iAddress, aInfo.iAddress); |
9570 iface->SetAddressAndScope(aInfo.iAddress, aInfo.iAddress); |
9589 return i; |
9571 return i; |
9590 } |
9572 } |
9591 } |
9573 } |
9592 return 0; |
9574 return 0; |
9593 } |
9575 } |
9594 |
9576 |
9595 // CIp6Manager::DomainSuffixInfo |
|
9596 // ***************************** |
|
9597 /** |
|
9598 // Locate the next domain suffix after aDomainSuffixIndex on the interface with name aActiveEnumInterface |
|
9599 // and return the information and assigned domain suffix index. |
|
9600 // The structure being used is a new type for retreiving extended information |
|
9601 // |
|
9602 // @param aActiveEnumInterface active interface name on which enumeration is to carried out |
|
9603 // @param aDomainSuffixIndex index in the domain suffix list after which we need extract the information |
|
9604 // @param aInfoStructure to store domain suffix properties for the application layer to read |
|
9605 // @return |
|
9606 // @li = 0, if no next domain suffix exists |
|
9607 // @li > 0, interface index, aInfo updated to describe this domain suffix in the list |
|
9608 // @li = KErrNotFound, if interface does not exist (or) when no domain suffix available for the interfce |
|
9609 */ |
|
9610 TInt CIp6Manager::DomainSuffixInfo(TName aActiveEnumInterface, TUint aDomainSuffixIndex, TInetSuffix &aDomainSuffix) |
|
9611 { |
|
9612 CIp6Interface* iface = FindInterface(aActiveEnumInterface); |
|
9613 |
|
9614 if (iface == NULL) |
|
9615 { |
|
9616 return KErrNotFound; |
|
9617 } |
|
9618 |
|
9619 TInt count = iface->iSuffixList.Count(); |
|
9620 if(count == 0 || count < aDomainSuffixIndex) |
|
9621 return KErrNotFound; |
|
9622 |
|
9623 if (count == aDomainSuffixIndex) |
|
9624 return 0; |
|
9625 |
|
9626 aDomainSuffix.Copy(iface->iSuffixList[aDomainSuffixIndex]); |
|
9627 aDomainSuffix.iDomainSuffixFunction = EInetFunctionUndefined; |
|
9628 |
|
9629 return ++aDomainSuffixIndex; |
|
9630 } |
|
9631 |
9577 |
9632 TInt CIp6Manager::GetInterfaces(TDes8& aOption) const |
9578 TInt CIp6Manager::GetInterfaces(TDes8& aOption) const |
9633 { |
9579 { |
9634 TOverlayArray<TInetInterfaceInfo> info(aOption); |
9580 TOverlayArray<TInetInterfaceInfo> info(aOption); |
9635 TInt idx = 0, exceed = 0; |
9581 TInt idx = 0, exceed = 0; |
10042 return KErrNone; |
9988 return KErrNone; |
10043 } |
9989 } |
10044 |
9990 |
10045 // CIp6Manager::InetInterfaceOption |
9991 // CIp6Manager::InetInterfaceOption |
10046 // ******************************** |
9992 // ******************************** |
10047 // Modify Inet Interface information (SetOption part!) for TSoInet6InterfaceInfo input |
9993 // Modify Inet Interface information (SetOption part) |
10048 // For maintaining backward compatibility |
9994 // |
10049 // |
9995 TInt CIp6Manager::InetInterfaceOption(TUint aName, const TSoInet6InterfaceInfo &aInfo) |
10050 TInt CIp6Manager::InetInterfaceOption(TUint aName, const TSoInet6InterfaceInfo &aInfo, const TInetSuffix* aDomainSuffix) |
|
10051 { |
9996 { |
10052 #ifdef _LOG |
9997 #ifdef _LOG |
10053 TBuf<39> addressStr; |
9998 TBuf<39> addressStr; |
10054 aInfo.iAddress.Output( addressStr ); |
9999 aInfo.iAddress.Output( addressStr ); |
10055 TBuf<39> netMaskStr; |
10000 TBuf<39> netMaskStr; |
10202 return prefix; // Bad address information |
10147 return prefix; // Bad address information |
10203 if (aInfo.iMtu > 0) |
10148 if (aInfo.iMtu > 0) |
10204 iface->iSMtu = iface->iRMtu = iface->iPMtu = aInfo.iMtu; |
10149 iface->iSMtu = iface->iRMtu = iface->iPMtu = aInfo.iMtu; |
10205 if (aInfo.iSpeedMetric > 0) |
10150 if (aInfo.iSpeedMetric > 0) |
10206 iface->iSpeedMetric = aInfo.iSpeedMetric; |
10151 iface->iSpeedMetric = aInfo.iSpeedMetric; |
10207 |
|
10208 // Copy the domain search list (if any) to the interface object |
|
10209 if (aDomainSuffix) |
|
10210 { |
|
10211 TRAPD(err, iface->ProcessDomainSuffixL(aDomainSuffix)); |
|
10212 if (err != KErrNone) |
|
10213 return err; |
|
10214 } |
|
10215 |
|
10216 if (aInfo.iDoState) |
10152 if (aInfo.iDoState) |
10217 { |
10153 { |
10218 if (aInfo.iState == EIfDown) |
10154 if (aInfo.iState == EIfDown) |
10219 iface->iState = KErrNotReady; |
10155 iface->iState = KErrNotReady; |
10220 else if (aInfo.iState == EIfUp) |
10156 else if (aInfo.iState == EIfUp) |
10328 iface->GetRoute(addr, prefix, KRouteAdd_ONLINK, NULL, &lifetime); |
10264 iface->GetRoute(addr, prefix, KRouteAdd_ONLINK, NULL, &lifetime); |
10329 } |
10265 } |
10330 return KErrNone; |
10266 return KErrNone; |
10331 } |
10267 } |
10332 |
10268 |
10333 // CIp6Manager::ProcessDomainSuffixL |
|
10334 // ********************************* |
|
10335 // Process SetOpt calls with TSoInetInterfaceInfoExtnDnsSuffix which contains |
|
10336 // domain suffix information for the interface in form of TInetSuffix structure |
|
10337 // This function is responsible to perform domain suffix updates (i.e. add/delete/deleteall) |
|
10338 // to the interface based on the operation mode specified in the structure |
|
10339 void CIp6Interface::ProcessDomainSuffixL(const TInetSuffix* aSuffix) |
|
10340 { |
|
10341 if (aSuffix->iDomainSuffixFunction == EInetAddSuffix) |
|
10342 { |
|
10343 // Perform addition of the incoming suffix name to the list maintained by interface object |
|
10344 iSuffixList.AppendL(aSuffix->iSuffixName); |
|
10345 TSuffixName tmpBuf; |
|
10346 tmpBuf.Copy(iSuffixList[iSuffixList.Count()-1]); |
|
10347 LOG(Log::Printf( _L( "Added domain suffix to interface %S - %S"), &iName, &tmpBuf)); |
|
10348 } |
|
10349 else if(aSuffix->iDomainSuffixFunction == EInetDeleteSuffix) |
|
10350 { |
|
10351 // Perform deletion of the suffix name from the list of suffices in the interface object |
|
10352 TInt pos; |
|
10353 pos = iSuffixList.Find(aSuffix->iSuffixName); |
|
10354 User::LeaveIfError(pos); |
|
10355 TSuffixName tmpBuf; |
|
10356 tmpBuf.Copy(iSuffixList[pos]); |
|
10357 iSuffixList.Remove(pos); |
|
10358 LOG(Log::Printf( _L( "Removed domain suffix from interface %S - %S"), &iName, &tmpBuf)); |
|
10359 } |
|
10360 else if (aSuffix->iDomainSuffixFunction == EInetDeleteAllSuffixes) |
|
10361 { |
|
10362 // Flush out all the suffix entries in the interface |
|
10363 iSuffixList.Reset(); |
|
10364 LOG(Log::Printf( _L( "Removed all domain suffix from interface %S"), &iName)); |
|
10365 } |
|
10366 } |
|
10367 |
|
10368 // CIp6Manager::InetInterfaceOption |
|
10369 // ******************************** |
|
10370 // Modify Inet Interface information (SetOption part!) for TSoInetInterfaceInfoExtnDnsSuffix input |
|
10371 // To support supplementary fields i.e. domain search list on an interface |
|
10372 // |
|
10373 TInt CIp6Manager::InetInterfaceOption(TUint aName, const TSoInetInterfaceInfoExtnDnsSuffix &aInfo) |
|
10374 { |
|
10375 return InetInterfaceOption(aName, (TSoInet6InterfaceInfo)aInfo, &aInfo.iDomainSuffix); |
|
10376 } |
|
10377 |
|
10378 // |
10269 // |
10379 // CIpManager::InterfaceOption |
10270 // CIpManager::InterfaceOption |
10380 // *************************** |
10271 // *************************** |
10381 /** |
10272 /** |
10382 // This method implements *BOTH* SetOption and GetOption when level KSOLInterface |
10273 // This method implements *BOTH* SetOption and GetOption when level KSOLInterface |
10512 if (ret != KErrNone) |
10403 if (ret != KErrNone) |
10513 return ret; |
10404 return ret; |
10514 if (aName == KSoIpv4LinkLocal && |
10405 if (aName == KSoIpv4LinkLocal && |
10515 aOption.Length() == sizeof(TSoInetIpv4LinkLocalInfo)) |
10406 aOption.Length() == sizeof(TSoInetIpv4LinkLocalInfo)) |
10516 return SetIpv4LinkLocalOption((TSoInetIpv4LinkLocalInfo &)ref); |
10407 return SetIpv4LinkLocalOption((TSoInetIpv4LinkLocalInfo &)ref); |
10517 if (aOption.Length() == sizeof(TSoInet6InterfaceInfo)) |
10408 |
10518 { |
10409 if (aOption.Length() != sizeof(TSoInet6InterfaceInfo)) |
10519 // if the SetOpt() requested with TSoInet6InterfaceInfo structure (legacy) |
|
10520 return InetInterfaceOption(aName, (TSoInet6InterfaceInfo &)ref, NULL); |
|
10521 } |
|
10522 else if (aOption.Length() == sizeof(TSoInetInterfaceInfoExtnDnsSuffix)) |
|
10523 { |
|
10524 // if the SetOpt() requested with new TSoInetInterfaceInfoExtnDnsSuffix structure |
|
10525 return InetInterfaceOption(aName, (TSoInetInterfaceInfoExtnDnsSuffix &)ref); |
|
10526 } |
|
10527 else |
|
10528 return KErrArgument; |
10410 return KErrArgument; |
|
10411 return InetInterfaceOption(aName, (TSoInet6InterfaceInfo &)ref); |
10529 } |
10412 } |
10530 else if (aLevel == KSOLInterface) |
10413 else if (aLevel == KSOLInterface) |
10531 { |
10414 { |
10532 const TInt ret = aChecker.CheckPolicy(KPolicyNetworkControl, 0); |
10415 const TInt ret = aChecker.CheckPolicy(KPolicyNetworkControl, 0); |
10533 if (ret != KErrNone) |
10416 if (ret != KErrNone) |