eth addrLen Hops Trans UInt8 ~ BS(0x01, 0x06) ~ AnyByte ~ UInt32 ~ AnyBytes(8) ~ // ip mac address AnyBytes(4).! ~ AnyBytes(8) ~ UInt8.rep(exactly = 6) ~ AnyBytes(10) ~ // ServerHostName BootFileName Magic Cookie AnyBytes(64) ~ AnyBytes(128) ~ AnyBytes(4) ~ // options type(1) length(1) value(n) (Int8.filter(_ != ‐1) ~ Int8.flatMap(size => AnyBytes(size).!)) .map(x => BootpOption(x._1, x._2)) .rep ~ BS(0xff) // option end ).map(x => { BootpPacket( bootpType = x._1, transactionId = x._2, yourClientIp = ByteArrays.getInet4Address(x._3.toArray, 0), clientMac = MacAddress.getByAddress(x._4.map(_.toByte).toArray), options = x._5 ) }) 25