private void BuildDHCPACK(PhysicalAddress chaddr, DhcpOption55 dhcpoption55, DhcpLeases dhcplease) { DhcpLeaseItem item = dhcplease.GetItem(chaddr); // 必須 this.dhcpoptions_.Add(new DhcpOption53(DhcpPacket.MessageType.DHCPACK)); this.dhcpoptions_.Add(new DhcpOption(54, item.server_identifier_)); this.dhcpoptions_.Add(new DhcpOption(51, item.lease_time_)); // 任意 if (dhcpoption55.parameter_request_list_ != null) { foreach (byte b in dhcpoption55.parameter_request_list_) { switch (b) { case 1: this.dhcpoptions_.Add(new DhcpOption(1, item.subnet_mask_)); break; case 3: this.dhcpoptions_.Add(new DhcpOption(3, item.router_)); break; case 6: this.dhcpoptions_.Add(new DhcpOption(6, item.domain_name_server_)); break; case 58: this.dhcpoptions_.Add(new DhcpOption(58, item.renewal_time_)); break; case 59: this.dhcpoptions_.Add(new DhcpOption(59, item.rebinding_time_)); break; default: break; } } } // 必須(最後必ず) this.dhcpoptions_.Add(new DhcpOption(255)); }
private void BuildDHCPACK(DhcpPacket basePacket, DhcpLeases dhcplease) { DhcpLeaseItem item = dhcplease.GetItem(basePacket.chaddr_); this.op_ = OP.BOOTREPLY; this.htype_ = basePacket.htype_; this.hlen_ = basePacket.hlen_; this.xid_ = basePacket.xid_; this.ciaddr_ = basePacket.ciaddr_; this.yiaddr_ = item.yiaddr_; this.siaddr_ = new IPAddress(0); // 仮 this.giaddr_ = basePacket.giaddr_; this.chaddr_ = basePacket.chaddr_; this.options_ = new DhcpOptions( DhcpPacket.MessageType.DHCPACK, basePacket.chaddr_, basePacket.dhcpoption55_, dhcplease ); }