voov
This commit is contained in:
parent
e1eb8e7acd
commit
fc2d863e11
11 changed files with 69 additions and 52 deletions
57
.gitignore
vendored
57
.gitignore
vendored
|
@ -1,52 +1,5 @@
|
||||||
# Prerequisites
|
# additions by alec (tm)
|
||||||
*.d
|
*.pem
|
||||||
|
.idea/
|
||||||
# Object files
|
cmake-build-*/
|
||||||
*.o
|
*.db-journal
|
||||||
*.ko
|
|
||||||
*.obj
|
|
||||||
*.elf
|
|
||||||
|
|
||||||
# Linker output
|
|
||||||
*.ilk
|
|
||||||
*.map
|
|
||||||
*.exp
|
|
||||||
|
|
||||||
# Precompiled Headers
|
|
||||||
*.gch
|
|
||||||
*.pch
|
|
||||||
|
|
||||||
# Libraries
|
|
||||||
*.lib
|
|
||||||
*.a
|
|
||||||
*.la
|
|
||||||
*.lo
|
|
||||||
|
|
||||||
# Shared objects (inc. Windows DLLs)
|
|
||||||
*.dll
|
|
||||||
*.so
|
|
||||||
*.so.*
|
|
||||||
*.dylib
|
|
||||||
|
|
||||||
# Executables
|
|
||||||
*.exe
|
|
||||||
*.out
|
|
||||||
*.app
|
|
||||||
*.i*86
|
|
||||||
*.x86_64
|
|
||||||
*.hex
|
|
||||||
|
|
||||||
# Debug files
|
|
||||||
*.dSYM/
|
|
||||||
*.su
|
|
||||||
*.idb
|
|
||||||
*.pdb
|
|
||||||
|
|
||||||
# Kernel Module Compile Results
|
|
||||||
*.mod*
|
|
||||||
*.cmd
|
|
||||||
.tmp_versions/
|
|
||||||
modules.order
|
|
||||||
Module.symvers
|
|
||||||
Mkfile.old
|
|
||||||
dkms.conf
|
|
24
CMakeLists.txt
Normal file
24
CMakeLists.txt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
set(CMAKE_C_STANDARD 99)
|
||||||
|
project(glovechat C)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE server_src
|
||||||
|
"src/server/*.h"
|
||||||
|
"src/server/*.c"
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package(OpenSSL)
|
||||||
|
|
||||||
|
add_executable(server ${server_src})
|
||||||
|
target_include_directories(server
|
||||||
|
PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||||
|
target_link_libraries(server ${OPENSSL_LIBRARIES})
|
||||||
|
install(TARGETS server RUNTIME DESTINATION bin/server)
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
|
target_link_libraries(server wsock32 ws2_32)
|
||||||
|
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
|
target_link_libraries(server dl pthread nsl resolv)
|
||||||
|
else()
|
||||||
|
target_link_libraries(server dl pthread socket nsl resolv)
|
||||||
|
endif()
|
1
resources/client/native/NULL
Normal file
1
resources/client/native/NULL
Normal file
|
@ -0,0 +1 @@
|
||||||
|
NULL
|
1
resources/server/NULL
Normal file
1
resources/server/NULL
Normal file
|
@ -0,0 +1 @@
|
||||||
|
NULL
|
1
src/client/native/NULL
Normal file
1
src/client/native/NULL
Normal file
|
@ -0,0 +1 @@
|
||||||
|
NULL
|
1
src/client/web/NULL
Normal file
1
src/client/web/NULL
Normal file
|
@ -0,0 +1 @@
|
||||||
|
NULL
|
7
src/server/main.c
Normal file
7
src/server/main.c
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
printf("allo");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
2
src/server/sock/tcp_win.c
Normal file
2
src/server/sock/tcp_win.c
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#include "tcp_win.h"
|
||||||
|
|
18
src/server/sock/tcp_win.h
Normal file
18
src/server/sock/tcp_win.h
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef GLOVE_SOCK_TCP_H
|
||||||
|
#define GLOVE_SOCK_TCP_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define TCP_FLAG_TYPE 1
|
||||||
|
#define TCP_FLAG_NONBLOCKING 2
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t flags;
|
||||||
|
} tcp_t;
|
||||||
|
|
||||||
|
tcp_t* tcp_create_server();
|
||||||
|
tcp_t* tcp_create_client();
|
||||||
|
|
||||||
|
void tcp_destroy(tcp_t* socket);
|
||||||
|
|
||||||
|
#endif
|
5
src/server/util/thread.c
Normal file
5
src/server/util/thread.c
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
//
|
||||||
|
// Created by alec on 12/20/2018.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "thread.h"
|
4
src/server/util/thread.h
Normal file
4
src/server/util/thread.h
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#ifndef GLOVE_UTIL_THREAD_H
|
||||||
|
#define GLOVE_UTIL_THREAD_H
|
||||||
|
|
||||||
|
#endif
|
Reference in a new issue