MCPcopy Create free account
hub / github.com/deepclause/agentvm / receive

Method receive

src/network.js:393–413  ·  view source on GitHub ↗
(frame)

Source from the content-addressed store, hash-verified

391 }
392
393 receive(frame) {
394 try {
395 if (frame.length < 14) return;
396 const etherType = frame.readUInt16BE(12);
397 const payload = frame.subarray(14);
398
399 // Learn VM MAC
400 const srcMac = frame.subarray(6, 12);
401 if (!this.vmMac) {
402 this.vmMac = Buffer.from(srcMac);
403 }
404
405 if (etherType === ETH_P_ARP) {
406 this.handleARP(payload);
407 } else if (etherType === ETH_P_IP) {
408 this.handleIP(payload);
409 }
410 } catch(err) {
411 this.emit('error', err);
412 }
413 }
414
415 handleARP(packet) {
416 // Simple ARP Reply

Callers 2

writeToNetworkMethod · 0.95
stack.test.jsFile · 0.80

Calls 2

handleARPMethod · 0.95
handleIPMethod · 0.95

Tested by

no test coverage detected