Moving headers into include/sls (#212)

This commit is contained in:
Erik Fröjdh
2020-11-02 16:05:28 +01:00
committed by GitHub
parent a57bbc084c
commit a15d8dd30a
199 changed files with 417 additions and 413 deletions

View File

@ -0,0 +1,33 @@
#pragma once
#include "sls/DataSocket.h"
#include "sls/ServerInterface.h"
#include "sls/network_utils.h"
#include <cstdint>
#include <netdb.h>
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
namespace sls {
class ServerSocket : public DataSocket {
public:
ServerSocket(int port);
ServerInterface accept();
IpAddr getLastClient() const noexcept { return lastClient; }
IpAddr getThisClient() const noexcept { return thisClient; }
IpAddr getLockedBy() const noexcept { return lockedBy; }
bool differentClients() const noexcept { return lastClient != thisClient; }
void setLockedBy(IpAddr addr) { lockedBy = addr; }
void setLastClient(IpAddr addr) { lastClient = addr; }
int getPort() const noexcept { return serverPort; }
private:
IpAddr thisClient;
IpAddr lastClient;
IpAddr lockedBy;
int serverPort;
};
}; // namespace sls