for( i = giRegisteredTypes; i -- ; )
{
if(gaRegisteredTypes[i].Type == Type) {
- Warning("[NET ] Attempt to register 0x%x twice", Type);
+ Log_Warning("NET", "Attempt to register 0x%x twice", Type);
return ;
}
// Ooh! Free slot!
{
tmp = realloc(gaRegisteredTypes, (giRegisteredTypes+1)*sizeof(*gaRegisteredTypes));
if(!tmp) {
- Warning("[NET ] Out of heap space!");
+ Log_Warning("NET",
+ "Out of heap space! (Attempted to allocate %i)",
+ (giRegisteredTypes+1)*sizeof(*gaRegisteredTypes)
+ );
return ;
}
i = giRegisteredTypes;
Uint8 buf[bufSize]; // dynamic stack arrays ftw!
tEthernetHeader *hdr = (void*)buf;
- Log("[NET ] Sending %i bytes to %02x:%02x:%02x:%02x:%02x:%02x (Type 0x%x)",
+ Log_Log("NET", "Sending %i bytes to %02x:%02x:%02x:%02x:%02x:%02x (Type 0x%x)",
Length, To.B[0], To.B[1], To.B[2], To.B[3], To.B[4], To.B[5], Type);
hdr->Dest = To;
int tid = Proc_SpawnWorker(); // Create a new worker thread
if(tid < 0) {
- Warning("[NET ] Unable to create watcher thread for '%s'", Adapter->Device);
+ Log_Warning("NET", "Unable to create watcher thread for '%s'", Adapter->Device);
return ;
}
if(tid > 0) {
- Log("[NET ] Watching '%s' using tid %i", Adapter->Device, tid);
+ Log_Log("NET", "Watching '%s' using tid %i", Adapter->Device, tid);
return ;
}
if(ret == -1) break;
if(ret <= sizeof(tEthernetHeader)) {
- Log("[NET ] Recieved an undersized packet");
+ Log_Log("NET", "Recieved an undersized packet");
continue;
}
- Log("[NET ] Packet from %02x:%02x:%02x:%02x:%02x:%02x",
+ Log_Log("NET", "Packet from %02x:%02x:%02x:%02x:%02x:%02x",
hdr->Src.B[0], hdr->Src.B[1], hdr->Src.B[2],
hdr->Src.B[3], hdr->Src.B[4], hdr->Src.B[5]
);
- Log("[NET ] to %02x:%02x:%02x:%02x:%02x:%02x",
+ Log_Log("NET", "to %02x:%02x:%02x:%02x:%02x:%02x",
hdr->Dest.B[0], hdr->Dest.B[1], hdr->Dest.B[2],
hdr->Dest.B[3], hdr->Dest.B[4], hdr->Dest.B[5]
);
checksum = *(Uint32*)&hdr->Data[ret-sizeof(tEthernetHeader)-4];
- Log("[NET ] Checksum 0x%08x", checksum);
+ Log_Log("NET", "Checksum 0x%08x", checksum);
// Check if there is a registered callback for this packet type
for( i = giRegisteredTypes; i--; )
}
// No? Ignore it
if( i == -1 ) {
- Log("[NET ] Unregistered type 0x%x", ntohs(hdr->Type));
+ Log_Log("NET", "Unregistered type 0x%x", ntohs(hdr->Type));
continue;
}
);
}
- Log("[NET ] Watcher terminated (file closed)");
+ Log_Log("NET", "Watcher terminated (file closed)");
+
+ Threads_Exit(0, 0);
}
// From http://www.cl.cam.ac.uk/research/srg/bluebook/21/crc/node6.html