Home
last modified time | relevance | path

Searched refs:packet (Results 1 – 25 of 54) sorted by relevance

123

/frameworks/libs/net/common/tests/unit/src/com/android/net/module/util/
DIpUtilsTest.java81 ByteBuffer packet = ByteBuffer.wrap(new byte[] { in testIpv6TcpChecksum() local
103 int transportLen = packet.limit() - IPV6_HEADER_LENGTH; in testIpv6TcpChecksum()
104 assertEquals(0, IpUtils.tcpChecksum(packet, 0, IPV6_HEADER_LENGTH, transportLen)); in testIpv6TcpChecksum()
108 int sum = getUnsignedByte(packet, sumOffset) * 256 + getUnsignedByte(packet, sumOffset + 1); in testIpv6TcpChecksum()
111 packet.put(sumOffset, (byte) 0); in testIpv6TcpChecksum()
112 packet.put(sumOffset + 1, (byte) 0); in testIpv6TcpChecksum()
113 assertChecksumEquals(sum, IpUtils.tcpChecksum(packet, 0, IPV6_HEADER_LENGTH, transportLen)); in testIpv6TcpChecksum()
116 packet.putShort( in testIpv6TcpChecksum()
118 IpUtils.tcpChecksum(packet, 0, IPV6_HEADER_LENGTH, transportLen)); in testIpv6TcpChecksum()
119 assertEquals(0, IpUtils.tcpChecksum(packet, 0, IPV6_HEADER_LENGTH, transportLen)); in testIpv6TcpChecksum()
[all …]
DPacketBuilderTest.java419 final ByteBuffer packet = buildIpv4Packet(SRC_MAC, DST_MAC, IPPROTO_TCP, null /* data */); in testBuildPacketEtherIPv4Tcp() local
420 checkTcpv4Packet(true /* hasEther */, false /* hasData */, packet); in testBuildPacketEtherIPv4Tcp()
421 assertArrayEquals(TEST_PACKET_ETHERHDR_IPV4HDR_TCPHDR, packet.array()); in testBuildPacketEtherIPv4Tcp()
426 final ByteBuffer packet = buildIpv4Packet(SRC_MAC, DST_MAC, IPPROTO_TCP, DATA); in testBuildPacketEtherIPv4TcpData() local
427 checkTcpv4Packet(true /* hasEther */, true /* hasData */, packet); in testBuildPacketEtherIPv4TcpData()
429 packet.array()); in testBuildPacketEtherIPv4TcpData()
434 final ByteBuffer packet = buildIpv4Packet(null /* srcMac */, null /* dstMac */, in testBuildPacketIPv4Tcp() local
436 checkTcpv4Packet(false /* hasEther */, false /* hasData */, packet); in testBuildPacketIPv4Tcp()
437 assertArrayEquals(TEST_PACKET_IPV4HDR_TCPHDR, packet.array()); in testBuildPacketIPv4Tcp()
442 final ByteBuffer packet = buildIpv4Packet(null /* srcMac */, null /* dstMac */, in testBuildPacketIPv4TcpData() local
[all …]
DDnsPacketTest.java99 TestDnsPacket packet = new TestDnsPacket(v4blob); in testV4Answer() local
102 assertHeaderParses(packet.getHeader(), 0x5566, 0x8180, 1, 1, 0, 0); in testV4Answer()
106 packet.getRecordList(DnsPacket.QDSECTION); in testV4Answer()
111 packet.getRecordList(DnsPacket.ANSECTION); in testV4Answer()
141 TestDnsPacket packet = new TestDnsPacket(v6blob); in testV6Answer() local
144 assertHeaderParses(packet.getHeader(), 0x7722, 0x8180, 1, 1, 0, 0); in testV6Answer()
148 packet.getRecordList(DnsPacket.QDSECTION); in testV6Answer()
153 packet.getRecordList(DnsPacket.ANSECTION); in testV6Answer()
/frameworks/av/media/mtp/
DMtpObjectInfo.cpp58 bool MtpObjectInfo::read(MtpDataPacket& packet) { in read() argument
62 if (!packet.getUInt32(mStorageID)) return false; in read()
63 if (!packet.getUInt16(mFormat)) return false; in read()
64 if (!packet.getUInt16(mProtectionStatus)) return false; in read()
65 if (!packet.getUInt32(mCompressedSize)) return false; in read()
66 if (!packet.getUInt16(mThumbFormat)) return false; in read()
67 if (!packet.getUInt32(mThumbCompressedSize)) return false; in read()
68 if (!packet.getUInt32(mThumbPixWidth)) return false; in read()
69 if (!packet.getUInt32(mThumbPixHeight)) return false; in read()
70 if (!packet.getUInt32(mImagePixWidth)) return false; in read()
[all …]
DMtpProperty.cpp130 bool MtpProperty::read(MtpDataPacket& packet) { in read() argument
133 if (!packet.getUInt16(mCode)) return false; in read()
135 if (!packet.getUInt16(mType)) return false; in read()
136 if (!packet.getUInt8(temp8)) return false; in read()
149 mDefaultArrayValues = readArrayValues(packet, mDefaultArrayLength); in read()
152 mCurrentArrayValues = readArrayValues(packet, mCurrentArrayLength); in read()
157 if (!readValue(packet, mDefaultValue)) return false; in read()
159 if (!readValue(packet, mCurrentValue)) return false; in read()
163 if (!packet.getUInt32(mGroupCode)) return false; in read()
165 if (!packet.getUInt8(mFormFlag)) return false; in read()
[all …]
DMtpDeviceInfo.cpp62 bool MtpDeviceInfo::read(MtpDataPacket& packet) { in read() argument
66 if (!packet.getUInt16(mStandardVersion)) return false; in read()
67 if (!packet.getUInt32(mVendorExtensionID)) return false; in read()
68 if (!packet.getUInt16(mVendorExtensionVersion)) return false; in read()
70 if (!packet.getString(string)) return false; in read()
74 if (!packet.getUInt16(mFunctionalMode)) return false; in read()
75 mOperations = packet.getAUInt16(); in read()
77 mEvents = packet.getAUInt16(); in read()
79 mDeviceProperties = packet.getAUInt16(); in read()
81 mCaptureFormats = packet.getAUInt16(); in read()
[all …]
DMtpStorageInfo.cpp48 bool MtpStorageInfo::read(MtpDataPacket& packet) { in read() argument
52 if (!packet.getUInt16(mStorageType)) return false; in read()
53 if (!packet.getUInt16(mFileSystemType)) return false; in read()
54 if (!packet.getUInt16(mAccessCapability)) return false; in read()
55 if (!packet.getUInt64(mMaxCapacity)) return false; in read()
56 if (!packet.getUInt64(mFreeSpaceBytes)) return false; in read()
57 if (!packet.getUInt32(mFreeSpaceObjects)) return false; in read()
59 if (!packet.getString(string)) return false; in read()
62 if (!packet.getString(string)) return false; in read()
DMtpStringBuffer.cpp83 bool MtpStringBuffer::readFromPacket(MtpDataPacket* packet) { in readFromPacket() argument
85 if (!packet->getUInt8(count)) in readFromPacket()
93 if (!packet->getUInt16(ch)) in readFromPacket()
105 void MtpStringBuffer::writeToPacket(MtpDataPacket* packet) const { in writeToPacket()
110 packet->putUInt8(0); in writeToPacket()
113 packet->putUInt8(std::min(count + 1, MTP_STRING_MAX_CHARACTER_NUMBER)); in writeToPacket()
122 packet->putUInt16(c); in writeToPacket()
126 packet->putUInt16(0); in writeToPacket()
DMtpProperty.h89 bool read(MtpDataPacket& packet);
90 void write(MtpDataPacket& packet);
95 void setCurrentValue(MtpDataPacket& packet);
110 bool readValue(MtpDataPacket& packet, MtpPropertyValue& value);
111 void writeValue(MtpDataPacket& packet, MtpPropertyValue& value);
112 MtpPropertyValue* readArrayValues(MtpDataPacket& packet, uint32_t& length);
113 void writeArrayValues(MtpDataPacket& packet,
DIMtpDatabase.h65 MtpDataPacket& packet) = 0;
69 MtpDataPacket& packet) = 0;
72 MtpDataPacket& packet) = 0;
75 MtpDataPacket& packet) = 0;
82 MtpDataPacket& packet) = 0;
/frameworks/libs/net/common/testutils/hostdevice/com/android/testutils/
DPacketFilter.kt46 override fun test(packet: ByteArray) = in test()
47 bytes.withIndex().all { it.value == packet[offset + it.index] } in test()
91 override fun test(packet: ByteArray): Boolean { in test()
92 val option = findDhcpOption(packet, option) ?: return false in test()
100 fun findDhcpOption(packet: ByteArray, option: Byte): ByteArray? = in findDhcpOption()
101 findOptionOffset(packet, option, DHCP_OPTIONS_OFFSET)?.let { in findDhcpOption()
102 val optionLen = packet[it + 1] in findDhcpOption()
103 return packet.copyOfRange(it + 2 /* type, length bytes */, it + 2 + optionLen) in findDhcpOption()
106 private tailrec fun findOptionOffset(packet: ByteArray, option: Byte, searchOffset: Int): Int? { in findOptionOffset()
107 if (packet.size <= searchOffset + 2 /* type, length bytes */) return null in findOptionOffset()
[all …]
/frameworks/base/media/jni/
Dandroid_mtp_MtpDatabase.cpp192 MtpDataPacket& packet);
196 MtpDataPacket& packet);
199 MtpDataPacket& packet);
202 MtpDataPacket& packet);
209 MtpDataPacket& packet);
437 MtpDataPacket& packet) { in getObjectPropertyValue() argument
473 packet.putInt8(longValue); in getObjectPropertyValue()
476 packet.putUInt8(longValue); in getObjectPropertyValue()
479 packet.putInt16(longValue); in getObjectPropertyValue()
482 packet.putUInt16(longValue); in getObjectPropertyValue()
[all …]
/frameworks/libs/net/common/device/com/android/net/module/util/
DIpv6Utils.java60 final ByteBuffer packet = ByteBuffer.allocate(etherHeaderLen + ipv6HeaderLen in buildIcmpv6Packet() local
70 ethHeader.writeToByteBuffer(packet); in buildIcmpv6Packet()
71 ipv6Header.writeToByteBuffer(packet); in buildIcmpv6Packet()
72 icmpv6Header.writeToByteBuffer(packet); in buildIcmpv6Packet()
74 packet.put(option); in buildIcmpv6Packet()
79 packet.flip(); in buildIcmpv6Packet()
82 packet.putShort(etherHeaderLen + ipv6HeaderLen + 2, icmpv6Checksum(packet, in buildIcmpv6Packet()
86 return packet; in buildIcmpv6Packet()
/frameworks/libs/net/common/testutils/devicetests/com/android/testutils/
DTapPacketReader.java102 return mReadHead.getValue().poll(timeoutMs, packet -> true); in poll()
129 public void sendResponse(final ByteBuffer packet) throws IOException { in sendResponse() argument
131 byte[] packetBytes = new byte[packet.limit()]; in sendResponse()
132 packet.get(packetBytes); in sendResponse()
133 packet.flip(); // So we can reuse it in the future. in sendResponse()
DArpResponder.kt39 override fun replyToPacket(packet: ByteArray, reader: TapPacketReader) { in replyToPacket()
41 packet.copyFromIndexWithLength(ARP_TARGET_IPADDR_OFFSET, 4)) in replyToPacket()
45 val senderMac = packet.copyFromIndexWithLength(ARP_SENDER_MAC_OFFSET, 6) in replyToPacket()
DTestableNetworkAgent.kt78 val packet: KeepalivePacketData constant in CallbackEntry.OnAddKeepalivePacketFilter
84 val packet: KeepalivePacketData constant in CallbackEntry.OnStartSocketKeepalive
109 override fun onAddKeepalivePacketFilter(slot: Int, packet: KeepalivePacketData) { in onAddKeepalivePacketFilter()
110 history.add(OnAddKeepalivePacketFilter(slot, packet)) in onAddKeepalivePacketFilter()
120 packet: KeepalivePacketData in onStartSocketKeepalive()
122 history.add(OnStartSocketKeepalive(slot, interval.seconds.toInt(), packet)) in onStartSocketKeepalive()
/frameworks/native/services/surfaceflinger/tests/unittests/
DFrameTracerTest.cpp88 for (const auto& packet : trace.packet()) { in readGraphicsFramePacketsBlocking() local
89 if (!packet.has_graphics_frame_event()) { in readGraphicsFramePacketsBlocking()
92 packets.emplace_back(packet); in readGraphicsFramePacketsBlocking()
184 const auto& packet = packets[0]; in TEST_F() local
185 ASSERT_TRUE(packet.has_timestamp()); in TEST_F()
186 EXPECT_EQ(packet.timestamp(), timestamp); in TEST_F()
187 ASSERT_TRUE(packet.has_graphics_frame_event()); in TEST_F()
188 const auto& frame_event = packet.graphics_frame_event(); in TEST_F()
240 const auto& packet = packets[1]; in TEST_F() local
241 ASSERT_TRUE(packet.has_timestamp()); in TEST_F()
[all …]
/frameworks/base/media/packages/BluetoothMidiService/tests/unit/src/com/android/bluetoothmidiservice/
DBluetoothMidiCodecTest.java85 byte[] packet = mPacketQueue.poll(0, TimeUnit.SECONDS); in processQueue()
86 if (packet == null) break; in processQueue()
87 Log.d(TAG, "decode " + MidiFramer.formatMidiData(packet, 0, packet.length)); in processQueue()
88 mDecoder.decodePacket(packet, mFramer); in processQueue()
119 byte[] packet = new byte[count]; in writePacket()
120 System.arraycopy(buffer, 0, packet, 0, count); in writePacket()
122 mPacketQueue.put(packet); in writePacket()
DBluetoothMidiDecoderTest.java75 void decodePacket(byte[] packet) throws IOException { in decodePacket() argument
76 mDecoder.decodePacket(packet, mReceiver); in decodePacket()
82 byte[] packet = multiplePackets[i]; in decodePackets()
83 mDecoder.decodePacket(packet, mReceiver); in decodePackets()
/frameworks/av/media/mtp/tests/MtpFuzzer/
DMtpMockDatabase.h71 MtpDataPacket& packet);
74 MtpDataPacket& packet);
76 MtpResponseCode getDevicePropertyValue(MtpDeviceProperty property, MtpDataPacket& packet);
78 MtpResponseCode setDevicePropertyValue(MtpDeviceProperty property, MtpDataPacket& packet);
84 MtpDataPacket& packet);
/frameworks/base/lowpan/java/android/net/lowpan/
DLowpanCommissioningSession.java53 public void onReceiveFromCommissioner(@NonNull byte[] packet) {}; in onReceiveFromCommissioner() argument
73 public void onReceiveFromCommissioner(byte[] packet) { in onReceiveFromCommissioner() argument
78 mCallback.onReceiveFromCommissioner(packet); in onReceiveFromCommissioner()
165 public void sendToCommissioner(@NonNull byte[] packet) { in sendToCommissioner() argument
168 mBinder.sendToCommissioner(packet); in sendToCommissioner()
/frameworks/native/services/surfaceflinger/FrameTimeline/
DFrameTimeline.cpp627 auto packet = ctx.NewTracePacket(); in tracePredictions() local
628 packet->set_timestamp_clock_id(perfetto::protos::pbzero::BUILTIN_CLOCK_BOOTTIME); in tracePredictions()
629 packet->set_timestamp(static_cast<uint64_t>(mPredictions.startTime + monoBootOffset)); in tracePredictions()
631 auto* event = packet->set_frame_timeline_event(); in tracePredictions()
646 auto packet = ctx.NewTracePacket(); in tracePredictions() local
647 packet->set_timestamp_clock_id(perfetto::protos::pbzero::BUILTIN_CLOCK_BOOTTIME); in tracePredictions()
648 packet->set_timestamp(static_cast<uint64_t>(mPredictions.endTime + monoBootOffset)); in tracePredictions()
650 auto* event = packet->set_frame_timeline_event(); in tracePredictions()
663 auto packet = ctx.NewTracePacket(); in traceActuals() local
664 packet->set_timestamp_clock_id(perfetto::protos::pbzero::BUILTIN_CLOCK_BOOTTIME); in traceActuals()
[all …]
/frameworks/native/services/gpuservice/tracing/
DGpuMemTracer.cpp112 auto packet = ctx.NewTracePacket(); in traceInitialCounters() local
113 packet->set_timestamp_clock_id(perfetto::protos::pbzero::BUILTIN_CLOCK_MONOTONIC); in traceInitialCounters()
114 packet->set_timestamp(ts); in traceInitialCounters()
115 auto* event = packet->set_gpu_mem_total_event(); in traceInitialCounters()
/frameworks/av/media/libstagefright/mpeg2ts/test/
DMpeg2tsUnitTest.cpp114 uint8_t packet[kTSPacketSize]; in TEST_P() local
122 while ((numBytesRead = mSource->readAt(mOffset, packet, kTSPacketSize)) == kTSPacketSize) { in TEST_P()
123 ASSERT_TRUE(packet[0] == kTSSyncByte) << "Sync byte error!"; in TEST_P()
126 uint16_t pid = (packet[1] + (packet[2] << 8)) & kPIDMask; in TEST_P()
129 status_t err = mParser->feedTSPacket(packet, kTSPacketSize, &event); in TEST_P()
/frameworks/native/libs/adbd_auth/
Dadbd_auth.cpp182 void HandlePacket(std::string_view packet) EXCLUDES(mutex_) { in HandlePacket()
183 LOG(INFO) << "adbd_auth: received packet: " << packet; in HandlePacket()
185 if (packet.size() < 2) { in HandlePacket()
193 if (android::base::ConsumePrefix(&packet, framework_handlers_[i].code)) { in HandlePacket()
194 framework_handlers_[i].cb(packet); in HandlePacket()
200 LOG(ERROR) << "adbd_auth: unhandled packet: " << packet; in HandlePacket()
247 auto& packet = output_queue_.front(); in SendPacket() local
250 if (auto* p = std::get_if<AdbdAuthPacketAuthenticated>(&packet)) { in SendPacket()
255 } else if (auto* p = std::get_if<AdbdAuthPacketDisconnected>(&packet)) { in SendPacket()
260 } else if (auto* p = std::get_if<AdbdAuthPacketRequestAuthorization>(&packet)) { in SendPacket()
[all …]

123