validator.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later OR BSD-3-Clause
2 /***************************************************************************
3  * Copyright (C) 2020 by Robert Middleton *
4  * robert.middleton@rm5248.com *
5  * *
6  * This file is part of the dbus-cxx library. *
7  ***************************************************************************/
8 #ifndef DBUSCXX_VALIDATOR_H
9 #define DBUSCXX_VALIDATOR_H
10 
11 #include <string>
12 #include <vector>
13 #include <stdint.h>
14 
15 namespace DBus {
16 
20 class Validator {
21 private:
23 
24 public:
46  static bool validate_bus_name( std::string name );
47 
60  static bool validate_interface_name( std::string name );
61 
73  static bool validate_member_name( std::string name );
74 
81  static bool validate_error_name( std::string name );
82 
90  static bool message_is_small_enough( const std::vector<uint8_t>* data );
91 
96  static constexpr uint32_t maximum_array_size() { return 0x01 << 26; }
97 
98  static constexpr uint32_t maximum_message_size() { return ( 0x01 << 27 ); }
99 
100  static constexpr uint32_t maximum_message_depth() { return 64; }
101 
102 };
103 
104 } /* namespace DBus */
105 
106 #endif /* DBUSCXX_VALIDATOR_H */
Contains various static routines for validating and/or sanitizing data.
Definition: validator.h:20
static bool message_is_small_enough(const std::vector< uint8_t > *data)
Checks to make sure that the size of the message(after serialization) is lower than 2^27.
Definition: validator.cpp:126
static bool validate_interface_name(std::string name)
Validate an interface name.
Definition: validator.cpp:71
static bool validate_member_name(std::string name)
Validate a member name.
Definition: validator.cpp:102
static bool validate_error_name(std::string name)
Validate an error name.
Definition: validator.cpp:122
static bool validate_bus_name(std::string name)
Validate a bus name.
Definition: validator.cpp:33
static constexpr uint32_t maximum_message_size()
Definition: validator.h:98
static constexpr uint32_t maximum_array_size()
Return the maximum array size.
Definition: validator.h:96
static constexpr uint32_t maximum_message_depth()
Definition: validator.h:100
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18