#
#  Test vectors for DHCP attributes
#
proto dhcpv4
proto-dictionary dhcpv4
fuzzer-out dhcpv4

#
#  DHCP TLV types
#
encode-pair Relay-Agent-Information.Circuit-Id = 0xabcdef, Relay-Agent-Information.Remote-Id = 0x010203040506
match 52 0d 01 03 ab cd ef 02 06 01 02 03 04 05 06

decode-pair -
match Relay-Agent-Information = { Circuit-Id = 0xabcdef, Remote-Id = 0x010203040506 }

#
#  And then again as nested pairs
#
encode-pair Relay-Agent-Information = { Circuit-Id = 0xabcdef, Remote-Id = 0x010203040506 }
match 52 0d 01 03 ab cd ef 02 06 01 02 03 04 05 06

encode-pair Subnet-Mask = 255.255.0.0
match 01 04 ff ff 00 00

decode-pair -
match Subnet-Mask = 255.255.0.0

# Packing multiple fixed length attributes
encode-pair CAPWAP-AC-IPv4-Address = 127.0.0.1, CAPWAP-AC-IPv4-Address = 192.168.3.1
match 8a 08 7f 00 00 01 c0 a8 03 01

# Overflow with multiple fixed length attributes (16x16)
encode-pair ANDSF-IPv6-Address = fe80::1, ANDSF-IPv6-Address = fe80::2, ANDSF-IPv6-Address = fe80::3, ANDSF-IPv6-Address = fe80::4, ANDSF-IPv6-Address = fe80::5, ANDSF-IPv6-Address = fe80::6, ANDSF-IPv6-Address = fe80::7, ANDSF-IPv6-Address = fe80::8, ANDSF-IPv6-Address = fe80::9, ANDSF-IPv6-Address = fe80::a, ANDSF-IPv6-Address = fe80::b, ANDSF-IPv6-Address = fe80::c, ANDSF-IPv6-Address = fe80::d, ANDSF-IPv6-Address = fe80::e, ANDSF-IPv6-Address = fe80::f, ANDSF-IPv6-Address = fe80::10

match 8f ff fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 01 fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 02 fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 03 fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 04 fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 05 fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 06 fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 07 fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 08 fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 09 fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 0a fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 0b fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 0c fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 0d fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 0e fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 0f fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 8f 01 10

decode-pair -
match ANDSF-IPv6-Address = fe80::1, ANDSF-IPv6-Address = fe80::2, ANDSF-IPv6-Address = fe80::3, ANDSF-IPv6-Address = fe80::4, ANDSF-IPv6-Address = fe80::5, ANDSF-IPv6-Address = fe80::6, ANDSF-IPv6-Address = fe80::7, ANDSF-IPv6-Address = fe80::8, ANDSF-IPv6-Address = fe80::9, ANDSF-IPv6-Address = fe80::a, ANDSF-IPv6-Address = fe80::b, ANDSF-IPv6-Address = fe80::c, ANDSF-IPv6-Address = fe80::d, ANDSF-IPv6-Address = fe80::e, ANDSF-IPv6-Address = fe80::f, ANDSF-IPv6-Address = fe80::10

#
#  A long one... with a weird specific vendor ID.
#
decode-pair 3501013d0701001ceaadac1e37070103060f2c2e2f3c094d5346545f495054565232011c4c41424f4c54322065746820312f312f30312f30312f31302f312f3209120000197f0d050b4c4142373336304f4c5432
match Message-Type = ::Discover, Client-Identifier = 0x01001ceaadac1e, Parameter-Request-List = ::Subnet-Mask, Parameter-Request-List = ::Router-Address, Parameter-Request-List = ::Domain-Name-Server, Parameter-Request-List = ::Domain-Name, Parameter-Request-List = ::NETBIOS-Name-Servers, Parameter-Request-List = ::NETBIOS-Node-Type, Parameter-Request-List = ::NETBIOS, Vendor-Class-Identifier = 0x4d5346545f49505456, Relay-Agent-Information = { Circuit-Id = 0x4c41424f4c54322065746820312f312f30312f30312f31302f312f32, Vendor-Specific-Information = 0x0000197f0d050b4c4142373336304f4c5432 }

#
#  Two sub-options 82, that cannot fit in a single option.
#
encode-pair Relay-Agent-Information.Circuit-Id = 'oh hai this is an agent, how are you doing DHCP server? this is a really long agent circuit id, which will occupy most of the maximum size for an option so that the next sub option will not fit and a new option will be needed', Relay-Agent-Information.Remote-Id = 'trying to add a sub option agent remote id'

#match 52 e3 01 e1 6f 68 20 68 61 69 20 74 68 69 73 20 69 73 20 61 6e 20 61 67 65 6e 74 2c 20 68 6f 77 20 61 72 65 20 79 6f 75 20 64 6f 69 6e 67 20 44 48 43 50 20 73 65 72 76 65 72 3f 20 74 68 69 73 20 69 73 20 61 20 72 65 61 6c 6c 79 20 6c 6f 6e 67 20 61 67 65 6e 74 20 63 69 72 63 75 69 74 20 69 64 2c 20 77 68 69 63 68 20 77 69 6c 6c 20 6f 63 63 75 70 79 20 6d 6f 73 74 20 6f 66 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 73 69 7a 65 20 66 6f 72 20 61 6e 20 6f 70 74 69 6f 6e 20 73 6f 20 74 68 61 74 20 74 68 65 20 6e 65 78 74 20 73 75 62 20 6f 70 74 69 6f 6e 20 77 69 6c 6c 20 6e 6f 74 20 66 69 74 20 61 6e 64 20 61 20 6e 65 77 20 6f 70 74 69 6f 6e 20 77 69 6c 6c 20 62 65 20 6e 65 65 64 65 64 52 2c 02 2a 74 72 79 69 6e 67 20 74 6f 20 61 64 64 20 61 20 73 75 62 20 6f 70 74 69 6f 6e 20 61 67 65 6e 74 20 72 65 6d 6f 74 65 20 69 64

match 52 ff 01 e1 6f 68 20 68 61 69 20 74 68 69 73 20 69 73 20 61 6e 20 61 67 65 6e 74 2c 20 68 6f 77 20 61 72 65 20 79 6f 75 20 64 6f 69 6e 67 20 44 48 43 50 20 73 65 72 76 65 72 3f 20 74 68 69 73 20 69 73 20 61 20 72 65 61 6c 6c 79 20 6c 6f 6e 67 20 61 67 65 6e 74 20 63 69 72 63 75 69 74 20 69 64 2c 20 77 68 69 63 68 20 77 69 6c 6c 20 6f 63 63 75 70 79 20 6d 6f 73 74 20 6f 66 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 73 69 7a 65 20 66 6f 72 20 61 6e 20 6f 70 74 69 6f 6e 20 73 6f 20 74 68 61 74 20 74 68 65 20 6e 65 78 74 20 73 75 62 20 6f 70 74 69 6f 6e 20 77 69 6c 6c 20 6e 6f 74 20 66 69 74 20 61 6e 64 20 61 20 6e 65 77 20 6f 70 74 69 6f 6e 20 77 69 6c 6c 20 62 65 20 6e 65 65 64 65 64 02 2a 74 72 79 69 6e 67 20 74 6f 20 61 64 64 20 61 20 73 75 62 20 6f 70 74 69 6f 6e 52 10 20 61 67 65 6e 74 20 72 65 6d 6f 74 65 20 69 64

#
#  The fields are "octets", and therefore decode as hex.
#
decode-pair -
match Relay-Agent-Information = { Circuit-Id = 0x6f6820686169207468697320697320616e206167656e742c20686f772061726520796f7520646f696e672044484350207365727665723f20746869732069732061207265616c6c79206c6f6e67206167656e7420636972637569742069642c2077686963682077696c6c206f6363757079206d6f7374206f6620746865206d6178696d756d2073697a6520666f7220616e206f7074696f6e20736f207468617420746865206e65787420737562206f7074696f6e2077696c6c206e6f742066697420616e642061206e6577206f7074696f6e2077696c6c206265206e6565646564, Remote-Id = 0x747279696e6720746f20616464206120737562206f7074696f6e206167656e742072656d6f7465206964 }

#  An empty octets option
encode-pair Merit-Dump-File = ''
match 0e 00

#
#  Decoding empty options yields empty data
#
decode-pair -
match Merit-Dump-File = ""

# 255 bytes are OK
encode-pair Domain-Name = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
match 0f ff 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78

decode-pair -
match Domain-Name = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

encode-pair Merit-Dump-File="1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456"
match 0e ff 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 0e 01 36

# A very long option should be split automatically
encode-pair Domain-Name = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy"
match 0f ff 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 0f 2d 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 79

#
#   The client concatenates the values of multiple instances of the
#   same option into a single parameter list for configuration.
#
#  Presumably this means that the server does the same thing, too.
#
decode-pair -
match Domain-Name = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy"

#
#  3 isn't used for anything, and should just be treated as an unknown attribute
#

# These next two tests will be broken until we start printing qualified attribute names
decode-pair 52 07 01 03 ab cd ef 03 00
match Relay-Agent-Information = { Circuit-Id = 0xabcdef, raw.3 = 0x }

decode-pair 52 08 01 03 ab cd ef 03 01 ad
match Relay-Agent-Information = { Circuit-Id = 0xabcdef, raw.3 = 0xad }

#
#  And option 82 with full suboptions
#
encode-pair Relay-Agent-Information.Circuit-Id = "123456789a123456789b123456789c123456789d123456789e123456789f123456789g123456789h123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789a123456789axyz"
match 52 ff 01 fd 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 62 31 32 33 34 35 36 37 38 39 63 31 32 33 34 35 36 37 38 39 64 31 32 33 34 35 36 37 38 39 65 31 32 33 34 35 36 37 38 39 66 31 32 33 34 35 36 37 38 39 67 31 32 33 34 35 36 37 38 39 68 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 31 32 33 34 35 36 37 38 39 61 78 79 7a

decode-pair -
match Relay-Agent-Information = { Circuit-Id = 0x3132333435363738396131323334353637383962313233343536373839633132333435363738396431323334353637383965313233343536373839663132333435363738396731323334353637383968313233343536373839613132333435363738396131323334353637383961313233343536373839613132333435363738396131323334353637383961313233343536373839613132333435363738396131323334353637383961313233343536373839613132333435363738396131323334353637383961313233343536373839613132333435363738396131323334353637383961313233343536373839613132333435363738396178797a }

#
#  from src/tests/keywords/xlat-dhcpv4
#
decode-pair 52 0d 01 03 ab cd ef 02 06 01 02 03 04 05 06
match Relay-Agent-Information = { Circuit-Id = 0xabcdef, Remote-Id = 0x010203040506 }

count
match 49
