1# -*- coding: utf-8 -*-
2"""ATA over Ethernet ATA command"""
3from __future__ import print_function
4from __future__ import absolute_import
5
6from . import dpkt
7
8
9class AOECFG(dpkt.Packet):
10    """ATA over Ethernet ATA command.
11
12    See more about the AOE on \
13    https://en.wikipedia.org/wiki/ATA_over_Ethernet
14
15    Attributes:
16        __hdr__: Header fields of AOECFG.
17        data: Message data.
18    """
19
20    __hdr__ = (
21        ('bufcnt', 'H', 0),
22        ('fwver', 'H', 0),
23        ('scnt', 'B', 0),
24        ('aoeccmd', 'B', 0),
25        ('cslen', 'H', 0),
26    )
27
28
29def test_aoecfg():
30    s = (b'\x01\x02\x03\x04\x05\x06\x11\x12\x13\x14\x15\x16\x88\xa2\x10\x00\x00\x01\x02\x01\x80'
31         b'\x00\x00\x00\x12\x34\x00\x00\x00\x00\x04\x00' + b'\0xed' * 1024)
32    aoecfg = AOECFG(s[14 + 10:])
33    assert (aoecfg.bufcnt == 0x1234)
34