summaryrefslogtreecommitdiff
path: root/src/server.hpp
blob: e1002669d8e7e3eedae9ea255dca8d0d6d02d335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include "FileDescriptor.hpp"
#include "log.hpp"
#include <netinet/in.h>
#include <string>
#include <memory>

class CServer {
  public:
	CServer(uint16_t port);
	~CServer();
	void log(const eLogLevel loglevel, const std::string &message) const;
  bool isValid();
  Hyprutils::OS::CFileDescriptor getSocket() const;

  private:
	Hyprutils::OS::CFileDescriptor m_sockfd;
	sockaddr_in					   m_addr;
	int							   m_dBind = -1;
	int							   m_dListen = -1;
};
inline std::unique_ptr<CServer> g_pServer;