Changed LICENSE to GLP v3

This commit is contained in:
Bazsalanszky 2020-05-19 10:44:05 +02:00
parent e4c454d478
commit 8ddfe9fdb1
16 changed files with 970 additions and 452 deletions

1047
LICENSE

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,21 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 10. 16.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 16.
*/
#include "map.h"
void map_init(Map *m) {

View file

@ -1,7 +1,21 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 10. 16.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 16.
*/
#pragma once
#define _CRT_SECURE_NO_WARNINGS
@ -74,4 +88,4 @@ void map_sort(Map *map);
* @param map
* @note Debugoláshoz hasznos
*/
void map_dump(Map map);
void map_dump(Map map);

View file

@ -1,7 +1,22 @@
//
// Keszitette: Toldi Balázs Ádám
// Datum: 2019. 11. 05.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 11. 05.
*/
#pragma once
#include "debugmalloc/debugmalloc.h"
#if defined(__linux__) && !defined(__CYGWIN__)
@ -49,4 +64,4 @@ typedef int SOCKET;
#include <ws2tcpip.h>
#include <mswsock.h>
#pragma comment(lib, "ws2_32.lib")
#endif
#endif

View file

@ -1,7 +1,22 @@
//
// Keszitette: Toldi Balázs Ádám
// Datum: 2019. 10. 28.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 28.
*/
#pragma once
#include "../utility.h"
#include "debugmalloc/debugmalloc.h"
@ -51,4 +66,4 @@ int tcp_getSockPort(SOCKET socket);
/*!
* @brief Kiírja az utoljára felépett hibaüzenetet szöveges formában
*/
void printLastError();
void printLastError();

21
main.c
View file

@ -1,3 +1,20 @@
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
@ -18,7 +35,7 @@ bool run = true;
void closeSocks(void){
if(run) {
run = false;
logger_log("Closing socket...");
logger_log("Closing sockets...");
closesocket(listening);
closesocket(web_sock);
}
@ -98,4 +115,4 @@ int main(void) {
free(peerList1.array);
free(config.pairs);
return 0;
}
}

View file

@ -1,7 +1,22 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 10. 16.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 16.
*/
#include "config.h"
Config config_load() {
@ -39,4 +54,4 @@ Config config_load() {
}
return cfg;
}
}

View file

@ -1,8 +1,21 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 10. 16.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 16.
*/
#pragma once
#define _CRT_SECURE_NO_WARNINGS

View file

@ -1,7 +1,22 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 10. 11.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 11.
*/
#include "peer.h"
//Kouhai peer
@ -326,4 +341,4 @@ void peer_loadPeerList(PeerList *list, Node_data mynode, fd_set *master) {
}
fclose(peer_file);
}
}

View file

@ -1,7 +1,21 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum 2019. 10. 09.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 09.
*/
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include "../utility.h"
@ -144,4 +158,4 @@ static int connectToReceivedPeers(char *peers, Node_data my, fd_set *fd_set, Pee
* @param[out] handshake A kézfogás szövege
* @note Ha a `peerList` paramétereként `NULL`-t kap, akkor nem küldi el a peerek listáját (Csatlakozáskor hasznos)
*/
static void constructHandshake(Node_data my, const PeerList *peerList, char handshake[]);
static void constructHandshake(Node_data my, const PeerList *peerList, char handshake[]);

View file

@ -1,7 +1,21 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 11. 07.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 11. 07.
*/
#include "server.h"

View file

@ -1,7 +1,21 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 11. 07.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 11. 07.
*/
#pragma once
#include "peer.h"
#include "webio.h"
@ -36,4 +50,4 @@ Node_data construct_Mynodedata(Config cfg);
* @param[in] mynode Az az adatstruktúra amiben a saját adatainkat tároljuk
* @param[in,out] run Logikai érték pointere ami meghatározza hogy a ciklus fusson-e.
*/
void serverThread(SOCKET listening, fd_set* master, WebIO webIo, PeerList *list,Node_data mynode,bool* run);
void serverThread(SOCKET listening, fd_set* master, WebIO webIo, PeerList *list,Node_data mynode,bool* run);

View file

@ -1,7 +1,21 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 10. 14.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 14.
*/
#include "webio.h"
int webio_create(Config config, struct PeerList *list, WebIO *webIo) {
@ -135,7 +149,6 @@ static int webio_handleGETrequest(SOCKET client, WebIO wio, char *file) {
memset(path, 0, sizeof(path));
strcat(path, wio.folder);
int len = 0;
if (file[0] == '/')
memmove(file, file + 1, strlen(file));
if (strcmp(file, "") == 0) {
@ -225,14 +238,16 @@ static void webio_getHeader(char *folder, char result[]) {
strcat(result, buf);
}
fclose(fp);
} else
result = "<html>";
} else{
logger_log("Error %s: No such file or directory",path);
strcpy(result,"<html>");
}
}
static void webio_getIndex(WebIO wio, char *outputBuffer) {
char content[8192] = "";
char header[4096] = "";
webio_getHeader(wio.folder, header);
strcpy(content, header);
@ -250,18 +265,18 @@ static void webio_getIndex(WebIO wio, char *outputBuffer) {
}
strcat(content, "</ul>\n");
} else
sprintf(content, "%s<div class=\"alert alert-warning\" role=\"alert\">\n"
strcat(content, "<div class=\"alert alert-warning\" role=\"alert\">\n"
" No peers connected!\n"
"</div>\n", content);
"</div>\n");
strcat(content, "<h1>Offline messages:</h1>\n");
getOfflineMessages(wio, content);
sprintf(content, "%s<script>setTimeout(function(){\n"
strcat(content, "<script>setTimeout(function(){\n"
" window.location.reload(1);\n"
"}, 5000);</script>\n"
"</div>\n"
"</body>\n"
"</html>\n", content);
"</html>\n");
strcpy(outputBuffer, content);
}
@ -371,9 +386,9 @@ void getOfflineMessages(WebIO wio, char *content) {
strcat(content, "</ul>\n");
}
if((dir = FindFirstFile(path, &file_data)) == INVALID_HANDLE_VALUE || cnt == 0){
sprintf(content, "%s<div class=\"alert alert-warning\" role=\"alert\">\n"
strcat(content, "<div class=\"alert alert-warning\" role=\"alert\">\n"
" No offline messages!\n"
"</div>\n", content);
"</div>\n");
}
#else
DIR *d;
@ -395,9 +410,9 @@ void getOfflineMessages(WebIO wio, char *content) {
strcat(content, "</ul>\n");
}
if (d == NULL || cnt == 0) {
sprintf(content, "%s<div class=\"alert alert-warning\" role=\"alert\">\n"
strcat(content, "<div class=\"alert alert-warning\" role=\"alert\">\n"
" No offline messages!\n"
"</div>\n", content);
"</div>\n");
}
#endif
}

View file

@ -1,8 +1,21 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 10. 14.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 14.
*/
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include "../utility.h"
@ -132,4 +145,4 @@ static void getOfflineMessages(WebIO wio, char *content);
* @param[in] path A file helye
* @param[in] client A fogadó socket-e
*/
static void sendFile(char* path, SOCKET client);
static void sendFile(char* path, SOCKET client);

View file

@ -1,6 +1,22 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 10. 11.
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 11.
*/
//
// Ebben a file-ban olyan függvényeket találunk, amelyeket sok helyen fel lehet használni vagy máshová nem illeszkedne
//
@ -80,4 +96,4 @@ void logger_log(const char* _Format, ...){
printf("\n");
fclose(fp);
}
}

View file

@ -1,7 +1,21 @@
//
// Készítette: Toldi Balázs Ádám
// Dátum: 2019. 10. 11.
//
/*
Copyright (C) 2019-2020 Toldi Balázs Ádám
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
File created at: 2019. 10. 11.
*/
#pragma once
#define _CRT_SECURE_NO_WARNINGS
@ -50,4 +64,4 @@ Map getPacketData(char* text);
* @param _Format Lásd <a href="http://www.cplusplus.com/reference/cstdio/printf/#parameters">printf</a>
* @param ...
*/
void logger_log(const char* _Format, ...);
void logger_log(const char* _Format, ...);