Slide 26
Slide 26 text
パケット生成
case class BootpPacket(
bootpType: Short,
transactionId: Long,
yourClientIp: Inet4Address,
clientMac: MacAddress,
options: Seq[BootpOption]) {
def asBytes: Bytes =
Bytes(bootpType) ++ Bytes(0x01, 0x06, 0) ++
Bytes.fromLong(transactionId, size = 4) ++ Bytes.fill(8)(0) ++
Bytes(yourClientIp.getAddress) ++ Bytes.fill(8)(0) ++
Bytes(clientMac.getAddress) ++ Bytes.fill(10)(0) ++
Bytes.fill(64)(0) ++ Bytes.fill(128)(0) ++ Bytes(0x63, 0x82, 0x53, 0x63) ++
Bytes.concat(options.map(o => Bytes(o.optionType) ++ Bytes.fromLong(o.value.length,
Bytes(0xff)
}
26