blob: 213d2e1cfcc2bae7d30eea59ae72f22f37e2d136 [file] [log] [blame]
// Copyright 2019 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.
#include <cups/ipp.h>
#include <string>
#include "chrome/services/ipp_parser/public/mojom/ipp_parser.mojom.h"
namespace cups_proxy {
enum ValidateAttributeResult {
kSuccess = 0,
// Unknown attribute name.
// Validates an attribute |name| of type |type| in operation |ipp_oper_id|.
// |values_count| represents number of values in the attribute. The following
// constraints are enforced:
// - only operations from predefined set are accepted
// - only attributes from predefined set are accepted
// - serialization type of the attribute must match the specification
// - a single-value attribute cannot have more than one value
// - a set-of-values attribute cannot be empty
// Returns kFatalError <=> at least one of the constraints has been violated.
ValidateAttributeResult ValidateAttribute(ipp_op_t ipp_oper_id,
const std::string& name,
ipp_parser::mojom::ValueType type,
size_t values_count);
} // namespace cups_proxy