mirror of https://github.com/PCSX2/pcsx2.git
DEV9: Make use of WriteIPAddress
This commit is contained in:
parent
095757044a
commit
b386f78d68
|
@ -107,9 +107,9 @@ namespace PacketReader::IP
|
|||
NetLib::ReadUInt16(buffer, &offset, &checksum);
|
||||
|
||||
//Bits 96-127
|
||||
NetLib::ReadByteArray(buffer, &offset, 4, (u8*)&sourceIP);
|
||||
NetLib::ReadIPAddress(buffer, &offset, &sourceIP);
|
||||
//Bits 128-159
|
||||
NetLib::ReadByteArray(buffer, &offset, 4, (u8*)&destinationIP);
|
||||
NetLib::ReadIPAddress(buffer, &offset, &destinationIP);
|
||||
|
||||
//Bits 160+
|
||||
if (headerLength > 20) //IP options (if any)
|
||||
|
@ -194,8 +194,8 @@ namespace PacketReader::IP
|
|||
NetLib::WriteByte08(buffer, offset, protocol);
|
||||
NetLib::WriteUInt16(buffer, offset, checksum); //header csum
|
||||
|
||||
NetLib::WriteByteArray(buffer, offset, 4, (u8*)&sourceIP);
|
||||
NetLib::WriteByteArray(buffer, offset, 4, (u8*)&destinationIP);
|
||||
NetLib::WriteIPAddress(buffer, offset, sourceIP);
|
||||
NetLib::WriteIPAddress(buffer, offset, destinationIP);
|
||||
|
||||
//options
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
|
@ -243,8 +243,8 @@ namespace PacketReader::IP
|
|||
NetLib::WriteByte08(headerSegment, &counter, protocol);
|
||||
NetLib::WriteUInt16(headerSegment, &counter, 0); //header csum
|
||||
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&sourceIP);
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&destinationIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, sourceIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, destinationIP);
|
||||
|
||||
//options
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
|
@ -276,8 +276,8 @@ namespace PacketReader::IP
|
|||
NetLib::WriteByte08(headerSegment, &counter, protocol);
|
||||
NetLib::WriteUInt16(headerSegment, &counter, checksum); //header csum
|
||||
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&sourceIP);
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&destinationIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, sourceIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, destinationIP);
|
||||
|
||||
//options
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
|
|
|
@ -263,8 +263,8 @@ namespace PacketReader::IP::TCP
|
|||
u8* headerSegment = new u8[pHeaderLen];
|
||||
int counter = 0;
|
||||
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&srcIP);
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&dstIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, srcIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, dstIP);
|
||||
NetLib::WriteByte08(headerSegment, &counter, 0);
|
||||
NetLib::WriteByte08(headerSegment, &counter, (u8)protocol);
|
||||
NetLib::WriteUInt16(headerSegment, &counter, GetLength());
|
||||
|
@ -291,8 +291,8 @@ namespace PacketReader::IP::TCP
|
|||
u8* headerSegment = new u8[pHeaderLen];
|
||||
int counter = 0;
|
||||
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&srcIP);
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&dstIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, srcIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, dstIP);
|
||||
NetLib::WriteByte08(headerSegment, &counter, 0);
|
||||
NetLib::WriteByte08(headerSegment, &counter, (u8)protocol);
|
||||
NetLib::WriteUInt16(headerSegment, &counter, GetLength());
|
||||
|
|
|
@ -27,13 +27,13 @@ namespace PacketReader::IP::UDP::DHCP
|
|||
DHCPopSubnet::DHCPopSubnet(u8* data, int offset)
|
||||
{
|
||||
offset += 2;
|
||||
NetLib::ReadByteArray(data, &offset, 4, (u8*)&subnetMask);
|
||||
NetLib::ReadIPAddress(data, &offset, &subnetMask);
|
||||
}
|
||||
void DHCPopSubnet::WriteBytes(u8* buffer, int* offset)
|
||||
{
|
||||
NetLib::WriteByte08(buffer, offset, GetCode());
|
||||
NetLib::WriteByte08(buffer, offset, GetLength() - 2);
|
||||
NetLib::WriteByteArray(buffer, offset, 4, (u8*)&subnetMask);
|
||||
NetLib::WriteIPAddress(buffer, offset, subnetMask);
|
||||
}
|
||||
|
||||
DHCPopRouter::DHCPopRouter(const std::vector<IP_Address>& routerIPs)
|
||||
|
@ -137,14 +137,14 @@ namespace PacketReader::IP::UDP::DHCP
|
|||
DHCPopBCIP::DHCPopBCIP(u8* data, int offset)
|
||||
{
|
||||
offset += 2;
|
||||
NetLib::ReadByteArray(data, &offset, 4, (u8*)&broadcastIP);
|
||||
NetLib::ReadIPAddress(data, &offset, &broadcastIP);
|
||||
}
|
||||
void DHCPopBCIP::WriteBytes(u8* buffer, int* offset)
|
||||
{
|
||||
NetLib::WriteByte08(buffer, offset, GetCode());
|
||||
NetLib::WriteByte08(buffer, offset, GetLength() - 2);
|
||||
|
||||
NetLib::WriteByteArray(buffer, offset, 4, (u8*)&broadcastIP);
|
||||
NetLib::WriteIPAddress(buffer, offset, broadcastIP);
|
||||
}
|
||||
|
||||
bool DHCPopNBIOSType::GetHNode()
|
||||
|
@ -228,14 +228,14 @@ namespace PacketReader::IP::UDP::DHCP
|
|||
DHCPopREQIP::DHCPopREQIP(u8* data, int offset)
|
||||
{
|
||||
offset += 2;
|
||||
NetLib::ReadByteArray(data, &offset, 4, (u8*)&requestedIP);
|
||||
NetLib::ReadIPAddress(data, &offset, &requestedIP);
|
||||
}
|
||||
void DHCPopREQIP::WriteBytes(u8* buffer, int* offset)
|
||||
{
|
||||
NetLib::WriteByte08(buffer, offset, GetCode());
|
||||
NetLib::WriteByte08(buffer, offset, GetLength() - 2);
|
||||
|
||||
NetLib::WriteByteArray(buffer, offset, 4, (u8*)&requestedIP);
|
||||
NetLib::WriteIPAddress(buffer, offset, requestedIP);
|
||||
}
|
||||
|
||||
DHCPopIPLT::DHCPopIPLT(u32 LeaseTime)
|
||||
|
@ -279,14 +279,14 @@ namespace PacketReader::IP::UDP::DHCP
|
|||
DHCPopSERVIP::DHCPopSERVIP(u8* data, int offset)
|
||||
{
|
||||
offset += 2;
|
||||
NetLib::ReadByteArray(data, &offset, 4, (u8*)&serverIP);
|
||||
NetLib::ReadIPAddress(data, &offset, &serverIP);
|
||||
}
|
||||
void DHCPopSERVIP::WriteBytes(u8* buffer, int* offset)
|
||||
{
|
||||
NetLib::WriteByte08(buffer, offset, GetCode());
|
||||
NetLib::WriteByte08(buffer, offset, GetLength() - 2);
|
||||
|
||||
NetLib::WriteByteArray(buffer, offset, 4, (u8*)&serverIP);
|
||||
NetLib::WriteIPAddress(buffer, offset, serverIP);
|
||||
}
|
||||
|
||||
DHCPopREQLIST::DHCPopREQLIST(const std::vector<u8>& requestList)
|
||||
|
|
|
@ -36,16 +36,16 @@ namespace PacketReader::IP::UDP::DHCP
|
|||
NetLib::ReadUInt16(buffer, &offset, &flags);
|
||||
|
||||
//Bits 96-127 //Bytes 12-15
|
||||
NetLib::ReadByteArray(buffer, &offset, 4, (u8*)&clientIP);
|
||||
NetLib::ReadIPAddress(buffer, &offset, &clientIP);
|
||||
|
||||
//Bits 128-159 //Bytes 16-19
|
||||
NetLib::ReadByteArray(buffer, &offset, 4, (u8*)&yourIP);
|
||||
NetLib::ReadIPAddress(buffer, &offset, &yourIP);
|
||||
|
||||
//Bits 160-191 //Bytes 20-23
|
||||
NetLib::ReadByteArray(buffer, &offset, 4, (u8*)&serverIP);
|
||||
NetLib::ReadIPAddress(buffer, &offset, &serverIP);
|
||||
|
||||
//Bits 192-223 //Bytes 24-27
|
||||
NetLib::ReadByteArray(buffer, &offset, 4, (u8*)&gatewayIP);
|
||||
NetLib::ReadIPAddress(buffer, &offset, &gatewayIP);
|
||||
|
||||
//Bits 192+ //Bytes 28-43
|
||||
NetLib::ReadByteArray(buffer, &offset, 16, clientHardwareAddress);
|
||||
|
@ -194,10 +194,10 @@ namespace PacketReader::IP::UDP::DHCP
|
|||
NetLib::WriteUInt16(buffer, offset, seconds);
|
||||
NetLib::WriteUInt16(buffer, offset, flags);
|
||||
|
||||
NetLib::WriteByteArray(buffer, offset, 4, (u8*)&clientIP);
|
||||
NetLib::WriteByteArray(buffer, offset, 4, (u8*)&yourIP);
|
||||
NetLib::WriteByteArray(buffer, offset, 4, (u8*)&serverIP);
|
||||
NetLib::WriteByteArray(buffer, offset, 4, (u8*)&gatewayIP);
|
||||
NetLib::WriteIPAddress(buffer, offset, clientIP);
|
||||
NetLib::WriteIPAddress(buffer, offset, yourIP);
|
||||
NetLib::WriteIPAddress(buffer, offset, serverIP);
|
||||
NetLib::WriteIPAddress(buffer, offset, gatewayIP);
|
||||
|
||||
NetLib::WriteByteArray(buffer, offset, 16, clientHardwareAddress);
|
||||
//empty bytes
|
||||
|
|
|
@ -93,8 +93,8 @@ namespace PacketReader::IP::UDP
|
|||
u8* headerSegment = new u8[pHeaderLen];
|
||||
int counter = 0;
|
||||
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&srcIP);
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&dstIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, srcIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, dstIP);
|
||||
NetLib::WriteByte08(headerSegment, &counter, 0);
|
||||
NetLib::WriteByte08(headerSegment, &counter, (u8)protocol);
|
||||
NetLib::WriteUInt16(headerSegment, &counter, GetLength());
|
||||
|
@ -120,8 +120,8 @@ namespace PacketReader::IP::UDP
|
|||
u8* headerSegment = new u8[pHeaderLen];
|
||||
int counter = 0;
|
||||
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&srcIP);
|
||||
NetLib::WriteByteArray(headerSegment, &counter, 4, (u8*)&dstIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, srcIP);
|
||||
NetLib::WriteIPAddress(headerSegment, &counter, dstIP);
|
||||
NetLib::WriteByte08(headerSegment, &counter, 0);
|
||||
NetLib::WriteByte08(headerSegment, &counter, (u8)protocol);
|
||||
NetLib::WriteUInt16(headerSegment, &counter, GetLength());
|
||||
|
|
Loading…
Reference in New Issue