sasl.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_SASL_H
9 #define DBUSCXX_SASL_H
10 
12 
13 #include <memory>
14 #include <stdint.h>
15 #include <string>
16 #include <tuple>
17 #include <vector>
18 
19 namespace DBus {
20 namespace priv {
21 
25 class SASL {
26 public:
34  SASL( int fd, bool negotiateFDPassing );
35 
36  ~SASL();
37 
46  std::tuple<bool, bool, std::vector<uint8_t>> authenticate();
47 
48 private:
49  int write_data_with_newline( std::string data );
50  std::string read_data();
51  std::string encode_as_hex( int num );
52  std::vector<uint8_t> hex_to_vector( std::string hexData );
53 
54 private:
55  class priv_data;
56 
57  DBUS_CXX_PROPAGATE_CONST( std::unique_ptr<priv_data> ) m_priv;
58 };
59 
60 } /* namespace priv */
61 } /* namespace DBus */
62 
63 #endif /* DBUSCXX_SASL_H */
Implements the authentication routines for connection to the bus.
Definition: sasl.h:25
std::string read_data()
Definition: sasl.cpp:122
SASL(int fd, bool negotiateFDPassing)
Create a new SASL authenticator.
Definition: sasl.cpp:51
DBUS_CXX_PROPAGATE_CONST(std::unique_ptr< priv_data >) m_priv
std::tuple< bool, bool, std::vector< uint8_t > > authenticate()
Perform the authentication with the server.
Definition: sasl.cpp:58
std::vector< uint8_t > hex_to_vector(std::string hexData)
Definition: sasl.cpp:169
~SASL()
Definition: sasl.cpp:56
std::string encode_as_hex(int num)
Definition: sasl.cpp:151
int write_data_with_newline(std::string data)
Definition: sasl.cpp:116
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18