// Extract the frame from NetFPGA_Data into a byte array. public static void Get_Frame(NetFPGA_Data src, ref byte[] dst) { // FIXME we don't check the bounds of dst. // FIXME we don't null unused locations in dst. int offset = 0; for (int i = 0; i < src.tdata.Length; i++) { byte[] bs = BitConverter.GetBytes(src.tdata[i]); for (int j = 0; j < bs.Length; j++) { if (src.tlast[i] && NetFPGA.to_keep(src, i) > j) { break; } dst[offset] = bs[j]; offset++; } if (src.tlast[i]) { break; } } }
// FIXME this function could be inlined at compile time, since the // surrounding functions are boilerplate. /*override*/ protected void Functor() { //Extract in_port and packet from NetFPGA_Data, and call the function //NOTE casting from uint to int int in_port = (int)NetFPGA.Read_Input_Port(dataplane); // FIXME currently we don't extract packet Hub /*FIXME currently hardcoded to Hub*/.process_packet((byte)in_port); /*FIXME WIP * //Update NetFPGA_Data with packet and out_port * // FIXME currently we don't update packet * for (int ofs = 0; ofs < no_interfaces; ofs++) * { * if ((forward ^ 1L) == 0L) * { * NetFPGA.Set_Output_Port (ref dataplane, (ulong)(no_interfaces - ofs)); * } * * forward = forward >> 1; * } */ }