mirror of https://github.com/PCSX2/pcsx2.git
DEV9: Add IP_Address helpers to NetLib
This commit is contained in:
parent
9b3b8aa4de
commit
095757044a
|
@ -23,6 +23,8 @@
|
|||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
using namespace PacketReader::IP;
|
||||
|
||||
namespace PacketReader::NetLib
|
||||
{
|
||||
void WriteByte08(u8* data, int* index, u8 value)
|
||||
|
@ -42,6 +44,11 @@ namespace PacketReader::NetLib
|
|||
}
|
||||
|
||||
//Special
|
||||
void WriteIPAddress(u8* data, int* index, IP_Address value)
|
||||
{
|
||||
*(IP_Address*)&data[*index] = value;
|
||||
*index += sizeof(IP_Address);
|
||||
}
|
||||
void WriteByteArray(u8* data, int* index, int length, u8* value)
|
||||
{
|
||||
memcpy(&data[*index], value, length);
|
||||
|
@ -67,6 +74,11 @@ namespace PacketReader::NetLib
|
|||
}
|
||||
|
||||
//Special
|
||||
void ReadIPAddress(u8* data, int* index, IP_Address* value)
|
||||
{
|
||||
*value = *(IP_Address*)&data[*index];
|
||||
*index += sizeof(IP_Address);
|
||||
}
|
||||
void ReadByteArray(u8* data, int* index, int length, u8* value)
|
||||
{
|
||||
memcpy(value, &data[*index], length);
|
||||
|
|
|
@ -15,17 +15,21 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "DEV9/PacketReader/IP/IP_Address.h"
|
||||
|
||||
namespace PacketReader::NetLib
|
||||
{
|
||||
void WriteByte08(u8* data, int* index, u8 value);
|
||||
void WriteUInt16(u8* data, int* index, u16 value);
|
||||
void WriteUInt32(u8* data, int* index, u32 value);
|
||||
|
||||
void WriteIPAddress(u8* data, int* index, PacketReader::IP::IP_Address value);
|
||||
void WriteByteArray(u8* data, int* index, int length, u8* value);
|
||||
|
||||
void ReadByte08(u8* data, int* index, u8* value);
|
||||
void ReadUInt16(u8* data, int* index, u16* value);
|
||||
void ReadUInt32(u8* data, int* index, u32* value);
|
||||
|
||||
void ReadIPAddress(u8* data, int* index, PacketReader::IP::IP_Address* value);
|
||||
void ReadByteArray(u8* data, int* index, int length, u8* value);
|
||||
} // namespace PacketReader::NetLib
|
||||
|
|
Loading…
Reference in New Issue