Quick commit while I look at the Windows side

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3209 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1 2009-05-12 14:32:52 +00:00
parent f16d0d1998
commit ecfe86efe3
4 changed files with 71 additions and 27 deletions

View File

@ -18,6 +18,8 @@
#include "../Memmap.h" #include "../Memmap.h"
#include "../EXI_Device.h" #include "../EXI_Device.h"
#include "../EXI_DeviceEthernet.h" #include "../EXI_DeviceEthernet.h"
#include <sys/socket.h>
#include <netinet/in.h>
bool CEXIETHERNET::deactivate() bool CEXIETHERNET::deactivate()
{ {
return true; return true;
@ -36,3 +38,43 @@ bool CEXIETHERNET::activate() {
return false; return false;
//TODO: Activate Device! //TODO: Activate Device!
} }
bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
{
DEBUGPRINT( "Packet: 0x");
for(int a = 0; a < size; ++a)
{
DEBUGPRINT( "%02X", etherpckt[a]);
}
DEBUGPRINT( " : Size: %d\n", size);
int raw_socket = socket(AF_INET, SOCK_RAW, IPPROTO_TCP);
DEBUGPRINT("Raw socket is : %d\n", raw_socket);
int sm=1;
const int *val=&sm;
int result = setsockopt(raw_socket, IPPROTO_IP, IP_HDRINCL, val, sizeof(sm));
DEBUGPRINT("Result is : %d\n", result);
int numBytesWrit = write(raw_socket, etherpckt, size);
if(numBytesWrit != size)
{
DEBUGPRINT("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit);
return false;
}
//fwrite(etherpckt, size, size, raw_socket);
/*DWORD numBytesWrit;
OVERLAPPED overlap;
ZERO_OBJECT(overlap);
//overlap.hEvent = mHRecvEvent;
TGLE(WriteFile(mHAdapter, etherpckt, size, &numBytesWrit, &overlap));
if(numBytesWrit != size)
{
DEGUB("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit);
FAIL(UE_BBA_ERROR);
}*/
recordSendComplete();
//exit(0);
return true;
}
bool CEXIETHERNET::handleRecvdPacket()
{
DEBUGPRINT(" Handle received Packet!\n");
exit(0);
}

View File

@ -37,3 +37,31 @@ bool CEXIETHERNET::activate() {
return false; return false;
//TODO: Activate Device! //TODO: Activate Device!
} }
bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
{
DEBUGPRINT( "Packet: 0x");
for(int a = 0; a < size; ++a)
{
DEBUGPRINT( "%02X", etherpckt[a]);
}
DEBUGPRINT( " : Size: %d\n", size);
//fwrite(etherpckt, size, size, raw_socket);
/*DWORD numBytesWrit;
OVERLAPPED overlap;
ZERO_OBJECT(overlap);
//overlap.hEvent = mHRecvEvent;
TGLE(WriteFile(mHAdapter, etherpckt, size, &numBytesWrit, &overlap));
if(numBytesWrit != size)
{
DEGUB("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit);
FAIL(UE_BBA_ERROR);
}*/
recordSendComplete();
//exit(0);
return true;
}
bool CEXIETHERNET::handleRecvdPacket()
{
DEBUGPRINT(" Handle received Packet!\n");
exit(0);
}

View File

@ -133,33 +133,6 @@ void CEXIETHERNET::recordSendComplete()
mPacketsSent++; mPacketsSent++;
} }
bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
{
DEBUGPRINT( "Packet: 0x");
for(int a = 0; a < size; ++a)
{
DEBUGPRINT( "%02X", etherpckt[a]);
}
DEBUGPRINT( " : Size: %d\n", size);
/*DWORD numBytesWrit;
OVERLAPPED overlap;
ZERO_OBJECT(overlap);
//overlap.hEvent = mHRecvEvent;
TGLE(WriteFile(mHAdapter, etherpckt, size, &numBytesWrit, &overlap));
if(numBytesWrit != size)
{
DEGUB("BBA sendPacket %i only got %i bytes sent!\n", size, numBytesWrit);
FAIL(UE_BBA_ERROR);
}*/
recordSendComplete();
//exit(0);
return true;
}
bool CEXIETHERNET::handleRecvdPacket()
{
DEBUGPRINT(" Handle received Packet!\n");
exit(0);
}
bool CEXIETHERNET::checkRecvBuffer() bool CEXIETHERNET::checkRecvBuffer()
{ {
if(mRecvBufferLength != 0) if(mRecvBufferLength != 0)

View File

@ -18,6 +18,7 @@
#ifndef _EXIDEVICE_ETHERNET_H #ifndef _EXIDEVICE_ETHERNET_H
#define _EXIDEVICE_ETHERNET_H #define _EXIDEVICE_ETHERNET_H
void DEBUGPRINT (const char * format, ...);
class WriteBuffer { class WriteBuffer {
public: public:
WriteBuffer(u32 s) :_size(0) { _buffer = (u8*)malloc(s*sizeof(u8)); ucapacity = s;} WriteBuffer(u32 s) :_size(0) { _buffer = (u8*)malloc(s*sizeof(u8)); ucapacity = s;}