Skip to content

Commit

Permalink
Changed server to sender and client to receiver to clear up the meani…
Browse files Browse the repository at this point in the history
…ng behind them
  • Loading branch information
Black-Speedy committed Jan 8, 2024
1 parent 93f622a commit 77ce578
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 141 deletions.
20 changes: 10 additions & 10 deletions Doxyfile WebShare-Connect
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ BINARY_TOC = NO
TOC_EXPAND = NO

# The SITEMAP_URL tag is used to specify the full URL of the place where the
# generated documentation will be placed on the server by the user during the
# generated documentation will be placed on the sender by the user during the
# deployment of the documentation. The generated sitemap is called sitemap.xml
# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL
# is specified no sitemap is generated. For information about the sitemap
Expand Down Expand Up @@ -1800,7 +1800,7 @@ FORMULA_FONTSIZE = 10
FORMULA_MACROFILE =

# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# https://www.mathjax.org) which uses client side JavaScript for the rendering
# https://www.mathjax.org) which uses receiver side JavaScript for the rendering
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
Expand Down Expand Up @@ -1879,7 +1879,7 @@ MATHJAX_CODEFILE =
# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
# there is already a search function so this one should typically be disabled.
# For large projects the javascript based search engine can be slow, then
# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
# enabling sender_BASED_SEARCH may provide a better solution. It is possible to
# search using the keyboard; to jump to the search box use <access key> + S
# (what the <access key> is depends on the OS and browser, but it is typically
# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
Expand All @@ -1894,17 +1894,17 @@ MATHJAX_CODEFILE =

SEARCHENGINE = YES

# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using JavaScript. There
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# When the sender_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web sender instead of a web receiver using JavaScript. There
# are two flavors of web sender based searching depending on the EXTERNAL_SEARCH
# setting. When disabled, doxygen will generate a PHP script for searching and
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
# and searching needs to be provided by external tools. See the section
# "External Indexing and Searching" for details.
# The default value is: NO.
# This tag requires that the tag SEARCHENGINE is set to YES.

SERVER_BASED_SEARCH = NO
sender_BASED_SEARCH = NO

# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
# script for searching. Instead the search results are written to an XML file
Expand All @@ -1923,7 +1923,7 @@ SERVER_BASED_SEARCH = NO

EXTERNAL_SEARCH = NO

# The SEARCHENGINE_URL should point to a search engine hosted by a web server
# The SEARCHENGINE_URL should point to a search engine hosted by a web sender
# which will return the search results when EXTERNAL_SEARCH is enabled.
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
Expand All @@ -1935,15 +1935,15 @@ EXTERNAL_SEARCH = NO

SEARCHENGINE_URL =

# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# When sender_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
# SEARCHDATA_FILE tag the name of this file can be specified.
# The default file is: searchdata.xml.
# This tag requires that the tag SEARCHENGINE is set to YES.

SEARCHDATA_FILE = searchdata.xml

# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
# When sender_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
# projects and redirect the results back to the right project.
Expand Down
19 changes: 8 additions & 11 deletions WebShare-Connect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@ project(WebShare-Connect)
# Add include directories to your project.
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Include)

# Add server executable to the project.
# Add sender executable to the project.
add_executable(WebShare-Connect
"WebShare-Connect.c"
"WebShare-Connect.h"
)

# Add libraries
add_library(sha512 "sha512.c" "sha512.h")
add_library(server "server.c" "server.h")
add_library(client "client.c" "client.h")
add_library(sender "sender.c" "sender.h")
add_library(receiver "receiver.c" "receiver.h")
add_library(removeQuotes "removeQuotes.c" "removeQuotes.h")

# Find packages
find_package(czmq CONFIG REQUIRED)
find_package(ZeroMQ CONFIG REQUIRED)
find_package(OpenSSL REQUIRED)

# Set Vcpkg directory
set(_VCPKG_INSTALLED_DIR "C:/PackageManagers/vcpkg/installed")

# Set include directories
set(GLIB_INCLUDE_DIR "${_VCPKG_INSTALLED_DIR}/x64-windows/include/glib-2.0")
set(LIBNICE_INCLUDE_DIR "${_VCPKG_INSTALLED_DIR}/x64-windows/include")
Expand All @@ -42,16 +39,16 @@ target_link_libraries(WebShare-Connect PRIVATE
czmq
libzmq
sha512
server
client
sender
receiver
OpenSSL::SSL
OpenSSL::Crypto
removeQuotes
)

# Link libraries to server and client targets
target_link_libraries(server PRIVATE czmq libzmq sha512 OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(client PRIVATE czmq)
# Link libraries to sender and receiver targets
target_link_libraries(sender PRIVATE czmq libzmq sha512 OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(receiver PRIVATE czmq)

# Set C standard
set_property(TARGET WebShare-Connect PROPERTY C_STANDARD 11)
Expand Down
2 changes: 1 addition & 1 deletion WebShare-Connect/Include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/*
* add macros and function declarations which should be
* common between the name server and peer programs in this file.
* common between the name sender and peer programs in this file.
*/

#define COMMAND_REGISTER 1
Expand Down
30 changes: 15 additions & 15 deletions WebShare-Connect/WebShare-Connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/

#include "WebShare-Connect.h"
#include "server.h"
#include "client.h"
#include "sender.h"
#include "receiver.h"
#include "removeQuotes.h"

/**
Expand All @@ -14,7 +14,7 @@
* @param argc The number of arguments passed to the program.
* @param argv The arguments passed to the program.
* - argv[0]: Program name
* - argv[1]: Operation mode (server/client)
* - argv[1]: Operation mode (sender/receiver)
* - argv[2]: Port number
* - argv[3]: Number of threads
* - argv[4]: File path
Expand All @@ -30,18 +30,18 @@ int main(int argc, char const* argv[])
char port[6];
char threads[4];
char filePath[256];
char* user_argv[5]; // Array of arguments to pass to server_main or client_main
char* user_argv[5]; // Array of arguments to pass to sender_main or receiver_main
do {
printf("Please enter either 'server' or 'client': ");
printf("Please enter either 'sender' or 'receiver': ");
error = scanf("%9s", mode);
if (error != 1) {
printf("Input error. Please try again.\n");
error = scanf("%*[^\n]"); // Clear the input buffer
}
else if (strcmp(mode, "server") != 0 && strcmp(mode, "client") != 0) {
else if (strcmp(mode, "sender") != 0 && strcmp(mode, "receiver") != 0) {
printf("Invalid mode entered. Please try again.\n");
}
} while (strcmp(mode, "server") != 0 && strcmp(mode, "client") != 0);
} while (strcmp(mode, "sender") != 0 && strcmp(mode, "receiver") != 0);

do {
printf("Please enter the port (0-65535): ");
Expand Down Expand Up @@ -90,23 +90,23 @@ int main(int argc, char const* argv[])
}
else user_argv[4] = strdup(filePath);

if (strcmp(mode, "server") == 0) {
if (strcmp(mode, "sender") == 0) {

return server_main(4, user_argv + 1); // 4 is the number of arguments in user_argv
return sender_main(4, user_argv + 1); // 4 is the number of arguments in user_argv
}
else {
return client_main(4, user_argv + 1);
return receiver_main(4, user_argv + 1);
}
}

if (strcmp(argv[1], "server") == 0) {
return server_main(argc - 1, argv + 1); //what does argv + 1 do? a: it is a pointer to the next element in the array of arguments
if (strcmp(argv[1], "sender") == 0) {
return sender_main(argc - 1, argv + 1); //what does argv + 1 do? a: it is a pointer to the next element in the array of arguments
}
else if (strcmp(argv[1], "client") == 0) {
return client_main(argc - 1, argv + 1);
else if (strcmp(argv[1], "receiver") == 0) {
return receiver_main(argc - 1, argv + 1);
}
else {
printf("Usage: %s [server|client]\n", argv[0]);
printf("Usage: %s [sender|receiver]\n", argv[0]);
return 1;
}
}
Loading

0 comments on commit 77ce578

Please sign in to comment.