[go: nahoru, domu]

blob: df96eea59703eb15c7e365dfd75bab103064c92e [file] [log] [blame]
Sparik Hayrapetyan48216b32022-12-16 16:07:261// Copyright 2022 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef PRINTING_CLIENT_INFO_HELPERS_H_
6#define PRINTING_CLIENT_INFO_HELPERS_H_
7
Bryan Cain034c5dc2023-02-09 19:24:548#include <cstddef>
Sparik Hayrapetyan48216b32022-12-16 16:07:269#include "base/component_export.h"
10#include "printing/mojom/print.mojom-forward.h"
Sparik Hayrapetyan48216b32022-12-16 16:07:2611
12namespace printing {
13
14// Maximum length limits for 'client-info' member attributes.
15inline constexpr size_t kClientInfoMaxNameLength = 127;
16inline constexpr size_t kClientInfoMaxPatchesLength = 255;
17inline constexpr size_t kClientInfoMaxStringVersionLength = 127;
18inline constexpr size_t kClientInfoMaxVersionLength = 64;
19
Bryan Cain034c5dc2023-02-09 19:24:5420// Returns true if all members of `client_info` are valid.
21// String members are considered valid if they match the regex [a-zA-Z0-9_.-]*
22// and do not exceed the maximum length specified for the respective IPP member
23// attribute. The `client_type` member is valid if it is equal to one of the
24// enum values defined for the `client-type` IPP attribute.
Sparik Hayrapetyan48216b32022-12-16 16:07:2625COMPONENT_EXPORT(PRINTING)
Bryan Cain034c5dc2023-02-09 19:24:5426bool ValidateClientInfoItem(const mojom::IppClientInfo& client_info);
Sparik Hayrapetyan48216b32022-12-16 16:07:2627
28} // namespace printing
29
30#endif // PRINTING_CLIENT_INFO_HELPERS_H_