All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scodec.protocols.pcap.Record.scala Maven / Gradle / Ivy

The newest version!
package scodec.protocols.pcap

import scodec.bits.{ BitVector, ByteOrdering }
import scodec.Codec
import scodec.codecs._

case class Record(
  header: RecordHeader,
  data: BitVector)

object Record {
  implicit def codec(implicit ordering: ByteOrdering): Codec[Record] = "record" | {
    ("record_header" | Codec[RecordHeader]               ) >>:~ { hdr =>
    ("record_data"   | bits(hdr.includedLength.toInt * 8L) ).hlist
  }}.as[Record]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy