simpletransport.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 DBUS_CXX_SIMPLETRANSPORT_H
9 #define DBUS_CXX_SIMPLETRANSPORT_H
10 
12 #include <memory>
13 #include <vector>
14 #include <stdint.h>
15 #include "transport.h"
16 
17 namespace DBus {
18 
19 class Message;
20 
21 namespace priv {
22 
26 class SimpleTransport : public Transport {
27 private:
28  SimpleTransport( int fd, bool initialize );
29 
30 public:
32 
42  static std::shared_ptr<SimpleTransport> create( int fd, bool initialize );
43 
44  ssize_t writeMessage( std::shared_ptr<const Message> message, uint32_t serial );
45 
46  std::shared_ptr<Message> readMessage();
47 
52  bool is_valid() const;
53 
54  int fd() const;
55 
56 private:
57  void purgeData();
58 
59 private:
60  class priv_data;
61 
62  DBUS_CXX_PROPAGATE_CONST( std::unique_ptr<priv_data> ) m_priv;
63 };
64 
65 } /* namespace priv */
66 
67 } /* namespace DBus */
68 
69 #endif
The SimpleTransport handles reading and writing over a Unix FD.
Definition: simpletransport.h:26
~SimpleTransport()
Definition: simpletransport.cpp:74
bool is_valid() const
Check if this transport is OK.
Definition: simpletransport.cpp:253
ssize_t writeMessage(std::shared_ptr< const Message > message, uint32_t serial)
Definition: simpletransport.cpp:84
int fd() const
Definition: simpletransport.cpp:257
void purgeData()
Definition: simpletransport.cpp:261
static std::shared_ptr< SimpleTransport > create(int fd, bool initialize)
Create a SimpleTransport.
Definition: simpletransport.cpp:80
DBUS_CXX_PROPAGATE_CONST(std::unique_ptr< priv_data >) m_priv
std::shared_ptr< Message > readMessage()
Definition: simpletransport.cpp:108
SimpleTransport(int fd, bool initialize)
Definition: simpletransport.cpp:54
Definition: transport.h:22
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18