def _is_matching_connection_response(packet, scid): frame = L2capMatchers.control_frame_with_code(packet, CommandCode.CONNECTION_RESPONSE) if frame is None: return False response = l2cap_packets.ConnectionResponseView(frame) return response.GetSourceCid() == scid and response.GetResult( ) == ConnectionResponseResult.SUCCESS and response.GetDestinationCid() != 0
def _extract_connection_response(packet): frame = L2capMatchers.control_frame_with_code( packet, CommandCode.CONNECTION_RESPONSE) return l2cap_packets.ConnectionResponseView(frame)