Aktualizr
C++ SOTA Client
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
secondary_tcp_server.h
1 #ifndef AKTUALIZR_SECONDARY_TCP_SERVER_H_
2 #define AKTUALIZR_SECONDARY_TCP_SERVER_H_
3 
4 #include "utilities/utils.h"
5 
6 #include <atomic>
7 
8 namespace Uptane {
10 } // namespace Uptane
11 /**
12  * Listens on a socket, decodes calls (ASN.1) and forwards them to an Uptane Secondary
13  * implementation
14  */
16  public:
17  SecondaryTcpServer(Uptane::SecondaryInterface& secondary, const std::string& primary_ip, in_port_t primary_port,
18  in_port_t port = 0);
19 
20  SecondaryTcpServer(Uptane::SecondaryInterface& secondary, in_port_t port = 0)
21  : keep_running_(true), impl_(secondary), listen_socket_(port) {}
22 
23  SecondaryTcpServer(const SecondaryTcpServer&) = delete;
24  SecondaryTcpServer& operator=(const SecondaryTcpServer&) = delete;
25 
26  public:
27  /**
28  * Accept connections on the socket, decode requests and respond using the secondary implementation
29  */
30  void run();
31  void stop();
32 
33  in_port_t port() const;
34 
35  private:
36  void HandleOneConnection(int socket);
37 
38  private:
39  std::atomic<bool> keep_running_;
41  ListenSocket listen_socket_;
42 };
43 
44 #endif // AKTUALIZR_SECONDARY_TCP_SERVER_H_
SecondaryTcpServer
Listens on a socket, decodes calls (ASN.1) and forwards them to an Uptane Secondary implementation.
Definition: secondary_tcp_server.h:15
SecondaryTcpServer::run
void run()
Accept connections on the socket, decode requests and respond using the secondary implementation.
Definition: secondary_tcp_server.cc:23
Uptane
Base data types that are used in The Update Framework (TUF), part of UPTANE.
Definition: secondary_tcp_server.h:8
Uptane::SecondaryInterface
Definition: secondaryinterface.h:12
ListenSocket
Definition: utils.h:157