//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void sendDHCPReply(pspsharp.network.protocols.EtherFrame frame, pspsharp.network.protocols.IPv4 ipv4, pspsharp.network.protocols.UDP udp, pspsharp.network.protocols.DHCP dhcp, int messageType) throws java.io.EOFException private void sendDHCPReply(EtherFrame frame, IPv4 ipv4, UDP udp, DHCP dhcp, int messageType) { // Send back a DHCP offer message EtherFrame answerFrame = new EtherFrame(frame); answerFrame.swapSourceAndDestination(); answerFrame.srcMac = MacAddress; IPv4 answerIPv4 = new IPv4(ipv4); answerIPv4.sourceIPAddress = IpAddress; answerIPv4.timeToLive--; // When a packet arrives at a router, the router decreases the TTL FieldInfo. UDP answerUdp = new UDP(udp); answerUdp.swapSourceAndDestination(); DHCP answerDhcp = new DHCP(dhcp); answerDhcp.opcode = DHCP_BOOT_REPLY; answerDhcp.yourIPAddress = LocalIpAddress; answerDhcp.nextServerIPAddress = IpAddress; answerDhcp.clearOptions(); // The DHCP message type answerDhcp.addOption(new DHCP.DHCPOption(DHCP.DHCP_OPTION_MESSAGE_TYPE, (sbyte)messageType)); // The subnet mask answerDhcp.addOption(new DHCP.DHCPOption(DHCP.DHCP_OPTION_SUBNET_MASK, getIpAddress(sceNetApctl.SubnetMaskInt))); // The only router is myself answerDhcp.addOption(new DHCP.DHCPOption(DHCP.DHCP_OPTION_ROUTER, IpAddress)); // The IP address lease time is forever answerDhcp.addOption(new DHCP.DHCPOption(DHCP.DHCP_OPTION_IP_ADDRESS_LEASE_TIME, int.MaxValue)); // The DHCP server identification is myself answerDhcp.addOption(new DHCP.DHCPOption(DHCP.DHCP_OPTION_SERVER_IDENTIFIER, IpAddress)); // The only DNS server is myself answerDhcp.addOption(new DHCP.DHCPOption(DHCP.DHCP_OPTION_DNS, IpAddress)); // The broadcast address answerDhcp.addOption(new DHCP.DHCPOption(DHCP.DHCP_OPTION_BROADCAST_ADDRESS, DHCP.broadcastIPAddress)); // Update lengths and checksums answerUdp.Length = answerUdp.sizeOf() + answerDhcp.sizeOf(); answerUdp.computeChecksum(); answerIPv4.totalLength = answerIPv4.sizeOf() + answerUdp.Length; answerIPv4.computeChecksum(); // Write the different headers in sequence NetPacket answerPacket = new NetPacket(BUFFER_SIZE); answerFrame.write(answerPacket); answerIPv4.write(answerPacket); answerUdp.write(answerPacket); answerDhcp.write(answerPacket); //if (log.DebugEnabled) { Console.WriteLine(string.Format("sendDHCPReply frame={0}", answerFrame)); Console.WriteLine(string.Format("sendDHCPReply IPv4={0}", answerIPv4)); Console.WriteLine(string.Format("sendDHCPReply UDP={0}", answerUdp)); Console.WriteLine(string.Format("sendDHCPReply messageType={0:D}, DHCP={1}", messageType, answerDhcp)); } sendPacket(answerPacket); }