90 |
|
|
91 |
|
|
92 |
|
/* |
93 |
+ |
* Remove all protocols |
94 |
+ |
*/ |
95 |
+ |
|
96 |
+ |
static void remove_all_protocols(void) |
97 |
+ |
{ |
98 |
+ |
NetProtocol *p; |
99 |
+ |
while ((p = (NetProtocol *)prot_list.RemoveItem((long)0)) != NULL) |
100 |
+ |
delete p; |
101 |
+ |
} |
102 |
+ |
|
103 |
+ |
|
104 |
+ |
/* |
105 |
|
* Initialization |
106 |
|
*/ |
107 |
|
|
260 |
|
delete_area(buffer_area); |
261 |
|
|
262 |
|
// Remove all protocols |
263 |
< |
NetProtocol *p; |
252 |
< |
while ((p = (NetProtocol *)prot_list.RemoveItem((long)0)) != NULL) |
253 |
< |
delete p; |
263 |
> |
remove_all_protocols(); |
264 |
|
} |
265 |
|
} |
266 |
|
|
271 |
|
|
272 |
|
void EtherReset(void) |
273 |
|
{ |
274 |
< |
// Remove all protocols |
265 |
< |
NetProtocol *p; |
266 |
< |
while ((p = (NetProtocol *)prot_list.RemoveItem((long)0)) != NULL) |
267 |
< |
delete p; |
274 |
> |
remove_all_protocols(); |
275 |
|
} |
276 |
|
|
277 |
|
|
281 |
|
|
282 |
|
int16 ether_add_multicast(uint32 pb) |
283 |
|
{ |
277 |
– |
uint8 *addr = Mac2HostAddr(pb + eMultiAddr); |
284 |
|
net_packet *p = &net_buffer_ptr->write[wr_pos]; |
285 |
|
if (p->cmd & IN_USE) { |
286 |
|
D(bug("WARNING: Couldn't enable multicast address\n")); |
287 |
|
} else { |
288 |
< |
memcpy(p->data, addr, 6); |
288 |
> |
Mac2Host_memcpy(p->data, pb + eMultiAddr, 6); |
289 |
|
p->length = 6; |
290 |
|
p->cmd = IN_USE | (ADD_MULTICAST << 8); |
291 |
|
wr_pos = (wr_pos + 1) % WRITE_PACKET_COUNT; |
301 |
|
|
302 |
|
int16 ether_del_multicast(uint32 pb) |
303 |
|
{ |
298 |
– |
uint8 *addr = Mac2HostAddr(pb + eMultiAddr); |
304 |
|
net_packet *p = &net_buffer_ptr->write[wr_pos]; |
305 |
|
if (p->cmd & IN_USE) { |
306 |
|
D(bug("WARNING: Couldn't enable multicast address\n")); |
307 |
|
} else { |
308 |
< |
memcpy(p->data, addr, 6); |
308 |
> |
Mac2Host_memcpy(p->data, pb + eMultiAddr, 6); |
309 |
|
p->length = 6; |
310 |
|
p->cmd = IN_USE | (REMOVE_MULTICAST << 8); |
311 |
|
wr_pos = (wr_pos + 1) % WRITE_PACKET_COUNT; |
370 |
|
int len = ReadMacInt16(wds); |
371 |
|
if (len == 0) |
372 |
|
break; |
373 |
< |
memcpy(bp, Mac2HostAddr(ReadMacInt32(wds + 2)), len); |
373 |
> |
Mac2Host_memcpy(bp, ReadMacInt32(wds + 2), len); |
374 |
|
bp += len; |
375 |
|
wds += 6; |
376 |
|
} |
446 |
|
goto next; |
447 |
|
|
448 |
|
// Copy header to RHA |
449 |
< |
memcpy(Mac2HostAddr(ether_data + ed_RHA), p->data, 14); |
449 |
> |
Host2Mac_memcpy(ether_data + ed_RHA, p->data, 14); |
450 |
|
D(bug(" header %08lx%04lx %08lx%04lx %04lx\n", ReadMacInt32(ether_data + ed_RHA), ReadMacInt16(ether_data + ed_RHA + 4), ReadMacInt32(ether_data + ed_RHA + 6), ReadMacInt16(ether_data + ed_RHA + 10), ReadMacInt16(ether_data + ed_RHA + 12))); |
451 |
|
|
452 |
|
// Call protocol handler |