| // Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #if defined(_MSC_VER) |
| #pragma warning(push) |
| #pragma warning(disable:4065) |
| #endif |
| |
| #include "services/device/public/interfaces/fingerprint.mojom-shared.h" |
| |
| #include <utility> |
| |
| #include "base/logging.h" |
| #include "mojo/public/cpp/bindings/lib/validate_params.h" |
| #include "mojo/public/cpp/bindings/lib/validation_context.h" |
| #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| #include "mojo/public/cpp/bindings/lib/validation_util.h" |
| namespace device { |
| namespace mojom { |
| |
| namespace internal { |
| |
| |
| // static |
| bool FingerprintObserver_OnRestarted_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const FingerprintObserver_OnRestarted_Params_Data* object = static_cast<const FingerprintObserver_OnRestarted_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 8 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| FingerprintObserver_OnRestarted_Params_Data::FingerprintObserver_OnRestarted_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool FingerprintObserver_OnEnrollScanDone_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const FingerprintObserver_OnEnrollScanDone_Params_Data* object = static_cast<const FingerprintObserver_OnEnrollScanDone_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 24 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| FingerprintObserver_OnEnrollScanDone_Params_Data::FingerprintObserver_OnEnrollScanDone_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool FingerprintObserver_OnAuthScanDone_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const FingerprintObserver_OnAuthScanDone_Params_Data* object = static_cast<const FingerprintObserver_OnAuthScanDone_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 24 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->matches, 2, validation_context)) { |
| return false; |
| } |
| const mojo::internal::ContainerValidateParams matches_validate_params( |
| new mojo::internal::ContainerValidateParams(0, false, new mojo::internal::ContainerValidateParams(0, false, nullptr)), new mojo::internal::ContainerValidateParams(0, false, new mojo::internal::ContainerValidateParams(0, false, new mojo::internal::ContainerValidateParams(0, false, nullptr)))); |
| if (!mojo::internal::ValidateContainer(object->matches, validation_context, |
| &matches_validate_params)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| FingerprintObserver_OnAuthScanDone_Params_Data::FingerprintObserver_OnAuthScanDone_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool FingerprintObserver_OnSessionFailed_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const FingerprintObserver_OnSessionFailed_Params_Data* object = static_cast<const FingerprintObserver_OnSessionFailed_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 8 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| FingerprintObserver_OnSessionFailed_Params_Data::FingerprintObserver_OnSessionFailed_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_GetRecordsForUser_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_GetRecordsForUser_Params_Data* object = static_cast<const Fingerprint_GetRecordsForUser_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->user_id, 1, validation_context)) { |
| return false; |
| } |
| const mojo::internal::ContainerValidateParams user_id_validate_params( |
| 0, false, nullptr); |
| if (!mojo::internal::ValidateContainer(object->user_id, validation_context, |
| &user_id_validate_params)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_GetRecordsForUser_Params_Data::Fingerprint_GetRecordsForUser_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_GetRecordsForUser_ResponseParams_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_GetRecordsForUser_ResponseParams_Data* object = static_cast<const Fingerprint_GetRecordsForUser_ResponseParams_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->records, 1, validation_context)) { |
| return false; |
| } |
| const mojo::internal::ContainerValidateParams records_validate_params( |
| new mojo::internal::ContainerValidateParams(0, false, new mojo::internal::ContainerValidateParams(0, false, nullptr)), new mojo::internal::ContainerValidateParams(0, false, new mojo::internal::ContainerValidateParams(0, false, nullptr))); |
| if (!mojo::internal::ValidateContainer(object->records, validation_context, |
| &records_validate_params)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_GetRecordsForUser_ResponseParams_Data::Fingerprint_GetRecordsForUser_ResponseParams_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_StartEnrollSession_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_StartEnrollSession_Params_Data* object = static_cast<const Fingerprint_StartEnrollSession_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 24 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->user_id, 1, validation_context)) { |
| return false; |
| } |
| const mojo::internal::ContainerValidateParams user_id_validate_params( |
| 0, false, nullptr); |
| if (!mojo::internal::ValidateContainer(object->user_id, validation_context, |
| &user_id_validate_params)) { |
| return false; |
| } |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->label, 2, validation_context)) { |
| return false; |
| } |
| const mojo::internal::ContainerValidateParams label_validate_params( |
| 0, false, nullptr); |
| if (!mojo::internal::ValidateContainer(object->label, validation_context, |
| &label_validate_params)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_StartEnrollSession_Params_Data::Fingerprint_StartEnrollSession_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_CancelCurrentEnrollSession_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_CancelCurrentEnrollSession_Params_Data* object = static_cast<const Fingerprint_CancelCurrentEnrollSession_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 8 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_CancelCurrentEnrollSession_Params_Data::Fingerprint_CancelCurrentEnrollSession_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_CancelCurrentEnrollSession_ResponseParams_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_CancelCurrentEnrollSession_ResponseParams_Data* object = static_cast<const Fingerprint_CancelCurrentEnrollSession_ResponseParams_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_CancelCurrentEnrollSession_ResponseParams_Data::Fingerprint_CancelCurrentEnrollSession_ResponseParams_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_RequestRecordLabel_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_RequestRecordLabel_Params_Data* object = static_cast<const Fingerprint_RequestRecordLabel_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->record_path, 1, validation_context)) { |
| return false; |
| } |
| const mojo::internal::ContainerValidateParams record_path_validate_params( |
| 0, false, nullptr); |
| if (!mojo::internal::ValidateContainer(object->record_path, validation_context, |
| &record_path_validate_params)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_RequestRecordLabel_Params_Data::Fingerprint_RequestRecordLabel_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_RequestRecordLabel_ResponseParams_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_RequestRecordLabel_ResponseParams_Data* object = static_cast<const Fingerprint_RequestRecordLabel_ResponseParams_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->label, 1, validation_context)) { |
| return false; |
| } |
| const mojo::internal::ContainerValidateParams label_validate_params( |
| 0, false, nullptr); |
| if (!mojo::internal::ValidateContainer(object->label, validation_context, |
| &label_validate_params)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_RequestRecordLabel_ResponseParams_Data::Fingerprint_RequestRecordLabel_ResponseParams_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_SetRecordLabel_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_SetRecordLabel_Params_Data* object = static_cast<const Fingerprint_SetRecordLabel_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 24 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->record_path, 1, validation_context)) { |
| return false; |
| } |
| const mojo::internal::ContainerValidateParams record_path_validate_params( |
| 0, false, nullptr); |
| if (!mojo::internal::ValidateContainer(object->record_path, validation_context, |
| &record_path_validate_params)) { |
| return false; |
| } |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->new_label, 2, validation_context)) { |
| return false; |
| } |
| const mojo::internal::ContainerValidateParams new_label_validate_params( |
| 0, false, nullptr); |
| if (!mojo::internal::ValidateContainer(object->new_label, validation_context, |
| &new_label_validate_params)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_SetRecordLabel_Params_Data::Fingerprint_SetRecordLabel_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_SetRecordLabel_ResponseParams_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_SetRecordLabel_ResponseParams_Data* object = static_cast<const Fingerprint_SetRecordLabel_ResponseParams_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_SetRecordLabel_ResponseParams_Data::Fingerprint_SetRecordLabel_ResponseParams_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_RemoveRecord_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_RemoveRecord_Params_Data* object = static_cast<const Fingerprint_RemoveRecord_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| if (!mojo::internal::ValidatePointerNonNullable( |
| object->record_path, 1, validation_context)) { |
| return false; |
| } |
| const mojo::internal::ContainerValidateParams record_path_validate_params( |
| 0, false, nullptr); |
| if (!mojo::internal::ValidateContainer(object->record_path, validation_context, |
| &record_path_validate_params)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_RemoveRecord_Params_Data::Fingerprint_RemoveRecord_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_RemoveRecord_ResponseParams_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_RemoveRecord_ResponseParams_Data* object = static_cast<const Fingerprint_RemoveRecord_ResponseParams_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_RemoveRecord_ResponseParams_Data::Fingerprint_RemoveRecord_ResponseParams_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_StartAuthSession_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_StartAuthSession_Params_Data* object = static_cast<const Fingerprint_StartAuthSession_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 8 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_StartAuthSession_Params_Data::Fingerprint_StartAuthSession_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_EndCurrentAuthSession_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_EndCurrentAuthSession_Params_Data* object = static_cast<const Fingerprint_EndCurrentAuthSession_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 8 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_EndCurrentAuthSession_Params_Data::Fingerprint_EndCurrentAuthSession_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_EndCurrentAuthSession_ResponseParams_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_EndCurrentAuthSession_ResponseParams_Data* object = static_cast<const Fingerprint_EndCurrentAuthSession_ResponseParams_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_EndCurrentAuthSession_ResponseParams_Data::Fingerprint_EndCurrentAuthSession_ResponseParams_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_DestroyAllRecords_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_DestroyAllRecords_Params_Data* object = static_cast<const Fingerprint_DestroyAllRecords_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 8 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_DestroyAllRecords_Params_Data::Fingerprint_DestroyAllRecords_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_DestroyAllRecords_ResponseParams_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_DestroyAllRecords_ResponseParams_Data* object = static_cast<const Fingerprint_DestroyAllRecords_ResponseParams_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_DestroyAllRecords_ResponseParams_Data::Fingerprint_DestroyAllRecords_ResponseParams_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_AddFingerprintObserver_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_AddFingerprintObserver_Params_Data* object = static_cast<const Fingerprint_AddFingerprintObserver_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| if (!mojo::internal::ValidateHandleOrInterfaceNonNullable( |
| object->observer, 1, validation_context)) { |
| return false; |
| } |
| if (!mojo::internal::ValidateHandleOrInterface(object->observer, |
| validation_context)) { |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_AddFingerprintObserver_Params_Data::Fingerprint_AddFingerprintObserver_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_RequestType_Params_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_RequestType_Params_Data* object = static_cast<const Fingerprint_RequestType_Params_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 8 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_RequestType_Params_Data::Fingerprint_RequestType_Params_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| |
| // static |
| bool Fingerprint_RequestType_ResponseParams_Data::Validate( |
| const void* data, |
| mojo::internal::ValidationContext* validation_context) { |
| if (!data) |
| return true; |
| |
| if (!ValidateStructHeaderAndClaimMemory(data, validation_context)) |
| return false; |
| |
| // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if |
| // the message comes from an older version. |
| const Fingerprint_RequestType_ResponseParams_Data* object = static_cast<const Fingerprint_RequestType_ResponseParams_Data*>(data); |
| |
| static constexpr struct { |
| uint32_t version; |
| uint32_t num_bytes; |
| } kVersionSizes[] = {{ 0, 16 }}; |
| |
| if (object->header_.version <= |
| kVersionSizes[arraysize(kVersionSizes) - 1].version) { |
| // Scan in reverse order to optimize for more recent versions. |
| for (int i = arraysize(kVersionSizes) - 1; i >= 0; --i) { |
| if (object->header_.version >= kVersionSizes[i].version) { |
| if (object->header_.num_bytes == kVersionSizes[i].num_bytes) |
| break; |
| |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| } |
| } else if (object->header_.num_bytes < |
| kVersionSizes[arraysize(kVersionSizes) - 1].num_bytes) { |
| ReportValidationError( |
| validation_context, |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_STRUCT_HEADER); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| Fingerprint_RequestType_ResponseParams_Data::Fingerprint_RequestType_ResponseParams_Data() |
| : header_({sizeof(*this), 0}) {} |
| |
| } // namespace internal |
| } // namespace mojom |
| } // namespace device |
| |
| #if defined(_MSC_VER) |
| #pragma warning(pop) |
| #endif |