public Binding(IdentityAssoc ia, DhcpLink dhcpLink) { this.origIa = ia; // save a reference to the original IA this.SetDhcpOptions(ia.GetDhcpOptions()); this.SetDuid(ia.GetDuid()); this.SetIaAddresses(ia.GetIaAddresses()); this.SetIaid(ia.GetIaid()); this.SetIatype(ia.GetIatype()); this.SetId(ia.GetId()); this.SetState(ia.GetState()); this.dhcpLink = dhcpLink; }
/// <summary> /// Find the current binding, if any, for the given client identity association (IA). /// </summary> /// <param name="clientLink">link for the client request message</param> /// <param name="duid">DUID of the client</param> /// <param name="iatype">the IAID of the client request</param> /// <param name="iaid"> IAID of the client request</param> /// <param name="requestMsg">requestMsg the client request message</param> /// <returns>return the existing Binding for this client request</returns> protected Binding FindCurrentBinding(DhcpLink clientLink, byte[] duid, byte iatype, long iaid, DhcpMessage requestMsg) { Binding binding = null; lock (_lock) { try { IdentityAssoc ia = iaMgr.FindIA(duid, iatype, iaid); if (ia != null) { _log.Info("Found current binding for " + IdentityAssoc.KeyToString(duid, iatype, iaid) + " state=" + ia.GetState()); binding = BuildBindingFromIa(ia, clientLink, requestMsg); if (binding != null) { _log.Info("Successfully built Binding object: " + binding); } else { _log.Error("Failed to build Binding object"); } } else { _log.Info("No current binding found for " + IdentityAssoc.KeyToString(duid, iatype, iaid)); } } catch (Exception ex) { _log.Error("Failed to find current binding"); } } return(binding); }