From: Kevin Day Date: Mon, 8 Jun 2020 23:06:30 +0000 (-0500) Subject: Update: move fl_socket to f_socket X-Git-Tag: 0.5.0~173 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=14a775546ff89d9d0b4a08d1c3b819c08389bf6a;p=fll Update: move fl_socket to f_socket There is nothing forcing the current functions in fl_socket from being in f_socket. --- diff --git a/build/level_0/settings b/build/level_0/settings index f4f1fe2..81f8794 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -20,7 +20,7 @@ build_language c build_linker ar build_libraries -lc build_libraries-level -build_sources_library console.c conversion.c directory.c private-directory.c environment.c private-environment.c file.c private-file.c memory.c path.c pipe.c print.c utf.c private-utf.c +build_sources_library console.c conversion.c directory.c private-directory.c environment.c private-environment.c file.c private-file.c memory.c path.c pipe.c print.c socket.c utf.c private-utf.c build_sources_program build_sources_headers color.h console.h conversion.h directory.h directory_type.h environment.h file.h fss.h memory.h path.h pipe.h print.h serialized.h socket.h status.h status_array.h string.h type.h type_array.h utf.h build_sources_script diff --git a/build/level_1/settings b/build/level_1/settings index ba38d95..8010e03 100644 --- a/build/level_1/settings +++ b/build/level_1/settings @@ -20,9 +20,9 @@ build_language c build_linker ar build_libraries -lc build_libraries-level -lfll_0 -build_sources_library color.c console.c directory.c private-directory.c fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c print.c serialized.c private-serialized.c socket.c status.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c +build_sources_library color.c console.c directory.c private-directory.c fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c print.c serialized.c private-serialized.c status.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c build_sources_program -build_sources_headers color.h console.h directory.h fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_macro.h fss_status.h print.h serialized.h socket.h status.h string.h utf.h utf_file.h +build_sources_headers color.h console.h directory.h fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_macro.h fss_status.h print.h serialized.h status.h string.h utf.h utf_file.h build_sources_script build_sources_setting build_script yes diff --git a/build/monolithic/settings b/build/monolithic/settings index 11e9dbf..1a16b71 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -20,9 +20,9 @@ build_language c build_linker ar build_libraries -lc build_libraries-monolithic -build_sources_library level_0/console.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/private-file.c level_0/memory.c level_0/path.c level_0/pipe.c level_0/print.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/directory.c level_1/private-directory.c level_1/fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/print.c level_1/serialized.c level_1/private-serialized.c level_1/socket.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/directory.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/program.c level_2/status.c +build_sources_library level_0/console.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/private-file.c level_0/memory.c level_0/path.c level_0/pipe.c level_0/print.c level_0/socket.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/directory.c level_1/private-directory.c level_1/fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/print.c level_1/serialized.c level_1/private-serialized.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/directory.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/program.c level_2/status.c build_sources_program -build_sources_headers level_0/color.h level_0/console.h level_0/conversion.h level_0/directory.h level_0/directory_type.h level_0/environment.h level_0/file.h level_0/fss.h level_0/memory.h level_0/path.h level_0/pipe.h level_0/print.h level_0/serialized.h level_0/socket.h level_0/status.h level_0/status_array.h level_0/string.h level_0/type.h level_0/type_array.h level_0/utf.h level_1/color.h level_1/console.h level_1/directory.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_macro.h level_1/fss_status.h level_1/print.h level_1/serialized.h level_1/socket.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/directory.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/program.h level_2/status.h +build_sources_headers level_0/color.h level_0/console.h level_0/conversion.h level_0/directory.h level_0/directory_type.h level_0/environment.h level_0/file.h level_0/fss.h level_0/memory.h level_0/path.h level_0/pipe.h level_0/print.h level_0/serialized.h level_0/socket.h level_0/status.h level_0/status_array.h level_0/string.h level_0/type.h level_0/type_array.h level_0/utf.h level_1/color.h level_1/console.h level_1/directory.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_macro.h level_1/fss_status.h level_1/print.h level_1/serialized.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/directory.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/program.h level_2/status.h build_sources_script build_sources_setting build_script yes diff --git a/build/scripts/bootstrap-example.sh b/build/scripts/bootstrap-example.sh index bc6cee8..8dc8e4a 100644 --- a/build/scripts/bootstrap-example.sh +++ b/build/scripts/bootstrap-example.sh @@ -23,7 +23,9 @@ if [[ $1 == "individual" ]] ; then bash build/scripts/package.sh build -i if [[ $? -eq 0 ]] ; then - for i in f_type f_status f_memory f_string f_utf f_color f_console f_conversion f_directory f_environment f_file f_fss f_path f_pipe f_print f_serialized f_socket fl_color fl_console fl_directory fl_fss fl_print fl_serialized fl_socket fl_status fl_string fl_utf fl_utf_file fll_directory fll_execute fll_file fll_fss fll_program fll_status ; do + for i in f_type f_status f_memory f_string f_utf f_color f_console f_conversion f_directory f_environment f_file f_fss f_path f_pipe f_print f_serialized f_socket fl_color fl_console fl_directory fl_fss fl_print fl_serialized fl_status fl_string fl_utf fl_utf_file fll_directory fll_execute fll_file fll_fss fll_program fll_status ; do + echo && echo "Processing $i." && + cd package/individual/$i-$2/ && ./bootstrap.sh clean && diff --git a/level_1/fl_socket/c/socket.c b/level_0/f_socket/c/socket.c similarity index 84% rename from level_1/fl_socket/c/socket.c rename to level_0/f_socket/c/socket.c index 1a469f4..9d4dbc3 100644 --- a/level_1/fl_socket/c/socket.c +++ b/level_0/f_socket/c/socket.c @@ -1,11 +1,11 @@ -#include +#include #ifdef __cplusplus extern "C"{ #endif -#ifndef _di_fl_socket_file_bind_ - f_return_status fl_socket_file_bind(const f_string path, const int id, struct sockaddr_un *address) { +#ifndef _di_f_socket_file_bind_ + f_return_status f_socket_file_bind(const f_string path, const int id, struct sockaddr_un *address) { memset(&address, 0, sizeof(struct sockaddr_un)); address->sun_family = AF_UNIX; strncpy(address->sun_path, path, sizeof(address->sun_path) - 1); @@ -28,10 +28,10 @@ extern "C"{ return F_none; } -#endif // _di_fl_socket_file_bind_ +#endif // _di_f_socket_file_bind_ -#ifndef _di_fl_socket_listen_ - f_return_status fl_socket_listen(const int id, const unsigned int max_backlog) { +#ifndef _di_f_socket_listen_ + f_return_status f_socket_listen(const int id, const unsigned int max_backlog) { if (listen(id, max_backlog) < 0) { if (errno == EADDRINUSE) return F_status_set_error(F_busy_address); @@ -44,10 +44,10 @@ extern "C"{ return F_none; } -#endif // _di_fl_socket_listen_ +#endif // _di_f_socket_listen_ -#ifndef _di_fl_socket_close_client_ - f_return_status fl_socket_close_client(const int id, const unsigned short action) { +#ifndef _di_f_socket_close_client_ + f_return_status f_socket_close_client(const int id, const unsigned short action) { unsigned int error_code = 0; if (action == f_socket_close_fast) { @@ -81,7 +81,7 @@ extern "C"{ return F_none; } -#endif // _di_fl_socket_close_client_ +#endif // _di_f_socket_close_client_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_socket/c/socket.h b/level_0/f_socket/c/socket.h index 08d3872..bee68d3 100644 --- a/level_0/f_socket/c/socket.h +++ b/level_0/f_socket/c/socket.h @@ -14,11 +14,16 @@ #include #include #include +#include +#include +#include +#include + // fll-0 includes +#include #include #include -#include #ifdef __cplusplus extern "C"{ @@ -36,6 +41,87 @@ extern "C"{ }; #endif // _di_f_socket_types_ +/** + * Bind a UNIX socket. + * + * @param path + * The path to a socket file to bind to. + * @param id + * The ID of a socket. + * @param address + * The socket address information. + * + * @return + * F_none on success. + * F_address (with error bit) if address is already in use (therefore unavailable). + * F_buffer (with error bit) if the buffer is invalid. + * F_busy_address (with error bit) if address is already in use (therefore unavailable). + * F_busy_socket (with error bit) if socket defined by id is already bound (therefore unavailable). + * F_descriptor (with error bit) if the id is not a socket descriptor. + * F_directory_found_not (with error bit) if directory was not found. + * F_file_found_not (with error bit) if file not found. + * F_memory_out (with error bit) if out of memory. + * F_name (with error bit) on path name error. + * F_string_too_large (with error bit) if string is too large to store in the buffer. + * F_unavailable_address (with error bit) if address is unavailable (is non-existent or not local). + * + * @see bind() + */ +#ifndef _di_f_socket_file_bind_ + extern f_return_status f_socket_file_bind(const f_string path, const int id, struct sockaddr_un *address); +#endif // _di_f_socket_file_bind_ + +/** + * Terminate a socket connection. + * + * @param id + * The ID of a socket. + * @param max_backlog + * The max length of the pending connections queue. + * Suggested default setting: 8. + * + * @return + * F_none on success. + * F_busy_address (with error bit) if address is already in use (therefore unavailable). + * F_descriptor (with error bit) if the id is not a socket descriptor. + * F_file_descriptor (with error bit) if id is an invalid descriptor. + * F_unsupported (with error bit) if this socket does not support the listen() operation. + * + * @see listen() + */ +#ifndef _di_f_socket_listen_ + extern f_return_status f_socket_listen(const int id, const unsigned int max_backlog); +#endif // _di_f_socket_listen_ + +/** + * Terminate a client socket connection. + * + * @param id + * The ID of a socket. + * @param action + * The action to perform on close. + * f_socket_close_fast calls close(). + * + * @return + * F_none on success. + * F_connected_not if the socket is not connected. + * F_busy_address (with error bit) if address is already in use (therefore unavailable). + * F_descriptor (with error bit) if the id is not a socket descriptor. + * F_file_descriptor (with error bit) if id is an invalid descriptor. + * F_filesystem_quota_block (with error bit) if filesystem's disk blocks or inodes are exhausted. + * F_input_output (with error bit) if an I/O error occurred. + * F_interrupted (with error bit) when program received an interrupt signal, halting operation. + * F_parameter (with error bit) if a parameter is invalid. + * F_space_not (with error bit) if filesystem is out of space (or filesystem quota is reached). + * F_unsupported (with error bit) if this socket does not support the listen() operation. + * + * @see close() + * @see shutdown() + */ +#ifndef _di_f_socket_close_client_ + extern f_return_status f_socket_close_client(const int id, const unsigned short action); +#endif // _di_f_socket_close_client_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_socket/data/build/dependencies b/level_0/f_socket/data/build/dependencies index 2060b72..300ca78 100644 --- a/level_0/f_socket/data/build/dependencies +++ b/level_0/f_socket/data/build/dependencies @@ -1,2 +1,4 @@ -f_type +f_memory f_status +f_string +f_type diff --git a/level_0/f_socket/data/build/settings b/level_0/f_socket/data/build/settings index ae925e1..e20a3f6 100644 --- a/level_0/f_socket/data/build/settings +++ b/level_0/f_socket/data/build/settings @@ -19,8 +19,8 @@ build_compiler gcc build_language c build_linker ar build_libraries -lc -build_libraries-individual -build_sources_library +build_libraries-individual -lf_memory +build_sources_library socket.c build_sources_program build_sources_headers socket.h build_sources_script diff --git a/level_1/fl_socket/c/socket.h b/level_1/fl_socket/c/socket.h deleted file mode 100644 index 129ef76..0000000 --- a/level_1/fl_socket/c/socket.h +++ /dev/null @@ -1,117 +0,0 @@ -/** - * FLL - Level 1 - * - * Project: Socket - * API Version: 0.5 - * Licenses: lgplv2.1 - * - * Provide means to connect to and use sockets. - */ -#ifndef _FL_socket_h -#define _FL_socket_h - -// libc includes -#include -#include -#include -#include -#include -#include -#include - -// fll-0 includes -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -/** - * Bind a UNIX socket. - * - * @param path - * The path to a socket file to bind to. - * @param id - * The ID of a socket. - * @param address - * The socket address information. - * - * @return - * F_none on success. - * F_address (with error bit) if address is already in use (therefore unavailable). - * F_buffer (with error bit) if the buffer is invalid. - * F_busy_address (with error bit) if address is already in use (therefore unavailable). - * F_busy_socket (with error bit) if socket defined by id is already bound (therefore unavailable). - * F_descriptor (with error bit) if the id is not a socket descriptor. - * F_directory_found_not (with error bit) if directory was not found. - * F_file_found_not (with error bit) if file not found. - * F_memory_out (with error bit) if out of memory. - * F_name (with error bit) on path name error. - * F_string_too_large (with error bit) if string is too large to store in the buffer. - * F_unavailable_address (with error bit) if address is unavailable (is non-existent or not local). - * - * @see bind() - */ -#ifndef _di_fl_socket_file_bind_ - extern f_return_status fl_socket_file_bind(const f_string path, const int id, struct sockaddr_un *address); -#endif // _di_fl_socket_file_bind_ - -/** - * Terminate a socket connection. - * - * @param id - * The ID of a socket. - * @param max_backlog - * The max length of the pending connections queue. - * Suggested default setting: 8. - * - * @return - * F_none on success. - * F_busy_address (with error bit) if address is already in use (therefore unavailable). - * F_descriptor (with error bit) if the id is not a socket descriptor. - * F_file_descriptor (with error bit) if id is an invalid descriptor. - * F_unsupported (with error bit) if this socket does not support the listen() operation. - * - * @see listen() - */ -#ifndef _di_fl_socket_listen_ - extern f_return_status fl_socket_listen(const int id, const unsigned int max_backlog); -#endif // _di_fl_socket_listen_ - -/** - * Terminate a client socket connection. - * - * @param id - * The ID of a socket. - * @param action - * The action to perform on close. - * f_socket_close_fast calls close(). - * - * @return - * F_none on success. - * F_connected_not if the socket is not connected. - * F_busy_address (with error bit) if address is already in use (therefore unavailable). - * F_descriptor (with error bit) if the id is not a socket descriptor. - * F_file_descriptor (with error bit) if id is an invalid descriptor. - * F_filesystem_quota_block (with error bit) if filesystem's disk blocks or inodes are exhausted. - * F_input_output (with error bit) if an I/O error occurred. - * F_interrupted (with error bit) when program received an interrupt signal, halting operation. - * F_parameter (with error bit) if a parameter is invalid. - * F_space_not (with error bit) if filesystem is out of space (or filesystem quota is reached). - * F_unsupported (with error bit) if this socket does not support the listen() operation. - * - * @see close() - * @see shutdown() - */ -#ifndef _di_fl_socket_close_client_ - extern f_return_status fl_socket_close_client(const int id, const unsigned short action); -#endif // _di_fl_socket_close_client_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _FL_socket_h diff --git a/level_1/fl_socket/data/build/defines b/level_1/fl_socket/data/build/defines deleted file mode 100644 index c665317..0000000 --- a/level_1/fl_socket/data/build/defines +++ /dev/null @@ -1,2 +0,0 @@ -# fss-0000 - diff --git a/level_1/fl_socket/data/build/dependencies b/level_1/fl_socket/data/build/dependencies deleted file mode 100644 index 1c281a2..0000000 --- a/level_1/fl_socket/data/build/dependencies +++ /dev/null @@ -1,3 +0,0 @@ -f_type -f_status -f_socket diff --git a/level_1/fl_socket/data/build/settings b/level_1/fl_socket/data/build/settings deleted file mode 100644 index ea43b32..0000000 --- a/level_1/fl_socket/data/build/settings +++ /dev/null @@ -1,52 +0,0 @@ -# fss-0001 - -project_name fl_socket - -version_major 0 -version_minor 5 -version_micro 0 -version_target major - -environment - -process_pre -process_post - -modes individual -modes_default individual - -build_compiler gcc -build_language c -build_linker ar -build_libraries -lc -build_libraries-individual -build_sources_library socket.c -build_sources_program -build_sources_headers socket.h -build_sources_script -build_sources_setting -build_script yes -build_shared yes -build_static yes - -path_headers level_1 -path_library_script script -path_library_shared shared -path_library_static static -path_program_script script -path_program_shared shared -path_program_static static - -search_exclusive yes -search_shared yes -search_static yes - -defines_all -defines_static -defines_shared - -flags_all -z now -g -flags_shared -flags_static -flags_library -fPIC -flags_program -fPIE