transport.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_TRANSPORT_H
9 #define DBUSCXX_TRANSPORT_H
10 
11 #include <memory>
12 #include <stdint.h>
13 #include <string>
14 #include <vector>
15 
16 namespace DBus {
17 
18 class Message;
19 
20 namespace priv {
21 
22 class Transport {
23 public:
24  virtual ~Transport();
25 
33  virtual ssize_t writeMessage( std::shared_ptr<const Message> message, uint32_t serial ) = 0;
34 
42  virtual std::shared_ptr<Message> readMessage() = 0;
43 
48  virtual bool is_valid() const = 0;
49 
55  virtual int fd() const = 0;
56 
64  static std::shared_ptr<Transport> open_transport( std::string address );
65 
66 protected:
67  std::vector<uint8_t> m_serverAddress;
68 
69 };
70 
71 } /* namepsace priv */
72 
73 } /* namespace DBus */
74 
75 #endif /* DBUSCXX_TRANSPORT_H */
Definition: transport.h:22
virtual int fd() const =0
Returns the file descriptor that this transport acts on.
virtual bool is_valid() const =0
Check to see if this transport is valid.
virtual std::shared_ptr< Message > readMessage()=0
Read a message from the transport stream.
virtual ~Transport()
Definition: transport.cpp:173
std::vector< uint8_t > m_serverAddress
Definition: transport.h:67
static std::shared_ptr< Transport > open_transport(std::string address)
Open and return a transport based off of the given address.
Definition: transport.cpp:175
virtual ssize_t writeMessage(std::shared_ptr< const Message > message, uint32_t serial)=0
Writes a message to the transport stream.
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18