(payload, proto)
| 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) { |
no outgoing calls
no test coverage detected