Bredbandskollen CLI  1.2
Asynchronous network task engine
unixdomainclient.h
1 // Copyright (c) 2019 Internetstiftelsen
2 // Written by Göran Andersson <initgoran@gmail.com>
3 
4 #pragma once
5 
6 #include <string>
7 
19 public:
21  UnixDomainClient(int peer_fd) :
22  client_socket(peer_fd) {
23  }
24 
31  std::string pollAgent();
32 
36  std::string waitForMsgFromAgent(unsigned long timeout_us = 0);
37 
47  void pushToAgent(const std::string &msg);
48 
56  bool flushToAgent();
57 
58 private:
59  std::string to_agent;
60  std::string to_client;
61  int client_socket;
62 };
Client communicating with an agent task using a UnixDomainBridge.
Definition: unixdomainclient.h:18
std::string pollAgent()
Return a line of data from the agent.
Definition: unixdomainclient.cpp:20
UnixDomainClient(int peer_fd)
Create client using one of a pair of Unix domain sockets.
Definition: unixdomainclient.h:21
std::string waitForMsgFromAgent(unsigned long timeout_us=0)
Definition: unixdomainclient.cpp:68
bool flushToAgent()
If there is unsent data, retry sending it to the agent.
Definition: unixdomainclient.cpp:57
void pushToAgent(const std::string &msg)
Send message to agent.
Definition: unixdomainclient.cpp:11