Function receive [src]

Receives a packet from a network interface.

Prototype

pub fn receive(self: *SimpleNetwork, buffer: []u8) ReceiveError!Packet

Parameters

self: *SimpleNetworkbuffer: []u8

Possible Errors

BufferTooSmall
DeviceError
InvalidParameter
NotReady
NotStarted
Unexpected UnexpectedError

Source

pub fn receive(self: *SimpleNetwork, buffer: []u8) ReceiveError!Packet { var packet: Packet = undefined; packet.buffer = buffer; switch (self._receive( self, &packet.header_size, &packet.buffer.len, packet.buffer.ptr, &packet.src_addr, &packet.dst_addr, &packet.protocol, )) { .success => return packet, .not_started => return Error.NotStarted, .not_ready => return Error.NotReady, .buffer_too_small => return Error.BufferTooSmall, .invalid_parameter => return Error.InvalidParameter, .device_error => return Error.DeviceError, else => |status| return uefi.unexpectedStatus(status), } }