l2_packet_init - Initialize l2_packet interface : Interface name : Optional own MAC address if available from driver interface or NULL if not available in host byte order : Callback function that will be called for each received packet : Callback data (ctx) for calls to rx_callback() : 1 = include layer 2 header, 0 = do not include header Returns: Pointer to internal data or NULL on failure
rx_callback function will be called with src_addr pointing to the source address (MAC address) of the the packet. If l2_hdr is set to 0, buf points to len bytes of the payload after the layer 2 header and similarly, TX buffers start with payload. This behavior can be changed by setting l2_hdr=1 to include the layer 2 header in the data buffer.