This commit is contained in:
malloc 2018-08-16 16:39:13 -05:00
parent 0369add339
commit 3cf8fd09cb
45 changed files with 82 additions and 40 deletions

View file

@ -3,6 +3,9 @@ project(sockscape)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -static")
endif()
## CLIENT BUILD ##
@ -13,12 +16,16 @@ find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
file(GLOB_RECURSE client_src
"src/common/*.hpp"
"src/common/*.cpp"
"src/client/*.hpp"
"src/client/*.cpp"
)
add_executable(client ${client_src})
target_include_directories(client
PRIVATE ${PROJECT_SOURCE_DIR}/src/common
PRIVATE ${PROJECT_SOURCE_DIR}/src/client
PRIVATE ${PROJECT_SOURCE_DIR}/include/client
PRIVATE ${OPENGL_INCLUDE_DIR}
PRIVATE ${GLEW_INCLUDE_DIR}
@ -36,6 +43,8 @@ install(TARGETS client RUNTIME DESTINATION bin/client)
## SERVER BUILD ##
file(GLOB_RECURSE server_src
"src/common/*.hpp"
"src/common/*.cpp"
"src/server/*.hpp"
"src/server/*.cpp"
"src/server/*.c"
@ -43,6 +52,9 @@ file(GLOB_RECURSE server_src
)
add_executable(server ${server_src})
target_include_directories(server
PRIVATE ${PROJECT_SOURCE_DIR}/src/common
PRIVATE ${PROJECT_SOURCE_DIR}/src/server)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(server wsock32 ws2_32)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")

Binary file not shown.

View file

@ -0,0 +1,9 @@
#version 330 core
in vec2 texCoords;
uniform sampler2D graphicSampler;
out vec4 fragColor;
void main() {
fragColor = texture(graphicSampler, texCoords);
}

View file

@ -0,0 +1,18 @@
#version 330 core
layout (location = 0) in vec2 aScreenCoords;
layout (location = 1) in vec2 aTexCoords;
out vec2 texCoords;
uniform vec2 screenSize;
void main() {
mat2 scMatrix = mat2(screenSize.x);
vec2 viewCoords = scMatrix * aScreenCoords;
gl_Position =
vec4((2 * aScreenCoords.x) / screenSize.x - 1,
1 - (2 * aScreenCoords.y) / screenSize.y,
0, 0);
texCoords = aTexCoords;
}

View file

@ -1,5 +1,6 @@
#include <SDL.h>
#include <glm/vec2.hpp>
#include <glm/mat2x2.hpp>
#define GL3_PROTOTYPES 1
#include <GL/glew.h>
@ -39,29 +40,29 @@ int main(int argc, char* argv[]) {
glewInit();
#endif
setColor(1, 0, 0, window);
bool running = true;
while(running) {
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapWindow(window);
SDL_Event event;
while(SDL_PollEvent(&event)) {
if(event.type == SDL_QUIT)
running = false;
if(event.type == SDL_WINDOWEVENT &&
event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
{
}
if(event.type == SDL_KEYDOWN) {
switch(event.key.keysym.sym) {
case SDLK_ESCAPE:
running = false;
break;
case SDLK_r:
setColor(1.0, 0.0, 0.0, window);
break;
case SDLK_g:
setColor(0.0, 1.0, 0.0, window);
break;
case SDLK_b:
setColor(0.0, 0.0, 1.0, window);
break;
default:
break;
}

View file

@ -1,4 +1,5 @@
#include "bcrypt.hpp"
#include "bfish.hpp"
static const uint32_t bcrypt_ciphertext[6] = {
0x4f727068, 0x65616e42, 0x65686f6c,

View file

@ -5,9 +5,8 @@
#include <cstring>
#include <string>
#include "base64.hpp"
#include "bfish.hpp"
#include "../utils/csprng.hpp"
#include "../utils/string.hpp"
#include "utils/csprng.hpp"
#include "utils/string.hpp"
#define BCRYPT_COST 10

View file

@ -24,7 +24,7 @@ private:
uint32_t parr[18];
uint32_t sbox[4][256];
friend std::string sosc::cgc::bcrypt_hash_raw
(const std::string& input, const std::string& salt, uint32_t cost);
};

View file

@ -1,7 +1,7 @@
#ifndef SOSC_CRYPTO_CIPHER_H
#define SOSC_CRYPTO_CIPHER_H
#include "../utils/bigint.hpp"
#include "utils/bigint.hpp"
#include "keyex.hpp"
namespace sosc {

View file

@ -1,8 +1,8 @@
#ifndef SOSC_CRYPTO_KEYEX_H
#define SOSC_CRYPTO_KEYEX_H
#include "../utils/bigint.hpp"
#include "../sock/packet.hpp"
#include "utils/bigint.hpp"
#include "sock/packet.hpp"
namespace sosc {
namespace cgc {

View file

@ -3,7 +3,7 @@
#include <string>
#include <cstdint>
#include "../utils/net.hpp"
#include "utils/net.hpp"
#define FRAME_OK 0
#define FRAME_MORE 1

View file

@ -3,7 +3,7 @@
#include "tcpsock.hpp"
#include "packet.hpp"
#include "../crypto/cipher.hpp"
#include "crypto/cipher.hpp"
namespace sosc {
class IntraClient {

View file

@ -23,6 +23,8 @@ bool sosc::Packet::AddRegions(std::vector<std::string> data) {
for(const auto& i : data)
this->regions.push_back(i);
return true;
}
void sosc::Packet::SetRegion(uint8_t index, std::string data) {

View file

@ -5,7 +5,7 @@
#include <vector>
#include <string>
#include <cstdarg>
#include "../utils/net.hpp"
#include "utils/net.hpp"
#define PCK_ANY 0

View file

@ -5,7 +5,7 @@
#include <list>
#include <thread>
#include <mutex>
#include "../db/database.hpp"
#include "db/database.hpp"
namespace sosc {
typedef struct {

View file

@ -2,9 +2,9 @@
#define SOSC_SCAPESOCK_H
#include <queue>
#include "../crypto/sha1.hpp"
#include "../crypto/base64.hpp"
#include "../crypto/cipher.hpp"
#include "crypto/sha1.hpp"
#include "crypto/base64.hpp"
#include "crypto/cipher.hpp"
#include "frame.hpp"
#include "packet.hpp"
#include "tcpsock.hpp"

View file

@ -31,8 +31,8 @@
#include <cstdlib>
#include <cstring>
#include <string>
#include "../utils/net.hpp"
#include "../utils/string.hpp"
#include "utils/net.hpp"
#include "utils/string.hpp"
#define SOSC_TCP_BUFLEN 2048

View file

@ -2,8 +2,8 @@
#define SOSC_DATABASE_H
#include "sqlite/sqlite3.h"
#include "../utils/time.hpp"
#include "../crypto/sha1.hpp"
#include "utils/time.hpp"
#include "crypto/sha1.hpp"
#include <vector>
#include <string>

View file

@ -1,16 +1,16 @@
#ifndef SOSC_HOST_MASTER_H
#define SOSC_HOST_MASTER_H
#include "../sock/intrasock.hpp"
#include "../sock/scapesock.hpp"
#include "../sock/pool.hpp"
#include "sock/intrasock.hpp"
#include "sock/scapesock.hpp"
#include "sock/pool.hpp"
#include "../crypto/keyex.hpp"
#include "../crypto/cipher.hpp"
#include "crypto/keyex.hpp"
#include "crypto/cipher.hpp"
#include "../db/database.hpp"
#include "db/database.hpp"
#include "../ctx/master.hpp"
#include "ctx/master.hpp"
#include <vector>

View file

@ -1,5 +1,5 @@
#include "master.hpp"
#include "../db/database.hpp"
#include "db/database.hpp"
#include <mutex>
static struct {

View file

@ -1,9 +1,9 @@
#ifndef SOSC_HOST_SLAVE_H
#define SOSC_HOST_SLAVE_H
#include "../sock/scapesock.hpp"
#include "../sock/pool.hpp"
#include "../ctx/slave.hpp"
#include "sock/scapesock.hpp"
#include "sock/pool.hpp"
#include "ctx/slave.hpp"
namespace sosc {
/** SLAVE -> CLIENT **/