1*cfb92d14SAndroid Build Coastguard Worker#!/usr/bin/env python3 2*cfb92d14SAndroid Build Coastguard Worker# 3*cfb92d14SAndroid Build Coastguard Worker# Copyright (c) 2016, The OpenThread Authors. 4*cfb92d14SAndroid Build Coastguard Worker# All rights reserved. 5*cfb92d14SAndroid Build Coastguard Worker# 6*cfb92d14SAndroid Build Coastguard Worker# Redistribution and use in source and binary forms, with or without 7*cfb92d14SAndroid Build Coastguard Worker# modification, are permitted provided that the following conditions are met: 8*cfb92d14SAndroid Build Coastguard Worker# 1. Redistributions of source code must retain the above copyright 9*cfb92d14SAndroid Build Coastguard Worker# notice, this list of conditions and the following disclaimer. 10*cfb92d14SAndroid Build Coastguard Worker# 2. Redistributions in binary form must reproduce the above copyright 11*cfb92d14SAndroid Build Coastguard Worker# notice, this list of conditions and the following disclaimer in the 12*cfb92d14SAndroid Build Coastguard Worker# documentation and/or other materials provided with the distribution. 13*cfb92d14SAndroid Build Coastguard Worker# 3. Neither the name of the copyright holder nor the 14*cfb92d14SAndroid Build Coastguard Worker# names of its contributors may be used to endorse or promote products 15*cfb92d14SAndroid Build Coastguard Worker# derived from this software without specific prior written permission. 16*cfb92d14SAndroid Build Coastguard Worker# 17*cfb92d14SAndroid Build Coastguard Worker# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18*cfb92d14SAndroid Build Coastguard Worker# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19*cfb92d14SAndroid Build Coastguard Worker# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20*cfb92d14SAndroid Build Coastguard Worker# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21*cfb92d14SAndroid Build Coastguard Worker# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22*cfb92d14SAndroid Build Coastguard Worker# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23*cfb92d14SAndroid Build Coastguard Worker# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24*cfb92d14SAndroid Build Coastguard Worker# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25*cfb92d14SAndroid Build Coastguard Worker# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26*cfb92d14SAndroid Build Coastguard Worker# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27*cfb92d14SAndroid Build Coastguard Worker# POSSIBILITY OF SUCH DAMAGE. 28*cfb92d14SAndroid Build Coastguard Worker# 29*cfb92d14SAndroid Build Coastguard Worker 30*cfb92d14SAndroid Build Coastguard Workerimport io 31*cfb92d14SAndroid Build Coastguard Workerimport random 32*cfb92d14SAndroid Build Coastguard Workerimport struct 33*cfb92d14SAndroid Build Coastguard Workerimport unittest 34*cfb92d14SAndroid Build Coastguard Worker 35*cfb92d14SAndroid Build Coastguard Workerimport common 36*cfb92d14SAndroid Build Coastguard Workerimport config 37*cfb92d14SAndroid Build Coastguard Workerimport ipv6 38*cfb92d14SAndroid Build Coastguard Workerimport lowpan 39*cfb92d14SAndroid Build Coastguard Worker 40*cfb92d14SAndroid Build Coastguard Worker 41*cfb92d14SAndroid Build Coastguard Workerdef create_default_lowpan_parser(context_manager): 42*cfb92d14SAndroid Build Coastguard Worker return lowpan.LowpanParser( 43*cfb92d14SAndroid Build Coastguard Worker lowpan_mesh_header_factory=lowpan.LowpanMeshHeaderFactory(), 44*cfb92d14SAndroid Build Coastguard Worker lowpan_decompressor=config.create_default_lowpan_decompressor(context_manager), 45*cfb92d14SAndroid Build Coastguard Worker lowpan_fragements_buffers_manager=lowpan.LowpanFragmentsBuffersManager(), 46*cfb92d14SAndroid Build Coastguard Worker ipv6_packet_factory=ipv6.IPv6PacketFactory( 47*cfb92d14SAndroid Build Coastguard Worker ehf=config.create_default_ipv6_extension_headers_factories(), 48*cfb92d14SAndroid Build Coastguard Worker ulpf={ 49*cfb92d14SAndroid Build Coastguard Worker 17: 50*cfb92d14SAndroid Build Coastguard Worker ipv6.UDPDatagramFactory(udp_header_factory=ipv6.UDPHeaderFactory(), 51*cfb92d14SAndroid Build Coastguard Worker udp_payload_factory=ipv6.BytesPayloadFactory()), 52*cfb92d14SAndroid Build Coastguard Worker 58: 53*cfb92d14SAndroid Build Coastguard Worker ipv6.ICMPv6Factory(body_factories=config.create_default_ipv6_icmp_body_factories()) 54*cfb92d14SAndroid Build Coastguard Worker })) 55*cfb92d14SAndroid Build Coastguard Worker 56*cfb92d14SAndroid Build Coastguard Worker 57*cfb92d14SAndroid Build Coastguard Workerdef any_tf(): 58*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(2) 59*cfb92d14SAndroid Build Coastguard Worker 60*cfb92d14SAndroid Build Coastguard Worker 61*cfb92d14SAndroid Build Coastguard Workerdef any_nh(): 62*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(1) 63*cfb92d14SAndroid Build Coastguard Worker 64*cfb92d14SAndroid Build Coastguard Worker 65*cfb92d14SAndroid Build Coastguard Workerdef any_hlim(): 66*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(2) 67*cfb92d14SAndroid Build Coastguard Worker 68*cfb92d14SAndroid Build Coastguard Worker 69*cfb92d14SAndroid Build Coastguard Workerdef any_cid(): 70*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(1) 71*cfb92d14SAndroid Build Coastguard Worker 72*cfb92d14SAndroid Build Coastguard Worker 73*cfb92d14SAndroid Build Coastguard Workerdef any_sac(): 74*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(1) 75*cfb92d14SAndroid Build Coastguard Worker 76*cfb92d14SAndroid Build Coastguard Worker 77*cfb92d14SAndroid Build Coastguard Workerdef any_sam(): 78*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(2) 79*cfb92d14SAndroid Build Coastguard Worker 80*cfb92d14SAndroid Build Coastguard Worker 81*cfb92d14SAndroid Build Coastguard Workerdef any_m(): 82*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(1) 83*cfb92d14SAndroid Build Coastguard Worker 84*cfb92d14SAndroid Build Coastguard Worker 85*cfb92d14SAndroid Build Coastguard Workerdef any_dac(): 86*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(1) 87*cfb92d14SAndroid Build Coastguard Worker 88*cfb92d14SAndroid Build Coastguard Worker 89*cfb92d14SAndroid Build Coastguard Workerdef any_dam(): 90*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(2) 91*cfb92d14SAndroid Build Coastguard Worker 92*cfb92d14SAndroid Build Coastguard Worker 93*cfb92d14SAndroid Build Coastguard Workerdef any_ecn(): 94*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(2) 95*cfb92d14SAndroid Build Coastguard Worker 96*cfb92d14SAndroid Build Coastguard Worker 97*cfb92d14SAndroid Build Coastguard Workerdef any_dscp(): 98*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(6) 99*cfb92d14SAndroid Build Coastguard Worker 100*cfb92d14SAndroid Build Coastguard Worker 101*cfb92d14SAndroid Build Coastguard Workerdef any_flow_label(): 102*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(6) 103*cfb92d14SAndroid Build Coastguard Worker 104*cfb92d14SAndroid Build Coastguard Worker 105*cfb92d14SAndroid Build Coastguard Workerdef any_hop_limit(): 106*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(8) 107*cfb92d14SAndroid Build Coastguard Worker 108*cfb92d14SAndroid Build Coastguard Worker 109*cfb92d14SAndroid Build Coastguard Workerdef any_src_addr(): 110*cfb92d14SAndroid Build Coastguard Worker return bytearray([random.getrandbits(8) for _ in range(16)]) 111*cfb92d14SAndroid Build Coastguard Worker 112*cfb92d14SAndroid Build Coastguard Worker 113*cfb92d14SAndroid Build Coastguard Workerdef any_dst_addr(): 114*cfb92d14SAndroid Build Coastguard Worker return bytearray([random.getrandbits(8) for _ in range(16)]) 115*cfb92d14SAndroid Build Coastguard Worker 116*cfb92d14SAndroid Build Coastguard Worker 117*cfb92d14SAndroid Build Coastguard Workerdef any_eui64(): 118*cfb92d14SAndroid Build Coastguard Worker return bytearray([random.getrandbits(8) for _ in range(8)]) 119*cfb92d14SAndroid Build Coastguard Worker 120*cfb92d14SAndroid Build Coastguard Worker 121*cfb92d14SAndroid Build Coastguard Workerdef any_rloc16(): 122*cfb92d14SAndroid Build Coastguard Worker return bytearray([random.getrandbits(8) for _ in range(2)]) 123*cfb92d14SAndroid Build Coastguard Worker 124*cfb92d14SAndroid Build Coastguard Worker 125*cfb92d14SAndroid Build Coastguard Workerdef any_48bits_addr(): 126*cfb92d14SAndroid Build Coastguard Worker return bytearray([random.getrandbits(8) for _ in range(6)]) 127*cfb92d14SAndroid Build Coastguard Worker 128*cfb92d14SAndroid Build Coastguard Worker 129*cfb92d14SAndroid Build Coastguard Workerdef any_32bits_addr(): 130*cfb92d14SAndroid Build Coastguard Worker return bytearray([random.getrandbits(8) for _ in range(4)]) 131*cfb92d14SAndroid Build Coastguard Worker 132*cfb92d14SAndroid Build Coastguard Worker 133*cfb92d14SAndroid Build Coastguard Workerdef any_8bits_addr(): 134*cfb92d14SAndroid Build Coastguard Worker return bytearray([random.getrandbits(8)]) 135*cfb92d14SAndroid Build Coastguard Worker 136*cfb92d14SAndroid Build Coastguard Worker 137*cfb92d14SAndroid Build Coastguard Workerdef any_c(): 138*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(1) 139*cfb92d14SAndroid Build Coastguard Worker 140*cfb92d14SAndroid Build Coastguard Worker 141*cfb92d14SAndroid Build Coastguard Workerdef any_p(): 142*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(2) 143*cfb92d14SAndroid Build Coastguard Worker 144*cfb92d14SAndroid Build Coastguard Worker 145*cfb92d14SAndroid Build Coastguard Workerdef any_src_port(): 146*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(16) 147*cfb92d14SAndroid Build Coastguard Worker 148*cfb92d14SAndroid Build Coastguard Worker 149*cfb92d14SAndroid Build Coastguard Workerdef any_dst_port(): 150*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(16) 151*cfb92d14SAndroid Build Coastguard Worker 152*cfb92d14SAndroid Build Coastguard Worker 153*cfb92d14SAndroid Build Coastguard Workerdef any_compressable_src_port(): 154*cfb92d14SAndroid Build Coastguard Worker return 0xf000 + random.getrandbits(8) 155*cfb92d14SAndroid Build Coastguard Worker 156*cfb92d14SAndroid Build Coastguard Worker 157*cfb92d14SAndroid Build Coastguard Workerdef any_compressable_dst_port(): 158*cfb92d14SAndroid Build Coastguard Worker return 0xf000 + random.getrandbits(8) 159*cfb92d14SAndroid Build Coastguard Worker 160*cfb92d14SAndroid Build Coastguard Worker 161*cfb92d14SAndroid Build Coastguard Workerdef any_nibble_src_port(): 162*cfb92d14SAndroid Build Coastguard Worker return 0xf0b0 + random.getrandbits(4) 163*cfb92d14SAndroid Build Coastguard Worker 164*cfb92d14SAndroid Build Coastguard Worker 165*cfb92d14SAndroid Build Coastguard Workerdef any_nibble_dst_port(): 166*cfb92d14SAndroid Build Coastguard Worker return 0xf0b0 + random.getrandbits(4) 167*cfb92d14SAndroid Build Coastguard Worker 168*cfb92d14SAndroid Build Coastguard Worker 169*cfb92d14SAndroid Build Coastguard Workerdef any_checksum(): 170*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(16) 171*cfb92d14SAndroid Build Coastguard Worker 172*cfb92d14SAndroid Build Coastguard Worker 173*cfb92d14SAndroid Build Coastguard Workerdef any_next_header(): 174*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(8) 175*cfb92d14SAndroid Build Coastguard Worker 176*cfb92d14SAndroid Build Coastguard Worker 177*cfb92d14SAndroid Build Coastguard Workerdef any_sci(): 178*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(4) 179*cfb92d14SAndroid Build Coastguard Worker 180*cfb92d14SAndroid Build Coastguard Worker 181*cfb92d14SAndroid Build Coastguard Workerdef any_dci(): 182*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(4) 183*cfb92d14SAndroid Build Coastguard Worker 184*cfb92d14SAndroid Build Coastguard Worker 185*cfb92d14SAndroid Build Coastguard Workerdef any_src_mac_addr(): 186*cfb92d14SAndroid Build Coastguard Worker return bytearray([random.getrandbits(8) for _ in range(8)]) 187*cfb92d14SAndroid Build Coastguard Worker 188*cfb92d14SAndroid Build Coastguard Worker 189*cfb92d14SAndroid Build Coastguard Workerdef any_dst_mac_addr(): 190*cfb92d14SAndroid Build Coastguard Worker return bytearray([random.getrandbits(8) for _ in range(8)]) 191*cfb92d14SAndroid Build Coastguard Worker 192*cfb92d14SAndroid Build Coastguard Worker 193*cfb92d14SAndroid Build Coastguard Workerdef any_context(): 194*cfb92d14SAndroid Build Coastguard Worker prefix = bytearray([random.getrandbits(8) for _ in range(random.randint(2, 15))]) 195*cfb92d14SAndroid Build Coastguard Worker prefix_length = len(prefix) 196*cfb92d14SAndroid Build Coastguard Worker return lowpan.Context(prefix, prefix_length * 8) 197*cfb92d14SAndroid Build Coastguard Worker 198*cfb92d14SAndroid Build Coastguard Worker 199*cfb92d14SAndroid Build Coastguard Workerdef any_mac_address(): 200*cfb92d14SAndroid Build Coastguard Worker length = random.choice([2, 8]) 201*cfb92d14SAndroid Build Coastguard Worker if length == 2: 202*cfb92d14SAndroid Build Coastguard Worker return common.MacAddress.from_rloc16(bytearray([random.getrandbits(8) for _ in range(length)])) 203*cfb92d14SAndroid Build Coastguard Worker elif length == 8: 204*cfb92d14SAndroid Build Coastguard Worker return common.MacAddress.from_eui64(bytearray([random.getrandbits(8) for _ in range(length)])) 205*cfb92d14SAndroid Build Coastguard Worker 206*cfb92d14SAndroid Build Coastguard Worker 207*cfb92d14SAndroid Build Coastguard Workerdef any_hops_left(): 208*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(8) 209*cfb92d14SAndroid Build Coastguard Worker 210*cfb92d14SAndroid Build Coastguard Worker 211*cfb92d14SAndroid Build Coastguard Workerdef any_data(length=None): 212*cfb92d14SAndroid Build Coastguard Worker length = length if length is not None else random.randint(1, 64) 213*cfb92d14SAndroid Build Coastguard Worker return bytearray([random.getrandbits(8) for _ in range(length)]) 214*cfb92d14SAndroid Build Coastguard Worker 215*cfb92d14SAndroid Build Coastguard Worker 216*cfb92d14SAndroid Build Coastguard Workerdef any_datagram_size(): 217*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(11) 218*cfb92d14SAndroid Build Coastguard Worker 219*cfb92d14SAndroid Build Coastguard Worker 220*cfb92d14SAndroid Build Coastguard Workerdef any_datagram_tag(): 221*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(16) 222*cfb92d14SAndroid Build Coastguard Worker 223*cfb92d14SAndroid Build Coastguard Worker 224*cfb92d14SAndroid Build Coastguard Workerdef any_datagram_offset(): 225*cfb92d14SAndroid Build Coastguard Worker return random.getrandbits(8) 226*cfb92d14SAndroid Build Coastguard Worker 227*cfb92d14SAndroid Build Coastguard Worker 228*cfb92d14SAndroid Build Coastguard Workerclass TestLowpanIPHC(unittest.TestCase): 229*cfb92d14SAndroid Build Coastguard Worker 230*cfb92d14SAndroid Build Coastguard Worker def test_should_create_LowpanIPHC_object_when_from_bytes_classmethod_called(self): 231*cfb92d14SAndroid Build Coastguard Worker # GIVEN 232*cfb92d14SAndroid Build Coastguard Worker tf = any_tf() 233*cfb92d14SAndroid Build Coastguard Worker nh = any_nh() 234*cfb92d14SAndroid Build Coastguard Worker hlim = any_hlim() 235*cfb92d14SAndroid Build Coastguard Worker cid = any_cid() 236*cfb92d14SAndroid Build Coastguard Worker sac = any_sac() 237*cfb92d14SAndroid Build Coastguard Worker sam = any_sam() 238*cfb92d14SAndroid Build Coastguard Worker m = any_m() 239*cfb92d14SAndroid Build Coastguard Worker dac = any_dac() 240*cfb92d14SAndroid Build Coastguard Worker dam = any_dam() 241*cfb92d14SAndroid Build Coastguard Worker 242*cfb92d14SAndroid Build Coastguard Worker byte0 = (3 << 5) | (tf << 3) | (nh << 2) | hlim 243*cfb92d14SAndroid Build Coastguard Worker byte1 = (cid << 7) | (sac << 6) | (sam << 4) | (m << 3) | (dac << 2) | dam 244*cfb92d14SAndroid Build Coastguard Worker 245*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray([byte0, byte1]) 246*cfb92d14SAndroid Build Coastguard Worker 247*cfb92d14SAndroid Build Coastguard Worker # WHEN 248*cfb92d14SAndroid Build Coastguard Worker actual = lowpan.LowpanIPHC.from_bytes(data_bytes) 249*cfb92d14SAndroid Build Coastguard Worker 250*cfb92d14SAndroid Build Coastguard Worker # THEN 251*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(tf, actual.tf) 252*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(nh, actual.nh) 253*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(hlim, actual.hlim) 254*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(cid, actual.cid) 255*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(sac, actual.sac) 256*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(sam, actual.sam) 257*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(m, actual.m) 258*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(dac, actual.dac) 259*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(dam, actual.dam) 260*cfb92d14SAndroid Build Coastguard Worker 261*cfb92d14SAndroid Build Coastguard Worker 262*cfb92d14SAndroid Build Coastguard Workerclass TestLowpanParser(unittest.TestCase): 263*cfb92d14SAndroid Build Coastguard Worker 264*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_mesh_hdr_that_contains_hlim_stored_on_2_bytes_when_decompress_method_called(self): 265*cfb92d14SAndroid Build Coastguard Worker # GIVEN 266*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 267*cfb92d14SAndroid Build Coastguard Worker 0xbf, 0x13, 0x90, 0x00, 0x48, 0x01, 0x7c, 0x77, 0x3f, 0xf2, 0xbf, 0xc0, 0x00, 0x24, 0xb1, 0x62, 0x44, 0x02, 268*cfb92d14SAndroid Build Coastguard Worker 0xf0, 0xba, 0x0d, 0xff, 0x04, 0x01, 0x00, 0x02, 0x02, 0x08, 0x00, 0x07, 0x09, 0x50, 0x20, 0x00, 0x20, 0x00, 269*cfb92d14SAndroid Build Coastguard Worker 0x08, 0x00, 0x00, 0x00 270*cfb92d14SAndroid Build Coastguard Worker ]) 271*cfb92d14SAndroid Build Coastguard Worker 272*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 273*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x21, 0x11, 0x3f, 0xfd, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 274*cfb92d14SAndroid Build Coastguard Worker 0x00, 0xff, 0xfe, 0x00, 0x90, 0x00, 0xfd, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 275*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0x00, 0x48, 0x01, 0xf0, 0xbf, 0xc0, 0x00, 0x00, 0x21, 0xe2, 0xdd, 0x62, 0x44, 0x02, 0xf0, 0xba, 0x0d, 276*cfb92d14SAndroid Build Coastguard Worker 0xff, 0x04, 0x01, 0x00, 0x02, 0x02, 0x08, 0x00, 0x07, 0x09, 0x50, 0x20, 0x00, 0x20, 0x00, 0x08, 0x00, 0x00, 277*cfb92d14SAndroid Build Coastguard Worker 0x00 278*cfb92d14SAndroid Build Coastguard Worker ]) 279*cfb92d14SAndroid Build Coastguard Worker 280*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 281*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 282*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 283*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 284*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 285*cfb92d14SAndroid Build Coastguard Worker 286*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 287*cfb92d14SAndroid Build Coastguard Worker context_manager[0] = lowpan.Context(prefix="fd00:db8::/64") 288*cfb92d14SAndroid Build Coastguard Worker 289*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 290*cfb92d14SAndroid Build Coastguard Worker 291*cfb92d14SAndroid Build Coastguard Worker # WHEN 292*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 293*cfb92d14SAndroid Build Coastguard Worker 294*cfb92d14SAndroid Build Coastguard Worker # THEN 295*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 296*cfb92d14SAndroid Build Coastguard Worker 297*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_uncompressed_udp_and_without_hbh_when_decompress_method_called(self): 298*cfb92d14SAndroid Build Coastguard Worker # GIVEN 299*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 300*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0x33, 0x11, 0x16, 0x33, 0x16, 0x34, 0x00, 0x14, 0xcf, 0x63, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 301*cfb92d14SAndroid Build Coastguard Worker 0x04, 0x4e, 0x92, 0xbb, 0x53 302*cfb92d14SAndroid Build Coastguard Worker ]) 303*cfb92d14SAndroid Build Coastguard Worker 304*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 305*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x14, 0x11, 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 306*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x29, 0x96, 0xff, 307*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xac, 0xff, 0x17, 0x16, 0x33, 0x16, 0x34, 0x00, 0x14, 0xcf, 0x63, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 308*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 309*cfb92d14SAndroid Build Coastguard Worker ]) 310*cfb92d14SAndroid Build Coastguard Worker 311*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 312*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 313*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 314*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 315*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 316*cfb92d14SAndroid Build Coastguard Worker 317*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager=None) 318*cfb92d14SAndroid Build Coastguard Worker 319*cfb92d14SAndroid Build Coastguard Worker # WHEN 320*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 321*cfb92d14SAndroid Build Coastguard Worker 322*cfb92d14SAndroid Build Coastguard Worker # THEN 323*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 324*cfb92d14SAndroid Build Coastguard Worker 325*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_udp_and_without_hbh_when_decompress_method_called(self): 326*cfb92d14SAndroid Build Coastguard Worker # GIVEN 327*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 328*cfb92d14SAndroid Build Coastguard Worker 0x7e, 0x33, 0xf0, 0x16, 0x33, 0x16, 0x34, 0x04, 0xd2, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 329*cfb92d14SAndroid Build Coastguard Worker 0x92, 0xbb, 0x53 330*cfb92d14SAndroid Build Coastguard Worker ]) 331*cfb92d14SAndroid Build Coastguard Worker 332*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 333*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x14, 0x11, 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 334*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x29, 0x96, 0xff, 335*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xac, 0xff, 0x17, 0x16, 0x33, 0x16, 0x34, 0x00, 0x14, 0xcf, 0x63, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 336*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 337*cfb92d14SAndroid Build Coastguard Worker ]) 338*cfb92d14SAndroid Build Coastguard Worker 339*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 340*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 341*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 342*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 343*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 344*cfb92d14SAndroid Build Coastguard Worker 345*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager=None) 346*cfb92d14SAndroid Build Coastguard Worker 347*cfb92d14SAndroid Build Coastguard Worker # WHEN 348*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 349*cfb92d14SAndroid Build Coastguard Worker 350*cfb92d14SAndroid Build Coastguard Worker # THEN 351*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 352*cfb92d14SAndroid Build Coastguard Worker 353*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_uncompressed_udp_and_with_uncompressed_hbh_when_decompress_method_called(self): 354*cfb92d14SAndroid Build Coastguard Worker # GIVEN 355*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 356*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0x33, 0x00, 0x11, 0x00, 0x6d, 0x04, 0x40, 0x02, 0x00, 0x18, 0x16, 0x33, 0x16, 0x34, 0x00, 0x0c, 0x04, 357*cfb92d14SAndroid Build Coastguard Worker 0xd2, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 358*cfb92d14SAndroid Build Coastguard Worker ]) 359*cfb92d14SAndroid Build Coastguard Worker 360*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 361*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 362*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x29, 0x96, 0xff, 363*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xac, 0xff, 0x17, 0x11, 0x00, 0x6d, 0x04, 0x40, 0x02, 0x00, 0x18, 0x16, 0x33, 0x16, 0x34, 0x00, 0x14, 364*cfb92d14SAndroid Build Coastguard Worker 0xcf, 0x63, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 365*cfb92d14SAndroid Build Coastguard Worker ]) 366*cfb92d14SAndroid Build Coastguard Worker 367*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 368*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 369*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 370*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 371*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 372*cfb92d14SAndroid Build Coastguard Worker 373*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager=None) 374*cfb92d14SAndroid Build Coastguard Worker 375*cfb92d14SAndroid Build Coastguard Worker # WHEN 376*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 377*cfb92d14SAndroid Build Coastguard Worker 378*cfb92d14SAndroid Build Coastguard Worker # THEN 379*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 380*cfb92d14SAndroid Build Coastguard Worker 381*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_uncompressed_udp_and_with_compressed_hbh_when_decompress_method_called(self): 382*cfb92d14SAndroid Build Coastguard Worker # GIVEN 383*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 384*cfb92d14SAndroid Build Coastguard Worker 0x7e, 0x33, 0xe0, 0x11, 0x06, 0x6d, 0x04, 0x40, 0x02, 0x00, 0x18, 0x16, 0x33, 0x16, 0x34, 0x00, 0x0c, 0x04, 385*cfb92d14SAndroid Build Coastguard Worker 0xd2, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 386*cfb92d14SAndroid Build Coastguard Worker ]) 387*cfb92d14SAndroid Build Coastguard Worker 388*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 389*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 390*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x29, 0x96, 0xff, 391*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xac, 0xff, 0x17, 0x11, 0x00, 0x6d, 0x04, 0x40, 0x02, 0x00, 0x18, 0x16, 0x33, 0x16, 0x34, 0x00, 0x14, 392*cfb92d14SAndroid Build Coastguard Worker 0xcf, 0x63, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 393*cfb92d14SAndroid Build Coastguard Worker ]) 394*cfb92d14SAndroid Build Coastguard Worker 395*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 396*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 397*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 398*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 399*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 400*cfb92d14SAndroid Build Coastguard Worker 401*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager=None) 402*cfb92d14SAndroid Build Coastguard Worker 403*cfb92d14SAndroid Build Coastguard Worker # WHEN 404*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 405*cfb92d14SAndroid Build Coastguard Worker 406*cfb92d14SAndroid Build Coastguard Worker # THEN 407*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 408*cfb92d14SAndroid Build Coastguard Worker 409*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_udp_and_with_compressed_hbh_when_decompress_method_called(self): 410*cfb92d14SAndroid Build Coastguard Worker # GIVEN 411*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 412*cfb92d14SAndroid Build Coastguard Worker 0x7e, 0x33, 0xe1, 0x06, 0x6d, 0x04, 0x40, 0x02, 0x00, 0x18, 0xf0, 0x16, 0x33, 0x16, 0x34, 0x04, 0xd2, 0x80, 413*cfb92d14SAndroid Build Coastguard Worker 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 414*cfb92d14SAndroid Build Coastguard Worker ]) 415*cfb92d14SAndroid Build Coastguard Worker 416*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 417*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 418*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x29, 0x96, 0xff, 419*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xac, 0xff, 0x17, 0x11, 0x00, 0x6d, 0x04, 0x40, 0x02, 0x00, 0x18, 0x16, 0x33, 0x16, 0x34, 0x00, 0x14, 420*cfb92d14SAndroid Build Coastguard Worker 0xcf, 0x63, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 421*cfb92d14SAndroid Build Coastguard Worker ]) 422*cfb92d14SAndroid Build Coastguard Worker 423*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 424*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 425*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 426*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 427*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 428*cfb92d14SAndroid Build Coastguard Worker 429*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager=None) 430*cfb92d14SAndroid Build Coastguard Worker 431*cfb92d14SAndroid Build Coastguard Worker # WHEN 432*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 433*cfb92d14SAndroid Build Coastguard Worker 434*cfb92d14SAndroid Build Coastguard Worker # THEN 435*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 436*cfb92d14SAndroid Build Coastguard Worker 437*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_icmp_and_without_compressed_hbh_when_decompress_method_called(self): 438*cfb92d14SAndroid Build Coastguard Worker # GIVEN 439*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 440*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0xd5, 0xaa, 0x3a, 0x02, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x01, 0x36, 0x29, 0x96, 0xff, 0xfe, 0xac, 441*cfb92d14SAndroid Build Coastguard Worker 0xff, 0x18, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 442*cfb92d14SAndroid Build Coastguard Worker ]) 443*cfb92d14SAndroid Build Coastguard Worker 444*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 445*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3a, 0x40, 0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 446*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x01, 0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x36, 0x29, 0x96, 0xff, 447*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xac, 0xff, 0x18, 0x80, 0x00, 0x97, 0xf3, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 448*cfb92d14SAndroid Build Coastguard Worker ]) 449*cfb92d14SAndroid Build Coastguard Worker 450*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 451*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 452*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 453*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 454*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 455*cfb92d14SAndroid Build Coastguard Worker 456*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 457*cfb92d14SAndroid Build Coastguard Worker context_manager[10] = lowpan.Context(prefix="2000:0db8::/64") 458*cfb92d14SAndroid Build Coastguard Worker 459*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 460*cfb92d14SAndroid Build Coastguard Worker 461*cfb92d14SAndroid Build Coastguard Worker # WHEN 462*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 463*cfb92d14SAndroid Build Coastguard Worker 464*cfb92d14SAndroid Build Coastguard Worker # THEN 465*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 466*cfb92d14SAndroid Build Coastguard Worker 467*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_icmp_and_without_compressed_hbh_when_decompress_method_called_1(self): 468*cfb92d14SAndroid Build Coastguard Worker # GIVEN 469*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 470*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0xd5, 0xaa, 0x3a, 0x02, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x01, 0x36, 0x29, 0x96, 0xff, 0xfe, 0xac, 471*cfb92d14SAndroid Build Coastguard Worker 0xff, 0x18, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 472*cfb92d14SAndroid Build Coastguard Worker ]) 473*cfb92d14SAndroid Build Coastguard Worker 474*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 475*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3a, 0x40, 0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 476*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x01, 0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x36, 0x29, 0x96, 0xff, 477*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xac, 0xff, 0x18, 0x80, 0x00, 0x97, 0xf3, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 478*cfb92d14SAndroid Build Coastguard Worker ]) 479*cfb92d14SAndroid Build Coastguard Worker 480*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 481*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 482*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 483*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 484*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 485*cfb92d14SAndroid Build Coastguard Worker 486*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 487*cfb92d14SAndroid Build Coastguard Worker context_manager[10] = lowpan.Context(prefix="2000:0db8::/64") 488*cfb92d14SAndroid Build Coastguard Worker 489*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 490*cfb92d14SAndroid Build Coastguard Worker 491*cfb92d14SAndroid Build Coastguard Worker # WHEN 492*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 493*cfb92d14SAndroid Build Coastguard Worker 494*cfb92d14SAndroid Build Coastguard Worker # THEN 495*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 496*cfb92d14SAndroid Build Coastguard Worker 497*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_icmp_and_without_compressed_hbh_when_decompress_method_called_2(self): 498*cfb92d14SAndroid Build Coastguard Worker # GIVEN 499*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 500*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0xf0, 0xa0, 0x3a, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x55, 0x00, 0x00, 0x25, 0x14, 0x46, 0xff, 0xfe, 0xdd, 501*cfb92d14SAndroid Build Coastguard Worker 0x2a, 0xfe, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 502*cfb92d14SAndroid Build Coastguard Worker ]) 503*cfb92d14SAndroid Build Coastguard Worker 504*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 505*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3a, 0x40, 0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 506*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x55, 0x00, 0x00, 0x25, 0x14, 0x46, 0xff, 507*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xdd, 0x2a, 0xfe, 0x80, 0x00, 0xb3, 0xf3, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 508*cfb92d14SAndroid Build Coastguard Worker ]) 509*cfb92d14SAndroid Build Coastguard Worker 510*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 511*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 512*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 513*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 514*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 515*cfb92d14SAndroid Build Coastguard Worker 516*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 517*cfb92d14SAndroid Build Coastguard Worker context_manager[10] = lowpan.Context(prefix="2000:0db8::/64") 518*cfb92d14SAndroid Build Coastguard Worker 519*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 520*cfb92d14SAndroid Build Coastguard Worker 521*cfb92d14SAndroid Build Coastguard Worker # WHEN 522*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 523*cfb92d14SAndroid Build Coastguard Worker 524*cfb92d14SAndroid Build Coastguard Worker # THEN 525*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 526*cfb92d14SAndroid Build Coastguard Worker 527*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_icmp_and_without_compressed_hbh_when_decompress_method_called_3(self): 528*cfb92d14SAndroid Build Coastguard Worker # GIVEN 529*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 530*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0xd5, 0xaa, 0x3a, 0x02, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x01, 0x36, 0x29, 0x96, 0xff, 0xfe, 0xac, 531*cfb92d14SAndroid Build Coastguard Worker 0xff, 0x18, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 532*cfb92d14SAndroid Build Coastguard Worker ]) 533*cfb92d14SAndroid Build Coastguard Worker 534*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 535*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3a, 0x40, 0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 536*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x01, 0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x36, 0x29, 0x96, 0xff, 537*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xac, 0xff, 0x18, 0x80, 0x00, 0x97, 0xf3, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 538*cfb92d14SAndroid Build Coastguard Worker ]) 539*cfb92d14SAndroid Build Coastguard Worker 540*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 541*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 542*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 543*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 544*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 545*cfb92d14SAndroid Build Coastguard Worker 546*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 547*cfb92d14SAndroid Build Coastguard Worker context_manager[10] = lowpan.Context(prefix="2000:0db8::/64") 548*cfb92d14SAndroid Build Coastguard Worker 549*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 550*cfb92d14SAndroid Build Coastguard Worker 551*cfb92d14SAndroid Build Coastguard Worker # WHEN 552*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 553*cfb92d14SAndroid Build Coastguard Worker 554*cfb92d14SAndroid Build Coastguard Worker # THEN 555*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 556*cfb92d14SAndroid Build Coastguard Worker 557*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_icmp_and_without_compressed_hbh_when_decompress_method_called_4(self): 558*cfb92d14SAndroid Build Coastguard Worker # GIVEN 559*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 560*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0xf5, 0xaa, 0x3a, 0x36, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x18, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 561*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 562*cfb92d14SAndroid Build Coastguard Worker ]) 563*cfb92d14SAndroid Build Coastguard Worker 564*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 565*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3a, 0x40, 0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 566*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00, 0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x36, 0x29, 0x96, 0xff, 567*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xac, 0xff, 0x18, 0x80, 0x00, 0x97, 0xf4, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 568*cfb92d14SAndroid Build Coastguard Worker ]) 569*cfb92d14SAndroid Build Coastguard Worker 570*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 571*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 572*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 573*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 574*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 575*cfb92d14SAndroid Build Coastguard Worker 576*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 577*cfb92d14SAndroid Build Coastguard Worker context_manager[10] = lowpan.Context(prefix="2000:0db8::/64") 578*cfb92d14SAndroid Build Coastguard Worker 579*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 580*cfb92d14SAndroid Build Coastguard Worker 581*cfb92d14SAndroid Build Coastguard Worker # WHEN 582*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 583*cfb92d14SAndroid Build Coastguard Worker 584*cfb92d14SAndroid Build Coastguard Worker # THEN 585*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 586*cfb92d14SAndroid Build Coastguard Worker 587*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_icmp_and_without_compressed_hbh_when_decompress_method_called_5(self): 588*cfb92d14SAndroid Build Coastguard Worker # GIVEN 589*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray( 590*cfb92d14SAndroid Build Coastguard Worker [0x7a, 0xf7, 0xac, 0x3a, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53]) 591*cfb92d14SAndroid Build Coastguard Worker 592*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 593*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3a, 0x40, 0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x02, 0x99, 594*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x55, 0x00, 0x00, 0x25, 0x14, 0x46, 0xff, 595*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xdd, 0x2a, 0xfe, 0x80, 0x00, 0xb3, 0xf3, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 596*cfb92d14SAndroid Build Coastguard Worker ]) 597*cfb92d14SAndroid Build Coastguard Worker 598*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 599*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 600*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 601*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 602*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 603*cfb92d14SAndroid Build Coastguard Worker 604*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 605*cfb92d14SAndroid Build Coastguard Worker context_manager[10] = lowpan.Context(prefix="2000:0db8::/64") 606*cfb92d14SAndroid Build Coastguard Worker context_manager[12] = lowpan.Context(prefix="200d:1456:1255:0000:2514:46ff:fedd:2afe/128") 607*cfb92d14SAndroid Build Coastguard Worker 608*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 609*cfb92d14SAndroid Build Coastguard Worker 610*cfb92d14SAndroid Build Coastguard Worker # WHEN 611*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 612*cfb92d14SAndroid Build Coastguard Worker 613*cfb92d14SAndroid Build Coastguard Worker # THEN 614*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 615*cfb92d14SAndroid Build Coastguard Worker 616*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_icmp_and_without_compressed_hbh_when_decompress_method_called_6(self): 617*cfb92d14SAndroid Build Coastguard Worker # GIVEN 618*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 619*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0xf0, 0xc0, 0x3a, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x54, 0x00, 0x00, 0x12, 0x54, 0x11, 0xff, 0xfe, 0x1c, 620*cfb92d14SAndroid Build Coastguard Worker 0x7e, 0xff, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 621*cfb92d14SAndroid Build Coastguard Worker ]) 622*cfb92d14SAndroid Build Coastguard Worker 623*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 624*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3a, 0x40, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x55, 0x00, 0x00, 0x25, 0x14, 625*cfb92d14SAndroid Build Coastguard Worker 0x46, 0xff, 0xfe, 0xdd, 0x2a, 0xfe, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x54, 0x00, 0x00, 0x12, 0x54, 0x11, 0xff, 626*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0x1c, 0x7e, 0xff, 0x80, 0x00, 0xa5, 0x40, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 627*cfb92d14SAndroid Build Coastguard Worker ]) 628*cfb92d14SAndroid Build Coastguard Worker 629*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 630*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 631*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 632*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 633*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 634*cfb92d14SAndroid Build Coastguard Worker 635*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 636*cfb92d14SAndroid Build Coastguard Worker context_manager[12] = lowpan.Context(prefix="200d:1456:1255:0000:2514:46ff:fedd:2afe/128") 637*cfb92d14SAndroid Build Coastguard Worker 638*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 639*cfb92d14SAndroid Build Coastguard Worker 640*cfb92d14SAndroid Build Coastguard Worker # WHEN 641*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 642*cfb92d14SAndroid Build Coastguard Worker 643*cfb92d14SAndroid Build Coastguard Worker # THEN 644*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 645*cfb92d14SAndroid Build Coastguard Worker 646*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_icmp_and_without_compressed_hbh_when_decompress_method_called_7(self): 647*cfb92d14SAndroid Build Coastguard Worker # GIVEN 648*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 649*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0xd0, 0xd0, 0x3a, 0x00, 0x02, 0x98, 0xff, 0xfe, 0x22, 0x12, 0x00, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x55, 650*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x00, 0x25, 0x14, 0x46, 0xff, 0xfe, 0xdd, 0x2a, 0xfe, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 651*cfb92d14SAndroid Build Coastguard Worker 0x4e, 0x92, 0xbb, 0x53 652*cfb92d14SAndroid Build Coastguard Worker ]) 653*cfb92d14SAndroid Build Coastguard Worker 654*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 655*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3a, 0x40, 0xaa, 0xbb, 0xcc, 0xdd, 0x00, 0x00, 0x00, 0x00, 0x77, 0x82, 656*cfb92d14SAndroid Build Coastguard Worker 0x98, 0xff, 0xfe, 0x22, 0x12, 0x00, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x55, 0x00, 0x00, 0x25, 0x14, 0x46, 0xff, 657*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xdd, 0x2a, 0xfe, 0x80, 0x00, 0xf5, 0x28, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 658*cfb92d14SAndroid Build Coastguard Worker ]) 659*cfb92d14SAndroid Build Coastguard Worker 660*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 661*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 662*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 663*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 664*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 665*cfb92d14SAndroid Build Coastguard Worker 666*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 667*cfb92d14SAndroid Build Coastguard Worker context_manager[13] = lowpan.Context(prefix="AABB:CCDD:0000:0000:7796::/75") 668*cfb92d14SAndroid Build Coastguard Worker 669*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 670*cfb92d14SAndroid Build Coastguard Worker 671*cfb92d14SAndroid Build Coastguard Worker # WHEN 672*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 673*cfb92d14SAndroid Build Coastguard Worker 674*cfb92d14SAndroid Build Coastguard Worker # THEN 675*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 676*cfb92d14SAndroid Build Coastguard Worker 677*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_icmp_and_without_compressed_hbh_when_decompress_method_called_8(self): 678*cfb92d14SAndroid Build Coastguard Worker # GIVEN 679*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 680*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0xf0, 0xd0, 0x3a, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x55, 0x00, 0x00, 0x25, 0x14, 0x46, 0xff, 0xfe, 0xdd, 681*cfb92d14SAndroid Build Coastguard Worker 0x2a, 0xfe, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 682*cfb92d14SAndroid Build Coastguard Worker ]) 683*cfb92d14SAndroid Build Coastguard Worker 684*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 685*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3a, 0x40, 0xaa, 0xbb, 0xcc, 0xdd, 0x00, 0x00, 0x00, 0x00, 0x77, 0x99, 686*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x55, 0x00, 0x00, 0x25, 0x14, 0x46, 0xff, 687*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xdd, 0x2a, 0xfe, 0x80, 0x00, 0xf5, 0x11, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 688*cfb92d14SAndroid Build Coastguard Worker ]) 689*cfb92d14SAndroid Build Coastguard Worker 690*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 691*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 692*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 693*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 694*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 695*cfb92d14SAndroid Build Coastguard Worker 696*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 697*cfb92d14SAndroid Build Coastguard Worker context_manager[13] = lowpan.Context(prefix="AABB:CCDD:0000:0000:7796::/75") 698*cfb92d14SAndroid Build Coastguard Worker 699*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 700*cfb92d14SAndroid Build Coastguard Worker 701*cfb92d14SAndroid Build Coastguard Worker # WHEN 702*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 703*cfb92d14SAndroid Build Coastguard Worker 704*cfb92d14SAndroid Build Coastguard Worker # THEN 705*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 706*cfb92d14SAndroid Build Coastguard Worker 707*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_6lo_with_compressed_icmp_and_without_compressed_hbh_when_decompress_method_called_9(self): 708*cfb92d14SAndroid Build Coastguard Worker # GIVEN 709*cfb92d14SAndroid Build Coastguard Worker lowpan_packet = bytearray([ 710*cfb92d14SAndroid Build Coastguard Worker 0x7a, 0xf0, 0xd0, 0x3a, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x55, 0x00, 0x00, 0x25, 0x14, 0x46, 0xff, 0xfe, 0xdd, 711*cfb92d14SAndroid Build Coastguard Worker 0x2a, 0xfe, 0x80, 0x00, 0xfa, 0xa5, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 712*cfb92d14SAndroid Build Coastguard Worker ]) 713*cfb92d14SAndroid Build Coastguard Worker 714*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 715*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3a, 0x40, 0xaa, 0xbb, 0xcc, 0xdd, 0x00, 0x00, 0x00, 0x00, 0x77, 0x99, 716*cfb92d14SAndroid Build Coastguard Worker 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00, 0x20, 0x0d, 0x14, 0x56, 0x12, 0x55, 0x00, 0x00, 0x25, 0x14, 0x46, 0xff, 717*cfb92d14SAndroid Build Coastguard Worker 0xfe, 0xdd, 0x2a, 0xfe, 0x80, 0x00, 0xf5, 0x11, 0x0b, 0xc0, 0x00, 0x04, 0x4e, 0x92, 0xbb, 0x53 718*cfb92d14SAndroid Build Coastguard Worker ]) 719*cfb92d14SAndroid Build Coastguard Worker 720*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 721*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 722*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x99, 0x99, 0xff, 0xfe, 0x22, 0x11, 0x00])) 723*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 724*cfb92d14SAndroid Build Coastguard Worker bytearray([0x34, 0x29, 0x96, 0xff, 0xfe, 0xac, 0xff, 0x17])) 725*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 726*cfb92d14SAndroid Build Coastguard Worker context_manager[13] = lowpan.Context(prefix="AABB:CCDD:0000:0000:7796::/75") 727*cfb92d14SAndroid Build Coastguard Worker 728*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager) 729*cfb92d14SAndroid Build Coastguard Worker 730*cfb92d14SAndroid Build Coastguard Worker # WHEN 731*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(lowpan_packet), message_info) 732*cfb92d14SAndroid Build Coastguard Worker 733*cfb92d14SAndroid Build Coastguard Worker # THEN 734*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 735*cfb92d14SAndroid Build Coastguard Worker 736*cfb92d14SAndroid Build Coastguard Worker def test_should_defragment_big_IPv6_packet_when_parse_method_called_with_fragments_in_random_order(self): 737*cfb92d14SAndroid Build Coastguard Worker # GIVEN 738*cfb92d14SAndroid Build Coastguard Worker fragment_1 = bytearray([ 739*cfb92d14SAndroid Build Coastguard Worker 0xC5, 0x00, 0x31, 0x9F, 0x7A, 0x33, 0x3A, 0x80, 0x00, 0xFA, 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 740*cfb92d14SAndroid Build Coastguard Worker 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 741*cfb92d14SAndroid Build Coastguard Worker 0x54, 0x01, 0xAA, 0x44, 0x54, 0x12, 0x43, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 742*cfb92d14SAndroid Build Coastguard Worker 0x77, 0x99, 0x1A, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 743*cfb92d14SAndroid Build Coastguard Worker 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x80, 0x00, 0xFA, 744*cfb92d14SAndroid Build Coastguard Worker 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x4C, 0x66, 0x4E 745*cfb92d14SAndroid Build Coastguard Worker ]) 746*cfb92d14SAndroid Build Coastguard Worker 747*cfb92d14SAndroid Build Coastguard Worker fragment_2 = bytearray([ 748*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x11, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 749*cfb92d14SAndroid Build Coastguard Worker 0x54, 0x01, 0xAA, 0x44, 0x54, 0x12, 0xa3, 0x53, 0x11, 0x44, 0x66, 0xFE, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 750*cfb92d14SAndroid Build Coastguard Worker 0x77, 0x99, 0x1A, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 751*cfb92d14SAndroid Build Coastguard Worker 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x80, 0x00, 0xFA, 752*cfb92d14SAndroid Build Coastguard Worker 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0x1B, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x22, 0xBB, 0x53, 0x1A, 0x44, 753*cfb92d14SAndroid Build Coastguard Worker 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA 754*cfb92d14SAndroid Build Coastguard Worker ]) 755*cfb92d14SAndroid Build Coastguard Worker 756*cfb92d14SAndroid Build Coastguard Worker fragment_3 = bytearray([ 757*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x1D, 0x44, 0x54, 0x12, 0xD3, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 758*cfb92d14SAndroid Build Coastguard Worker 0x44, 0x66, 0x77, 0x99, 0x1A, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 759*cfb92d14SAndroid Build Coastguard Worker 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0xC0, 760*cfb92d14SAndroid Build Coastguard Worker 0x00, 0xFA, 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x44, 0xCC, 0x4E, 0x92, 0xBB, 0x53, 761*cfb92d14SAndroid Build Coastguard Worker 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x44, 0x54, 0x12, 0x43, 0x53, 762*cfb92d14SAndroid Build Coastguard Worker 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBC, 0x53, 0x1A, 0x44, 0x66, 0x77 763*cfb92d14SAndroid Build Coastguard Worker ]) 764*cfb92d14SAndroid Build Coastguard Worker 765*cfb92d14SAndroid Build Coastguard Worker fragment_4 = bytearray([ 766*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x29, 0x99, 0x1A, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 767*cfb92d14SAndroid Build Coastguard Worker 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 768*cfb92d14SAndroid Build Coastguard Worker 0x1A, 0x80, 0x00, 0xFA, 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 769*cfb92d14SAndroid Build Coastguard Worker 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x44, 0x54, 0x12, 770*cfb92d14SAndroid Build Coastguard Worker 0x43, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x1A, 0x92, 0xBB, 0x53, 771*cfb92d14SAndroid Build Coastguard Worker 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99 772*cfb92d14SAndroid Build Coastguard Worker ]) 773*cfb92d14SAndroid Build Coastguard Worker 774*cfb92d14SAndroid Build Coastguard Worker fragment_5 = bytearray([ 775*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x35, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 776*cfb92d14SAndroid Build Coastguard Worker 0xBB, 0x53, 0x1A, 0x80, 0x00, 0xFA, 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x4C, 0x66, 777*cfb92d14SAndroid Build Coastguard Worker 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x44, 778*cfb92d14SAndroid Build Coastguard Worker 0x54, 0x12, 0xa3, 0x53, 0x11, 0x44, 0x66, 0xFE, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x1A, 0x92, 779*cfb92d14SAndroid Build Coastguard Worker 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 780*cfb92d14SAndroid Build Coastguard Worker 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A 781*cfb92d14SAndroid Build Coastguard Worker ]) 782*cfb92d14SAndroid Build Coastguard Worker 783*cfb92d14SAndroid Build Coastguard Worker fragment_6 = bytearray([ 784*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x41, 0x80, 0x00, 0xFA, 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0x1B, 0x53, 0x11, 785*cfb92d14SAndroid Build Coastguard Worker 0x44, 0x66, 0x4E, 0x22, 0xBB, 0x53, 0x1A, 0x44, 0x67, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 786*cfb92d14SAndroid Build Coastguard Worker 0xAA, 0x44, 0x54, 0x12, 0xD3, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 787*cfb92d14SAndroid Build Coastguard Worker 0x1A, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 788*cfb92d14SAndroid Build Coastguard Worker 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0xC0, 0x00, 0xFA, 0x15, 0x0B, 789*cfb92d14SAndroid Build Coastguard Worker 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x44, 0xCC, 0x4E 790*cfb92d14SAndroid Build Coastguard Worker ]) 791*cfb92d14SAndroid Build Coastguard Worker 792*cfb92d14SAndroid Build Coastguard Worker fragment_7 = bytearray([ 793*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x4D, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 794*cfb92d14SAndroid Build Coastguard Worker 0x54, 0x01, 0xAA, 0x44, 0x54, 0x12, 0x43, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBC, 0x53, 0x1A, 0x44, 0x66, 795*cfb92d14SAndroid Build Coastguard Worker 0x77, 0x99, 0x1A, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 796*cfb92d14SAndroid Build Coastguard Worker 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBA, 0x53, 0x1A, 0x60, 0x00, 0x00, 797*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x00, 0x10, 0x3A, 0x64, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x11, 0x12, 798*cfb92d14SAndroid Build Coastguard Worker 0x13, 0x14, 0x15, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 799*cfb92d14SAndroid Build Coastguard Worker ]) 800*cfb92d14SAndroid Build Coastguard Worker 801*cfb92d14SAndroid Build Coastguard Worker fragment_8 = bytearray([ 802*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x59, 0x02, 0x00, 0x1A, 0x2A, 0x3F, 0x09, 0xAB, 0x43, 0x60, 0x00, 0xF0, 0x00, 0x00, 803*cfb92d14SAndroid Build Coastguard Worker 0x10, 0x3A, 0x64, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x11, 0x12, 0x13, 0x14, 804*cfb92d14SAndroid Build Coastguard Worker 0x15, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x1A, 0x2A, 0x3F, 0x09, 0xAB, 0x43, 0x80, 805*cfb92d14SAndroid Build Coastguard Worker 0x00, 0xFA, 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 806*cfb92d14SAndroid Build Coastguard Worker 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x44, 0x54, 0x12, 0x43, 0x53, 807*cfb92d14SAndroid Build Coastguard Worker 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBC, 0x53, 0x1A, 0x44, 0x66, 0x77 808*cfb92d14SAndroid Build Coastguard Worker ]) 809*cfb92d14SAndroid Build Coastguard Worker 810*cfb92d14SAndroid Build Coastguard Worker fragment_9 = bytearray([ 811*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x65, 0x99, 0x1A, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 812*cfb92d14SAndroid Build Coastguard Worker 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 813*cfb92d14SAndroid Build Coastguard Worker 0x1A, 0x80, 0x00, 0xFA, 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x4C, 0x66, 0x4E, 0x92, 814*cfb92d14SAndroid Build Coastguard Worker 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x44, 0x54, 0x12, 815*cfb92d14SAndroid Build Coastguard Worker 0xa3, 0x53, 0x11, 0x44, 0x66, 0xFE, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x1A, 0x92, 0xBB, 0x53, 816*cfb92d14SAndroid Build Coastguard Worker 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x4D, 0x66, 0x77, 0x99 817*cfb92d14SAndroid Build Coastguard Worker ]) 818*cfb92d14SAndroid Build Coastguard Worker 819*cfb92d14SAndroid Build Coastguard Worker fragment_10 = bytearray([ 820*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x71, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 821*cfb92d14SAndroid Build Coastguard Worker 0xBB, 0x53, 0x1A, 0x80, 0x00, 0xFA, 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0x1B, 0x53, 0x11, 0x44, 0x66, 822*cfb92d14SAndroid Build Coastguard Worker 0x4E, 0x22, 0xBB, 0x51, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x44, 823*cfb92d14SAndroid Build Coastguard Worker 0x54, 0x12, 0xD3, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x1A, 0x92, 824*cfb92d14SAndroid Build Coastguard Worker 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 825*cfb92d14SAndroid Build Coastguard Worker 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A 826*cfb92d14SAndroid Build Coastguard Worker ]) 827*cfb92d14SAndroid Build Coastguard Worker 828*cfb92d14SAndroid Build Coastguard Worker fragment_11 = bytearray([ 829*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x7D, 0xC0, 0x00, 0xFA, 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 830*cfb92d14SAndroid Build Coastguard Worker 0x44, 0xCC, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 831*cfb92d14SAndroid Build Coastguard Worker 0xAA, 0x44, 0x54, 0x12, 0x4A, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBC, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 832*cfb92d14SAndroid Build Coastguard Worker 0x1A, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 833*cfb92d14SAndroid Build Coastguard Worker 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x80, 0x00, 0xFA, 0xA5, 0x0B, 834*cfb92d14SAndroid Build Coastguard Worker 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x4E 835*cfb92d14SAndroid Build Coastguard Worker ]) 836*cfb92d14SAndroid Build Coastguard Worker 837*cfb92d14SAndroid Build Coastguard Worker fragment_12 = bytearray([ 838*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x89, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 839*cfb92d14SAndroid Build Coastguard Worker 0x54, 0x01, 0xAA, 0x44, 0x54, 0x12, 0x43, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x3A, 0x44, 0x66, 840*cfb92d14SAndroid Build Coastguard Worker 0x77, 0x99, 0x1A, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 841*cfb92d14SAndroid Build Coastguard Worker 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x80, 0x00, 0xFA, 842*cfb92d14SAndroid Build Coastguard Worker 0xA5, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x4C, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x44, 843*cfb92d14SAndroid Build Coastguard Worker 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA 844*cfb92d14SAndroid Build Coastguard Worker ]) 845*cfb92d14SAndroid Build Coastguard Worker 846*cfb92d14SAndroid Build Coastguard Worker fragment_13 = bytearray([ 847*cfb92d14SAndroid Build Coastguard Worker 0xE5, 0x00, 0x31, 0x9F, 0x95, 0x44, 0x54, 0x12, 0xa3, 0x53, 0x11, 0x44, 0x66, 0xFE, 0x92, 0xBB, 0x53, 0x1A, 848*cfb92d14SAndroid Build Coastguard Worker 0x44, 0x66, 0x77, 0x99, 0x1A, 0x92, 0xBB, 0x53, 0x11, 0x44, 0x66, 0x92, 0xBB, 0x53, 0x1A, 0x44, 0x66, 0x77, 849*cfb92d14SAndroid Build Coastguard Worker 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x11, 0x44, 0x66, 0x4E, 0x92, 0xBB, 0x53, 0x1A, 0x80, 850*cfb92d14SAndroid Build Coastguard Worker 0x00, 0xFA, 0xA5, 0x1B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0x1B, 0x53, 0x11, 0x44, 0x66, 0x4E, 0x22, 0xBB, 0x53, 851*cfb92d14SAndroid Build Coastguard Worker 0x1A, 0x44, 0x66, 0x77, 0x99, 0x15, 0xB3, 0x00, 0x54, 0xCC, 0x54, 0x01, 0xAA, 0x44, 0x54, 0x12, 0xD3, 0x53, 852*cfb92d14SAndroid Build Coastguard Worker 0x11, 0x44, 0x66 853*cfb92d14SAndroid Build Coastguard Worker ]) 854*cfb92d14SAndroid Build Coastguard Worker 855*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 856*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 857*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x00, 0x00, 0x11, 0x12, 0x13, 0x14, 0x15])) 858*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 859*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x00, 0x1A, 0x2A, 0x3F, 0x09, 0xAB, 0x43])) 860*cfb92d14SAndroid Build Coastguard Worker 861*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(context_manager=None) 862*cfb92d14SAndroid Build Coastguard Worker 863*cfb92d14SAndroid Build Coastguard Worker # WHEN 864*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_4), message_info)) 865*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_2), message_info)) 866*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_3), message_info)) 867*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_13), message_info)) 868*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_5), message_info)) 869*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_6), message_info)) 870*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_7), message_info)) 871*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_8), message_info)) 872*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_9), message_info)) 873*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_10), message_info)) 874*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_11), message_info)) 875*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_12), message_info)) 876*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(fragment_1), message_info) 877*cfb92d14SAndroid Build Coastguard Worker 878*cfb92d14SAndroid Build Coastguard Worker # THEN 879*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 880*cfb92d14SAndroid Build Coastguard Worker 0x60, 881*cfb92d14SAndroid Build Coastguard Worker 0x00, 882*cfb92d14SAndroid Build Coastguard Worker 0x00, 883*cfb92d14SAndroid Build Coastguard Worker 0x00, 884*cfb92d14SAndroid Build Coastguard Worker 0x04, 885*cfb92d14SAndroid Build Coastguard Worker 0xD8, 886*cfb92d14SAndroid Build Coastguard Worker 0x3A, 887*cfb92d14SAndroid Build Coastguard Worker 0x40, 888*cfb92d14SAndroid Build Coastguard Worker 0xfe, 889*cfb92d14SAndroid Build Coastguard Worker 0x80, 890*cfb92d14SAndroid Build Coastguard Worker 0x00, 891*cfb92d14SAndroid Build Coastguard Worker 0x00, 892*cfb92d14SAndroid Build Coastguard Worker 0x00, 893*cfb92d14SAndroid Build Coastguard Worker 0x00, 894*cfb92d14SAndroid Build Coastguard Worker 0x00, 895*cfb92d14SAndroid Build Coastguard Worker 0x00, 896*cfb92d14SAndroid Build Coastguard Worker 0x02, 897*cfb92d14SAndroid Build Coastguard Worker 0x00, 898*cfb92d14SAndroid Build Coastguard Worker 0x00, 899*cfb92d14SAndroid Build Coastguard Worker 0x11, 900*cfb92d14SAndroid Build Coastguard Worker 0x12, 901*cfb92d14SAndroid Build Coastguard Worker 0x13, 902*cfb92d14SAndroid Build Coastguard Worker 0x14, 903*cfb92d14SAndroid Build Coastguard Worker 0x15, 904*cfb92d14SAndroid Build Coastguard Worker 0xfe, 905*cfb92d14SAndroid Build Coastguard Worker 0x80, 906*cfb92d14SAndroid Build Coastguard Worker 0x00, 907*cfb92d14SAndroid Build Coastguard Worker 0x00, 908*cfb92d14SAndroid Build Coastguard Worker 0x00, 909*cfb92d14SAndroid Build Coastguard Worker 0x00, 910*cfb92d14SAndroid Build Coastguard Worker 0x00, 911*cfb92d14SAndroid Build Coastguard Worker 0x00, 912*cfb92d14SAndroid Build Coastguard Worker 0x02, 913*cfb92d14SAndroid Build Coastguard Worker 0x00, 914*cfb92d14SAndroid Build Coastguard Worker 0x1A, 915*cfb92d14SAndroid Build Coastguard Worker 0x2A, 916*cfb92d14SAndroid Build Coastguard Worker 0x3F, 917*cfb92d14SAndroid Build Coastguard Worker 0x09, 918*cfb92d14SAndroid Build Coastguard Worker 0xAB, 919*cfb92d14SAndroid Build Coastguard Worker 0x43, # / * 40 * / 920*cfb92d14SAndroid Build Coastguard Worker 0x80, 921*cfb92d14SAndroid Build Coastguard Worker 0x00, 922*cfb92d14SAndroid Build Coastguard Worker 0xAB, 923*cfb92d14SAndroid Build Coastguard Worker 0x64, 924*cfb92d14SAndroid Build Coastguard Worker 0x0B, 925*cfb92d14SAndroid Build Coastguard Worker 0xC0, 926*cfb92d14SAndroid Build Coastguard Worker 0x00, 927*cfb92d14SAndroid Build Coastguard Worker 0x04, 928*cfb92d14SAndroid Build Coastguard Worker 0x4E, 929*cfb92d14SAndroid Build Coastguard Worker 0x92, 930*cfb92d14SAndroid Build Coastguard Worker 0xBB, 931*cfb92d14SAndroid Build Coastguard Worker 0x53, 932*cfb92d14SAndroid Build Coastguard Worker 0x11, 933*cfb92d14SAndroid Build Coastguard Worker 0x44, 934*cfb92d14SAndroid Build Coastguard Worker 0x66, 935*cfb92d14SAndroid Build Coastguard Worker 0x4E, 936*cfb92d14SAndroid Build Coastguard Worker 0x92, 937*cfb92d14SAndroid Build Coastguard Worker 0xBB, 938*cfb92d14SAndroid Build Coastguard Worker 0x53, 939*cfb92d14SAndroid Build Coastguard Worker 0x1A, 940*cfb92d14SAndroid Build Coastguard Worker 0x44, 941*cfb92d14SAndroid Build Coastguard Worker 0x66, 942*cfb92d14SAndroid Build Coastguard Worker 0x77, 943*cfb92d14SAndroid Build Coastguard Worker 0x99, 944*cfb92d14SAndroid Build Coastguard Worker 0x15, 945*cfb92d14SAndroid Build Coastguard Worker 0xB3, 946*cfb92d14SAndroid Build Coastguard Worker 0x00, 947*cfb92d14SAndroid Build Coastguard Worker 0x54, 948*cfb92d14SAndroid Build Coastguard Worker 0xCC, 949*cfb92d14SAndroid Build Coastguard Worker 0x54, 950*cfb92d14SAndroid Build Coastguard Worker 0x01, 951*cfb92d14SAndroid Build Coastguard Worker 0xAA, 952*cfb92d14SAndroid Build Coastguard Worker 0x44, 953*cfb92d14SAndroid Build Coastguard Worker 0x54, 954*cfb92d14SAndroid Build Coastguard Worker 0x12, 955*cfb92d14SAndroid Build Coastguard Worker 0x43, 956*cfb92d14SAndroid Build Coastguard Worker 0x53, 957*cfb92d14SAndroid Build Coastguard Worker 0x11, 958*cfb92d14SAndroid Build Coastguard Worker 0x44, 959*cfb92d14SAndroid Build Coastguard Worker 0x66, 960*cfb92d14SAndroid Build Coastguard Worker 0x4E, 961*cfb92d14SAndroid Build Coastguard Worker 0x92, 962*cfb92d14SAndroid Build Coastguard Worker 0xBB, 963*cfb92d14SAndroid Build Coastguard Worker 0x53, 964*cfb92d14SAndroid Build Coastguard Worker 0x1A, 965*cfb92d14SAndroid Build Coastguard Worker 0x44, 966*cfb92d14SAndroid Build Coastguard Worker 0x66, 967*cfb92d14SAndroid Build Coastguard Worker 0x77, 968*cfb92d14SAndroid Build Coastguard Worker 0x99, 969*cfb92d14SAndroid Build Coastguard Worker 0x1A, 970*cfb92d14SAndroid Build Coastguard Worker 0x92, 971*cfb92d14SAndroid Build Coastguard Worker 0xBB, 972*cfb92d14SAndroid Build Coastguard Worker 0x53, 973*cfb92d14SAndroid Build Coastguard Worker 0x11, 974*cfb92d14SAndroid Build Coastguard Worker 0x44, 975*cfb92d14SAndroid Build Coastguard Worker 0x66, 976*cfb92d14SAndroid Build Coastguard Worker 0x92, 977*cfb92d14SAndroid Build Coastguard Worker 0xBB, 978*cfb92d14SAndroid Build Coastguard Worker 0x53, 979*cfb92d14SAndroid Build Coastguard Worker 0x1A, 980*cfb92d14SAndroid Build Coastguard Worker 0x44, 981*cfb92d14SAndroid Build Coastguard Worker 0x66, 982*cfb92d14SAndroid Build Coastguard Worker 0x77, 983*cfb92d14SAndroid Build Coastguard Worker 0x99, 984*cfb92d14SAndroid Build Coastguard Worker 0x15, 985*cfb92d14SAndroid Build Coastguard Worker 0xB3, 986*cfb92d14SAndroid Build Coastguard Worker 0x00, 987*cfb92d14SAndroid Build Coastguard Worker 0x54, 988*cfb92d14SAndroid Build Coastguard Worker 0xCC, 989*cfb92d14SAndroid Build Coastguard Worker 0x54, 990*cfb92d14SAndroid Build Coastguard Worker 0x01, 991*cfb92d14SAndroid Build Coastguard Worker 0xAA, 992*cfb92d14SAndroid Build Coastguard Worker 0x11, 993*cfb92d14SAndroid Build Coastguard Worker 0x44, 994*cfb92d14SAndroid Build Coastguard Worker 0x66, 995*cfb92d14SAndroid Build Coastguard Worker 0x4E, 996*cfb92d14SAndroid Build Coastguard Worker 0x92, 997*cfb92d14SAndroid Build Coastguard Worker 0xBB, 998*cfb92d14SAndroid Build Coastguard Worker 0x53, 999*cfb92d14SAndroid Build Coastguard Worker 0x1A, # / * 120 * / 1000*cfb92d14SAndroid Build Coastguard Worker 0x80, 1001*cfb92d14SAndroid Build Coastguard Worker 0x00, 1002*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1003*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1004*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1005*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1006*cfb92d14SAndroid Build Coastguard Worker 0x00, 1007*cfb92d14SAndroid Build Coastguard Worker 0x04, 1008*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1009*cfb92d14SAndroid Build Coastguard Worker 0x92, 1010*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1011*cfb92d14SAndroid Build Coastguard Worker 0x53, 1012*cfb92d14SAndroid Build Coastguard Worker 0x11, 1013*cfb92d14SAndroid Build Coastguard Worker 0x4C, 1014*cfb92d14SAndroid Build Coastguard Worker 0x66, 1015*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1016*cfb92d14SAndroid Build Coastguard Worker 0x92, 1017*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1018*cfb92d14SAndroid Build Coastguard Worker 0x53, 1019*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1020*cfb92d14SAndroid Build Coastguard Worker 0x44, 1021*cfb92d14SAndroid Build Coastguard Worker 0x66, 1022*cfb92d14SAndroid Build Coastguard Worker 0x77, 1023*cfb92d14SAndroid Build Coastguard Worker 0x99, 1024*cfb92d14SAndroid Build Coastguard Worker 0x15, 1025*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1026*cfb92d14SAndroid Build Coastguard Worker 0x00, 1027*cfb92d14SAndroid Build Coastguard Worker 0x54, 1028*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1029*cfb92d14SAndroid Build Coastguard Worker 0x54, 1030*cfb92d14SAndroid Build Coastguard Worker 0x01, 1031*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1032*cfb92d14SAndroid Build Coastguard Worker 0x44, 1033*cfb92d14SAndroid Build Coastguard Worker 0x54, 1034*cfb92d14SAndroid Build Coastguard Worker 0x12, 1035*cfb92d14SAndroid Build Coastguard Worker 0xa3, 1036*cfb92d14SAndroid Build Coastguard Worker 0x53, 1037*cfb92d14SAndroid Build Coastguard Worker 0x11, 1038*cfb92d14SAndroid Build Coastguard Worker 0x44, 1039*cfb92d14SAndroid Build Coastguard Worker 0x66, 1040*cfb92d14SAndroid Build Coastguard Worker 0xFE, 1041*cfb92d14SAndroid Build Coastguard Worker 0x92, 1042*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1043*cfb92d14SAndroid Build Coastguard Worker 0x53, 1044*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1045*cfb92d14SAndroid Build Coastguard Worker 0x44, 1046*cfb92d14SAndroid Build Coastguard Worker 0x66, 1047*cfb92d14SAndroid Build Coastguard Worker 0x77, 1048*cfb92d14SAndroid Build Coastguard Worker 0x99, 1049*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1050*cfb92d14SAndroid Build Coastguard Worker 0x92, 1051*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1052*cfb92d14SAndroid Build Coastguard Worker 0x53, 1053*cfb92d14SAndroid Build Coastguard Worker 0x11, 1054*cfb92d14SAndroid Build Coastguard Worker 0x44, 1055*cfb92d14SAndroid Build Coastguard Worker 0x66, 1056*cfb92d14SAndroid Build Coastguard Worker 0x92, 1057*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1058*cfb92d14SAndroid Build Coastguard Worker 0x53, 1059*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1060*cfb92d14SAndroid Build Coastguard Worker 0x44, 1061*cfb92d14SAndroid Build Coastguard Worker 0x66, 1062*cfb92d14SAndroid Build Coastguard Worker 0x77, 1063*cfb92d14SAndroid Build Coastguard Worker 0x99, 1064*cfb92d14SAndroid Build Coastguard Worker 0x15, 1065*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1066*cfb92d14SAndroid Build Coastguard Worker 0x00, 1067*cfb92d14SAndroid Build Coastguard Worker 0x54, 1068*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1069*cfb92d14SAndroid Build Coastguard Worker 0x54, 1070*cfb92d14SAndroid Build Coastguard Worker 0x01, 1071*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1072*cfb92d14SAndroid Build Coastguard Worker 0x11, 1073*cfb92d14SAndroid Build Coastguard Worker 0x44, 1074*cfb92d14SAndroid Build Coastguard Worker 0x66, 1075*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1076*cfb92d14SAndroid Build Coastguard Worker 0x92, 1077*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1078*cfb92d14SAndroid Build Coastguard Worker 0x53, 1079*cfb92d14SAndroid Build Coastguard Worker 0x1A, # / * 200 * / 1080*cfb92d14SAndroid Build Coastguard Worker 0x80, 1081*cfb92d14SAndroid Build Coastguard Worker 0x00, 1082*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1083*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1084*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1085*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1086*cfb92d14SAndroid Build Coastguard Worker 0x00, 1087*cfb92d14SAndroid Build Coastguard Worker 0x04, 1088*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1089*cfb92d14SAndroid Build Coastguard Worker 0x92, 1090*cfb92d14SAndroid Build Coastguard Worker 0x1B, 1091*cfb92d14SAndroid Build Coastguard Worker 0x53, 1092*cfb92d14SAndroid Build Coastguard Worker 0x11, 1093*cfb92d14SAndroid Build Coastguard Worker 0x44, 1094*cfb92d14SAndroid Build Coastguard Worker 0x66, 1095*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1096*cfb92d14SAndroid Build Coastguard Worker 0x22, 1097*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1098*cfb92d14SAndroid Build Coastguard Worker 0x53, 1099*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1100*cfb92d14SAndroid Build Coastguard Worker 0x44, 1101*cfb92d14SAndroid Build Coastguard Worker 0x66, 1102*cfb92d14SAndroid Build Coastguard Worker 0x77, 1103*cfb92d14SAndroid Build Coastguard Worker 0x99, 1104*cfb92d14SAndroid Build Coastguard Worker 0x15, 1105*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1106*cfb92d14SAndroid Build Coastguard Worker 0x00, 1107*cfb92d14SAndroid Build Coastguard Worker 0x54, 1108*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1109*cfb92d14SAndroid Build Coastguard Worker 0x54, 1110*cfb92d14SAndroid Build Coastguard Worker 0x01, 1111*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1112*cfb92d14SAndroid Build Coastguard Worker 0x44, 1113*cfb92d14SAndroid Build Coastguard Worker 0x54, 1114*cfb92d14SAndroid Build Coastguard Worker 0x12, 1115*cfb92d14SAndroid Build Coastguard Worker 0xD3, 1116*cfb92d14SAndroid Build Coastguard Worker 0x53, 1117*cfb92d14SAndroid Build Coastguard Worker 0x11, 1118*cfb92d14SAndroid Build Coastguard Worker 0x44, 1119*cfb92d14SAndroid Build Coastguard Worker 0x66, 1120*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1121*cfb92d14SAndroid Build Coastguard Worker 0x92, 1122*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1123*cfb92d14SAndroid Build Coastguard Worker 0x53, 1124*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1125*cfb92d14SAndroid Build Coastguard Worker 0x44, 1126*cfb92d14SAndroid Build Coastguard Worker 0x66, 1127*cfb92d14SAndroid Build Coastguard Worker 0x77, 1128*cfb92d14SAndroid Build Coastguard Worker 0x99, 1129*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1130*cfb92d14SAndroid Build Coastguard Worker 0x92, 1131*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1132*cfb92d14SAndroid Build Coastguard Worker 0x53, 1133*cfb92d14SAndroid Build Coastguard Worker 0x11, 1134*cfb92d14SAndroid Build Coastguard Worker 0x44, 1135*cfb92d14SAndroid Build Coastguard Worker 0x66, 1136*cfb92d14SAndroid Build Coastguard Worker 0x92, 1137*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1138*cfb92d14SAndroid Build Coastguard Worker 0x53, 1139*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1140*cfb92d14SAndroid Build Coastguard Worker 0x44, 1141*cfb92d14SAndroid Build Coastguard Worker 0x66, 1142*cfb92d14SAndroid Build Coastguard Worker 0x77, 1143*cfb92d14SAndroid Build Coastguard Worker 0x99, 1144*cfb92d14SAndroid Build Coastguard Worker 0x15, 1145*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1146*cfb92d14SAndroid Build Coastguard Worker 0x00, 1147*cfb92d14SAndroid Build Coastguard Worker 0x54, 1148*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1149*cfb92d14SAndroid Build Coastguard Worker 0x54, 1150*cfb92d14SAndroid Build Coastguard Worker 0x01, 1151*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1152*cfb92d14SAndroid Build Coastguard Worker 0x11, 1153*cfb92d14SAndroid Build Coastguard Worker 0x44, 1154*cfb92d14SAndroid Build Coastguard Worker 0x66, 1155*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1156*cfb92d14SAndroid Build Coastguard Worker 0x92, 1157*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1158*cfb92d14SAndroid Build Coastguard Worker 0x53, 1159*cfb92d14SAndroid Build Coastguard Worker 0x1A, # / * 280 * / 1160*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1161*cfb92d14SAndroid Build Coastguard Worker 0x00, 1162*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1163*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1164*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1165*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1166*cfb92d14SAndroid Build Coastguard Worker 0x00, 1167*cfb92d14SAndroid Build Coastguard Worker 0x04, 1168*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1169*cfb92d14SAndroid Build Coastguard Worker 0x92, 1170*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1171*cfb92d14SAndroid Build Coastguard Worker 0x53, 1172*cfb92d14SAndroid Build Coastguard Worker 0x11, 1173*cfb92d14SAndroid Build Coastguard Worker 0x44, 1174*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1175*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1176*cfb92d14SAndroid Build Coastguard Worker 0x92, 1177*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1178*cfb92d14SAndroid Build Coastguard Worker 0x53, 1179*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1180*cfb92d14SAndroid Build Coastguard Worker 0x44, 1181*cfb92d14SAndroid Build Coastguard Worker 0x66, 1182*cfb92d14SAndroid Build Coastguard Worker 0x77, 1183*cfb92d14SAndroid Build Coastguard Worker 0x99, 1184*cfb92d14SAndroid Build Coastguard Worker 0x15, 1185*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1186*cfb92d14SAndroid Build Coastguard Worker 0x00, 1187*cfb92d14SAndroid Build Coastguard Worker 0x54, 1188*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1189*cfb92d14SAndroid Build Coastguard Worker 0x54, 1190*cfb92d14SAndroid Build Coastguard Worker 0x01, 1191*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1192*cfb92d14SAndroid Build Coastguard Worker 0x44, 1193*cfb92d14SAndroid Build Coastguard Worker 0x54, 1194*cfb92d14SAndroid Build Coastguard Worker 0x12, 1195*cfb92d14SAndroid Build Coastguard Worker 0x43, 1196*cfb92d14SAndroid Build Coastguard Worker 0x53, 1197*cfb92d14SAndroid Build Coastguard Worker 0x11, 1198*cfb92d14SAndroid Build Coastguard Worker 0x44, 1199*cfb92d14SAndroid Build Coastguard Worker 0x66, 1200*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1201*cfb92d14SAndroid Build Coastguard Worker 0x92, 1202*cfb92d14SAndroid Build Coastguard Worker 0xBC, 1203*cfb92d14SAndroid Build Coastguard Worker 0x53, 1204*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1205*cfb92d14SAndroid Build Coastguard Worker 0x44, 1206*cfb92d14SAndroid Build Coastguard Worker 0x66, 1207*cfb92d14SAndroid Build Coastguard Worker 0x77, 1208*cfb92d14SAndroid Build Coastguard Worker 0x99, 1209*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1210*cfb92d14SAndroid Build Coastguard Worker 0x92, 1211*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1212*cfb92d14SAndroid Build Coastguard Worker 0x53, 1213*cfb92d14SAndroid Build Coastguard Worker 0x11, 1214*cfb92d14SAndroid Build Coastguard Worker 0x44, 1215*cfb92d14SAndroid Build Coastguard Worker 0x66, 1216*cfb92d14SAndroid Build Coastguard Worker 0x92, 1217*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1218*cfb92d14SAndroid Build Coastguard Worker 0x53, 1219*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1220*cfb92d14SAndroid Build Coastguard Worker 0x44, 1221*cfb92d14SAndroid Build Coastguard Worker 0x66, 1222*cfb92d14SAndroid Build Coastguard Worker 0x77, 1223*cfb92d14SAndroid Build Coastguard Worker 0x99, 1224*cfb92d14SAndroid Build Coastguard Worker 0x15, 1225*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1226*cfb92d14SAndroid Build Coastguard Worker 0x00, 1227*cfb92d14SAndroid Build Coastguard Worker 0x54, 1228*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1229*cfb92d14SAndroid Build Coastguard Worker 0x54, 1230*cfb92d14SAndroid Build Coastguard Worker 0x01, 1231*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1232*cfb92d14SAndroid Build Coastguard Worker 0x11, 1233*cfb92d14SAndroid Build Coastguard Worker 0x44, 1234*cfb92d14SAndroid Build Coastguard Worker 0x66, 1235*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1236*cfb92d14SAndroid Build Coastguard Worker 0x92, 1237*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1238*cfb92d14SAndroid Build Coastguard Worker 0x53, 1239*cfb92d14SAndroid Build Coastguard Worker 0x1A, # / * 360 * / 1240*cfb92d14SAndroid Build Coastguard Worker 0x80, 1241*cfb92d14SAndroid Build Coastguard Worker 0x00, 1242*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1243*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1244*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1245*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1246*cfb92d14SAndroid Build Coastguard Worker 0x00, 1247*cfb92d14SAndroid Build Coastguard Worker 0x04, 1248*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1249*cfb92d14SAndroid Build Coastguard Worker 0x92, 1250*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1251*cfb92d14SAndroid Build Coastguard Worker 0x53, 1252*cfb92d14SAndroid Build Coastguard Worker 0x11, 1253*cfb92d14SAndroid Build Coastguard Worker 0x44, 1254*cfb92d14SAndroid Build Coastguard Worker 0x66, 1255*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1256*cfb92d14SAndroid Build Coastguard Worker 0x92, 1257*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1258*cfb92d14SAndroid Build Coastguard Worker 0x53, 1259*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1260*cfb92d14SAndroid Build Coastguard Worker 0x44, 1261*cfb92d14SAndroid Build Coastguard Worker 0x66, 1262*cfb92d14SAndroid Build Coastguard Worker 0x77, 1263*cfb92d14SAndroid Build Coastguard Worker 0x99, 1264*cfb92d14SAndroid Build Coastguard Worker 0x15, 1265*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1266*cfb92d14SAndroid Build Coastguard Worker 0x00, 1267*cfb92d14SAndroid Build Coastguard Worker 0x54, 1268*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1269*cfb92d14SAndroid Build Coastguard Worker 0x54, 1270*cfb92d14SAndroid Build Coastguard Worker 0x01, 1271*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1272*cfb92d14SAndroid Build Coastguard Worker 0x44, 1273*cfb92d14SAndroid Build Coastguard Worker 0x54, 1274*cfb92d14SAndroid Build Coastguard Worker 0x12, 1275*cfb92d14SAndroid Build Coastguard Worker 0x43, 1276*cfb92d14SAndroid Build Coastguard Worker 0x53, 1277*cfb92d14SAndroid Build Coastguard Worker 0x11, 1278*cfb92d14SAndroid Build Coastguard Worker 0x44, 1279*cfb92d14SAndroid Build Coastguard Worker 0x66, 1280*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1281*cfb92d14SAndroid Build Coastguard Worker 0x92, 1282*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1283*cfb92d14SAndroid Build Coastguard Worker 0x53, 1284*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1285*cfb92d14SAndroid Build Coastguard Worker 0x44, 1286*cfb92d14SAndroid Build Coastguard Worker 0x66, 1287*cfb92d14SAndroid Build Coastguard Worker 0x77, 1288*cfb92d14SAndroid Build Coastguard Worker 0x99, 1289*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1290*cfb92d14SAndroid Build Coastguard Worker 0x92, 1291*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1292*cfb92d14SAndroid Build Coastguard Worker 0x53, 1293*cfb92d14SAndroid Build Coastguard Worker 0x11, 1294*cfb92d14SAndroid Build Coastguard Worker 0x44, 1295*cfb92d14SAndroid Build Coastguard Worker 0x66, 1296*cfb92d14SAndroid Build Coastguard Worker 0x92, 1297*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1298*cfb92d14SAndroid Build Coastguard Worker 0x53, 1299*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1300*cfb92d14SAndroid Build Coastguard Worker 0x44, 1301*cfb92d14SAndroid Build Coastguard Worker 0x66, 1302*cfb92d14SAndroid Build Coastguard Worker 0x77, 1303*cfb92d14SAndroid Build Coastguard Worker 0x99, 1304*cfb92d14SAndroid Build Coastguard Worker 0x15, 1305*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1306*cfb92d14SAndroid Build Coastguard Worker 0x00, 1307*cfb92d14SAndroid Build Coastguard Worker 0x54, 1308*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1309*cfb92d14SAndroid Build Coastguard Worker 0x54, 1310*cfb92d14SAndroid Build Coastguard Worker 0x01, 1311*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1312*cfb92d14SAndroid Build Coastguard Worker 0x11, 1313*cfb92d14SAndroid Build Coastguard Worker 0x44, 1314*cfb92d14SAndroid Build Coastguard Worker 0x66, 1315*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1316*cfb92d14SAndroid Build Coastguard Worker 0x92, 1317*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1318*cfb92d14SAndroid Build Coastguard Worker 0x53, 1319*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1320*cfb92d14SAndroid Build Coastguard Worker 0x80, 1321*cfb92d14SAndroid Build Coastguard Worker 0x00, 1322*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1323*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1324*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1325*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1326*cfb92d14SAndroid Build Coastguard Worker 0x00, 1327*cfb92d14SAndroid Build Coastguard Worker 0x04, 1328*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1329*cfb92d14SAndroid Build Coastguard Worker 0x92, 1330*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1331*cfb92d14SAndroid Build Coastguard Worker 0x53, 1332*cfb92d14SAndroid Build Coastguard Worker 0x11, 1333*cfb92d14SAndroid Build Coastguard Worker 0x4C, 1334*cfb92d14SAndroid Build Coastguard Worker 0x66, 1335*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1336*cfb92d14SAndroid Build Coastguard Worker 0x92, 1337*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1338*cfb92d14SAndroid Build Coastguard Worker 0x53, 1339*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1340*cfb92d14SAndroid Build Coastguard Worker 0x44, 1341*cfb92d14SAndroid Build Coastguard Worker 0x66, 1342*cfb92d14SAndroid Build Coastguard Worker 0x77, 1343*cfb92d14SAndroid Build Coastguard Worker 0x99, 1344*cfb92d14SAndroid Build Coastguard Worker 0x15, 1345*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1346*cfb92d14SAndroid Build Coastguard Worker 0x00, 1347*cfb92d14SAndroid Build Coastguard Worker 0x54, 1348*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1349*cfb92d14SAndroid Build Coastguard Worker 0x54, 1350*cfb92d14SAndroid Build Coastguard Worker 0x01, 1351*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1352*cfb92d14SAndroid Build Coastguard Worker 0x44, 1353*cfb92d14SAndroid Build Coastguard Worker 0x54, 1354*cfb92d14SAndroid Build Coastguard Worker 0x12, 1355*cfb92d14SAndroid Build Coastguard Worker 0xa3, 1356*cfb92d14SAndroid Build Coastguard Worker 0x53, 1357*cfb92d14SAndroid Build Coastguard Worker 0x11, 1358*cfb92d14SAndroid Build Coastguard Worker 0x44, 1359*cfb92d14SAndroid Build Coastguard Worker 0x66, 1360*cfb92d14SAndroid Build Coastguard Worker 0xFE, 1361*cfb92d14SAndroid Build Coastguard Worker 0x92, 1362*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1363*cfb92d14SAndroid Build Coastguard Worker 0x53, 1364*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1365*cfb92d14SAndroid Build Coastguard Worker 0x44, 1366*cfb92d14SAndroid Build Coastguard Worker 0x66, 1367*cfb92d14SAndroid Build Coastguard Worker 0x77, 1368*cfb92d14SAndroid Build Coastguard Worker 0x99, 1369*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1370*cfb92d14SAndroid Build Coastguard Worker 0x92, 1371*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1372*cfb92d14SAndroid Build Coastguard Worker 0x53, 1373*cfb92d14SAndroid Build Coastguard Worker 0x11, 1374*cfb92d14SAndroid Build Coastguard Worker 0x44, 1375*cfb92d14SAndroid Build Coastguard Worker 0x66, 1376*cfb92d14SAndroid Build Coastguard Worker 0x92, 1377*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1378*cfb92d14SAndroid Build Coastguard Worker 0x53, 1379*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1380*cfb92d14SAndroid Build Coastguard Worker 0x44, 1381*cfb92d14SAndroid Build Coastguard Worker 0x66, 1382*cfb92d14SAndroid Build Coastguard Worker 0x77, 1383*cfb92d14SAndroid Build Coastguard Worker 0x99, 1384*cfb92d14SAndroid Build Coastguard Worker 0x15, 1385*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1386*cfb92d14SAndroid Build Coastguard Worker 0x00, 1387*cfb92d14SAndroid Build Coastguard Worker 0x54, 1388*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1389*cfb92d14SAndroid Build Coastguard Worker 0x54, 1390*cfb92d14SAndroid Build Coastguard Worker 0x01, 1391*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1392*cfb92d14SAndroid Build Coastguard Worker 0x11, 1393*cfb92d14SAndroid Build Coastguard Worker 0x44, 1394*cfb92d14SAndroid Build Coastguard Worker 0x66, 1395*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1396*cfb92d14SAndroid Build Coastguard Worker 0x92, 1397*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1398*cfb92d14SAndroid Build Coastguard Worker 0x53, 1399*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1400*cfb92d14SAndroid Build Coastguard Worker 0x80, 1401*cfb92d14SAndroid Build Coastguard Worker 0x00, 1402*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1403*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1404*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1405*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1406*cfb92d14SAndroid Build Coastguard Worker 0x00, 1407*cfb92d14SAndroid Build Coastguard Worker 0x04, 1408*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1409*cfb92d14SAndroid Build Coastguard Worker 0x92, 1410*cfb92d14SAndroid Build Coastguard Worker 0x1B, 1411*cfb92d14SAndroid Build Coastguard Worker 0x53, 1412*cfb92d14SAndroid Build Coastguard Worker 0x11, 1413*cfb92d14SAndroid Build Coastguard Worker 0x44, 1414*cfb92d14SAndroid Build Coastguard Worker 0x66, 1415*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1416*cfb92d14SAndroid Build Coastguard Worker 0x22, 1417*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1418*cfb92d14SAndroid Build Coastguard Worker 0x53, 1419*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1420*cfb92d14SAndroid Build Coastguard Worker 0x44, 1421*cfb92d14SAndroid Build Coastguard Worker 0x67, 1422*cfb92d14SAndroid Build Coastguard Worker 0x77, 1423*cfb92d14SAndroid Build Coastguard Worker 0x99, 1424*cfb92d14SAndroid Build Coastguard Worker 0x15, 1425*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1426*cfb92d14SAndroid Build Coastguard Worker 0x00, 1427*cfb92d14SAndroid Build Coastguard Worker 0x54, 1428*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1429*cfb92d14SAndroid Build Coastguard Worker 0x54, 1430*cfb92d14SAndroid Build Coastguard Worker 0x01, 1431*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1432*cfb92d14SAndroid Build Coastguard Worker 0x44, 1433*cfb92d14SAndroid Build Coastguard Worker 0x54, 1434*cfb92d14SAndroid Build Coastguard Worker 0x12, 1435*cfb92d14SAndroid Build Coastguard Worker 0xD3, 1436*cfb92d14SAndroid Build Coastguard Worker 0x53, 1437*cfb92d14SAndroid Build Coastguard Worker 0x11, 1438*cfb92d14SAndroid Build Coastguard Worker 0x44, 1439*cfb92d14SAndroid Build Coastguard Worker 0x66, 1440*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1441*cfb92d14SAndroid Build Coastguard Worker 0x92, 1442*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1443*cfb92d14SAndroid Build Coastguard Worker 0x53, 1444*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1445*cfb92d14SAndroid Build Coastguard Worker 0x44, 1446*cfb92d14SAndroid Build Coastguard Worker 0x66, 1447*cfb92d14SAndroid Build Coastguard Worker 0x77, 1448*cfb92d14SAndroid Build Coastguard Worker 0x99, 1449*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1450*cfb92d14SAndroid Build Coastguard Worker 0x92, 1451*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1452*cfb92d14SAndroid Build Coastguard Worker 0x53, 1453*cfb92d14SAndroid Build Coastguard Worker 0x11, 1454*cfb92d14SAndroid Build Coastguard Worker 0x44, 1455*cfb92d14SAndroid Build Coastguard Worker 0x66, 1456*cfb92d14SAndroid Build Coastguard Worker 0x92, 1457*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1458*cfb92d14SAndroid Build Coastguard Worker 0x53, 1459*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1460*cfb92d14SAndroid Build Coastguard Worker 0x44, 1461*cfb92d14SAndroid Build Coastguard Worker 0x66, 1462*cfb92d14SAndroid Build Coastguard Worker 0x77, 1463*cfb92d14SAndroid Build Coastguard Worker 0x99, 1464*cfb92d14SAndroid Build Coastguard Worker 0x15, 1465*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1466*cfb92d14SAndroid Build Coastguard Worker 0x00, 1467*cfb92d14SAndroid Build Coastguard Worker 0x54, 1468*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1469*cfb92d14SAndroid Build Coastguard Worker 0x54, 1470*cfb92d14SAndroid Build Coastguard Worker 0x01, 1471*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1472*cfb92d14SAndroid Build Coastguard Worker 0x11, 1473*cfb92d14SAndroid Build Coastguard Worker 0x44, 1474*cfb92d14SAndroid Build Coastguard Worker 0x66, 1475*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1476*cfb92d14SAndroid Build Coastguard Worker 0x92, 1477*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1478*cfb92d14SAndroid Build Coastguard Worker 0x53, 1479*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1480*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1481*cfb92d14SAndroid Build Coastguard Worker 0x00, 1482*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1483*cfb92d14SAndroid Build Coastguard Worker 0x15, 1484*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1485*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1486*cfb92d14SAndroid Build Coastguard Worker 0x00, 1487*cfb92d14SAndroid Build Coastguard Worker 0x04, 1488*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1489*cfb92d14SAndroid Build Coastguard Worker 0x92, 1490*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1491*cfb92d14SAndroid Build Coastguard Worker 0x53, 1492*cfb92d14SAndroid Build Coastguard Worker 0x11, 1493*cfb92d14SAndroid Build Coastguard Worker 0x44, 1494*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1495*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1496*cfb92d14SAndroid Build Coastguard Worker 0x92, 1497*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1498*cfb92d14SAndroid Build Coastguard Worker 0x53, 1499*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1500*cfb92d14SAndroid Build Coastguard Worker 0x44, 1501*cfb92d14SAndroid Build Coastguard Worker 0x66, 1502*cfb92d14SAndroid Build Coastguard Worker 0x77, 1503*cfb92d14SAndroid Build Coastguard Worker 0x99, 1504*cfb92d14SAndroid Build Coastguard Worker 0x15, 1505*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1506*cfb92d14SAndroid Build Coastguard Worker 0x00, 1507*cfb92d14SAndroid Build Coastguard Worker 0x54, 1508*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1509*cfb92d14SAndroid Build Coastguard Worker 0x54, 1510*cfb92d14SAndroid Build Coastguard Worker 0x01, 1511*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1512*cfb92d14SAndroid Build Coastguard Worker 0x44, 1513*cfb92d14SAndroid Build Coastguard Worker 0x54, 1514*cfb92d14SAndroid Build Coastguard Worker 0x12, 1515*cfb92d14SAndroid Build Coastguard Worker 0x43, 1516*cfb92d14SAndroid Build Coastguard Worker 0x53, 1517*cfb92d14SAndroid Build Coastguard Worker 0x11, 1518*cfb92d14SAndroid Build Coastguard Worker 0x44, 1519*cfb92d14SAndroid Build Coastguard Worker 0x66, 1520*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1521*cfb92d14SAndroid Build Coastguard Worker 0x92, 1522*cfb92d14SAndroid Build Coastguard Worker 0xBC, 1523*cfb92d14SAndroid Build Coastguard Worker 0x53, 1524*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1525*cfb92d14SAndroid Build Coastguard Worker 0x44, 1526*cfb92d14SAndroid Build Coastguard Worker 0x66, 1527*cfb92d14SAndroid Build Coastguard Worker 0x77, 1528*cfb92d14SAndroid Build Coastguard Worker 0x99, 1529*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1530*cfb92d14SAndroid Build Coastguard Worker 0x92, 1531*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1532*cfb92d14SAndroid Build Coastguard Worker 0x53, 1533*cfb92d14SAndroid Build Coastguard Worker 0x11, 1534*cfb92d14SAndroid Build Coastguard Worker 0x44, 1535*cfb92d14SAndroid Build Coastguard Worker 0x66, 1536*cfb92d14SAndroid Build Coastguard Worker 0x92, 1537*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1538*cfb92d14SAndroid Build Coastguard Worker 0x53, 1539*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1540*cfb92d14SAndroid Build Coastguard Worker 0x44, 1541*cfb92d14SAndroid Build Coastguard Worker 0x66, 1542*cfb92d14SAndroid Build Coastguard Worker 0x77, 1543*cfb92d14SAndroid Build Coastguard Worker 0x99, 1544*cfb92d14SAndroid Build Coastguard Worker 0x15, 1545*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1546*cfb92d14SAndroid Build Coastguard Worker 0x00, 1547*cfb92d14SAndroid Build Coastguard Worker 0x54, 1548*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1549*cfb92d14SAndroid Build Coastguard Worker 0x54, 1550*cfb92d14SAndroid Build Coastguard Worker 0x01, 1551*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1552*cfb92d14SAndroid Build Coastguard Worker 0x11, 1553*cfb92d14SAndroid Build Coastguard Worker 0x44, 1554*cfb92d14SAndroid Build Coastguard Worker 0x66, 1555*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1556*cfb92d14SAndroid Build Coastguard Worker 0x92, 1557*cfb92d14SAndroid Build Coastguard Worker 0xBA, 1558*cfb92d14SAndroid Build Coastguard Worker 0x53, 1559*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1560*cfb92d14SAndroid Build Coastguard Worker 0x60, 1561*cfb92d14SAndroid Build Coastguard Worker 0x00, 1562*cfb92d14SAndroid Build Coastguard Worker 0x00, 1563*cfb92d14SAndroid Build Coastguard Worker 0x00, 1564*cfb92d14SAndroid Build Coastguard Worker 0x00, 1565*cfb92d14SAndroid Build Coastguard Worker 0x10, 1566*cfb92d14SAndroid Build Coastguard Worker 0x3A, 1567*cfb92d14SAndroid Build Coastguard Worker 0x64, 1568*cfb92d14SAndroid Build Coastguard Worker 0xfe, 1569*cfb92d14SAndroid Build Coastguard Worker 0x80, 1570*cfb92d14SAndroid Build Coastguard Worker 0x00, 1571*cfb92d14SAndroid Build Coastguard Worker 0x00, 1572*cfb92d14SAndroid Build Coastguard Worker 0x00, 1573*cfb92d14SAndroid Build Coastguard Worker 0x00, 1574*cfb92d14SAndroid Build Coastguard Worker 0x00, 1575*cfb92d14SAndroid Build Coastguard Worker 0x00, 1576*cfb92d14SAndroid Build Coastguard Worker 0x02, 1577*cfb92d14SAndroid Build Coastguard Worker 0x00, 1578*cfb92d14SAndroid Build Coastguard Worker 0x00, 1579*cfb92d14SAndroid Build Coastguard Worker 0x11, 1580*cfb92d14SAndroid Build Coastguard Worker 0x12, 1581*cfb92d14SAndroid Build Coastguard Worker 0x13, 1582*cfb92d14SAndroid Build Coastguard Worker 0x14, 1583*cfb92d14SAndroid Build Coastguard Worker 0x15, 1584*cfb92d14SAndroid Build Coastguard Worker 0xfe, 1585*cfb92d14SAndroid Build Coastguard Worker 0x80, 1586*cfb92d14SAndroid Build Coastguard Worker 0x00, 1587*cfb92d14SAndroid Build Coastguard Worker 0x00, 1588*cfb92d14SAndroid Build Coastguard Worker 0x00, 1589*cfb92d14SAndroid Build Coastguard Worker 0x00, 1590*cfb92d14SAndroid Build Coastguard Worker 0x00, 1591*cfb92d14SAndroid Build Coastguard Worker 0x00, 1592*cfb92d14SAndroid Build Coastguard Worker 0x02, 1593*cfb92d14SAndroid Build Coastguard Worker 0x00, 1594*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1595*cfb92d14SAndroid Build Coastguard Worker 0x2A, 1596*cfb92d14SAndroid Build Coastguard Worker 0x3F, 1597*cfb92d14SAndroid Build Coastguard Worker 0x09, 1598*cfb92d14SAndroid Build Coastguard Worker 0xAB, 1599*cfb92d14SAndroid Build Coastguard Worker 0x43, # / * 720 * / 1600*cfb92d14SAndroid Build Coastguard Worker 0x60, 1601*cfb92d14SAndroid Build Coastguard Worker 0x00, 1602*cfb92d14SAndroid Build Coastguard Worker 0xF0, 1603*cfb92d14SAndroid Build Coastguard Worker 0x00, 1604*cfb92d14SAndroid Build Coastguard Worker 0x00, 1605*cfb92d14SAndroid Build Coastguard Worker 0x10, 1606*cfb92d14SAndroid Build Coastguard Worker 0x3A, 1607*cfb92d14SAndroid Build Coastguard Worker 0x64, 1608*cfb92d14SAndroid Build Coastguard Worker 0xfe, 1609*cfb92d14SAndroid Build Coastguard Worker 0x80, 1610*cfb92d14SAndroid Build Coastguard Worker 0x00, 1611*cfb92d14SAndroid Build Coastguard Worker 0x00, 1612*cfb92d14SAndroid Build Coastguard Worker 0x00, 1613*cfb92d14SAndroid Build Coastguard Worker 0x00, 1614*cfb92d14SAndroid Build Coastguard Worker 0x00, 1615*cfb92d14SAndroid Build Coastguard Worker 0x00, 1616*cfb92d14SAndroid Build Coastguard Worker 0x02, 1617*cfb92d14SAndroid Build Coastguard Worker 0x00, 1618*cfb92d14SAndroid Build Coastguard Worker 0x00, 1619*cfb92d14SAndroid Build Coastguard Worker 0x11, 1620*cfb92d14SAndroid Build Coastguard Worker 0x12, 1621*cfb92d14SAndroid Build Coastguard Worker 0x13, 1622*cfb92d14SAndroid Build Coastguard Worker 0x14, 1623*cfb92d14SAndroid Build Coastguard Worker 0x15, 1624*cfb92d14SAndroid Build Coastguard Worker 0xfe, 1625*cfb92d14SAndroid Build Coastguard Worker 0x80, 1626*cfb92d14SAndroid Build Coastguard Worker 0x00, 1627*cfb92d14SAndroid Build Coastguard Worker 0x00, 1628*cfb92d14SAndroid Build Coastguard Worker 0x00, 1629*cfb92d14SAndroid Build Coastguard Worker 0x00, 1630*cfb92d14SAndroid Build Coastguard Worker 0x00, 1631*cfb92d14SAndroid Build Coastguard Worker 0x00, 1632*cfb92d14SAndroid Build Coastguard Worker 0x02, 1633*cfb92d14SAndroid Build Coastguard Worker 0x00, 1634*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1635*cfb92d14SAndroid Build Coastguard Worker 0x2A, 1636*cfb92d14SAndroid Build Coastguard Worker 0x3F, 1637*cfb92d14SAndroid Build Coastguard Worker 0x09, 1638*cfb92d14SAndroid Build Coastguard Worker 0xAB, 1639*cfb92d14SAndroid Build Coastguard Worker 0x43, 1640*cfb92d14SAndroid Build Coastguard Worker 0x80, 1641*cfb92d14SAndroid Build Coastguard Worker 0x00, 1642*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1643*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1644*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1645*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1646*cfb92d14SAndroid Build Coastguard Worker 0x00, 1647*cfb92d14SAndroid Build Coastguard Worker 0x04, 1648*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1649*cfb92d14SAndroid Build Coastguard Worker 0x92, 1650*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1651*cfb92d14SAndroid Build Coastguard Worker 0x53, 1652*cfb92d14SAndroid Build Coastguard Worker 0x11, 1653*cfb92d14SAndroid Build Coastguard Worker 0x44, 1654*cfb92d14SAndroid Build Coastguard Worker 0x66, 1655*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1656*cfb92d14SAndroid Build Coastguard Worker 0x92, 1657*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1658*cfb92d14SAndroid Build Coastguard Worker 0x53, 1659*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1660*cfb92d14SAndroid Build Coastguard Worker 0x44, 1661*cfb92d14SAndroid Build Coastguard Worker 0x66, 1662*cfb92d14SAndroid Build Coastguard Worker 0x77, 1663*cfb92d14SAndroid Build Coastguard Worker 0x99, 1664*cfb92d14SAndroid Build Coastguard Worker 0x15, 1665*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1666*cfb92d14SAndroid Build Coastguard Worker 0x00, 1667*cfb92d14SAndroid Build Coastguard Worker 0x54, 1668*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1669*cfb92d14SAndroid Build Coastguard Worker 0x54, 1670*cfb92d14SAndroid Build Coastguard Worker 0x01, 1671*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1672*cfb92d14SAndroid Build Coastguard Worker 0x44, 1673*cfb92d14SAndroid Build Coastguard Worker 0x54, 1674*cfb92d14SAndroid Build Coastguard Worker 0x12, 1675*cfb92d14SAndroid Build Coastguard Worker 0x43, 1676*cfb92d14SAndroid Build Coastguard Worker 0x53, 1677*cfb92d14SAndroid Build Coastguard Worker 0x11, 1678*cfb92d14SAndroid Build Coastguard Worker 0x44, 1679*cfb92d14SAndroid Build Coastguard Worker 0x66, 1680*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1681*cfb92d14SAndroid Build Coastguard Worker 0x92, 1682*cfb92d14SAndroid Build Coastguard Worker 0xBC, 1683*cfb92d14SAndroid Build Coastguard Worker 0x53, 1684*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1685*cfb92d14SAndroid Build Coastguard Worker 0x44, 1686*cfb92d14SAndroid Build Coastguard Worker 0x66, 1687*cfb92d14SAndroid Build Coastguard Worker 0x77, 1688*cfb92d14SAndroid Build Coastguard Worker 0x99, 1689*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1690*cfb92d14SAndroid Build Coastguard Worker 0x92, 1691*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1692*cfb92d14SAndroid Build Coastguard Worker 0x53, 1693*cfb92d14SAndroid Build Coastguard Worker 0x11, 1694*cfb92d14SAndroid Build Coastguard Worker 0x44, 1695*cfb92d14SAndroid Build Coastguard Worker 0x66, 1696*cfb92d14SAndroid Build Coastguard Worker 0x92, 1697*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1698*cfb92d14SAndroid Build Coastguard Worker 0x53, 1699*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1700*cfb92d14SAndroid Build Coastguard Worker 0x44, 1701*cfb92d14SAndroid Build Coastguard Worker 0x66, 1702*cfb92d14SAndroid Build Coastguard Worker 0x77, 1703*cfb92d14SAndroid Build Coastguard Worker 0x99, 1704*cfb92d14SAndroid Build Coastguard Worker 0x15, 1705*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1706*cfb92d14SAndroid Build Coastguard Worker 0x00, 1707*cfb92d14SAndroid Build Coastguard Worker 0x54, 1708*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1709*cfb92d14SAndroid Build Coastguard Worker 0x54, 1710*cfb92d14SAndroid Build Coastguard Worker 0x01, 1711*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1712*cfb92d14SAndroid Build Coastguard Worker 0x11, 1713*cfb92d14SAndroid Build Coastguard Worker 0x44, 1714*cfb92d14SAndroid Build Coastguard Worker 0x66, 1715*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1716*cfb92d14SAndroid Build Coastguard Worker 0x92, 1717*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1718*cfb92d14SAndroid Build Coastguard Worker 0x53, 1719*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1720*cfb92d14SAndroid Build Coastguard Worker 0x80, 1721*cfb92d14SAndroid Build Coastguard Worker 0x00, 1722*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1723*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1724*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1725*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1726*cfb92d14SAndroid Build Coastguard Worker 0x00, 1727*cfb92d14SAndroid Build Coastguard Worker 0x04, 1728*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1729*cfb92d14SAndroid Build Coastguard Worker 0x92, 1730*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1731*cfb92d14SAndroid Build Coastguard Worker 0x53, 1732*cfb92d14SAndroid Build Coastguard Worker 0x11, 1733*cfb92d14SAndroid Build Coastguard Worker 0x4C, 1734*cfb92d14SAndroid Build Coastguard Worker 0x66, 1735*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1736*cfb92d14SAndroid Build Coastguard Worker 0x92, 1737*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1738*cfb92d14SAndroid Build Coastguard Worker 0x53, 1739*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1740*cfb92d14SAndroid Build Coastguard Worker 0x44, 1741*cfb92d14SAndroid Build Coastguard Worker 0x66, 1742*cfb92d14SAndroid Build Coastguard Worker 0x77, 1743*cfb92d14SAndroid Build Coastguard Worker 0x99, 1744*cfb92d14SAndroid Build Coastguard Worker 0x15, 1745*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1746*cfb92d14SAndroid Build Coastguard Worker 0x00, 1747*cfb92d14SAndroid Build Coastguard Worker 0x54, 1748*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1749*cfb92d14SAndroid Build Coastguard Worker 0x54, 1750*cfb92d14SAndroid Build Coastguard Worker 0x01, 1751*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1752*cfb92d14SAndroid Build Coastguard Worker 0x44, 1753*cfb92d14SAndroid Build Coastguard Worker 0x54, 1754*cfb92d14SAndroid Build Coastguard Worker 0x12, 1755*cfb92d14SAndroid Build Coastguard Worker 0xa3, 1756*cfb92d14SAndroid Build Coastguard Worker 0x53, 1757*cfb92d14SAndroid Build Coastguard Worker 0x11, 1758*cfb92d14SAndroid Build Coastguard Worker 0x44, 1759*cfb92d14SAndroid Build Coastguard Worker 0x66, 1760*cfb92d14SAndroid Build Coastguard Worker 0xFE, 1761*cfb92d14SAndroid Build Coastguard Worker 0x92, 1762*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1763*cfb92d14SAndroid Build Coastguard Worker 0x53, 1764*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1765*cfb92d14SAndroid Build Coastguard Worker 0x44, 1766*cfb92d14SAndroid Build Coastguard Worker 0x66, 1767*cfb92d14SAndroid Build Coastguard Worker 0x77, 1768*cfb92d14SAndroid Build Coastguard Worker 0x99, 1769*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1770*cfb92d14SAndroid Build Coastguard Worker 0x92, 1771*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1772*cfb92d14SAndroid Build Coastguard Worker 0x53, 1773*cfb92d14SAndroid Build Coastguard Worker 0x11, 1774*cfb92d14SAndroid Build Coastguard Worker 0x44, 1775*cfb92d14SAndroid Build Coastguard Worker 0x66, 1776*cfb92d14SAndroid Build Coastguard Worker 0x92, 1777*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1778*cfb92d14SAndroid Build Coastguard Worker 0x53, 1779*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1780*cfb92d14SAndroid Build Coastguard Worker 0x4D, 1781*cfb92d14SAndroid Build Coastguard Worker 0x66, 1782*cfb92d14SAndroid Build Coastguard Worker 0x77, 1783*cfb92d14SAndroid Build Coastguard Worker 0x99, 1784*cfb92d14SAndroid Build Coastguard Worker 0x15, 1785*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1786*cfb92d14SAndroid Build Coastguard Worker 0x00, 1787*cfb92d14SAndroid Build Coastguard Worker 0x54, 1788*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1789*cfb92d14SAndroid Build Coastguard Worker 0x54, 1790*cfb92d14SAndroid Build Coastguard Worker 0x01, 1791*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1792*cfb92d14SAndroid Build Coastguard Worker 0x11, 1793*cfb92d14SAndroid Build Coastguard Worker 0x44, 1794*cfb92d14SAndroid Build Coastguard Worker 0x66, 1795*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1796*cfb92d14SAndroid Build Coastguard Worker 0x92, 1797*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1798*cfb92d14SAndroid Build Coastguard Worker 0x53, 1799*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1800*cfb92d14SAndroid Build Coastguard Worker 0x80, 1801*cfb92d14SAndroid Build Coastguard Worker 0x00, 1802*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1803*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1804*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1805*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1806*cfb92d14SAndroid Build Coastguard Worker 0x00, 1807*cfb92d14SAndroid Build Coastguard Worker 0x04, 1808*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1809*cfb92d14SAndroid Build Coastguard Worker 0x92, 1810*cfb92d14SAndroid Build Coastguard Worker 0x1B, 1811*cfb92d14SAndroid Build Coastguard Worker 0x53, 1812*cfb92d14SAndroid Build Coastguard Worker 0x11, 1813*cfb92d14SAndroid Build Coastguard Worker 0x44, 1814*cfb92d14SAndroid Build Coastguard Worker 0x66, 1815*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1816*cfb92d14SAndroid Build Coastguard Worker 0x22, 1817*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1818*cfb92d14SAndroid Build Coastguard Worker 0x51, 1819*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1820*cfb92d14SAndroid Build Coastguard Worker 0x44, 1821*cfb92d14SAndroid Build Coastguard Worker 0x66, 1822*cfb92d14SAndroid Build Coastguard Worker 0x77, 1823*cfb92d14SAndroid Build Coastguard Worker 0x99, 1824*cfb92d14SAndroid Build Coastguard Worker 0x15, 1825*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1826*cfb92d14SAndroid Build Coastguard Worker 0x00, 1827*cfb92d14SAndroid Build Coastguard Worker 0x54, 1828*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1829*cfb92d14SAndroid Build Coastguard Worker 0x54, 1830*cfb92d14SAndroid Build Coastguard Worker 0x01, 1831*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1832*cfb92d14SAndroid Build Coastguard Worker 0x44, 1833*cfb92d14SAndroid Build Coastguard Worker 0x54, 1834*cfb92d14SAndroid Build Coastguard Worker 0x12, 1835*cfb92d14SAndroid Build Coastguard Worker 0xD3, 1836*cfb92d14SAndroid Build Coastguard Worker 0x53, 1837*cfb92d14SAndroid Build Coastguard Worker 0x11, 1838*cfb92d14SAndroid Build Coastguard Worker 0x44, 1839*cfb92d14SAndroid Build Coastguard Worker 0x66, 1840*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1841*cfb92d14SAndroid Build Coastguard Worker 0x92, 1842*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1843*cfb92d14SAndroid Build Coastguard Worker 0x53, 1844*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1845*cfb92d14SAndroid Build Coastguard Worker 0x44, 1846*cfb92d14SAndroid Build Coastguard Worker 0x66, 1847*cfb92d14SAndroid Build Coastguard Worker 0x77, 1848*cfb92d14SAndroid Build Coastguard Worker 0x99, 1849*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1850*cfb92d14SAndroid Build Coastguard Worker 0x92, 1851*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1852*cfb92d14SAndroid Build Coastguard Worker 0x53, 1853*cfb92d14SAndroid Build Coastguard Worker 0x11, 1854*cfb92d14SAndroid Build Coastguard Worker 0x44, 1855*cfb92d14SAndroid Build Coastguard Worker 0x66, 1856*cfb92d14SAndroid Build Coastguard Worker 0x92, 1857*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1858*cfb92d14SAndroid Build Coastguard Worker 0x53, 1859*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1860*cfb92d14SAndroid Build Coastguard Worker 0x44, 1861*cfb92d14SAndroid Build Coastguard Worker 0x66, 1862*cfb92d14SAndroid Build Coastguard Worker 0x77, 1863*cfb92d14SAndroid Build Coastguard Worker 0x99, 1864*cfb92d14SAndroid Build Coastguard Worker 0x15, 1865*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1866*cfb92d14SAndroid Build Coastguard Worker 0x00, 1867*cfb92d14SAndroid Build Coastguard Worker 0x54, 1868*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1869*cfb92d14SAndroid Build Coastguard Worker 0x54, 1870*cfb92d14SAndroid Build Coastguard Worker 0x01, 1871*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1872*cfb92d14SAndroid Build Coastguard Worker 0x11, 1873*cfb92d14SAndroid Build Coastguard Worker 0x44, 1874*cfb92d14SAndroid Build Coastguard Worker 0x66, 1875*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1876*cfb92d14SAndroid Build Coastguard Worker 0x92, 1877*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1878*cfb92d14SAndroid Build Coastguard Worker 0x53, 1879*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1880*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1881*cfb92d14SAndroid Build Coastguard Worker 0x00, 1882*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1883*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1884*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1885*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1886*cfb92d14SAndroid Build Coastguard Worker 0x00, 1887*cfb92d14SAndroid Build Coastguard Worker 0x04, 1888*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1889*cfb92d14SAndroid Build Coastguard Worker 0x92, 1890*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1891*cfb92d14SAndroid Build Coastguard Worker 0x53, 1892*cfb92d14SAndroid Build Coastguard Worker 0x11, 1893*cfb92d14SAndroid Build Coastguard Worker 0x44, 1894*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1895*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1896*cfb92d14SAndroid Build Coastguard Worker 0x92, 1897*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1898*cfb92d14SAndroid Build Coastguard Worker 0x53, 1899*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1900*cfb92d14SAndroid Build Coastguard Worker 0x44, 1901*cfb92d14SAndroid Build Coastguard Worker 0x66, 1902*cfb92d14SAndroid Build Coastguard Worker 0x77, 1903*cfb92d14SAndroid Build Coastguard Worker 0x99, 1904*cfb92d14SAndroid Build Coastguard Worker 0x15, 1905*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1906*cfb92d14SAndroid Build Coastguard Worker 0x00, 1907*cfb92d14SAndroid Build Coastguard Worker 0x54, 1908*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1909*cfb92d14SAndroid Build Coastguard Worker 0x54, 1910*cfb92d14SAndroid Build Coastguard Worker 0x01, 1911*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1912*cfb92d14SAndroid Build Coastguard Worker 0x44, 1913*cfb92d14SAndroid Build Coastguard Worker 0x54, 1914*cfb92d14SAndroid Build Coastguard Worker 0x12, 1915*cfb92d14SAndroid Build Coastguard Worker 0x4A, 1916*cfb92d14SAndroid Build Coastguard Worker 0x53, 1917*cfb92d14SAndroid Build Coastguard Worker 0x11, 1918*cfb92d14SAndroid Build Coastguard Worker 0x44, 1919*cfb92d14SAndroid Build Coastguard Worker 0x66, 1920*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1921*cfb92d14SAndroid Build Coastguard Worker 0x92, 1922*cfb92d14SAndroid Build Coastguard Worker 0xBC, 1923*cfb92d14SAndroid Build Coastguard Worker 0x53, 1924*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1925*cfb92d14SAndroid Build Coastguard Worker 0x44, 1926*cfb92d14SAndroid Build Coastguard Worker 0x66, 1927*cfb92d14SAndroid Build Coastguard Worker 0x77, 1928*cfb92d14SAndroid Build Coastguard Worker 0x99, 1929*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1930*cfb92d14SAndroid Build Coastguard Worker 0x92, 1931*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1932*cfb92d14SAndroid Build Coastguard Worker 0x53, 1933*cfb92d14SAndroid Build Coastguard Worker 0x11, 1934*cfb92d14SAndroid Build Coastguard Worker 0x44, 1935*cfb92d14SAndroid Build Coastguard Worker 0x66, 1936*cfb92d14SAndroid Build Coastguard Worker 0x92, 1937*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1938*cfb92d14SAndroid Build Coastguard Worker 0x53, 1939*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1940*cfb92d14SAndroid Build Coastguard Worker 0x44, 1941*cfb92d14SAndroid Build Coastguard Worker 0x66, 1942*cfb92d14SAndroid Build Coastguard Worker 0x77, 1943*cfb92d14SAndroid Build Coastguard Worker 0x99, 1944*cfb92d14SAndroid Build Coastguard Worker 0x15, 1945*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1946*cfb92d14SAndroid Build Coastguard Worker 0x00, 1947*cfb92d14SAndroid Build Coastguard Worker 0x54, 1948*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1949*cfb92d14SAndroid Build Coastguard Worker 0x54, 1950*cfb92d14SAndroid Build Coastguard Worker 0x01, 1951*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1952*cfb92d14SAndroid Build Coastguard Worker 0x11, 1953*cfb92d14SAndroid Build Coastguard Worker 0x44, 1954*cfb92d14SAndroid Build Coastguard Worker 0x66, 1955*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1956*cfb92d14SAndroid Build Coastguard Worker 0x92, 1957*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1958*cfb92d14SAndroid Build Coastguard Worker 0x53, 1959*cfb92d14SAndroid Build Coastguard Worker 0x1A, # / * 1080 * / 1960*cfb92d14SAndroid Build Coastguard Worker 0x80, 1961*cfb92d14SAndroid Build Coastguard Worker 0x00, 1962*cfb92d14SAndroid Build Coastguard Worker 0xFA, 1963*cfb92d14SAndroid Build Coastguard Worker 0xA5, 1964*cfb92d14SAndroid Build Coastguard Worker 0x0B, 1965*cfb92d14SAndroid Build Coastguard Worker 0xC0, 1966*cfb92d14SAndroid Build Coastguard Worker 0x00, 1967*cfb92d14SAndroid Build Coastguard Worker 0x04, 1968*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1969*cfb92d14SAndroid Build Coastguard Worker 0x92, 1970*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1971*cfb92d14SAndroid Build Coastguard Worker 0x53, 1972*cfb92d14SAndroid Build Coastguard Worker 0x11, 1973*cfb92d14SAndroid Build Coastguard Worker 0x44, 1974*cfb92d14SAndroid Build Coastguard Worker 0x66, 1975*cfb92d14SAndroid Build Coastguard Worker 0x4E, 1976*cfb92d14SAndroid Build Coastguard Worker 0x92, 1977*cfb92d14SAndroid Build Coastguard Worker 0xBB, 1978*cfb92d14SAndroid Build Coastguard Worker 0x53, 1979*cfb92d14SAndroid Build Coastguard Worker 0x1A, 1980*cfb92d14SAndroid Build Coastguard Worker 0x44, 1981*cfb92d14SAndroid Build Coastguard Worker 0x66, 1982*cfb92d14SAndroid Build Coastguard Worker 0x77, 1983*cfb92d14SAndroid Build Coastguard Worker 0x99, 1984*cfb92d14SAndroid Build Coastguard Worker 0x15, 1985*cfb92d14SAndroid Build Coastguard Worker 0xB3, 1986*cfb92d14SAndroid Build Coastguard Worker 0x00, 1987*cfb92d14SAndroid Build Coastguard Worker 0x54, 1988*cfb92d14SAndroid Build Coastguard Worker 0xCC, 1989*cfb92d14SAndroid Build Coastguard Worker 0x54, 1990*cfb92d14SAndroid Build Coastguard Worker 0x01, 1991*cfb92d14SAndroid Build Coastguard Worker 0xAA, 1992*cfb92d14SAndroid Build Coastguard Worker 0x44, 1993*cfb92d14SAndroid Build Coastguard Worker 0x54, 1994*cfb92d14SAndroid Build Coastguard Worker 0x12, 1995*cfb92d14SAndroid Build Coastguard Worker 0x43, 1996*cfb92d14SAndroid Build Coastguard Worker 0x53, 1997*cfb92d14SAndroid Build Coastguard Worker 0x11, 1998*cfb92d14SAndroid Build Coastguard Worker 0x44, 1999*cfb92d14SAndroid Build Coastguard Worker 0x66, 2000*cfb92d14SAndroid Build Coastguard Worker 0x4E, 2001*cfb92d14SAndroid Build Coastguard Worker 0x92, 2002*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2003*cfb92d14SAndroid Build Coastguard Worker 0x53, 2004*cfb92d14SAndroid Build Coastguard Worker 0x3A, 2005*cfb92d14SAndroid Build Coastguard Worker 0x44, 2006*cfb92d14SAndroid Build Coastguard Worker 0x66, 2007*cfb92d14SAndroid Build Coastguard Worker 0x77, 2008*cfb92d14SAndroid Build Coastguard Worker 0x99, 2009*cfb92d14SAndroid Build Coastguard Worker 0x1A, 2010*cfb92d14SAndroid Build Coastguard Worker 0x92, 2011*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2012*cfb92d14SAndroid Build Coastguard Worker 0x53, 2013*cfb92d14SAndroid Build Coastguard Worker 0x11, 2014*cfb92d14SAndroid Build Coastguard Worker 0x44, 2015*cfb92d14SAndroid Build Coastguard Worker 0x66, 2016*cfb92d14SAndroid Build Coastguard Worker 0x92, 2017*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2018*cfb92d14SAndroid Build Coastguard Worker 0x53, 2019*cfb92d14SAndroid Build Coastguard Worker 0x1A, 2020*cfb92d14SAndroid Build Coastguard Worker 0x44, 2021*cfb92d14SAndroid Build Coastguard Worker 0x66, 2022*cfb92d14SAndroid Build Coastguard Worker 0x77, 2023*cfb92d14SAndroid Build Coastguard Worker 0x99, 2024*cfb92d14SAndroid Build Coastguard Worker 0x15, 2025*cfb92d14SAndroid Build Coastguard Worker 0xB3, 2026*cfb92d14SAndroid Build Coastguard Worker 0x00, 2027*cfb92d14SAndroid Build Coastguard Worker 0x54, 2028*cfb92d14SAndroid Build Coastguard Worker 0xCC, 2029*cfb92d14SAndroid Build Coastguard Worker 0x54, 2030*cfb92d14SAndroid Build Coastguard Worker 0x01, 2031*cfb92d14SAndroid Build Coastguard Worker 0xAA, 2032*cfb92d14SAndroid Build Coastguard Worker 0x11, 2033*cfb92d14SAndroid Build Coastguard Worker 0x44, 2034*cfb92d14SAndroid Build Coastguard Worker 0x66, 2035*cfb92d14SAndroid Build Coastguard Worker 0x4E, 2036*cfb92d14SAndroid Build Coastguard Worker 0x92, 2037*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2038*cfb92d14SAndroid Build Coastguard Worker 0x53, 2039*cfb92d14SAndroid Build Coastguard Worker 0x1A, 2040*cfb92d14SAndroid Build Coastguard Worker 0x80, 2041*cfb92d14SAndroid Build Coastguard Worker 0x00, 2042*cfb92d14SAndroid Build Coastguard Worker 0xFA, 2043*cfb92d14SAndroid Build Coastguard Worker 0xA5, 2044*cfb92d14SAndroid Build Coastguard Worker 0x0B, 2045*cfb92d14SAndroid Build Coastguard Worker 0xC0, 2046*cfb92d14SAndroid Build Coastguard Worker 0x00, 2047*cfb92d14SAndroid Build Coastguard Worker 0x04, 2048*cfb92d14SAndroid Build Coastguard Worker 0x4E, 2049*cfb92d14SAndroid Build Coastguard Worker 0x92, 2050*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2051*cfb92d14SAndroid Build Coastguard Worker 0x53, 2052*cfb92d14SAndroid Build Coastguard Worker 0x11, 2053*cfb92d14SAndroid Build Coastguard Worker 0x4C, 2054*cfb92d14SAndroid Build Coastguard Worker 0x66, 2055*cfb92d14SAndroid Build Coastguard Worker 0x4E, 2056*cfb92d14SAndroid Build Coastguard Worker 0x92, 2057*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2058*cfb92d14SAndroid Build Coastguard Worker 0x53, 2059*cfb92d14SAndroid Build Coastguard Worker 0x1A, 2060*cfb92d14SAndroid Build Coastguard Worker 0x44, 2061*cfb92d14SAndroid Build Coastguard Worker 0x66, 2062*cfb92d14SAndroid Build Coastguard Worker 0x77, 2063*cfb92d14SAndroid Build Coastguard Worker 0x99, 2064*cfb92d14SAndroid Build Coastguard Worker 0x15, 2065*cfb92d14SAndroid Build Coastguard Worker 0xB3, 2066*cfb92d14SAndroid Build Coastguard Worker 0x00, 2067*cfb92d14SAndroid Build Coastguard Worker 0x54, 2068*cfb92d14SAndroid Build Coastguard Worker 0xCC, 2069*cfb92d14SAndroid Build Coastguard Worker 0x54, 2070*cfb92d14SAndroid Build Coastguard Worker 0x01, 2071*cfb92d14SAndroid Build Coastguard Worker 0xAA, 2072*cfb92d14SAndroid Build Coastguard Worker 0x44, 2073*cfb92d14SAndroid Build Coastguard Worker 0x54, 2074*cfb92d14SAndroid Build Coastguard Worker 0x12, 2075*cfb92d14SAndroid Build Coastguard Worker 0xa3, 2076*cfb92d14SAndroid Build Coastguard Worker 0x53, 2077*cfb92d14SAndroid Build Coastguard Worker 0x11, 2078*cfb92d14SAndroid Build Coastguard Worker 0x44, 2079*cfb92d14SAndroid Build Coastguard Worker 0x66, 2080*cfb92d14SAndroid Build Coastguard Worker 0xFE, 2081*cfb92d14SAndroid Build Coastguard Worker 0x92, 2082*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2083*cfb92d14SAndroid Build Coastguard Worker 0x53, 2084*cfb92d14SAndroid Build Coastguard Worker 0x1A, 2085*cfb92d14SAndroid Build Coastguard Worker 0x44, 2086*cfb92d14SAndroid Build Coastguard Worker 0x66, 2087*cfb92d14SAndroid Build Coastguard Worker 0x77, 2088*cfb92d14SAndroid Build Coastguard Worker 0x99, 2089*cfb92d14SAndroid Build Coastguard Worker 0x1A, 2090*cfb92d14SAndroid Build Coastguard Worker 0x92, 2091*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2092*cfb92d14SAndroid Build Coastguard Worker 0x53, 2093*cfb92d14SAndroid Build Coastguard Worker 0x11, 2094*cfb92d14SAndroid Build Coastguard Worker 0x44, 2095*cfb92d14SAndroid Build Coastguard Worker 0x66, 2096*cfb92d14SAndroid Build Coastguard Worker 0x92, 2097*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2098*cfb92d14SAndroid Build Coastguard Worker 0x53, 2099*cfb92d14SAndroid Build Coastguard Worker 0x1A, 2100*cfb92d14SAndroid Build Coastguard Worker 0x44, 2101*cfb92d14SAndroid Build Coastguard Worker 0x66, 2102*cfb92d14SAndroid Build Coastguard Worker 0x77, 2103*cfb92d14SAndroid Build Coastguard Worker 0x99, 2104*cfb92d14SAndroid Build Coastguard Worker 0x15, 2105*cfb92d14SAndroid Build Coastguard Worker 0xB3, 2106*cfb92d14SAndroid Build Coastguard Worker 0x00, 2107*cfb92d14SAndroid Build Coastguard Worker 0x54, 2108*cfb92d14SAndroid Build Coastguard Worker 0xCC, 2109*cfb92d14SAndroid Build Coastguard Worker 0x54, 2110*cfb92d14SAndroid Build Coastguard Worker 0x01, 2111*cfb92d14SAndroid Build Coastguard Worker 0xAA, 2112*cfb92d14SAndroid Build Coastguard Worker 0x11, 2113*cfb92d14SAndroid Build Coastguard Worker 0x44, 2114*cfb92d14SAndroid Build Coastguard Worker 0x66, 2115*cfb92d14SAndroid Build Coastguard Worker 0x4E, 2116*cfb92d14SAndroid Build Coastguard Worker 0x92, 2117*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2118*cfb92d14SAndroid Build Coastguard Worker 0x53, 2119*cfb92d14SAndroid Build Coastguard Worker 0x1A, 2120*cfb92d14SAndroid Build Coastguard Worker 0x80, 2121*cfb92d14SAndroid Build Coastguard Worker 0x00, 2122*cfb92d14SAndroid Build Coastguard Worker 0xFA, 2123*cfb92d14SAndroid Build Coastguard Worker 0xA5, 2124*cfb92d14SAndroid Build Coastguard Worker 0x1B, 2125*cfb92d14SAndroid Build Coastguard Worker 0xC0, 2126*cfb92d14SAndroid Build Coastguard Worker 0x00, 2127*cfb92d14SAndroid Build Coastguard Worker 0x04, 2128*cfb92d14SAndroid Build Coastguard Worker 0x4E, 2129*cfb92d14SAndroid Build Coastguard Worker 0x92, 2130*cfb92d14SAndroid Build Coastguard Worker 0x1B, 2131*cfb92d14SAndroid Build Coastguard Worker 0x53, 2132*cfb92d14SAndroid Build Coastguard Worker 0x11, 2133*cfb92d14SAndroid Build Coastguard Worker 0x44, 2134*cfb92d14SAndroid Build Coastguard Worker 0x66, 2135*cfb92d14SAndroid Build Coastguard Worker 0x4E, 2136*cfb92d14SAndroid Build Coastguard Worker 0x22, 2137*cfb92d14SAndroid Build Coastguard Worker 0xBB, 2138*cfb92d14SAndroid Build Coastguard Worker 0x53, 2139*cfb92d14SAndroid Build Coastguard Worker 0x1A, 2140*cfb92d14SAndroid Build Coastguard Worker 0x44, 2141*cfb92d14SAndroid Build Coastguard Worker 0x66, 2142*cfb92d14SAndroid Build Coastguard Worker 0x77, 2143*cfb92d14SAndroid Build Coastguard Worker 0x99, 2144*cfb92d14SAndroid Build Coastguard Worker 0x15, 2145*cfb92d14SAndroid Build Coastguard Worker 0xB3, 2146*cfb92d14SAndroid Build Coastguard Worker 0x00, 2147*cfb92d14SAndroid Build Coastguard Worker 0x54, 2148*cfb92d14SAndroid Build Coastguard Worker 0xCC, 2149*cfb92d14SAndroid Build Coastguard Worker 0x54, 2150*cfb92d14SAndroid Build Coastguard Worker 0x01, 2151*cfb92d14SAndroid Build Coastguard Worker 0xAA, 2152*cfb92d14SAndroid Build Coastguard Worker 0x44, 2153*cfb92d14SAndroid Build Coastguard Worker 0x54, 2154*cfb92d14SAndroid Build Coastguard Worker 0x12, 2155*cfb92d14SAndroid Build Coastguard Worker 0xD3, 2156*cfb92d14SAndroid Build Coastguard Worker 0x53, 2157*cfb92d14SAndroid Build Coastguard Worker 0x11, 2158*cfb92d14SAndroid Build Coastguard Worker 0x44, 2159*cfb92d14SAndroid Build Coastguard Worker 0x66 2160*cfb92d14SAndroid Build Coastguard Worker ]) 2161*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 2162*cfb92d14SAndroid Build Coastguard Worker 2163*cfb92d14SAndroid Build Coastguard Worker def test_should_defragment_IPv6_packet_when_parse_method_called_with_fragments(self): 2164*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2165*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 2166*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 2167*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x00, 0x00, 0x11, 0x12, 0x13, 0x14, 0x15])) 2168*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 2169*cfb92d14SAndroid Build Coastguard Worker bytearray([0x00, 0x00, 0x1A, 0x2A, 0x3F, 0x09, 0xAB, 0x43])) 2170*cfb92d14SAndroid Build Coastguard Worker 2171*cfb92d14SAndroid Build Coastguard Worker fragment_1 = bytearray( 2172*cfb92d14SAndroid Build Coastguard Worker [0xC0, 0x38, 0x12, 0x34, 0x7A, 0x33, 0x3A, 0x80, 0x00, 0x1A, 0x33, 0x0B, 0xC0, 0x00, 0x04]) 2173*cfb92d14SAndroid Build Coastguard Worker 2174*cfb92d14SAndroid Build Coastguard Worker fragment_2 = bytearray([0xE0, 0x38, 0x12, 0x34, 0x06, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x12, 0x13, 0x14]) 2175*cfb92d14SAndroid Build Coastguard Worker 2176*cfb92d14SAndroid Build Coastguard Worker parser = create_default_lowpan_parser(None) 2177*cfb92d14SAndroid Build Coastguard Worker 2178*cfb92d14SAndroid Build Coastguard Worker # WHEN 2179*cfb92d14SAndroid Build Coastguard Worker self.assertIsNone(parser.parse(io.BytesIO(fragment_1), message_info=message_info)) 2180*cfb92d14SAndroid Build Coastguard Worker actual_ipv6_packet = parser.parse(io.BytesIO(fragment_2), message_info=message_info) 2181*cfb92d14SAndroid Build Coastguard Worker 2182*cfb92d14SAndroid Build Coastguard Worker # THEN 2183*cfb92d14SAndroid Build Coastguard Worker ipv6_packet = bytearray([ 2184*cfb92d14SAndroid Build Coastguard Worker 0x60, 0x00, 0x00, 0x00, 0x00, 0x10, 0x3A, 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 2185*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x11, 0x12, 0x13, 0x14, 0x15, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x1A, 0x2A, 2186*cfb92d14SAndroid Build Coastguard Worker 0x3F, 0x09, 0xAB, 0x43, 0x80, 0x00, 0x1A, 0x33, 0x0B, 0xC0, 0x00, 0x04, 0x4E, 0x92, 0xBB, 0x53, 0x11, 0x12, 2187*cfb92d14SAndroid Build Coastguard Worker 0x13, 0x14 2188*cfb92d14SAndroid Build Coastguard Worker ]) 2189*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_packet, actual_ipv6_packet.to_bytes()) 2190*cfb92d14SAndroid Build Coastguard Worker 2191*cfb92d14SAndroid Build Coastguard Worker 2192*cfb92d14SAndroid Build Coastguard Workerclass TestLowpanUdpHeaderFactory(unittest.TestCase): 2193*cfb92d14SAndroid Build Coastguard Worker 2194*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_udp_datagram_ports_when_decompress_udp_ports_method_called_with_udphc_p_eq_0(self): 2195*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2196*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanUdpHeaderFactory() 2197*cfb92d14SAndroid Build Coastguard Worker 2198*cfb92d14SAndroid Build Coastguard Worker p = factory.UDP_HC_P_BOTH_FULL 2199*cfb92d14SAndroid Build Coastguard Worker 2200*cfb92d14SAndroid Build Coastguard Worker udphc = lowpan.LowpanUDPHC(any_c(), p) 2201*cfb92d14SAndroid Build Coastguard Worker 2202*cfb92d14SAndroid Build Coastguard Worker src_port = any_src_port() 2203*cfb92d14SAndroid Build Coastguard Worker dst_port = any_dst_port() 2204*cfb92d14SAndroid Build Coastguard Worker 2205*cfb92d14SAndroid Build Coastguard Worker data_bytes = struct.pack(">H", src_port) + struct.pack(">H", dst_port) 2206*cfb92d14SAndroid Build Coastguard Worker 2207*cfb92d14SAndroid Build Coastguard Worker # WHEN 2208*cfb92d14SAndroid Build Coastguard Worker actual_src_port, actual_dst_port = factory._decompress_udp_ports(udphc, io.BytesIO(data_bytes)) 2209*cfb92d14SAndroid Build Coastguard Worker 2210*cfb92d14SAndroid Build Coastguard Worker # THEN 2211*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(src_port, actual_src_port) 2212*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(dst_port, actual_dst_port) 2213*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, p) 2214*cfb92d14SAndroid Build Coastguard Worker 2215*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_udp_datagram_ports_when_decompress_udp_ports_method_called_with_udphc_p_eq_1(self): 2216*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2217*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanUdpHeaderFactory() 2218*cfb92d14SAndroid Build Coastguard Worker 2219*cfb92d14SAndroid Build Coastguard Worker p = factory.UDP_HC_P_DST_COMPR 2220*cfb92d14SAndroid Build Coastguard Worker 2221*cfb92d14SAndroid Build Coastguard Worker udphc = lowpan.LowpanUDPHC(any_c(), p) 2222*cfb92d14SAndroid Build Coastguard Worker 2223*cfb92d14SAndroid Build Coastguard Worker src_port = any_src_port() 2224*cfb92d14SAndroid Build Coastguard Worker dst_port = any_compressable_dst_port() 2225*cfb92d14SAndroid Build Coastguard Worker 2226*cfb92d14SAndroid Build Coastguard Worker data_bytes = struct.pack(">H", src_port) + bytearray([struct.pack(">H", dst_port)[1]]) 2227*cfb92d14SAndroid Build Coastguard Worker 2228*cfb92d14SAndroid Build Coastguard Worker # WHEN 2229*cfb92d14SAndroid Build Coastguard Worker actual_src_port, actual_dst_port = factory._decompress_udp_ports(udphc, io.BytesIO(data_bytes)) 2230*cfb92d14SAndroid Build Coastguard Worker 2231*cfb92d14SAndroid Build Coastguard Worker # THEN 2232*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, p) 2233*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(src_port, actual_src_port) 2234*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(dst_port, actual_dst_port) 2235*cfb92d14SAndroid Build Coastguard Worker 2236*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_udp_datagram_ports_when_decompress_udp_ports_method_called_with_udphc_p_eq_2(self): 2237*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2238*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanUdpHeaderFactory() 2239*cfb92d14SAndroid Build Coastguard Worker 2240*cfb92d14SAndroid Build Coastguard Worker p = factory.UDP_HC_P_SRC_COMPR 2241*cfb92d14SAndroid Build Coastguard Worker 2242*cfb92d14SAndroid Build Coastguard Worker udphc = lowpan.LowpanUDPHC(any_c(), p) 2243*cfb92d14SAndroid Build Coastguard Worker 2244*cfb92d14SAndroid Build Coastguard Worker src_port = any_compressable_src_port() 2245*cfb92d14SAndroid Build Coastguard Worker dst_port = any_dst_port() 2246*cfb92d14SAndroid Build Coastguard Worker 2247*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray([struct.pack(">H", src_port)[1]]) + struct.pack(">H", dst_port) 2248*cfb92d14SAndroid Build Coastguard Worker 2249*cfb92d14SAndroid Build Coastguard Worker # WHEN 2250*cfb92d14SAndroid Build Coastguard Worker actual_src_port, actual_dst_port = factory._decompress_udp_ports(udphc, io.BytesIO(data_bytes)) 2251*cfb92d14SAndroid Build Coastguard Worker 2252*cfb92d14SAndroid Build Coastguard Worker # THEN 2253*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(2, p) 2254*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(src_port, actual_src_port) 2255*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(dst_port, actual_dst_port) 2256*cfb92d14SAndroid Build Coastguard Worker 2257*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_udp_datagram_ports_when_decompress_udp_ports_method_called_with_udphc_p_eq_3(self): 2258*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2259*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanUdpHeaderFactory() 2260*cfb92d14SAndroid Build Coastguard Worker 2261*cfb92d14SAndroid Build Coastguard Worker p = factory.UDP_HC_P_BOTH_COMPR 2262*cfb92d14SAndroid Build Coastguard Worker 2263*cfb92d14SAndroid Build Coastguard Worker udphc = lowpan.LowpanUDPHC(any_c(), p) 2264*cfb92d14SAndroid Build Coastguard Worker 2265*cfb92d14SAndroid Build Coastguard Worker src_port = any_nibble_src_port() 2266*cfb92d14SAndroid Build Coastguard Worker dst_port = any_nibble_dst_port() 2267*cfb92d14SAndroid Build Coastguard Worker 2268*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray([((src_port & 0x0F) << 4) | (dst_port & 0x0F)]) 2269*cfb92d14SAndroid Build Coastguard Worker 2270*cfb92d14SAndroid Build Coastguard Worker # WHEN 2271*cfb92d14SAndroid Build Coastguard Worker actual_src_port, actual_dst_port = factory._decompress_udp_ports(udphc, io.BytesIO(data_bytes)) 2272*cfb92d14SAndroid Build Coastguard Worker 2273*cfb92d14SAndroid Build Coastguard Worker # THEN 2274*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(3, p) 2275*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(src_port, actual_src_port) 2276*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(dst_port, actual_dst_port) 2277*cfb92d14SAndroid Build Coastguard Worker 2278*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_udp_datagram_checksum_when_decompress_udp_checksum_called_with_udphc_c_eq_0(self): 2279*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2280*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanUdpHeaderFactory() 2281*cfb92d14SAndroid Build Coastguard Worker 2282*cfb92d14SAndroid Build Coastguard Worker c = factory.UDP_HC_C_INLINE 2283*cfb92d14SAndroid Build Coastguard Worker 2284*cfb92d14SAndroid Build Coastguard Worker udphc = lowpan.LowpanUDPHC(c, any_p()) 2285*cfb92d14SAndroid Build Coastguard Worker 2286*cfb92d14SAndroid Build Coastguard Worker checksum = any_checksum() 2287*cfb92d14SAndroid Build Coastguard Worker 2288*cfb92d14SAndroid Build Coastguard Worker data_bytes = struct.pack(">H", checksum) 2289*cfb92d14SAndroid Build Coastguard Worker 2290*cfb92d14SAndroid Build Coastguard Worker # WHEN 2291*cfb92d14SAndroid Build Coastguard Worker actual_checksum = factory._decompress_udp_checksum(udphc, io.BytesIO(data_bytes)) 2292*cfb92d14SAndroid Build Coastguard Worker 2293*cfb92d14SAndroid Build Coastguard Worker # THEN 2294*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, c) 2295*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(checksum, actual_checksum) 2296*cfb92d14SAndroid Build Coastguard Worker 2297*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_udp_datagram_checksum_when_decompress_udp_checksum_called_with_udphc_c_eq_1(self): 2298*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2299*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanUdpHeaderFactory() 2300*cfb92d14SAndroid Build Coastguard Worker 2301*cfb92d14SAndroid Build Coastguard Worker c = factory.UDP_HC_C_ELIDED 2302*cfb92d14SAndroid Build Coastguard Worker 2303*cfb92d14SAndroid Build Coastguard Worker udphc = lowpan.LowpanUDPHC(c, any_p()) 2304*cfb92d14SAndroid Build Coastguard Worker 2305*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray() 2306*cfb92d14SAndroid Build Coastguard Worker 2307*cfb92d14SAndroid Build Coastguard Worker # WHEN 2308*cfb92d14SAndroid Build Coastguard Worker actual_checksum = factory._decompress_udp_checksum(udphc, io.BytesIO(data_bytes)) 2309*cfb92d14SAndroid Build Coastguard Worker 2310*cfb92d14SAndroid Build Coastguard Worker # THEN 2311*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, c) 2312*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, actual_checksum) 2313*cfb92d14SAndroid Build Coastguard Worker 2314*cfb92d14SAndroid Build Coastguard Worker 2315*cfb92d14SAndroid Build Coastguard Workerclass TestLowpanIpv6HeaderFactory(unittest.TestCase): 2316*cfb92d14SAndroid Build Coastguard Worker 2317*cfb92d14SAndroid Build Coastguard Worker IPV6_LINKLOCAL_PREFIX = bytearray([0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) 2318*cfb92d14SAndroid Build Coastguard Worker 2319*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_traffic_class_and_flow_label_when_decompress_tf_method_called_with_iphc_tf_eq_0(self): 2320*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2321*cfb92d14SAndroid Build Coastguard Worker ecn = any_ecn() 2322*cfb92d14SAndroid Build Coastguard Worker dscp = any_dscp() 2323*cfb92d14SAndroid Build Coastguard Worker flow_label = any_flow_label() 2324*cfb92d14SAndroid Build Coastguard Worker 2325*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray() 2326*cfb92d14SAndroid Build Coastguard Worker data_bytes.append((ecn << 6) | dscp) 2327*cfb92d14SAndroid Build Coastguard Worker data_bytes.append((flow_label >> 16) & 0x0F) 2328*cfb92d14SAndroid Build Coastguard Worker data_bytes.append((flow_label >> 8) & 0xFF) 2329*cfb92d14SAndroid Build Coastguard Worker data_bytes.append(flow_label & 0xFF) 2330*cfb92d14SAndroid Build Coastguard Worker 2331*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2332*cfb92d14SAndroid Build Coastguard Worker 2333*cfb92d14SAndroid Build Coastguard Worker tf = factory.IPHC_TF_4B 2334*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(tf, any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), any_m(), any_dac(), 2335*cfb92d14SAndroid Build Coastguard Worker any_dam()) 2336*cfb92d14SAndroid Build Coastguard Worker 2337*cfb92d14SAndroid Build Coastguard Worker # WHEN 2338*cfb92d14SAndroid Build Coastguard Worker actual_traffic_class, actual_flow_label = factory._decompress_tf(iphc, io.BytesIO(data_bytes)) 2339*cfb92d14SAndroid Build Coastguard Worker 2340*cfb92d14SAndroid Build Coastguard Worker # THEN 2341*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, tf) 2342*cfb92d14SAndroid Build Coastguard Worker self.assertEqual((dscp << 2) | ecn, actual_traffic_class) 2343*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(flow_label, actual_flow_label) 2344*cfb92d14SAndroid Build Coastguard Worker 2345*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_traffic_class_and_flow_label_when_decompress_tf_method_called_with_iphc_tf_eq_1(self): 2346*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2347*cfb92d14SAndroid Build Coastguard Worker ecn = any_ecn() 2348*cfb92d14SAndroid Build Coastguard Worker flow_label = any_flow_label() 2349*cfb92d14SAndroid Build Coastguard Worker 2350*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray() 2351*cfb92d14SAndroid Build Coastguard Worker data_bytes.append((ecn << 6) | (flow_label >> 16) & 0x0F) 2352*cfb92d14SAndroid Build Coastguard Worker data_bytes.append((flow_label >> 8) & 0xFF) 2353*cfb92d14SAndroid Build Coastguard Worker data_bytes.append(flow_label & 0xFF) 2354*cfb92d14SAndroid Build Coastguard Worker 2355*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2356*cfb92d14SAndroid Build Coastguard Worker 2357*cfb92d14SAndroid Build Coastguard Worker tf = factory.IPHC_TF_3B 2358*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(tf, any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), any_m(), any_dac(), 2359*cfb92d14SAndroid Build Coastguard Worker any_dam()) 2360*cfb92d14SAndroid Build Coastguard Worker 2361*cfb92d14SAndroid Build Coastguard Worker # WHEN 2362*cfb92d14SAndroid Build Coastguard Worker actual_traffic_class, actual_flow_label = factory._decompress_tf(iphc, io.BytesIO(data_bytes)) 2363*cfb92d14SAndroid Build Coastguard Worker 2364*cfb92d14SAndroid Build Coastguard Worker # THEN 2365*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, tf) 2366*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ecn, actual_traffic_class) 2367*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(flow_label, actual_flow_label) 2368*cfb92d14SAndroid Build Coastguard Worker 2369*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_traffic_class_and_flow_label_when_decompress_tf_method_called_with_iphc_tf_eq_2(self): 2370*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2371*cfb92d14SAndroid Build Coastguard Worker ecn = any_ecn() 2372*cfb92d14SAndroid Build Coastguard Worker dscp = any_dscp() 2373*cfb92d14SAndroid Build Coastguard Worker 2374*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray([(ecn << 6) | dscp]) 2375*cfb92d14SAndroid Build Coastguard Worker 2376*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2377*cfb92d14SAndroid Build Coastguard Worker 2378*cfb92d14SAndroid Build Coastguard Worker tf = factory.IPHC_TF_1B 2379*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(tf, any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), any_m(), any_dac(), 2380*cfb92d14SAndroid Build Coastguard Worker any_dam()) 2381*cfb92d14SAndroid Build Coastguard Worker 2382*cfb92d14SAndroid Build Coastguard Worker # WHEN 2383*cfb92d14SAndroid Build Coastguard Worker actual_traffic_class, actual_flow_label = factory._decompress_tf(iphc, io.BytesIO(data_bytes)) 2384*cfb92d14SAndroid Build Coastguard Worker 2385*cfb92d14SAndroid Build Coastguard Worker # THEN 2386*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(2, tf) 2387*cfb92d14SAndroid Build Coastguard Worker self.assertEqual((dscp << 2) | ecn, actual_traffic_class) 2388*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, actual_flow_label) 2389*cfb92d14SAndroid Build Coastguard Worker 2390*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_traffic_class_and_flow_label_when_decompress_tf_method_called_with_iphc_tf_eq_3(self): 2391*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray() 2392*cfb92d14SAndroid Build Coastguard Worker 2393*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2394*cfb92d14SAndroid Build Coastguard Worker 2395*cfb92d14SAndroid Build Coastguard Worker tf = factory.IPHC_TF_ELIDED 2396*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(tf, any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), any_m(), any_dac(), 2397*cfb92d14SAndroid Build Coastguard Worker any_dam()) 2398*cfb92d14SAndroid Build Coastguard Worker 2399*cfb92d14SAndroid Build Coastguard Worker # WHEN 2400*cfb92d14SAndroid Build Coastguard Worker actual_traffic_class, actual_flow_label = factory._decompress_tf(iphc, io.BytesIO(data_bytes)) 2401*cfb92d14SAndroid Build Coastguard Worker 2402*cfb92d14SAndroid Build Coastguard Worker # THEN 2403*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(3, tf) 2404*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, actual_traffic_class) 2405*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, actual_flow_label) 2406*cfb92d14SAndroid Build Coastguard Worker 2407*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_traffic_class_and_flow_label_when_decompress_nh_method_called_with_iphc_nh_eq_0(self): 2408*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2409*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2410*cfb92d14SAndroid Build Coastguard Worker 2411*cfb92d14SAndroid Build Coastguard Worker next_header = any_next_header() 2412*cfb92d14SAndroid Build Coastguard Worker 2413*cfb92d14SAndroid Build Coastguard Worker nh = factory.IPHC_NH_INLINE 2414*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), nh, any_hlim(), any_cid(), any_sac(), any_sam(), any_m(), any_dac(), 2415*cfb92d14SAndroid Build Coastguard Worker any_dam()) 2416*cfb92d14SAndroid Build Coastguard Worker 2417*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray([next_header]) 2418*cfb92d14SAndroid Build Coastguard Worker 2419*cfb92d14SAndroid Build Coastguard Worker # WHEN 2420*cfb92d14SAndroid Build Coastguard Worker actual_next_header = factory._decompress_nh(iphc, io.BytesIO(data_bytes)) 2421*cfb92d14SAndroid Build Coastguard Worker 2422*cfb92d14SAndroid Build Coastguard Worker # THEN 2423*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, nh) 2424*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(next_header, actual_next_header) 2425*cfb92d14SAndroid Build Coastguard Worker 2426*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_traffic_class_and_flow_label_when_decompress_nh_method_called_with_iphc_nh_eq_1(self): 2427*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2428*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2429*cfb92d14SAndroid Build Coastguard Worker 2430*cfb92d14SAndroid Build Coastguard Worker nh = factory.IPHC_NH_COMPRESSED 2431*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), nh, any_hlim(), any_cid(), any_sac(), any_sam(), any_m(), any_dac(), 2432*cfb92d14SAndroid Build Coastguard Worker any_dam()) 2433*cfb92d14SAndroid Build Coastguard Worker 2434*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray() 2435*cfb92d14SAndroid Build Coastguard Worker 2436*cfb92d14SAndroid Build Coastguard Worker # WHEN 2437*cfb92d14SAndroid Build Coastguard Worker actual_next_header = factory._decompress_nh(iphc, io.BytesIO(data_bytes)) 2438*cfb92d14SAndroid Build Coastguard Worker 2439*cfb92d14SAndroid Build Coastguard Worker # THEN 2440*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, nh) 2441*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(None, actual_next_header) 2442*cfb92d14SAndroid Build Coastguard Worker 2443*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_hop_limit_when_decompress_hlim_called_with_iphc_hlim_eq_0(self): 2444*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2445*cfb92d14SAndroid Build Coastguard Worker hop_limit = any_hop_limit() 2446*cfb92d14SAndroid Build Coastguard Worker 2447*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2448*cfb92d14SAndroid Build Coastguard Worker 2449*cfb92d14SAndroid Build Coastguard Worker hlim = factory.IPHC_HLIM_INLINE 2450*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), hlim, any_cid(), any_sac(), any_sam(), any_m(), any_dac(), 2451*cfb92d14SAndroid Build Coastguard Worker any_dam()) 2452*cfb92d14SAndroid Build Coastguard Worker 2453*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray([hop_limit]) 2454*cfb92d14SAndroid Build Coastguard Worker 2455*cfb92d14SAndroid Build Coastguard Worker # WHEN 2456*cfb92d14SAndroid Build Coastguard Worker actual_hop_limit = factory._decompress_hlim(iphc, io.BytesIO(data_bytes)) 2457*cfb92d14SAndroid Build Coastguard Worker 2458*cfb92d14SAndroid Build Coastguard Worker # THEN 2459*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, hlim) 2460*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(hop_limit, actual_hop_limit) 2461*cfb92d14SAndroid Build Coastguard Worker 2462*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_hop_limit_when_decompress_hlim_called_with_iphc_hlim_eq_1(self): 2463*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2464*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2465*cfb92d14SAndroid Build Coastguard Worker 2466*cfb92d14SAndroid Build Coastguard Worker hlim = factory.IPHC_HLIM_1 2467*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), hlim, any_cid(), any_sac(), any_sam(), any_m(), any_dac(), 2468*cfb92d14SAndroid Build Coastguard Worker any_dam()) 2469*cfb92d14SAndroid Build Coastguard Worker 2470*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray() 2471*cfb92d14SAndroid Build Coastguard Worker 2472*cfb92d14SAndroid Build Coastguard Worker # WHEN 2473*cfb92d14SAndroid Build Coastguard Worker actual_hop_limit = factory._decompress_hlim(iphc, io.BytesIO(data_bytes)) 2474*cfb92d14SAndroid Build Coastguard Worker 2475*cfb92d14SAndroid Build Coastguard Worker # THEN 2476*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, hlim) 2477*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, actual_hop_limit) 2478*cfb92d14SAndroid Build Coastguard Worker 2479*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_hop_limit_when_decompress_hlim_called_with_iphc_hlim_eq_2(self): 2480*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2481*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2482*cfb92d14SAndroid Build Coastguard Worker 2483*cfb92d14SAndroid Build Coastguard Worker hlim = factory.IPHC_HLIM_64 2484*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), hlim, any_cid(), any_sac(), any_sam(), any_m(), any_dac(), 2485*cfb92d14SAndroid Build Coastguard Worker any_dam()) 2486*cfb92d14SAndroid Build Coastguard Worker 2487*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray() 2488*cfb92d14SAndroid Build Coastguard Worker 2489*cfb92d14SAndroid Build Coastguard Worker # WHEN 2490*cfb92d14SAndroid Build Coastguard Worker actual_hop_limit = factory._decompress_hlim(iphc, io.BytesIO(data_bytes)) 2491*cfb92d14SAndroid Build Coastguard Worker 2492*cfb92d14SAndroid Build Coastguard Worker # THEN 2493*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(2, hlim) 2494*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(64, actual_hop_limit) 2495*cfb92d14SAndroid Build Coastguard Worker 2496*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_hop_limit_when_decompress_hlim_called_with_iphc_hlim_eq_3(self): 2497*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2498*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2499*cfb92d14SAndroid Build Coastguard Worker 2500*cfb92d14SAndroid Build Coastguard Worker hlim = factory.IPHC_HLIM_255 2501*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), hlim, any_cid(), any_sac(), any_sam(), any_m(), any_dac(), 2502*cfb92d14SAndroid Build Coastguard Worker any_dam()) 2503*cfb92d14SAndroid Build Coastguard Worker 2504*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray() 2505*cfb92d14SAndroid Build Coastguard Worker 2506*cfb92d14SAndroid Build Coastguard Worker # WHEN 2507*cfb92d14SAndroid Build Coastguard Worker actual_hop_limit = factory._decompress_hlim(iphc, io.BytesIO(data_bytes)) 2508*cfb92d14SAndroid Build Coastguard Worker 2509*cfb92d14SAndroid Build Coastguard Worker # THEN 2510*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(3, hlim) 2511*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(255, actual_hop_limit) 2512*cfb92d14SAndroid Build Coastguard Worker 2513*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_source_address_when_decompress_src_addr_called_with_sac_eq_0_and_sam_eq_0(self): 2514*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2515*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2516*cfb92d14SAndroid Build Coastguard Worker 2517*cfb92d14SAndroid Build Coastguard Worker src_addr = any_src_addr() 2518*cfb92d14SAndroid Build Coastguard Worker 2519*cfb92d14SAndroid Build Coastguard Worker sac = factory.IPHC_SAC_STATELESS 2520*cfb92d14SAndroid Build Coastguard Worker sam = factory.IPHC_SAM_128B 2521*cfb92d14SAndroid Build Coastguard Worker 2522*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), sac, sam, any_m(), any_dac(), any_dam()) 2523*cfb92d14SAndroid Build Coastguard Worker 2524*cfb92d14SAndroid Build Coastguard Worker # WHEN 2525*cfb92d14SAndroid Build Coastguard Worker actual_src_addr = factory._decompress_src_addr(iphc, any_src_mac_addr(), any_sci(), io.BytesIO(src_addr)) 2526*cfb92d14SAndroid Build Coastguard Worker 2527*cfb92d14SAndroid Build Coastguard Worker # THEN 2528*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, sac) 2529*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, sam) 2530*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(bytes(src_addr), actual_src_addr) 2531*cfb92d14SAndroid Build Coastguard Worker 2532*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_source_address_when_decompress_src_addr_called_with_sac_eq_0_and_sam_eq_1(self): 2533*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2534*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2535*cfb92d14SAndroid Build Coastguard Worker 2536*cfb92d14SAndroid Build Coastguard Worker eui64 = any_eui64() 2537*cfb92d14SAndroid Build Coastguard Worker 2538*cfb92d14SAndroid Build Coastguard Worker sac = factory.IPHC_SAC_STATELESS 2539*cfb92d14SAndroid Build Coastguard Worker sam = factory.IPHC_SAM_64B 2540*cfb92d14SAndroid Build Coastguard Worker 2541*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), sac, sam, any_m(), any_dac(), any_dam()) 2542*cfb92d14SAndroid Build Coastguard Worker 2543*cfb92d14SAndroid Build Coastguard Worker # WHEN 2544*cfb92d14SAndroid Build Coastguard Worker actual_src_addr = factory._decompress_src_addr(iphc, any_src_mac_addr(), any_sci(), io.BytesIO(eui64)) 2545*cfb92d14SAndroid Build Coastguard Worker 2546*cfb92d14SAndroid Build Coastguard Worker # THEN 2547*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, sac) 2548*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, sam) 2549*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(self.IPV6_LINKLOCAL_PREFIX + eui64, actual_src_addr) 2550*cfb92d14SAndroid Build Coastguard Worker 2551*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_source_address_when_decompress_src_addr_called_with_sac_eq_0_and_sam_eq_2(self): 2552*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2553*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2554*cfb92d14SAndroid Build Coastguard Worker 2555*cfb92d14SAndroid Build Coastguard Worker rloc16 = any_rloc16() 2556*cfb92d14SAndroid Build Coastguard Worker 2557*cfb92d14SAndroid Build Coastguard Worker sac = factory.IPHC_SAC_STATELESS 2558*cfb92d14SAndroid Build Coastguard Worker sam = factory.IPHC_SAM_16B 2559*cfb92d14SAndroid Build Coastguard Worker 2560*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), sac, sam, any_m(), any_dac(), any_dam()) 2561*cfb92d14SAndroid Build Coastguard Worker 2562*cfb92d14SAndroid Build Coastguard Worker # WHEN 2563*cfb92d14SAndroid Build Coastguard Worker actual_src_addr = factory._decompress_src_addr(iphc, any_src_mac_addr(), any_sci(), io.BytesIO(rloc16)) 2564*cfb92d14SAndroid Build Coastguard Worker 2565*cfb92d14SAndroid Build Coastguard Worker # THEN 2566*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, sac) 2567*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(2, sam) 2568*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(self.IPV6_LINKLOCAL_PREFIX + bytearray([0x00, 0x00, 0x00, 0xff, 0xfe, 0x00]) + rloc16, 2569*cfb92d14SAndroid Build Coastguard Worker actual_src_addr) 2570*cfb92d14SAndroid Build Coastguard Worker 2571*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_source_address_when_decompress_src_addr_called_with_sac_eq_0_and_sam_eq_3(self): 2572*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2573*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2574*cfb92d14SAndroid Build Coastguard Worker 2575*cfb92d14SAndroid Build Coastguard Worker src_mac_addr = common.MacAddress.from_eui64(any_src_mac_addr()) 2576*cfb92d14SAndroid Build Coastguard Worker 2577*cfb92d14SAndroid Build Coastguard Worker sac = factory.IPHC_SAC_STATELESS 2578*cfb92d14SAndroid Build Coastguard Worker sam = factory.IPHC_SAM_ELIDED 2579*cfb92d14SAndroid Build Coastguard Worker 2580*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), sac, sam, any_m(), any_dac(), any_dam()) 2581*cfb92d14SAndroid Build Coastguard Worker 2582*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray([]) 2583*cfb92d14SAndroid Build Coastguard Worker 2584*cfb92d14SAndroid Build Coastguard Worker # WHEN 2585*cfb92d14SAndroid Build Coastguard Worker actual_src_addr = factory._decompress_src_addr(iphc, src_mac_addr, any_sci(), io.BytesIO(data_bytes)) 2586*cfb92d14SAndroid Build Coastguard Worker 2587*cfb92d14SAndroid Build Coastguard Worker # THEN 2588*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, sac) 2589*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(3, sam) 2590*cfb92d14SAndroid Build Coastguard Worker self.assertEqual( 2591*cfb92d14SAndroid Build Coastguard Worker self.IPV6_LINKLOCAL_PREFIX + bytearray([src_mac_addr.mac_address[0] ^ 0x02]) + 2592*cfb92d14SAndroid Build Coastguard Worker src_mac_addr.mac_address[1:], actual_src_addr) 2593*cfb92d14SAndroid Build Coastguard Worker 2594*cfb92d14SAndroid Build Coastguard Worker def _merge_prefix_and_address(self, prefix, prefix_length, address): 2595*cfb92d14SAndroid Build Coastguard Worker total_bytes = 16 2596*cfb92d14SAndroid Build Coastguard Worker 2597*cfb92d14SAndroid Build Coastguard Worker prefix_length_in_bytes = int(prefix_length / 8) 2598*cfb92d14SAndroid Build Coastguard Worker 2599*cfb92d14SAndroid Build Coastguard Worker if (prefix_length_in_bytes + len(address)) > total_bytes: 2600*cfb92d14SAndroid Build Coastguard Worker total_bytes -= prefix_length_in_bytes 2601*cfb92d14SAndroid Build Coastguard Worker 2602*cfb92d14SAndroid Build Coastguard Worker return prefix[:prefix_length_in_bytes] + address[-total_bytes:] 2603*cfb92d14SAndroid Build Coastguard Worker 2604*cfb92d14SAndroid Build Coastguard Worker else: 2605*cfb92d14SAndroid Build Coastguard Worker total_bytes -= prefix_length_in_bytes 2606*cfb92d14SAndroid Build Coastguard Worker total_bytes -= len(address) 2607*cfb92d14SAndroid Build Coastguard Worker 2608*cfb92d14SAndroid Build Coastguard Worker return prefix[:prefix_length_in_bytes] + bytearray([0x00] * total_bytes) + address 2609*cfb92d14SAndroid Build Coastguard Worker 2610*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_source_address_when_decompress_src_addr_called_with_sac_eq_1_and_sam_eq_0(self): 2611*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2612*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory(None) 2613*cfb92d14SAndroid Build Coastguard Worker 2614*cfb92d14SAndroid Build Coastguard Worker src_addr = any_src_addr() 2615*cfb92d14SAndroid Build Coastguard Worker 2616*cfb92d14SAndroid Build Coastguard Worker sac = factory.IPHC_SAC_STATEFUL 2617*cfb92d14SAndroid Build Coastguard Worker sam = factory.IPHC_SAM_UNSPECIFIED 2618*cfb92d14SAndroid Build Coastguard Worker 2619*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), sac, sam, any_m(), any_dac(), any_dam()) 2620*cfb92d14SAndroid Build Coastguard Worker 2621*cfb92d14SAndroid Build Coastguard Worker # WHEN 2622*cfb92d14SAndroid Build Coastguard Worker actual_src_addr = factory._decompress_src_addr(iphc, any_src_mac_addr(), any_sci(), io.BytesIO(src_addr)) 2623*cfb92d14SAndroid Build Coastguard Worker 2624*cfb92d14SAndroid Build Coastguard Worker # THEN 2625*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, sac) 2626*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, sam) 2627*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(bytearray([0x00] * 16), actual_src_addr) 2628*cfb92d14SAndroid Build Coastguard Worker 2629*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_source_address_when_decompress_src_addr_called_with_sac_eq_1_and_sam_eq_1(self): 2630*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2631*cfb92d14SAndroid Build Coastguard Worker sci = any_sci() 2632*cfb92d14SAndroid Build Coastguard Worker 2633*cfb92d14SAndroid Build Coastguard Worker context = any_context() 2634*cfb92d14SAndroid Build Coastguard Worker 2635*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 2636*cfb92d14SAndroid Build Coastguard Worker context_manager[sci] = context 2637*cfb92d14SAndroid Build Coastguard Worker 2638*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory(context_manager) 2639*cfb92d14SAndroid Build Coastguard Worker 2640*cfb92d14SAndroid Build Coastguard Worker eui64 = any_eui64() 2641*cfb92d14SAndroid Build Coastguard Worker 2642*cfb92d14SAndroid Build Coastguard Worker sac = factory.IPHC_SAC_STATEFUL 2643*cfb92d14SAndroid Build Coastguard Worker sam = factory.IPHC_SAM_64B 2644*cfb92d14SAndroid Build Coastguard Worker 2645*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), sac, sam, any_m(), any_dac(), any_dam()) 2646*cfb92d14SAndroid Build Coastguard Worker 2647*cfb92d14SAndroid Build Coastguard Worker src_addr = self._merge_prefix_and_address(context.prefix, context.prefix_length, eui64) 2648*cfb92d14SAndroid Build Coastguard Worker 2649*cfb92d14SAndroid Build Coastguard Worker # WHEN 2650*cfb92d14SAndroid Build Coastguard Worker actual_src_addr = factory._decompress_src_addr(iphc, any_src_mac_addr(), sci, io.BytesIO(eui64)) 2651*cfb92d14SAndroid Build Coastguard Worker 2652*cfb92d14SAndroid Build Coastguard Worker # THEN 2653*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, sac) 2654*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, sam) 2655*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(src_addr, actual_src_addr) 2656*cfb92d14SAndroid Build Coastguard Worker 2657*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_source_address_when_decompress_src_addr_called_with_sac_eq_1_and_sam_eq_2(self): 2658*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2659*cfb92d14SAndroid Build Coastguard Worker sci = any_sci() 2660*cfb92d14SAndroid Build Coastguard Worker 2661*cfb92d14SAndroid Build Coastguard Worker context = any_context() 2662*cfb92d14SAndroid Build Coastguard Worker 2663*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 2664*cfb92d14SAndroid Build Coastguard Worker context_manager[sci] = context 2665*cfb92d14SAndroid Build Coastguard Worker 2666*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory(context_manager) 2667*cfb92d14SAndroid Build Coastguard Worker 2668*cfb92d14SAndroid Build Coastguard Worker rloc16 = any_rloc16() 2669*cfb92d14SAndroid Build Coastguard Worker 2670*cfb92d14SAndroid Build Coastguard Worker sac = factory.IPHC_SAC_STATEFUL 2671*cfb92d14SAndroid Build Coastguard Worker sam = factory.IPHC_SAM_16B 2672*cfb92d14SAndroid Build Coastguard Worker 2673*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), sac, sam, any_m(), any_dac(), any_dam()) 2674*cfb92d14SAndroid Build Coastguard Worker 2675*cfb92d14SAndroid Build Coastguard Worker iid = bytearray([0x00, 0x00, 0x00, 0xff, 0xfe, 0x00]) + rloc16 2676*cfb92d14SAndroid Build Coastguard Worker 2677*cfb92d14SAndroid Build Coastguard Worker src_addr = self._merge_prefix_and_address(context.prefix, context.prefix_length, iid) 2678*cfb92d14SAndroid Build Coastguard Worker 2679*cfb92d14SAndroid Build Coastguard Worker # WHEN 2680*cfb92d14SAndroid Build Coastguard Worker actual_src_addr = factory._decompress_src_addr(iphc, any_src_mac_addr(), sci, io.BytesIO(rloc16)) 2681*cfb92d14SAndroid Build Coastguard Worker 2682*cfb92d14SAndroid Build Coastguard Worker # THEN 2683*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, sac) 2684*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(2, sam) 2685*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(src_addr, actual_src_addr) 2686*cfb92d14SAndroid Build Coastguard Worker 2687*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_source_address_when_decompress_src_addr_called_with_sac_eq_1_and_sam_eq_3(self): 2688*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2689*cfb92d14SAndroid Build Coastguard Worker sci = any_sci() 2690*cfb92d14SAndroid Build Coastguard Worker 2691*cfb92d14SAndroid Build Coastguard Worker context = any_context() 2692*cfb92d14SAndroid Build Coastguard Worker 2693*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 2694*cfb92d14SAndroid Build Coastguard Worker context_manager[sci] = context 2695*cfb92d14SAndroid Build Coastguard Worker 2696*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory(context_manager) 2697*cfb92d14SAndroid Build Coastguard Worker 2698*cfb92d14SAndroid Build Coastguard Worker src_mac_addr = common.MacAddress.from_eui64(any_src_mac_addr()) 2699*cfb92d14SAndroid Build Coastguard Worker 2700*cfb92d14SAndroid Build Coastguard Worker sac = factory.IPHC_SAC_STATEFUL 2701*cfb92d14SAndroid Build Coastguard Worker sam = factory.IPHC_SAM_0B 2702*cfb92d14SAndroid Build Coastguard Worker 2703*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), sac, sam, any_m(), any_dac(), any_dam()) 2704*cfb92d14SAndroid Build Coastguard Worker 2705*cfb92d14SAndroid Build Coastguard Worker iid = bytearray([src_mac_addr.mac_address[0] ^ 0x02]) + src_mac_addr.mac_address[1:] 2706*cfb92d14SAndroid Build Coastguard Worker 2707*cfb92d14SAndroid Build Coastguard Worker src_addr = self._merge_prefix_and_address(context.prefix, context.prefix_length, iid) 2708*cfb92d14SAndroid Build Coastguard Worker 2709*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray([]) 2710*cfb92d14SAndroid Build Coastguard Worker 2711*cfb92d14SAndroid Build Coastguard Worker # WHEN 2712*cfb92d14SAndroid Build Coastguard Worker actual_src_addr = factory._decompress_src_addr(iphc, src_mac_addr, sci, io.BytesIO(data_bytes)) 2713*cfb92d14SAndroid Build Coastguard Worker 2714*cfb92d14SAndroid Build Coastguard Worker # THEN 2715*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, sac) 2716*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(3, sam) 2717*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(src_addr, actual_src_addr) 2718*cfb92d14SAndroid Build Coastguard Worker 2719*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_0_and_dac_eq_0_and_dam_eq_0(self): 2720*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2721*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2722*cfb92d14SAndroid Build Coastguard Worker 2723*cfb92d14SAndroid Build Coastguard Worker ipv6_addr = any_dst_addr() 2724*cfb92d14SAndroid Build Coastguard Worker 2725*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_NO 2726*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATELESS 2727*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_128B 2728*cfb92d14SAndroid Build Coastguard Worker 2729*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2730*cfb92d14SAndroid Build Coastguard Worker 2731*cfb92d14SAndroid Build Coastguard Worker dst_mac_addr = bytearray([0x00] * 8) 2732*cfb92d14SAndroid Build Coastguard Worker 2733*cfb92d14SAndroid Build Coastguard Worker # WHEN 2734*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, dst_mac_addr, any_dci(), io.BytesIO(ipv6_addr)) 2735*cfb92d14SAndroid Build Coastguard Worker 2736*cfb92d14SAndroid Build Coastguard Worker # THEN 2737*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, m) 2738*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dac) 2739*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dam) 2740*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_addr, actual_dst_addr) 2741*cfb92d14SAndroid Build Coastguard Worker 2742*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_0_and_dac_eq_0_and_dam_eq_1(self): 2743*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2744*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2745*cfb92d14SAndroid Build Coastguard Worker 2746*cfb92d14SAndroid Build Coastguard Worker eui64 = any_eui64() 2747*cfb92d14SAndroid Build Coastguard Worker 2748*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_NO 2749*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATELESS 2750*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_64B 2751*cfb92d14SAndroid Build Coastguard Worker 2752*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2753*cfb92d14SAndroid Build Coastguard Worker 2754*cfb92d14SAndroid Build Coastguard Worker # WHEN 2755*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, any_dst_mac_addr(), any_dci(), io.BytesIO(eui64)) 2756*cfb92d14SAndroid Build Coastguard Worker 2757*cfb92d14SAndroid Build Coastguard Worker # THEN 2758*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, m) 2759*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dac) 2760*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, dam) 2761*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(self.IPV6_LINKLOCAL_PREFIX + eui64, actual_dst_addr) 2762*cfb92d14SAndroid Build Coastguard Worker 2763*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_0_and_dac_eq_0_and_dam_eq_2(self): 2764*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2765*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2766*cfb92d14SAndroid Build Coastguard Worker 2767*cfb92d14SAndroid Build Coastguard Worker rloc16 = any_rloc16() 2768*cfb92d14SAndroid Build Coastguard Worker 2769*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_NO 2770*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATELESS 2771*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_16B 2772*cfb92d14SAndroid Build Coastguard Worker 2773*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2774*cfb92d14SAndroid Build Coastguard Worker 2775*cfb92d14SAndroid Build Coastguard Worker # WHEN 2776*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, any_dst_mac_addr(), any_dci(), io.BytesIO(rloc16)) 2777*cfb92d14SAndroid Build Coastguard Worker 2778*cfb92d14SAndroid Build Coastguard Worker # THEN 2779*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, m) 2780*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dac) 2781*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(2, dam) 2782*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(self.IPV6_LINKLOCAL_PREFIX + bytearray([0x00, 0x00, 0x00, 0xff, 0xfe, 0x00]) + rloc16, 2783*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr) 2784*cfb92d14SAndroid Build Coastguard Worker 2785*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_0_and_dac_eq_0_and_dam_eq_3(self): 2786*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2787*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2788*cfb92d14SAndroid Build Coastguard Worker 2789*cfb92d14SAndroid Build Coastguard Worker dst_mac_addr = common.MacAddress.from_eui64(any_dst_mac_addr()) 2790*cfb92d14SAndroid Build Coastguard Worker 2791*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_NO 2792*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATELESS 2793*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_ELIDED 2794*cfb92d14SAndroid Build Coastguard Worker 2795*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2796*cfb92d14SAndroid Build Coastguard Worker 2797*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray([]) 2798*cfb92d14SAndroid Build Coastguard Worker 2799*cfb92d14SAndroid Build Coastguard Worker # WHEN 2800*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, dst_mac_addr, any_dci(), io.BytesIO(data_bytes)) 2801*cfb92d14SAndroid Build Coastguard Worker 2802*cfb92d14SAndroid Build Coastguard Worker # THEN 2803*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, m) 2804*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dac) 2805*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(3, dam) 2806*cfb92d14SAndroid Build Coastguard Worker self.assertEqual( 2807*cfb92d14SAndroid Build Coastguard Worker self.IPV6_LINKLOCAL_PREFIX + bytearray([dst_mac_addr.mac_address[0] ^ 0x02]) + 2808*cfb92d14SAndroid Build Coastguard Worker dst_mac_addr.mac_address[1:], actual_dst_addr) 2809*cfb92d14SAndroid Build Coastguard Worker 2810*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_RuntimeError_when_decompress_dst_addr_called_with_m_eq_0_and_dac_eq_1_and_dam_eq_0(self): 2811*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2812*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2813*cfb92d14SAndroid Build Coastguard Worker 2814*cfb92d14SAndroid Build Coastguard Worker ipv6_addr = any_dst_addr() 2815*cfb92d14SAndroid Build Coastguard Worker 2816*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_NO 2817*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATEFUL 2818*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_128B 2819*cfb92d14SAndroid Build Coastguard Worker 2820*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2821*cfb92d14SAndroid Build Coastguard Worker 2822*cfb92d14SAndroid Build Coastguard Worker # WHEN 2823*cfb92d14SAndroid Build Coastguard Worker self.assertRaises(RuntimeError, factory._decompress_dst_addr, iphc, any_dst_mac_addr(), any_dci(), 2824*cfb92d14SAndroid Build Coastguard Worker io.BytesIO(ipv6_addr)) 2825*cfb92d14SAndroid Build Coastguard Worker 2826*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_0_and_dac_eq_1_and_dam_eq_1(self): 2827*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2828*cfb92d14SAndroid Build Coastguard Worker dci = any_dci() 2829*cfb92d14SAndroid Build Coastguard Worker 2830*cfb92d14SAndroid Build Coastguard Worker context = any_context() 2831*cfb92d14SAndroid Build Coastguard Worker 2832*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 2833*cfb92d14SAndroid Build Coastguard Worker context_manager[dci] = context 2834*cfb92d14SAndroid Build Coastguard Worker 2835*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory(context_manager) 2836*cfb92d14SAndroid Build Coastguard Worker 2837*cfb92d14SAndroid Build Coastguard Worker eui64 = any_eui64() 2838*cfb92d14SAndroid Build Coastguard Worker 2839*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_NO 2840*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATEFUL 2841*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_64B 2842*cfb92d14SAndroid Build Coastguard Worker 2843*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2844*cfb92d14SAndroid Build Coastguard Worker 2845*cfb92d14SAndroid Build Coastguard Worker dst_addr = self._merge_prefix_and_address(context.prefix, context.prefix_length, eui64) 2846*cfb92d14SAndroid Build Coastguard Worker 2847*cfb92d14SAndroid Build Coastguard Worker # WHEN 2848*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, any_dst_mac_addr(), dci, io.BytesIO(eui64)) 2849*cfb92d14SAndroid Build Coastguard Worker 2850*cfb92d14SAndroid Build Coastguard Worker # THEN 2851*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, m) 2852*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, dac) 2853*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, dam) 2854*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(dst_addr, actual_dst_addr) 2855*cfb92d14SAndroid Build Coastguard Worker 2856*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_0_and_dac_eq_1_and_dam_eq_2(self): 2857*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2858*cfb92d14SAndroid Build Coastguard Worker dci = any_dci() 2859*cfb92d14SAndroid Build Coastguard Worker 2860*cfb92d14SAndroid Build Coastguard Worker context = any_context() 2861*cfb92d14SAndroid Build Coastguard Worker 2862*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 2863*cfb92d14SAndroid Build Coastguard Worker context_manager[dci] = context 2864*cfb92d14SAndroid Build Coastguard Worker 2865*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory(context_manager) 2866*cfb92d14SAndroid Build Coastguard Worker 2867*cfb92d14SAndroid Build Coastguard Worker rloc16 = any_rloc16() 2868*cfb92d14SAndroid Build Coastguard Worker 2869*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_NO 2870*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATEFUL 2871*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_16B 2872*cfb92d14SAndroid Build Coastguard Worker 2873*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2874*cfb92d14SAndroid Build Coastguard Worker 2875*cfb92d14SAndroid Build Coastguard Worker iid = bytearray([0x00, 0x00, 0x00, 0xff, 0xfe, 0x00]) + rloc16 2876*cfb92d14SAndroid Build Coastguard Worker 2877*cfb92d14SAndroid Build Coastguard Worker dst_addr = self._merge_prefix_and_address(context.prefix, context.prefix_length, iid) 2878*cfb92d14SAndroid Build Coastguard Worker 2879*cfb92d14SAndroid Build Coastguard Worker # WHEN 2880*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, any_dst_mac_addr(), dci, io.BytesIO(rloc16)) 2881*cfb92d14SAndroid Build Coastguard Worker 2882*cfb92d14SAndroid Build Coastguard Worker # THEN 2883*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, m) 2884*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, dac) 2885*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(2, dam) 2886*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(dst_addr, actual_dst_addr) 2887*cfb92d14SAndroid Build Coastguard Worker 2888*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_0_and_dac_eq_1_and_dam_eq_3(self): 2889*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2890*cfb92d14SAndroid Build Coastguard Worker dci = any_dci() 2891*cfb92d14SAndroid Build Coastguard Worker 2892*cfb92d14SAndroid Build Coastguard Worker context = any_context() 2893*cfb92d14SAndroid Build Coastguard Worker 2894*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 2895*cfb92d14SAndroid Build Coastguard Worker context_manager[dci] = context 2896*cfb92d14SAndroid Build Coastguard Worker 2897*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory(context_manager) 2898*cfb92d14SAndroid Build Coastguard Worker 2899*cfb92d14SAndroid Build Coastguard Worker dst_mac_addr = common.MacAddress.from_eui64(any_dst_mac_addr()) 2900*cfb92d14SAndroid Build Coastguard Worker 2901*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_NO 2902*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATEFUL 2903*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_0B 2904*cfb92d14SAndroid Build Coastguard Worker 2905*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2906*cfb92d14SAndroid Build Coastguard Worker 2907*cfb92d14SAndroid Build Coastguard Worker iid = bytearray([dst_mac_addr.mac_address[0] ^ 0x02]) + dst_mac_addr.mac_address[1:] 2908*cfb92d14SAndroid Build Coastguard Worker 2909*cfb92d14SAndroid Build Coastguard Worker dst_addr = self._merge_prefix_and_address(context.prefix, context.prefix_length, iid) 2910*cfb92d14SAndroid Build Coastguard Worker 2911*cfb92d14SAndroid Build Coastguard Worker data_bytes = bytearray([]) 2912*cfb92d14SAndroid Build Coastguard Worker 2913*cfb92d14SAndroid Build Coastguard Worker # WHEN 2914*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, dst_mac_addr, dci, io.BytesIO(data_bytes)) 2915*cfb92d14SAndroid Build Coastguard Worker 2916*cfb92d14SAndroid Build Coastguard Worker # THEN 2917*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, m) 2918*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, dac) 2919*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(3, dam) 2920*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(dst_addr, actual_dst_addr) 2921*cfb92d14SAndroid Build Coastguard Worker 2922*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_1_and_dac_eq_0_and_dam_eq_0(self): 2923*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2924*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2925*cfb92d14SAndroid Build Coastguard Worker 2926*cfb92d14SAndroid Build Coastguard Worker ipv6_addr = any_dst_addr() 2927*cfb92d14SAndroid Build Coastguard Worker 2928*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_YES 2929*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATELESS 2930*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_128B 2931*cfb92d14SAndroid Build Coastguard Worker 2932*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2933*cfb92d14SAndroid Build Coastguard Worker 2934*cfb92d14SAndroid Build Coastguard Worker # WHEN 2935*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, any_dst_mac_addr(), any_dci(), io.BytesIO(ipv6_addr)) 2936*cfb92d14SAndroid Build Coastguard Worker 2937*cfb92d14SAndroid Build Coastguard Worker # THEN 2938*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, m) 2939*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dac) 2940*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dam) 2941*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(ipv6_addr, actual_dst_addr) 2942*cfb92d14SAndroid Build Coastguard Worker 2943*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_1_and_dac_eq_0_and_dam_eq_1(self): 2944*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2945*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2946*cfb92d14SAndroid Build Coastguard Worker 2947*cfb92d14SAndroid Build Coastguard Worker addr48b = any_48bits_addr() 2948*cfb92d14SAndroid Build Coastguard Worker 2949*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_YES 2950*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATELESS 2951*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_48B 2952*cfb92d14SAndroid Build Coastguard Worker 2953*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2954*cfb92d14SAndroid Build Coastguard Worker 2955*cfb92d14SAndroid Build Coastguard Worker expected_dst_addr = bytearray([ 2956*cfb92d14SAndroid Build Coastguard Worker 0xff, addr48b[0], 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, addr48b[1], addr48b[2], addr48b[3], 2957*cfb92d14SAndroid Build Coastguard Worker addr48b[4], addr48b[5] 2958*cfb92d14SAndroid Build Coastguard Worker ]) 2959*cfb92d14SAndroid Build Coastguard Worker 2960*cfb92d14SAndroid Build Coastguard Worker # WHEN 2961*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, any_dst_mac_addr(), any_dci(), io.BytesIO(addr48b)) 2962*cfb92d14SAndroid Build Coastguard Worker 2963*cfb92d14SAndroid Build Coastguard Worker # THEN 2964*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, m) 2965*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dac) 2966*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, dam) 2967*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(expected_dst_addr, actual_dst_addr) 2968*cfb92d14SAndroid Build Coastguard Worker 2969*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_1_and_dac_eq_0_and_dam_eq_2(self): 2970*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2971*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2972*cfb92d14SAndroid Build Coastguard Worker 2973*cfb92d14SAndroid Build Coastguard Worker addr32b = any_32bits_addr() 2974*cfb92d14SAndroid Build Coastguard Worker 2975*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_YES 2976*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATELESS 2977*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_32B 2978*cfb92d14SAndroid Build Coastguard Worker 2979*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 2980*cfb92d14SAndroid Build Coastguard Worker 2981*cfb92d14SAndroid Build Coastguard Worker expected_dst_addr = bytearray([ 2982*cfb92d14SAndroid Build Coastguard Worker 0xff, addr32b[0], 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, addr32b[1], addr32b[2], 2983*cfb92d14SAndroid Build Coastguard Worker addr32b[3] 2984*cfb92d14SAndroid Build Coastguard Worker ]) 2985*cfb92d14SAndroid Build Coastguard Worker 2986*cfb92d14SAndroid Build Coastguard Worker # WHEN 2987*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, any_dst_mac_addr(), any_dci(), io.BytesIO(addr32b)) 2988*cfb92d14SAndroid Build Coastguard Worker 2989*cfb92d14SAndroid Build Coastguard Worker # THEN 2990*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, m) 2991*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dac) 2992*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(2, dam) 2993*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(expected_dst_addr, actual_dst_addr) 2994*cfb92d14SAndroid Build Coastguard Worker 2995*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_1_and_dac_eq_0_and_dam_eq_3(self): 2996*cfb92d14SAndroid Build Coastguard Worker # GIVEN 2997*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 2998*cfb92d14SAndroid Build Coastguard Worker 2999*cfb92d14SAndroid Build Coastguard Worker addr8b = any_8bits_addr() 3000*cfb92d14SAndroid Build Coastguard Worker 3001*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_YES 3002*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATELESS 3003*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_8B 3004*cfb92d14SAndroid Build Coastguard Worker 3005*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 3006*cfb92d14SAndroid Build Coastguard Worker 3007*cfb92d14SAndroid Build Coastguard Worker expected_dst_addr = bytearray( 3008*cfb92d14SAndroid Build Coastguard Worker [0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, addr8b[0]]) 3009*cfb92d14SAndroid Build Coastguard Worker 3010*cfb92d14SAndroid Build Coastguard Worker # WHEN 3011*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, any_dst_mac_addr(), any_dci(), io.BytesIO(addr8b)) 3012*cfb92d14SAndroid Build Coastguard Worker 3013*cfb92d14SAndroid Build Coastguard Worker # THEN 3014*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, m) 3015*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dac) 3016*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(3, dam) 3017*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(expected_dst_addr, actual_dst_addr) 3018*cfb92d14SAndroid Build Coastguard Worker 3019*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_RuntimeError_when_decompress_dst_addr_called_with_m_eq_1_and_dac_eq_1_and_dam_eq_0(self): 3020*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3021*cfb92d14SAndroid Build Coastguard Worker dci = any_dci() 3022*cfb92d14SAndroid Build Coastguard Worker 3023*cfb92d14SAndroid Build Coastguard Worker context = any_context() 3024*cfb92d14SAndroid Build Coastguard Worker 3025*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 3026*cfb92d14SAndroid Build Coastguard Worker context_manager[dci] = context 3027*cfb92d14SAndroid Build Coastguard Worker 3028*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory(context_manager) 3029*cfb92d14SAndroid Build Coastguard Worker 3030*cfb92d14SAndroid Build Coastguard Worker addr48b = any_48bits_addr() 3031*cfb92d14SAndroid Build Coastguard Worker 3032*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_YES 3033*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATEFUL 3034*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_128B 3035*cfb92d14SAndroid Build Coastguard Worker 3036*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 3037*cfb92d14SAndroid Build Coastguard Worker 3038*cfb92d14SAndroid Build Coastguard Worker prefix = context.prefix[:8] 3039*cfb92d14SAndroid Build Coastguard Worker 3040*cfb92d14SAndroid Build Coastguard Worker if len(prefix) < 8: 3041*cfb92d14SAndroid Build Coastguard Worker missing_bytes_count = 8 - len(prefix) 3042*cfb92d14SAndroid Build Coastguard Worker prefix += bytearray([0x00] * missing_bytes_count) 3043*cfb92d14SAndroid Build Coastguard Worker 3044*cfb92d14SAndroid Build Coastguard Worker prefix_length = context.prefix_length 3045*cfb92d14SAndroid Build Coastguard Worker 3046*cfb92d14SAndroid Build Coastguard Worker dst_addr = bytearray([0xff]) + addr48b[:2] + bytearray([prefix_length]) + prefix + addr48b[2:] 3047*cfb92d14SAndroid Build Coastguard Worker 3048*cfb92d14SAndroid Build Coastguard Worker # WHEN 3049*cfb92d14SAndroid Build Coastguard Worker actual_dst_addr = factory._decompress_dst_addr(iphc, any_dst_mac_addr(), dci, io.BytesIO(addr48b)) 3050*cfb92d14SAndroid Build Coastguard Worker 3051*cfb92d14SAndroid Build Coastguard Worker # THEN 3052*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, m) 3053*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(1, dac) 3054*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(0, dam) 3055*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(dst_addr, actual_dst_addr) 3056*cfb92d14SAndroid Build Coastguard Worker 3057*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_RuntimeError_when_decompress_dst_addr_called_with_m_eq_1_and_dac_eq_1_and_dam_eq_1(self): 3058*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3059*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 3060*cfb92d14SAndroid Build Coastguard Worker 3061*cfb92d14SAndroid Build Coastguard Worker addr48b = any_48bits_addr() 3062*cfb92d14SAndroid Build Coastguard Worker 3063*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_YES 3064*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATEFUL 3065*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_48B 3066*cfb92d14SAndroid Build Coastguard Worker 3067*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 3068*cfb92d14SAndroid Build Coastguard Worker 3069*cfb92d14SAndroid Build Coastguard Worker # WHEN 3070*cfb92d14SAndroid Build Coastguard Worker self.assertRaises(RuntimeError, factory._decompress_dst_addr, iphc, any_dst_mac_addr(), any_dci(), 3071*cfb92d14SAndroid Build Coastguard Worker io.BytesIO(addr48b)) 3072*cfb92d14SAndroid Build Coastguard Worker 3073*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_RuntimeError_when_decompress_dst_addr_called_with_m_eq_1_and_dac_eq_1_and_dam_eq_2(self): 3074*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3075*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 3076*cfb92d14SAndroid Build Coastguard Worker 3077*cfb92d14SAndroid Build Coastguard Worker addr32b = any_32bits_addr() 3078*cfb92d14SAndroid Build Coastguard Worker 3079*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_YES 3080*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATEFUL 3081*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_32B 3082*cfb92d14SAndroid Build Coastguard Worker 3083*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 3084*cfb92d14SAndroid Build Coastguard Worker 3085*cfb92d14SAndroid Build Coastguard Worker # WHEN 3086*cfb92d14SAndroid Build Coastguard Worker self.assertRaises(RuntimeError, factory._decompress_dst_addr, iphc, any_dst_mac_addr(), any_dci(), 3087*cfb92d14SAndroid Build Coastguard Worker io.BytesIO(addr32b)) 3088*cfb92d14SAndroid Build Coastguard Worker 3089*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_dst_addr_when_decompress_dst_addr_called_with_m_eq_1_and_dac_eq_1_and_dam_eq_3(self): 3090*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3091*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 3092*cfb92d14SAndroid Build Coastguard Worker 3093*cfb92d14SAndroid Build Coastguard Worker addr8b = any_8bits_addr() 3094*cfb92d14SAndroid Build Coastguard Worker 3095*cfb92d14SAndroid Build Coastguard Worker m = factory.IPHC_M_YES 3096*cfb92d14SAndroid Build Coastguard Worker dac = factory.IPHC_DAC_STATEFUL 3097*cfb92d14SAndroid Build Coastguard Worker dam = factory.IPHC_DAM_8B 3098*cfb92d14SAndroid Build Coastguard Worker 3099*cfb92d14SAndroid Build Coastguard Worker iphc = lowpan.LowpanIPHC(any_tf(), any_nh(), any_hlim(), any_cid(), any_sac(), any_sam(), m, dac, dam) 3100*cfb92d14SAndroid Build Coastguard Worker 3101*cfb92d14SAndroid Build Coastguard Worker # WHEN 3102*cfb92d14SAndroid Build Coastguard Worker self.assertRaises(RuntimeError, factory._decompress_dst_addr, iphc, any_dst_mac_addr(), any_dci(), 3103*cfb92d14SAndroid Build Coastguard Worker io.BytesIO(addr8b)) 3104*cfb92d14SAndroid Build Coastguard Worker 3105*cfb92d14SAndroid Build Coastguard Worker def test_should_merge_pfx_with_addr_bytes_when_merge_method_called_with_pfx_shorter_than_missing_bits(self): 3106*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3107*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 3108*cfb92d14SAndroid Build Coastguard Worker 3109*cfb92d14SAndroid Build Coastguard Worker prefix = bytearray([0x20, 0x00, 0x0d, 0xb8]) 3110*cfb92d14SAndroid Build Coastguard Worker prefix_length = 32 3111*cfb92d14SAndroid Build Coastguard Worker 3112*cfb92d14SAndroid Build Coastguard Worker address_bytes = bytearray([0x1a, 0x2b, 0x3c, 0x4d, 0x5e, 0x6f, 0x70, 0x81]) 3113*cfb92d14SAndroid Build Coastguard Worker 3114*cfb92d14SAndroid Build Coastguard Worker addr = prefix + bytearray([0x00] * 4) + address_bytes 3115*cfb92d14SAndroid Build Coastguard Worker 3116*cfb92d14SAndroid Build Coastguard Worker # WHEN 3117*cfb92d14SAndroid Build Coastguard Worker actual_addr = factory._merge_prefix_with_address(prefix, prefix_length, address_bytes) 3118*cfb92d14SAndroid Build Coastguard Worker 3119*cfb92d14SAndroid Build Coastguard Worker # THEN 3120*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(addr, actual_addr) 3121*cfb92d14SAndroid Build Coastguard Worker 3122*cfb92d14SAndroid Build Coastguard Worker def test_should_merge_pfx_with_addr_bytes_when_merge_method_called_with_pfx_longer_than_missing_bits_overlap(self): 3123*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3124*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 3125*cfb92d14SAndroid Build Coastguard Worker 3126*cfb92d14SAndroid Build Coastguard Worker prefix = bytearray([0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x22]) 3127*cfb92d14SAndroid Build Coastguard Worker prefix_length = 68 3128*cfb92d14SAndroid Build Coastguard Worker 3129*cfb92d14SAndroid Build Coastguard Worker address_bytes = bytearray([0x1a, 0x2b, 0x3c, 0x4d, 0x5e, 0x6f, 0x70, 0x81]) 3130*cfb92d14SAndroid Build Coastguard Worker 3131*cfb92d14SAndroid Build Coastguard Worker addr = prefix[:-1] + bytearray([0x2a]) + address_bytes[1:] 3132*cfb92d14SAndroid Build Coastguard Worker 3133*cfb92d14SAndroid Build Coastguard Worker # WHEN 3134*cfb92d14SAndroid Build Coastguard Worker actual_addr = factory._merge_prefix_with_address(prefix, prefix_length, address_bytes) 3135*cfb92d14SAndroid Build Coastguard Worker 3136*cfb92d14SAndroid Build Coastguard Worker # THEN 3137*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(addr, actual_addr) 3138*cfb92d14SAndroid Build Coastguard Worker 3139*cfb92d14SAndroid Build Coastguard Worker def test_should_merge_pfx_with_address_bytes_when_merge_method_called_with_pfx_longer_than_missing_bits(self): 3140*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3141*cfb92d14SAndroid Build Coastguard Worker factory = lowpan.LowpanIpv6HeaderFactory() 3142*cfb92d14SAndroid Build Coastguard Worker 3143*cfb92d14SAndroid Build Coastguard Worker prefix = bytearray( 3144*cfb92d14SAndroid Build Coastguard Worker [0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x11, 0x01, 0x11, 0x01, 0x22]) 3145*cfb92d14SAndroid Build Coastguard Worker prefix_length = 128 3146*cfb92d14SAndroid Build Coastguard Worker 3147*cfb92d14SAndroid Build Coastguard Worker address_bytes = bytearray([0x1a, 0x2b, 0x3c, 0x4d, 0x5e, 0x6f, 0x70, 0x81]) 3148*cfb92d14SAndroid Build Coastguard Worker 3149*cfb92d14SAndroid Build Coastguard Worker addr = prefix 3150*cfb92d14SAndroid Build Coastguard Worker 3151*cfb92d14SAndroid Build Coastguard Worker # WHEN 3152*cfb92d14SAndroid Build Coastguard Worker actual_addr = factory._merge_prefix_with_address(prefix, prefix_length, address_bytes) 3153*cfb92d14SAndroid Build Coastguard Worker 3154*cfb92d14SAndroid Build Coastguard Worker # THEN 3155*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(addr, actual_addr) 3156*cfb92d14SAndroid Build Coastguard Worker 3157*cfb92d14SAndroid Build Coastguard Worker 3158*cfb92d14SAndroid Build Coastguard Workerclass TestContext(unittest.TestCase): 3159*cfb92d14SAndroid Build Coastguard Worker 3160*cfb92d14SAndroid Build Coastguard Worker def test_should_extract_context_from_str_representation_when_constructor_called(self): 3161*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3162*cfb92d14SAndroid Build Coastguard Worker prefix = "2000:db8::/64" 3163*cfb92d14SAndroid Build Coastguard Worker 3164*cfb92d14SAndroid Build Coastguard Worker # WHEN 3165*cfb92d14SAndroid Build Coastguard Worker c = lowpan.Context(prefix) 3166*cfb92d14SAndroid Build Coastguard Worker 3167*cfb92d14SAndroid Build Coastguard Worker # THEN 3168*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(bytearray([0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00]), c.prefix) 3169*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(64, c.prefix_length) 3170*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(8, c.prefix_length_full_bytes) 3171*cfb92d14SAndroid Build Coastguard Worker 3172*cfb92d14SAndroid Build Coastguard Worker def test_should_extract_context_from_bytearray_when_construct_called(self): 3173*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3174*cfb92d14SAndroid Build Coastguard Worker prefix = bytearray([0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00]) 3175*cfb92d14SAndroid Build Coastguard Worker 3176*cfb92d14SAndroid Build Coastguard Worker # WHEN 3177*cfb92d14SAndroid Build Coastguard Worker c = lowpan.Context(prefix) 3178*cfb92d14SAndroid Build Coastguard Worker 3179*cfb92d14SAndroid Build Coastguard Worker # THEN 3180*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(bytearray([0x20, 0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00]), c.prefix) 3181*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(8, c.prefix_length_full_bytes) 3182*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(64, c.prefix_length) 3183*cfb92d14SAndroid Build Coastguard Worker 3184*cfb92d14SAndroid Build Coastguard Worker 3185*cfb92d14SAndroid Build Coastguard Workerclass TestContextManager(unittest.TestCase): 3186*cfb92d14SAndroid Build Coastguard Worker 3187*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_IndexError_when_index_is_larger_than_15(self): 3188*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3189*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 3190*cfb92d14SAndroid Build Coastguard Worker 3191*cfb92d14SAndroid Build Coastguard Worker index = random.randint(16, 255) 3192*cfb92d14SAndroid Build Coastguard Worker 3193*cfb92d14SAndroid Build Coastguard Worker # WHEN 3194*cfb92d14SAndroid Build Coastguard Worker with self.assertRaises(IndexError): 3195*cfb92d14SAndroid Build Coastguard Worker context_manager[index] = any_context() 3196*cfb92d14SAndroid Build Coastguard Worker 3197*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_IndexError_when_index_is_smaller_than_0(self): 3198*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3199*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 3200*cfb92d14SAndroid Build Coastguard Worker 3201*cfb92d14SAndroid Build Coastguard Worker index = random.randint(-255, -1) 3202*cfb92d14SAndroid Build Coastguard Worker 3203*cfb92d14SAndroid Build Coastguard Worker # WHEN 3204*cfb92d14SAndroid Build Coastguard Worker with self.assertRaises(IndexError): 3205*cfb92d14SAndroid Build Coastguard Worker context_manager[index] = any_context() 3206*cfb92d14SAndroid Build Coastguard Worker 3207*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_TypeError_when_set_value_is_not_Context(self): 3208*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3209*cfb92d14SAndroid Build Coastguard Worker context_manager = lowpan.ContextManager() 3210*cfb92d14SAndroid Build Coastguard Worker 3211*cfb92d14SAndroid Build Coastguard Worker # WHEN 3212*cfb92d14SAndroid Build Coastguard Worker with self.assertRaises(TypeError): 3213*cfb92d14SAndroid Build Coastguard Worker context_manager[0] = int 3214*cfb92d14SAndroid Build Coastguard Worker 3215*cfb92d14SAndroid Build Coastguard Worker 3216*cfb92d14SAndroid Build Coastguard Workerclass TestLowpanMeshHeader(unittest.TestCase): 3217*cfb92d14SAndroid Build Coastguard Worker 3218*cfb92d14SAndroid Build Coastguard Worker def test_should_return_hops_left_value_when_hops_left_property_called(self): 3219*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3220*cfb92d14SAndroid Build Coastguard Worker hops_left = any_hops_left() 3221*cfb92d14SAndroid Build Coastguard Worker 3222*cfb92d14SAndroid Build Coastguard Worker mesh_header = lowpan.LowpanMeshHeader(hops_left, any_mac_address(), any_mac_address()) 3223*cfb92d14SAndroid Build Coastguard Worker 3224*cfb92d14SAndroid Build Coastguard Worker # WHEN 3225*cfb92d14SAndroid Build Coastguard Worker actual_hops_left = mesh_header.hops_left 3226*cfb92d14SAndroid Build Coastguard Worker 3227*cfb92d14SAndroid Build Coastguard Worker # THEN 3228*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(hops_left, actual_hops_left) 3229*cfb92d14SAndroid Build Coastguard Worker 3230*cfb92d14SAndroid Build Coastguard Worker def test_should_return_originator_address_value_when_originator_address_property_called(self): 3231*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3232*cfb92d14SAndroid Build Coastguard Worker originator_address = any_mac_address() 3233*cfb92d14SAndroid Build Coastguard Worker 3234*cfb92d14SAndroid Build Coastguard Worker mesh_header = lowpan.LowpanMeshHeader(any_hops_left(), originator_address, any_mac_address()) 3235*cfb92d14SAndroid Build Coastguard Worker 3236*cfb92d14SAndroid Build Coastguard Worker # WHEN 3237*cfb92d14SAndroid Build Coastguard Worker actual_originator_address = mesh_header.originator_address 3238*cfb92d14SAndroid Build Coastguard Worker 3239*cfb92d14SAndroid Build Coastguard Worker # THEN 3240*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(originator_address, actual_originator_address) 3241*cfb92d14SAndroid Build Coastguard Worker 3242*cfb92d14SAndroid Build Coastguard Worker def test_should_return_final_destination_address_value_when_final_destination_address_property_called(self): 3243*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3244*cfb92d14SAndroid Build Coastguard Worker final_destination_address = any_mac_address() 3245*cfb92d14SAndroid Build Coastguard Worker 3246*cfb92d14SAndroid Build Coastguard Worker mesh_header = lowpan.LowpanMeshHeader(any_hops_left(), any_mac_address(), final_destination_address) 3247*cfb92d14SAndroid Build Coastguard Worker 3248*cfb92d14SAndroid Build Coastguard Worker # WHEN 3249*cfb92d14SAndroid Build Coastguard Worker actual_final_destination_address = mesh_header.final_destination_address 3250*cfb92d14SAndroid Build Coastguard Worker 3251*cfb92d14SAndroid Build Coastguard Worker # THEN 3252*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(final_destination_address, actual_final_destination_address) 3253*cfb92d14SAndroid Build Coastguard Worker 3254*cfb92d14SAndroid Build Coastguard Worker 3255*cfb92d14SAndroid Build Coastguard Workerclass TestLowpanMeshHeaderFactory(unittest.TestCase): 3256*cfb92d14SAndroid Build Coastguard Worker 3257*cfb92d14SAndroid Build Coastguard Worker def test_should_create_LowpanMeshHeader_when_parse_method_called(self): 3258*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3259*cfb92d14SAndroid Build Coastguard Worker hops_left = any_hops_left() 3260*cfb92d14SAndroid Build Coastguard Worker 3261*cfb92d14SAndroid Build Coastguard Worker originator_address = any_mac_address() 3262*cfb92d14SAndroid Build Coastguard Worker final_destination_address = any_mac_address() 3263*cfb92d14SAndroid Build Coastguard Worker 3264*cfb92d14SAndroid Build Coastguard Worker v = int(originator_address.type == common.MacAddressType.SHORT) 3265*cfb92d14SAndroid Build Coastguard Worker f = int(final_destination_address.type == common.MacAddressType.SHORT) 3266*cfb92d14SAndroid Build Coastguard Worker 3267*cfb92d14SAndroid Build Coastguard Worker mesh_header_first_byte = (2 << 6) | (v << 5) | (f << 4) 3268*cfb92d14SAndroid Build Coastguard Worker 3269*cfb92d14SAndroid Build Coastguard Worker if hops_left >= 0x0f: 3270*cfb92d14SAndroid Build Coastguard Worker mesh_header_data = bytearray([mesh_header_first_byte | 0x0f, hops_left]) 3271*cfb92d14SAndroid Build Coastguard Worker else: 3272*cfb92d14SAndroid Build Coastguard Worker mesh_header_data = bytearray([mesh_header_first_byte | hops_left]) 3273*cfb92d14SAndroid Build Coastguard Worker 3274*cfb92d14SAndroid Build Coastguard Worker mesh_header_data += originator_address.mac_address + final_destination_address.mac_address 3275*cfb92d14SAndroid Build Coastguard Worker 3276*cfb92d14SAndroid Build Coastguard Worker mesh_header_factory = lowpan.LowpanMeshHeaderFactory() 3277*cfb92d14SAndroid Build Coastguard Worker 3278*cfb92d14SAndroid Build Coastguard Worker # WHEN 3279*cfb92d14SAndroid Build Coastguard Worker mesh_header = mesh_header_factory.parse(io.BytesIO(mesh_header_data), None) 3280*cfb92d14SAndroid Build Coastguard Worker 3281*cfb92d14SAndroid Build Coastguard Worker # THEN 3282*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(hops_left, mesh_header.hops_left) 3283*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(originator_address, mesh_header.originator_address) 3284*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(final_destination_address, mesh_header.final_destination_address) 3285*cfb92d14SAndroid Build Coastguard Worker 3286*cfb92d14SAndroid Build Coastguard Worker 3287*cfb92d14SAndroid Build Coastguard Workerclass TestLowpanFragmentationHeader(unittest.TestCase): 3288*cfb92d14SAndroid Build Coastguard Worker 3289*cfb92d14SAndroid Build Coastguard Worker def test_should_return_datagram_size_value_when_datagram_size_property_called(self): 3290*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3291*cfb92d14SAndroid Build Coastguard Worker datagram_size = any_datagram_size() 3292*cfb92d14SAndroid Build Coastguard Worker 3293*cfb92d14SAndroid Build Coastguard Worker fragmentation_header = lowpan.LowpanFragmentationHeader(datagram_size, any_datagram_tag(), 3294*cfb92d14SAndroid Build Coastguard Worker any_datagram_offset()) 3295*cfb92d14SAndroid Build Coastguard Worker 3296*cfb92d14SAndroid Build Coastguard Worker # WHEN 3297*cfb92d14SAndroid Build Coastguard Worker actual_datagram_size = fragmentation_header.datagram_size 3298*cfb92d14SAndroid Build Coastguard Worker 3299*cfb92d14SAndroid Build Coastguard Worker # THEN 3300*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(datagram_size, actual_datagram_size) 3301*cfb92d14SAndroid Build Coastguard Worker 3302*cfb92d14SAndroid Build Coastguard Worker def test_should_return_datagram_tag_value_when_datagram_tag_property_called(self): 3303*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3304*cfb92d14SAndroid Build Coastguard Worker datagram_tag = any_datagram_tag() 3305*cfb92d14SAndroid Build Coastguard Worker 3306*cfb92d14SAndroid Build Coastguard Worker fragmentation_header = lowpan.LowpanFragmentationHeader(any_datagram_size(), datagram_tag, 3307*cfb92d14SAndroid Build Coastguard Worker any_datagram_offset()) 3308*cfb92d14SAndroid Build Coastguard Worker 3309*cfb92d14SAndroid Build Coastguard Worker # WHEN 3310*cfb92d14SAndroid Build Coastguard Worker actual_datagram_tag = fragmentation_header.datagram_tag 3311*cfb92d14SAndroid Build Coastguard Worker 3312*cfb92d14SAndroid Build Coastguard Worker # THEN 3313*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(datagram_tag, actual_datagram_tag) 3314*cfb92d14SAndroid Build Coastguard Worker 3315*cfb92d14SAndroid Build Coastguard Worker def test_should_return_datagram_offset_value_when_datagram_offset_property_called(self): 3316*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3317*cfb92d14SAndroid Build Coastguard Worker datagram_offset = any_datagram_offset() 3318*cfb92d14SAndroid Build Coastguard Worker 3319*cfb92d14SAndroid Build Coastguard Worker fragmentation_header = lowpan.LowpanFragmentationHeader(any_datagram_size(), any_datagram_tag(), 3320*cfb92d14SAndroid Build Coastguard Worker datagram_offset) 3321*cfb92d14SAndroid Build Coastguard Worker 3322*cfb92d14SAndroid Build Coastguard Worker # WHEN 3323*cfb92d14SAndroid Build Coastguard Worker actual_datagram_offset = fragmentation_header.datagram_offset 3324*cfb92d14SAndroid Build Coastguard Worker 3325*cfb92d14SAndroid Build Coastguard Worker # THEN 3326*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(datagram_offset, actual_datagram_offset) 3327*cfb92d14SAndroid Build Coastguard Worker 3328*cfb92d14SAndroid Build Coastguard Worker def test_should_return_False_when_is_first_property_called_and_datagram_offset_is_not_eq_0(self): 3329*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3330*cfb92d14SAndroid Build Coastguard Worker datagram_offset = random.randint(1, (1 << 8) - 1) 3331*cfb92d14SAndroid Build Coastguard Worker 3332*cfb92d14SAndroid Build Coastguard Worker fragmentation_header = lowpan.LowpanFragmentationHeader(any_datagram_size(), any_datagram_tag(), 3333*cfb92d14SAndroid Build Coastguard Worker datagram_offset) 3334*cfb92d14SAndroid Build Coastguard Worker 3335*cfb92d14SAndroid Build Coastguard Worker # WHEN 3336*cfb92d14SAndroid Build Coastguard Worker is_first = fragmentation_header.is_first 3337*cfb92d14SAndroid Build Coastguard Worker 3338*cfb92d14SAndroid Build Coastguard Worker # THEN 3339*cfb92d14SAndroid Build Coastguard Worker self.assertFalse(is_first) 3340*cfb92d14SAndroid Build Coastguard Worker 3341*cfb92d14SAndroid Build Coastguard Worker def test_should_to_bytes_LowpanFragmentationHeader_from_bytes_when_from_bytes_class_method_called(self): 3342*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3343*cfb92d14SAndroid Build Coastguard Worker datagram_size = any_datagram_size() 3344*cfb92d14SAndroid Build Coastguard Worker datagram_tag = any_datagram_tag() 3345*cfb92d14SAndroid Build Coastguard Worker datagram_offset = any_datagram_offset() 3346*cfb92d14SAndroid Build Coastguard Worker 3347*cfb92d14SAndroid Build Coastguard Worker data = struct.pack(">HHB", ((3 << 14) | (int(datagram_offset != 0) << 13) | datagram_size), datagram_tag, 3348*cfb92d14SAndroid Build Coastguard Worker datagram_offset) 3349*cfb92d14SAndroid Build Coastguard Worker 3350*cfb92d14SAndroid Build Coastguard Worker # WHEN 3351*cfb92d14SAndroid Build Coastguard Worker fragmentation_header = lowpan.LowpanFragmentationHeader.from_bytes(io.BytesIO(data)) 3352*cfb92d14SAndroid Build Coastguard Worker 3353*cfb92d14SAndroid Build Coastguard Worker # THEN 3354*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(datagram_size, fragmentation_header.datagram_size) 3355*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(datagram_tag, fragmentation_header.datagram_tag) 3356*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(datagram_offset, fragmentation_header.datagram_offset) 3357*cfb92d14SAndroid Build Coastguard Worker 3358*cfb92d14SAndroid Build Coastguard Worker 3359*cfb92d14SAndroid Build Coastguard Workerclass TestLowpanDecompressor(unittest.TestCase): 3360*cfb92d14SAndroid Build Coastguard Worker 3361*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_parent_request_when_decompress_method_called(self): 3362*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3363*cfb92d14SAndroid Build Coastguard Worker data = bytearray([ 3364*cfb92d14SAndroid Build Coastguard Worker 0x7f, 0x3b, 0x02, 0xf0, 0x4d, 0x4c, 0x4d, 0x4c, 0x5e, 0xaf, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 3365*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x00, 0x01, 0x3b, 0xfb, 0x0e, 0x3b, 0x15, 0xa1, 0xf9, 0xf5, 0x64, 0xf4, 0x99, 0xef, 0x70, 0x78, 0x6c, 3366*cfb92d14SAndroid Build Coastguard Worker 0x3c, 0x0f, 0x54, 0x4e, 0x95, 0xe8, 0xf5, 0x27, 0x4c, 0xfc 3367*cfb92d14SAndroid Build Coastguard Worker ]) 3368*cfb92d14SAndroid Build Coastguard Worker 3369*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 3370*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 3371*cfb92d14SAndroid Build Coastguard Worker bytearray([0x12, 0xcf, 0xd3, 0x8b, 0x3b, 0x61, 0x55, 0x58])) 3372*cfb92d14SAndroid Build Coastguard Worker 3373*cfb92d14SAndroid Build Coastguard Worker decompressor = config.create_default_lowpan_decompressor(context_manager=None) 3374*cfb92d14SAndroid Build Coastguard Worker 3375*cfb92d14SAndroid Build Coastguard Worker # WHEN 3376*cfb92d14SAndroid Build Coastguard Worker ipv6_header, extension_headers, udp_header = decompressor.decompress(io.BytesIO(data), message_info) 3377*cfb92d14SAndroid Build Coastguard Worker 3378*cfb92d14SAndroid Build Coastguard Worker # THEN 3379*cfb92d14SAndroid Build Coastguard Worker self.assertEqual("fe80::10cf:d38b:3b61:5558", ipv6_header.source_address.compressed) 3380*cfb92d14SAndroid Build Coastguard Worker self.assertEqual("ff02::2", ipv6_header.destination_address.compressed) 3381*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(17, ipv6_header.next_header) 3382*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(255, ipv6_header.hop_limit) 3383*cfb92d14SAndroid Build Coastguard Worker 3384*cfb92d14SAndroid Build Coastguard Worker self.assertEqual([], extension_headers) 3385*cfb92d14SAndroid Build Coastguard Worker 3386*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_parent_response_when_decompress_method_called(self): 3387*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3388*cfb92d14SAndroid Build Coastguard Worker data = bytearray([ 3389*cfb92d14SAndroid Build Coastguard Worker 0x7f, 0x33, 0xf0, 0x4d, 0x4c, 0x4d, 0x4c, 0x0f, 0xe8, 0x00, 0x15, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 3390*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x01, 0x31, 0xb8, 0x16, 0x02, 0x61, 0xcc, 0x98, 0x90, 0xd6, 0xfd, 0x69, 0xd3, 0x89, 0xa0, 0x30, 0x49, 3391*cfb92d14SAndroid Build Coastguard Worker 0x83, 0x7c, 0xf7, 0xb5, 0x7f, 0x83, 0x2a, 0x04, 0xf6, 0x3b, 0x8c, 0xe8, 0xb6, 0x37, 0x51, 0x5b, 0x28, 0x9a, 3392*cfb92d14SAndroid Build Coastguard Worker 0x3b, 0xbe, 0x0d, 0xb3, 0x4e, 0x9f, 0xd8, 0x14, 0xc8, 0xc9, 0xf4, 0x28, 0xf6, 0x8d, 0xb7, 0xf0, 0x7d, 0x46, 3393*cfb92d14SAndroid Build Coastguard Worker 0x13, 0xc2, 0xb1, 0x69, 0x4d, 0xae, 0xc1, 0x23, 0x16, 0x62, 0x90, 0xea, 0xff, 0x1b, 0xb7, 0xd7, 0x1e, 0x5c 3394*cfb92d14SAndroid Build Coastguard Worker ]) 3395*cfb92d14SAndroid Build Coastguard Worker 3396*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 3397*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 3398*cfb92d14SAndroid Build Coastguard Worker bytearray([0x3a, 0x3e, 0x9e, 0xed, 0x7a, 0x01, 0x36, 0xa5])) 3399*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 3400*cfb92d14SAndroid Build Coastguard Worker bytearray([0x12, 0xcf, 0xd3, 0x8b, 0x3b, 0x61, 0x55, 0x58])) 3401*cfb92d14SAndroid Build Coastguard Worker 3402*cfb92d14SAndroid Build Coastguard Worker decompressor = config.create_default_lowpan_decompressor(context_manager=None) 3403*cfb92d14SAndroid Build Coastguard Worker 3404*cfb92d14SAndroid Build Coastguard Worker # WHEN 3405*cfb92d14SAndroid Build Coastguard Worker ipv6_header, extension_headers, udp_header = decompressor.decompress(io.BytesIO(data), message_info) 3406*cfb92d14SAndroid Build Coastguard Worker 3407*cfb92d14SAndroid Build Coastguard Worker # THEN 3408*cfb92d14SAndroid Build Coastguard Worker self.assertEqual("fe80::383e:9eed:7a01:36a5", ipv6_header.source_address.compressed) 3409*cfb92d14SAndroid Build Coastguard Worker self.assertEqual("fe80::10cf:d38b:3b61:5558", ipv6_header.destination_address.compressed) 3410*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(17, ipv6_header.next_header) 3411*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(255, ipv6_header.hop_limit) 3412*cfb92d14SAndroid Build Coastguard Worker 3413*cfb92d14SAndroid Build Coastguard Worker self.assertEqual([], extension_headers) 3414*cfb92d14SAndroid Build Coastguard Worker 3415*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(19788, udp_header.src_port) 3416*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(19788, udp_header.dst_port) 3417*cfb92d14SAndroid Build Coastguard Worker 3418*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_child_id_request_when_decompress_method_called(self): 3419*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3420*cfb92d14SAndroid Build Coastguard Worker data = bytearray([ 3421*cfb92d14SAndroid Build Coastguard Worker 0x7f, 0x33, 0xf0, 0x4d, 0x4c, 0x4d, 0x4c, 0x9a, 0x62, 0x00, 0x15, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 3422*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x01, 0x14, 0x03, 0xe3, 0x72, 0x50, 0x4f, 0x8c, 0x5c, 0x42, 0x81, 0x68, 0xe2, 0x11, 0xfc, 0xf5, 0x8c, 3423*cfb92d14SAndroid Build Coastguard Worker 0x62, 0x8e, 0x83, 0x99, 0xe7, 0x26, 0x86, 0x34, 0x3b, 0xa7, 0x68, 0xc7, 0x93, 0xfb, 0x72, 0xd9, 0xcc, 0x13, 3424*cfb92d14SAndroid Build Coastguard Worker 0x5e, 0x5b, 0x96, 0x0e, 0xf1, 0x80, 0x03, 0x55, 0x4f, 0x27, 0xc2, 0x96, 0xf4, 0x9c, 0x65, 0x82, 0x97, 0xcf, 3425*cfb92d14SAndroid Build Coastguard Worker 0x97, 0x35, 0x89, 0xc2 3426*cfb92d14SAndroid Build Coastguard Worker ]) 3427*cfb92d14SAndroid Build Coastguard Worker 3428*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 3429*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 3430*cfb92d14SAndroid Build Coastguard Worker bytearray([0x12, 0xcf, 0xd3, 0x8b, 0x3b, 0x61, 0x55, 0x58])) 3431*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 3432*cfb92d14SAndroid Build Coastguard Worker bytearray([0x3a, 0x3e, 0x9e, 0xed, 0x7a, 0x01, 0x36, 0xa5])) 3433*cfb92d14SAndroid Build Coastguard Worker 3434*cfb92d14SAndroid Build Coastguard Worker decompressor = config.create_default_lowpan_decompressor(context_manager=None) 3435*cfb92d14SAndroid Build Coastguard Worker 3436*cfb92d14SAndroid Build Coastguard Worker # WHEN 3437*cfb92d14SAndroid Build Coastguard Worker ipv6_header, extension_headers, udp_header = decompressor.decompress(io.BytesIO(data), message_info) 3438*cfb92d14SAndroid Build Coastguard Worker 3439*cfb92d14SAndroid Build Coastguard Worker # THEN 3440*cfb92d14SAndroid Build Coastguard Worker self.assertEqual("fe80::10cf:d38b:3b61:5558", ipv6_header.source_address.compressed) 3441*cfb92d14SAndroid Build Coastguard Worker self.assertEqual("fe80::383e:9eed:7a01:36a5", ipv6_header.destination_address.compressed) 3442*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(17, ipv6_header.next_header) 3443*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(255, ipv6_header.hop_limit) 3444*cfb92d14SAndroid Build Coastguard Worker 3445*cfb92d14SAndroid Build Coastguard Worker self.assertEqual([], extension_headers) 3446*cfb92d14SAndroid Build Coastguard Worker 3447*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(19788, udp_header.src_port) 3448*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(19788, udp_header.dst_port) 3449*cfb92d14SAndroid Build Coastguard Worker 3450*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_child_id_response_when_decompress_method_called(self): 3451*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3452*cfb92d14SAndroid Build Coastguard Worker data = bytearray([ 3453*cfb92d14SAndroid Build Coastguard Worker 0x7f, 0x33, 0xf0, 0x4d, 0x4c, 0x4d, 0x4c, 0x7b, 0xe3, 0x00, 0x15, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 3454*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x01, 0xe0, 0x57, 0xbf, 0x2f, 0xc0, 0x4b, 0x1d, 0xac, 0x3c, 0x24, 0x16, 0xdf, 0xeb, 0x96, 0xeb, 0xda, 3455*cfb92d14SAndroid Build Coastguard Worker 0x42, 0xeb, 0x00, 0x89, 0x5f, 0x39, 0xc9, 0x2b, 0x7d, 0x31, 0xd5, 0x83, 0x9d, 0xdb, 0xb7, 0xc8, 0xe6, 0x25, 3456*cfb92d14SAndroid Build Coastguard Worker 0xd3, 0x7a, 0x1e, 0x5f, 0x66, 0x9e, 0x63, 0x2d, 0x42, 0x27, 0x19, 0x41, 0xdc, 0xc4, 0xc4, 0xc0, 0x8c, 0x07 3457*cfb92d14SAndroid Build Coastguard Worker ]) 3458*cfb92d14SAndroid Build Coastguard Worker 3459*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 3460*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 3461*cfb92d14SAndroid Build Coastguard Worker bytearray([0x3a, 0x3e, 0x9e, 0xed, 0x7a, 0x01, 0x36, 0xa5])) 3462*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = common.MacAddress.from_eui64( 3463*cfb92d14SAndroid Build Coastguard Worker bytearray([0x12, 0xcf, 0xd3, 0x8b, 0x3b, 0x61, 0x55, 0x58])) 3464*cfb92d14SAndroid Build Coastguard Worker 3465*cfb92d14SAndroid Build Coastguard Worker decompressor = config.create_default_lowpan_decompressor(context_manager=None) 3466*cfb92d14SAndroid Build Coastguard Worker 3467*cfb92d14SAndroid Build Coastguard Worker # WHEN 3468*cfb92d14SAndroid Build Coastguard Worker ipv6_header, extension_headers, udp_header = decompressor.decompress(io.BytesIO(data), message_info) 3469*cfb92d14SAndroid Build Coastguard Worker 3470*cfb92d14SAndroid Build Coastguard Worker # THEN 3471*cfb92d14SAndroid Build Coastguard Worker self.assertEqual("fe80::383e:9eed:7a01:36a5", ipv6_header.source_address.compressed) 3472*cfb92d14SAndroid Build Coastguard Worker self.assertEqual("fe80::10cf:d38b:3b61:5558", ipv6_header.destination_address.compressed) 3473*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(17, ipv6_header.next_header) 3474*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(255, ipv6_header.hop_limit) 3475*cfb92d14SAndroid Build Coastguard Worker 3476*cfb92d14SAndroid Build Coastguard Worker self.assertEqual([], extension_headers) 3477*cfb92d14SAndroid Build Coastguard Worker 3478*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(19788, udp_header.src_port) 3479*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(19788, udp_header.dst_port) 3480*cfb92d14SAndroid Build Coastguard Worker 3481*cfb92d14SAndroid Build Coastguard Worker def test_should_parse_advertisement_when_decompress_method_called(self): 3482*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3483*cfb92d14SAndroid Build Coastguard Worker data = bytearray([ 3484*cfb92d14SAndroid Build Coastguard Worker 0x7f, 0x3b, 0x01, 0xf0, 0x4d, 0x4c, 0x4d, 0x4c, 0x35, 0x9f, 0x00, 0x15, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 3485*cfb92d14SAndroid Build Coastguard Worker 0x00, 0x00, 0x01, 0x9e, 0xb8, 0xd0, 0x2f, 0x2a, 0xe0, 0x00, 0x5d, 0x66, 0x63, 0x05, 0xa0, 0x59, 0xb0, 0xd4, 3486*cfb92d14SAndroid Build Coastguard Worker 0x95, 0x7f, 0xe6, 0x79, 0x17, 0x87, 0x2c, 0x1d, 0x83, 0xad, 0xc2, 0x64, 0x47, 0x20, 0x7a, 0xe2 3487*cfb92d14SAndroid Build Coastguard Worker ]) 3488*cfb92d14SAndroid Build Coastguard Worker 3489*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 3490*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = common.MacAddress.from_eui64( 3491*cfb92d14SAndroid Build Coastguard Worker bytearray([0x3a, 0x3e, 0x9e, 0xed, 0x7a, 0x01, 0x36, 0xa5])) 3492*cfb92d14SAndroid Build Coastguard Worker 3493*cfb92d14SAndroid Build Coastguard Worker decompressor = config.create_default_lowpan_decompressor(context_manager=None) 3494*cfb92d14SAndroid Build Coastguard Worker 3495*cfb92d14SAndroid Build Coastguard Worker # WHEN 3496*cfb92d14SAndroid Build Coastguard Worker ipv6_header, extension_headers, udp_header = decompressor.decompress(io.BytesIO(data), message_info) 3497*cfb92d14SAndroid Build Coastguard Worker 3498*cfb92d14SAndroid Build Coastguard Worker # THEN 3499*cfb92d14SAndroid Build Coastguard Worker self.assertEqual("fe80::383e:9eed:7a01:36a5", ipv6_header.source_address.compressed) 3500*cfb92d14SAndroid Build Coastguard Worker self.assertEqual("ff02::1", ipv6_header.destination_address.compressed) 3501*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(17, ipv6_header.next_header) 3502*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(255, ipv6_header.hop_limit) 3503*cfb92d14SAndroid Build Coastguard Worker 3504*cfb92d14SAndroid Build Coastguard Worker self.assertEqual([], extension_headers) 3505*cfb92d14SAndroid Build Coastguard Worker 3506*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(19788, udp_header.src_port) 3507*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(19788, udp_header.dst_port) 3508*cfb92d14SAndroid Build Coastguard Worker 3509*cfb92d14SAndroid Build Coastguard Worker 3510*cfb92d14SAndroid Build Coastguard Workerclass TestLowpanFragmentsBuffer(unittest.TestCase): 3511*cfb92d14SAndroid Build Coastguard Worker 3512*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_ValueError_when_write_method_called_with_data_length_bigger_than_buffer_length(self): 3513*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3514*cfb92d14SAndroid Build Coastguard Worker length = random.randint(1, 1280) 3515*cfb92d14SAndroid Build Coastguard Worker 3516*cfb92d14SAndroid Build Coastguard Worker fragments_buffer = lowpan.LowpanFragmentsBuffer(buffer_size=(length - 1)) 3517*cfb92d14SAndroid Build Coastguard Worker 3518*cfb92d14SAndroid Build Coastguard Worker # THEN 3519*cfb92d14SAndroid Build Coastguard Worker self.assertRaises(ValueError, fragments_buffer.write, any_data(length)) 3520*cfb92d14SAndroid Build Coastguard Worker 3521*cfb92d14SAndroid Build Coastguard Worker def test_should_move_write_position_by_the_data_length_when_write_method_called(self): 3522*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3523*cfb92d14SAndroid Build Coastguard Worker length = random.randint(1, 1280) 3524*cfb92d14SAndroid Build Coastguard Worker 3525*cfb92d14SAndroid Build Coastguard Worker fragments_buffer = lowpan.LowpanFragmentsBuffer(buffer_size=length) 3526*cfb92d14SAndroid Build Coastguard Worker 3527*cfb92d14SAndroid Build Coastguard Worker start_position = fragments_buffer.tell() 3528*cfb92d14SAndroid Build Coastguard Worker 3529*cfb92d14SAndroid Build Coastguard Worker data = any_data(length=random.randint(1, length)) 3530*cfb92d14SAndroid Build Coastguard Worker 3531*cfb92d14SAndroid Build Coastguard Worker # WHEN 3532*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.write(data) 3533*cfb92d14SAndroid Build Coastguard Worker 3534*cfb92d14SAndroid Build Coastguard Worker # THEN 3535*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(fragments_buffer.tell() - start_position, len(data)) 3536*cfb92d14SAndroid Build Coastguard Worker 3537*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_ValueError_when_read_method_called_but_not_whole_packet_has_been_stored_in_buffer(self): 3538*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3539*cfb92d14SAndroid Build Coastguard Worker data = any_data(length=3) 3540*cfb92d14SAndroid Build Coastguard Worker 3541*cfb92d14SAndroid Build Coastguard Worker fragments_buffer = lowpan.LowpanFragmentsBuffer(buffer_size=random.randint(4, 1280)) 3542*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.write(data) 3543*cfb92d14SAndroid Build Coastguard Worker 3544*cfb92d14SAndroid Build Coastguard Worker # WHEN 3545*cfb92d14SAndroid Build Coastguard Worker self.assertRaises(ValueError, fragments_buffer.read) 3546*cfb92d14SAndroid Build Coastguard Worker 3547*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_ValueError_when_seek_method_called_with_offset_bigger_than_buffer_length(self): 3548*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3549*cfb92d14SAndroid Build Coastguard Worker offset = random.randint(1281, 2500) 3550*cfb92d14SAndroid Build Coastguard Worker 3551*cfb92d14SAndroid Build Coastguard Worker fragments_buffer = lowpan.LowpanFragmentsBuffer(buffer_size=1280) 3552*cfb92d14SAndroid Build Coastguard Worker 3553*cfb92d14SAndroid Build Coastguard Worker # THEN 3554*cfb92d14SAndroid Build Coastguard Worker self.assertRaises(ValueError, fragments_buffer.seek, offset) 3555*cfb92d14SAndroid Build Coastguard Worker 3556*cfb92d14SAndroid Build Coastguard Worker def test_should_set_write_position_when_seek_method_called(self): 3557*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3558*cfb92d14SAndroid Build Coastguard Worker length = random.randint(1, 1280) 3559*cfb92d14SAndroid Build Coastguard Worker offset = random.randint(0, length - 1) 3560*cfb92d14SAndroid Build Coastguard Worker 3561*cfb92d14SAndroid Build Coastguard Worker fragments_buffer = lowpan.LowpanFragmentsBuffer(buffer_size=length) 3562*cfb92d14SAndroid Build Coastguard Worker 3563*cfb92d14SAndroid Build Coastguard Worker # WHEN 3564*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.seek(offset) 3565*cfb92d14SAndroid Build Coastguard Worker 3566*cfb92d14SAndroid Build Coastguard Worker # THEN 3567*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(offset, fragments_buffer.tell()) 3568*cfb92d14SAndroid Build Coastguard Worker 3569*cfb92d14SAndroid Build Coastguard Worker def test_should_write_whole_packet_to_buffer_when_write_method_called(self): 3570*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3571*cfb92d14SAndroid Build Coastguard Worker data = any_data(length=random.randint(1, 1280)) 3572*cfb92d14SAndroid Build Coastguard Worker 3573*cfb92d14SAndroid Build Coastguard Worker fragments_buffer = lowpan.LowpanFragmentsBuffer(buffer_size=len(data)) 3574*cfb92d14SAndroid Build Coastguard Worker 3575*cfb92d14SAndroid Build Coastguard Worker # WHEN 3576*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.write(data) 3577*cfb92d14SAndroid Build Coastguard Worker 3578*cfb92d14SAndroid Build Coastguard Worker # THEN 3579*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(data, fragments_buffer.read()) 3580*cfb92d14SAndroid Build Coastguard Worker 3581*cfb92d14SAndroid Build Coastguard Worker def test_should_write_many_frags_to_the_buffer_and_return_whole_message_when_write_method_called_many_times(self): 3582*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3583*cfb92d14SAndroid Build Coastguard Worker buffer_size = 42 3584*cfb92d14SAndroid Build Coastguard Worker fragments_buffer = lowpan.LowpanFragmentsBuffer(buffer_size=buffer_size) 3585*cfb92d14SAndroid Build Coastguard Worker 3586*cfb92d14SAndroid Build Coastguard Worker offset_1 = 0 3587*cfb92d14SAndroid Build Coastguard Worker fragment_1 = bytearray([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]) 3588*cfb92d14SAndroid Build Coastguard Worker 3589*cfb92d14SAndroid Build Coastguard Worker offset_2 = 8 3590*cfb92d14SAndroid Build Coastguard Worker fragment_2 = bytearray([0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10]) 3591*cfb92d14SAndroid Build Coastguard Worker 3592*cfb92d14SAndroid Build Coastguard Worker offset_3 = 16 3593*cfb92d14SAndroid Build Coastguard Worker fragment_3 = bytearray([0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18]) 3594*cfb92d14SAndroid Build Coastguard Worker 3595*cfb92d14SAndroid Build Coastguard Worker offset_4 = 24 3596*cfb92d14SAndroid Build Coastguard Worker fragment_4 = bytearray([0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20]) 3597*cfb92d14SAndroid Build Coastguard Worker 3598*cfb92d14SAndroid Build Coastguard Worker offset_5 = 32 3599*cfb92d14SAndroid Build Coastguard Worker fragment_5 = bytearray([0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28]) 3600*cfb92d14SAndroid Build Coastguard Worker 3601*cfb92d14SAndroid Build Coastguard Worker offset_6 = 40 3602*cfb92d14SAndroid Build Coastguard Worker fragment_6 = bytearray([0x29, 0x2a]) 3603*cfb92d14SAndroid Build Coastguard Worker 3604*cfb92d14SAndroid Build Coastguard Worker # WHEN 3605*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.seek(offset_1) 3606*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.write(fragment_1) 3607*cfb92d14SAndroid Build Coastguard Worker 3608*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.seek(offset_2) 3609*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.write(fragment_2) 3610*cfb92d14SAndroid Build Coastguard Worker 3611*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.seek(offset_3) 3612*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.write(fragment_3) 3613*cfb92d14SAndroid Build Coastguard Worker 3614*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.seek(offset_4) 3615*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.write(fragment_4) 3616*cfb92d14SAndroid Build Coastguard Worker 3617*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.seek(offset_5) 3618*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.write(fragment_5) 3619*cfb92d14SAndroid Build Coastguard Worker 3620*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.seek(offset_6) 3621*cfb92d14SAndroid Build Coastguard Worker fragments_buffer.write(fragment_6) 3622*cfb92d14SAndroid Build Coastguard Worker 3623*cfb92d14SAndroid Build Coastguard Worker # THEN 3624*cfb92d14SAndroid Build Coastguard Worker self.assertEqual( 3625*cfb92d14SAndroid Build Coastguard Worker bytearray([ 3626*cfb92d14SAndroid Build Coastguard Worker 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 3627*cfb92d14SAndroid Build Coastguard Worker 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 3628*cfb92d14SAndroid Build Coastguard Worker 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a 3629*cfb92d14SAndroid Build Coastguard Worker ]), fragments_buffer.read()) 3630*cfb92d14SAndroid Build Coastguard Worker 3631*cfb92d14SAndroid Build Coastguard Worker 3632*cfb92d14SAndroid Build Coastguard Workerclass TestLowpanFragmentsBuffersManager(unittest.TestCase): 3633*cfb92d14SAndroid Build Coastguard Worker 3634*cfb92d14SAndroid Build Coastguard Worker def test_should_raise_ValueError_when_get_fragments_buffer_method_called_with_invalid_dgram_size(self): 3635*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3636*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 3637*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = any_mac_address() 3638*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = any_mac_address() 3639*cfb92d14SAndroid Build Coastguard Worker 3640*cfb92d14SAndroid Build Coastguard Worker negative_int = -random.randint(1, 1280) 3641*cfb92d14SAndroid Build Coastguard Worker 3642*cfb92d14SAndroid Build Coastguard Worker manager = lowpan.LowpanFragmentsBuffersManager() 3643*cfb92d14SAndroid Build Coastguard Worker 3644*cfb92d14SAndroid Build Coastguard Worker # THEN 3645*cfb92d14SAndroid Build Coastguard Worker self.assertRaises(ValueError, manager.get_fragments_buffer, message_info, any_datagram_tag(), None) 3646*cfb92d14SAndroid Build Coastguard Worker self.assertRaises(ValueError, manager.get_fragments_buffer, message_info, any_datagram_tag(), negative_int) 3647*cfb92d14SAndroid Build Coastguard Worker 3648*cfb92d14SAndroid Build Coastguard Worker def test_should_return_LowpanFragmentsBuffer_when_get_fragments_buffer_method_called_with_valid_dgram_size(self): 3649*cfb92d14SAndroid Build Coastguard Worker # GIVEN 3650*cfb92d14SAndroid Build Coastguard Worker message_info = common.MessageInfo() 3651*cfb92d14SAndroid Build Coastguard Worker message_info.source_mac_address = any_mac_address() 3652*cfb92d14SAndroid Build Coastguard Worker message_info.destination_mac_address = any_mac_address() 3653*cfb92d14SAndroid Build Coastguard Worker 3654*cfb92d14SAndroid Build Coastguard Worker datagram_size = any_datagram_size() 3655*cfb92d14SAndroid Build Coastguard Worker 3656*cfb92d14SAndroid Build Coastguard Worker manager = lowpan.LowpanFragmentsBuffersManager() 3657*cfb92d14SAndroid Build Coastguard Worker 3658*cfb92d14SAndroid Build Coastguard Worker # WHEN 3659*cfb92d14SAndroid Build Coastguard Worker fragments_buffer = manager.get_fragments_buffer(message_info, any_datagram_tag(), datagram_size) 3660*cfb92d14SAndroid Build Coastguard Worker 3661*cfb92d14SAndroid Build Coastguard Worker # THEN 3662*cfb92d14SAndroid Build Coastguard Worker self.assertIsInstance(fragments_buffer, lowpan.LowpanFragmentsBuffer) 3663*cfb92d14SAndroid Build Coastguard Worker self.assertEqual(datagram_size, len(fragments_buffer)) 3664*cfb92d14SAndroid Build Coastguard Worker 3665*cfb92d14SAndroid Build Coastguard Worker 3666*cfb92d14SAndroid Build Coastguard Workerif __name__ == "__main__": 3667*cfb92d14SAndroid Build Coastguard Worker unittest.main(verbosity=1) 3668