internal override void EnterEvent() { client.StartNewTransaction(); DhcpFormat dhcp = new DhcpFormat(DhcpFormat.MessageType.Discover); dhcp.TransactionID = client.TransactionID; dhcp.SetHardwareAddress(client.MacAddress); #if ADVERTISE_CLIENT_ID // Add Client Identifier for self // // [2006-02-03 ohodson] This is disabled because the Windows // DHCP server allocates us a different address with the // client id present if we networked booted. Thus having the // identifier breaks static DHCP entries which we use // for test machines. EthernetAddress macAddress = client.MacAddress; dhcp.AddOption(DhcpClientID.Create(macAddress.GetAddressBytes())); #endif // Add parameters we'd like to know about dhcp.AddOption(DhcpParameterRequest.Create( DhcpClient.StandardRequestParameters ) ); // dhcp.AddOption(DhcpAutoConfigure.Create(0)); client.Send(EthernetAddress.Broadcast, dhcp); client.ChangeState(new DhcpClientStateSelecting(client)); }
/////////////////////////////////////////////////////////////////////// // // Helper functions // internal void GetMacHiLow(out uint addr_low, out uint addr_hi, EthernetAddress mac) { byte[] macBytes = mac.GetAddressBytes(); addr_hi = (uint)((macBytes[5] << 8) | (macBytes[4])); addr_low = (uint)((macBytes[3] << 24) | (macBytes[2] << 16) | (macBytes[1] << 8) | (macBytes[0])); }