5536 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) |
5537 { |
5537 { |
5538 // Should this also check whether address type is same? |
5538 // Should this also check whether address type is same? |
5539 // Changing just type does not work with this code! |
5539 // Changing just type does not work with this code! |
5540 // -- msa 24.10.2003 |
5540 // -- msa 24.10.2003 |
5541 if (aId.IsSet() && aPrefix == aId.iPrefix && aAddr.IsEqual(aId.iId)) |
|
5542 return 0; // Id is same as before, no change! |
|
5543 if (aPrefix < 0 || aPrefix > 128) |
5541 if (aPrefix < 0 || aPrefix > 128) |
5544 return 0; // Invalid length, do nothing! |
5542 return 0; // Invalid length, do nothing! |
5545 if (TIp46Addr::Cast(aAddr).IsMulticast()) |
5543 if (TIp46Addr::Cast(aAddr).IsMulticast()) |
5546 return 0; // A multicast address cannot be my own. |
5544 return 0; // A multicast address cannot be my own. |
|
5545 if (aId.IsSet() && aPrefix == aId.iPrefix && aAddr.IsEqual(aId.iId)) |
|
5546 { |
|
5547 // Id has not changed but expecting some change in any of |
|
5548 // the other interface fields. So raising a Interface change event |
|
5549 // for the subscribers to keep themselves updated |
|
5550 |
|
5551 // Send notification to the event service |
|
5552 NotifyInterfaceEvent(EventTypeModify); |
|
5553 return 1; |
|
5554 } |
5547 |
5555 |
5548 UpdateIdRoutes(aId, 0); // Remove old route (if needed) |
5556 UpdateIdRoutes(aId, 0); // Remove old route (if needed) |
5549 aId.iId = aAddr; |
5557 aId.iId = aAddr; |
5550 aId.iPrefix = (TUint8)aPrefix; |
5558 aId.iPrefix = (TUint8)aPrefix; |
5551 aId.SetInitial(NeedsND()); |
5559 aId.SetInitial(NeedsND()); |