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

Method send

src/network.js:355–372  ·  view source on GitHub ↗
(payload, proto)

Source from the content-addressed store, hash-verified

353
354 // Called internally when we want to send a frame TO the VM
355 send(payload, proto) {
356 if (!this.vmMac) return;
357
358 const frame = Buffer.alloc(14 + payload.length);
359 this.vmMac.copy(frame, 0);
360 this.gatewayMac.copy(frame, 6);
361 frame.writeUInt16BE(proto, 12);
362 payload.copy(frame, 14);
363
364 // Wrap in QEMU framing
365 const header = Buffer.alloc(4);
366 header.writeUInt32BE(frame.length, 0);
367
368 this.txBuffer = Buffer.concat([this.txBuffer, header, frame]);
369
370 this.emit('tx', frame); // For testing/debug
371 this.emit('network-activity'); // Notify worker to wake up poll
372 }
373
374 // Send to broadcast MAC (for DHCP etc)
375 sendBroadcast(payload, proto) {

Callers 4

handleARPMethod · 0.95
sendIPMethod · 0.95
stack.test.jsFile · 0.80
_handleUdpSendMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected