libxutils is a cross-platform C library that provides safer implementations of various functionality to make routine tasks easier for programs written in C and it's compatible languages like C++, Rust, and Objective C. The library offers a range of features including containers, data structures, network tools, cryptography algorithms, string manipulations, system utilities, HTTP/S & WS/WSS client/server, JSON parser/serializer, JWT tokens, and etc. A list of key features can be found below.
libxutils is available for Linux, Unix and Windows operating systems and is released under the MIT License. To check the version of the library you have, you can refer to the file src/xver.h. Please note that the list of features provided in the README is incomplete. For more information about the full range of features, you can refer to the individual header files linked below or browse the source code.
- Dynamically allocated array with sort and search features
- Dynamically allocated byte and data buffers
- Dynamically allocated key-value pair map
- Dynamically allocated hash map
- Dynamically allocated C string
- Implementation of linked list
- Event based client/server API for HTTP/S, WS/WSS and UNIX/TCP connections
- Cross-platform socket library with RAW, UNIX, TCP, UDP and SSL support
- Cross-platform event library based on poll(), epoll() and WSAPoll()
- Web Socket client/server library
- HTTP client/server library
- MDTP client/server library
- RTP packet parser library
- Implementation of various encrypt/decrypt algorithms
- Base64 and Base64Url encrypt/decrypt functions
- AES based on FIPS-197 implementation by Christophe Devine
- Implementation of HMAC algorithm with SHA256 and MD5
- RSA implementation based on OpenSSL library
- Implementation of SHA256 calculations
- Implementation of SHA1 calculations
- Implementation of CRC32 calculations
- Implementation of MD5 calculations
- Cross-platform file and directory operations
- Cross-platform CPU affinity manipulation
- Implementation of advanced file search
- System time manipulation library
- Performance monitoring library
- Simple and fast memory pool
- Advanced logging library
- JSON parser and writer library with lint and minify support
- Implementation of JSON Web Tokens with HS256 and RS256
- Cross-platform synchronization library
- Cross-platform multithreading library
- Command-Line interface operations
- C String manipulation library
There are several ways to build and install the project.
A relatively simple way to build and install the libary and tools is to use the included build script:
git clone https://github.com/kala13x/libxutils.git && ./libxutils/build.sh --installList options that build script supports:
--tool=<tool>SpecifyMakefilegeneration tool or use includedMakefile.--installInstall library and the tools after the build.--examplesInclude examples in the build.--toolsInclude tools in the build.--cleanCleanup object files after build/installation.
You can either choose cmake, smake or make as the tool argument.
If the tool will not be specified the script will use cmake as default.
If you have a CMake tool installed in your operating system, here is how project can be built and installed using cmake:
git clone https://github.com/kala13x/libxutils.git
cd libxutils
cmake . && make
sudo make installSMake is a simple Makefile generator tool for the Linux/Unix operating systems:
git clone https://github.com/kala13x/libxutils.git
cd libxutils
smake && make
sudo make installThe project can also be built with a pre-generated Makefile for the Linux.
export XUTILS_USE_SSL=y # In case you want to use SSL features
git clone https://github.com/kala13x/libxutils.git
cd libxutils
make
sudo make installThe only dependency that the library uses is the openssl-devel package for the SSL and RSA implementations.
If openssl package is not installed on the system, the lib will automatically be compiled without SSL support.
Red-Hat family: sudo dnf install openssl-devel
Debian family: sudo apt-get install libssl-dev
Windows: choco install openssl
MacOS: brew install openssl
Just include the required <xutils/*.h> header files in your source code and use -lxutils
linker flag while compiling your project. See the example directory for more information.
Use the included script to build or install CLI apps from the tools directory.
The script can be used to build the sources from the examples directory as well.
./libxutils/build.sh --tools --examplesThese sources can also be built by using the CMake tool or Makefile from that directory.
You may need to export the SSL flag accordingly if you are doing a build without the script:
export XUTILS_USE_SSL=y # In case you want to use SSL features
cd examples
cmake .
makeXTOP is HTOP like performance monitor that supports to monitor CPU, memory, and network traffic into a single window. In addition, it has powerful REST API client/server mode and much more.
After building the sources in tools directory, run sudo make install command to install following apps in the system:
xcrypt- File and text encrypt/decrypt tool for CLIxpass- Secure password manager tool for CLIxjson- JSON linter and minifier tool for CLIxhttp- Powerful HTTP client tool for CLIxhost- CLI tool to search and modify hostsxtop- Advanced resource monithor for CLIxsrc- Advanced file search tool for CLI
Run each of this tool with -h argument to check out the usage and version information.
