public static unsafe void Write48(byte[] arr, uint offset, bit48 value) { fixed(byte *p = &arr[offset]) { *((uint *)p) = (uint)value.Value; *((ushort *)(p + 4)) = (ushort)(value.Value >> 32); } }
public Set_smac_Action(EthernetAddress smac) : base(action_list.Set_smac) { this.smac = smac; }
//action Set_smac(EthernetAddress smac) // { headers.ethernet.srcAddr = smac; } private static void Set_smac(TopPipe_Args args, EthernetAddress smac) { args.headers.ethernet.srcAddr = smac; }
public Set_dmac_Action(EthernetAddress dmac) : base(action_list.Set_dmac) { this.dmac = dmac; }
//action Set_dmac(EthernetAddress dmac) //{ headers.ethernet.dstAddr = dmac; } private static void Set_dmac(TopPipe_Args args, EthernetAddress dmac) { args.headers.ethernet.dstAddr = dmac; }
// NOTE these methods aren't in the P4 - they are generated to help packet_in, etc. public override void Extract(byte[] data, uint offset) { dstAddr = BitHelper.Extract48(data, offset); srcAddr = BitHelper.Extract48(data, offset + 5); etherType = BitHelper.Extract16(data, offset + 10); }