Merge pull request #3 from lioncash/include

General: Amend includes where applicable
This commit is contained in:
Phillip Stephens 2019-09-03 00:36:09 -07:00 committed by GitHub
commit dff87c2c6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 19 deletions

View File

@ -1,10 +1,13 @@
#pragma once
#include "Common.hpp"
#include "Socket.hpp"
#include <thread>
#include <mutex>
#include <condition_variable>
#include <cstddef>
#include <functional>
#include <mutex>
#include <thread>
#include "jbus/Common.hpp"
#include "jbus/Socket.hpp"
namespace jbus {

View File

@ -1,12 +1,15 @@
#pragma once
#include "Common.hpp"
#include "Socket.hpp"
#include <thread>
#include <queue>
#include <cstdint>
#include <memory>
#include <mutex>
#include <queue>
#include <thread>
#include "jbus/Socket.hpp"
namespace jbus {
class Endpoint;
/** Server interface for accepting incoming connections from GBA emulator instances. */
class Listener {
@ -33,6 +36,7 @@ public:
* @return Endpoint instance, ready to issue commands. */
std::unique_ptr<Endpoint> accept();
Listener();
~Listener();
};

View File

@ -1,17 +1,14 @@
#pragma once
#include <sys/types.h>
#include <fcntl.h>
#include <cstddef>
#include <cstdint>
#include <string>
#include <memory.h>
#ifdef _WIN32
#include <BaseTsd.h>
typedef UINT_PTR SOCKET;
using SOCKET = UINT_PTR;
#endif
#include "Common.hpp"
struct sockaddr_in;
namespace jbus::net {

View File

@ -1,7 +1,13 @@
#include "jbus/Endpoint.hpp"
#include <cstring>
#define LOG_TRANSFER 0
#if LOG_TRANSFER
#include <cstdio>
#endif
namespace jbus {
#define ROUND_UP_8(val) (((val) + 7) & ~7)

View File

@ -1,8 +1,14 @@
#include "jbus/Listener.hpp"
#include "jbus/Common.hpp"
#include "jbus/Endpoint.hpp"
#define LOG_LISTENER 0
#if LOG_LISTENER
#include <cstdio>
#endif
namespace jbus {
void Listener::listenerProc() {
@ -94,6 +100,8 @@ std::unique_ptr<Endpoint> Listener::accept() {
return {};
}
Listener::Listener() = default;
Listener::~Listener() { stop(); }
} // namespace jbus

View File

@ -1,13 +1,19 @@
#include "jbus/Socket.hpp"
#include <cstdio>
#include <cstring>
#ifndef _WIN32
#include <sys/socket.h>
#include <cerrno>
#include <arpa/inet.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <cerrno>
#else
#include <WinSock2.h>
#include <Ws2tcpip.h>
@ -100,7 +106,7 @@ void Socket::setRemoteSocket(int remSocket) noexcept {
}
#ifdef _WIN32
Socket::EResult Socket::LastWSAError() {
Socket::EResult Socket::LastWSAError() noexcept {
switch (WSAGetLastError()) {
case WSAEWOULDBLOCK:
case WSAEALREADY: