rogue
Loading...
Searching...
No Matches
Client.h
Go to the documentation of this file.
1
17#ifndef __ROGUE_PROTOCOLS_UDP_CLIENT_H__
18#define __ROGUE_PROTOCOLS_UDP_CLIENT_H__
19#include "rogue/Directives.h"
20
21#include <netdb.h>
22#include <netinet/in.h>
23#include <netinet/ip.h>
24#include <stdint.h>
25#include <sys/socket.h>
26
27#include <memory>
28#include <string>
29#include <thread>
30
31#include "rogue/Logging.h"
35
36namespace rogue {
37namespace protocols {
38namespace udp {
39
54 // Remote hostname or IPv4 address string.
55 std::string address_;
56
57 // Remote UDP port.
58 uint16_t port_;
59
60 // Background receive thread entry point.
61 void runThread(std::weak_ptr<int>);
62
63 public:
79 static std::shared_ptr<rogue::protocols::udp::Client> create(std::string host, uint16_t port, bool jumbo);
80
82 static void setup_python();
83
98 Client(std::string host, uint16_t port, bool jumbo);
99
101 ~Client();
102
109 void stop();
110
120 void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
121};
122
123// Convenience
124typedef std::shared_ptr<rogue::protocols::udp::Client> ClientPtr;
125
126} // namespace udp
127} // namespace protocols
128}; // namespace rogue
129
130#endif
Stream master endpoint.
Definition Master.h:65
static std::shared_ptr< rogue::interfaces::stream::Master > create()
Creates a stream master.
Definition Master.cpp:40
Stream slave endpoint and default frame pool.
Definition Slave.h:72
UDP stream endpoint that sends to and receives from a remote host.
Definition Client.h:53
static void setup_python()
Registers Python bindings for this class.
Definition Client.cpp:229
void acceptFrame(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Accepts an outbound stream frame and transmits it as UDP datagrams.
Definition Client.cpp:121
~Client()
Destroys the UDP client endpoint.
Definition Client.cpp:107
void stop()
Stops the UDP client endpoint.
Definition Client.cpp:111
Shared UDP transport base for stream client/server endpoints.
Definition Core.h:61
std::shared_ptr< rogue::protocols::udp::Client > ClientPtr
Definition Client.h:124