public void Use(Parser <H, M> p, VerifyChecksum <H, M> vr, Ingress <H, M> ig, Egress <H, M> eg, ComputeChecksum <H, M> ck, Deparser <H> dep) { this.p = p; this.vr = vr; this.ig = ig; this.eg = eg; this.ck = ck; this.dep = dep; }
public void ComputesFileChecksum(string algoritm, string hash) { var task = new ComputeChecksum { File = Path.Combine(AppContext.BaseDirectory, "TestResources", "lorem.bin"), BuildEngine = new MockEngine(), Algorithm = algoritm, }; Assert.True(task.Execute(), "Task should pass"); Assert.Equal(hash, task.Hash); }
public void Execute(object parameter) { if (parameter != null && parameter is string) { try { var computeChecksum = new ComputeChecksum(); var fileContent = FileHelpers.ReadFileToEnd(parameter as string); checksumDetailsVM.ActualChecksum = computeChecksum.CheckChecksum(checksumDetailsVM.ChecksumModel.ChecksumType, fileContent); } catch (Exception ex) { } } }
public packet_out ProcessPacket(byte[] packet, Parser <H, M> p, VerifyChecksum <H, M> vr, Ingress <H, M> ig, Egress <H, M> eg, ComputeChecksum <H, M> ck, Deparser <H> dep) { H hdr = default(H); M meta = default(M); standard_metadata_t smeta = new standard_metadata_t(); try { p.apply(new packet_in(packet), out hdr, meta, ref meta, smeta, ref smeta); } catch (P4Exception ex) { Console.Error.WriteLine("P4 exception. V1Model not sure how to give to remainder of pipeline."); Console.Error.WriteLine(ex.Error); } vr.apply(hdr, meta, ref meta); ig.apply(hdr, ref hdr, meta, ref meta, smeta, ref smeta); eg.apply(hdr, ref hdr, meta, ref meta, smeta, ref smeta); ck.apply(hdr, ref hdr, meta, ref meta); packet_out po = new packet_out(smeta); dep.apply(po, hdr); // TODO do something with the result return(po); }