All Projects → AgentD → Ctools

AgentD / Ctools

Licence: mit
A utillity library for C programs

Programming Languages

c
50402 projects - #5 most used programming language
  1. About

This is small utility library for C programs, containing generic implementations of commonly used container structures, data structures, algorithms and operating system abstraction (filesystem access et cetera).

At the moment, the following things are implemented:

  • container data structures
    • resizeable array
    • hash map
    • intrusive linked list
    • red-black tree
    • a container for blobs of data with auto detection and conversion of encoding
    • abstract allocator to create deep copies of user data types
    • abstract external iterator interface
  • string handling
    • UTF-8 dynamic string implementation
    • UTF-8 and UTF-16 string utilities
  • various sorting algorithm implementations
  • various non-cryptgraphic hash functions
  • command line option parsing
  • abstract filesystem and directory access
    • automatic long path handling on Windows(R)
  • file I/O
    • arbitrary length UTF-8 paths on all supported platforms
    • memory mapping support
  • creating and managing child processes
  • creating and managing threads
    • thread abstraction
    • thread pool
  • synchronization primitives
    • mutex
    • read/write semaphore
    • monitor
  • abstract network I/O
    • IPv4 and IPv6 support
    • abstract byte stream oriented TCP and UDP client
    • TCP server that creates client streams for connections
    • packet oriented UDP server
    • name resolving
  • data compression and conversion
    • abstract I/O stream based
    • deflate/inflate
    • base64
  1. Compiling

1.1) Unix-like Systems

The library uses an Autotools based build system. So simply run configure, make, make install as usual.

When working with the GIT tree, run the autogen.sh script to generate the build system.

In addition to the default autoconf options, the following configure options are provided: --disable-deflate Disable the zlib deflate/inflate support. If left enabled (default), the library depends on Zlib, wich is searched for using pkg-config.

--with-builtin-zlib Use a stripped down version of Zlib included in the source tree, instead of the one installed on the system and compile it statically into the core library.

To generate the doxygen based documentation and reference manual, simply run

$ make doxygen-doc

To run the unit test programs, simply run

$ make check

1.2) Windows

The Autotools build system supports compiling and cross compiling for Windows(R) using mingw (e.g. by specifying the configure option --host=i686-w64-mingw32).

For compiling on Windows(R), for instance using VisualStudio(R), a minimal CMake based build system is maintained.

Start the CMake gui, set the input directory to the root source directory containing the CMakeLists.txt file and set an output directory of your choice. Click 'configure', select a build system, click 'configure' again, then click 'generate'.

Use the generated build system files in the target directory (e.g. MSVC solution) to compile the library.

If the cmake option "SHARED" is set, a shared library is generated.

  1. Directory Hirarchy

The root directory contains the following files and directories:

  • 3rdparty/ Contains 3rd party source code (e.g. zlib stub)
  • doc/ Contains additional doxygen input files
  • m4/ Contains m4 macros used by the build system
  • main/ Contains the core library (containers, algorithms,...)
    • include/ Contains the core library headers
    • src/ Contains the core library source
    • CMakeLists.txt CMake file for the core library
    • Makemodule.am Automake file for the core library
  • os/ Contains the OS abstraction library (threads, network, ...)
    • include/ Contains the OS library headers
    • src/ Contains the OS library source
    • CMakeLists.txt CMake file for OS library
    • Makemodule.am Automake file for the OS library
  • samples/ Contains small demo programs
  • tests/ Contains unit tests
  • autogen.sh Buildconf stub script that runs autoreconf
  • CMakeLists.txt CMake build system main input file
  • configure.ac Autoconf input file
  • Doxyfile.in Doxygen input file consumed by build system
  • LICENSE License file
  • Makefile.am Main automake input file
  • README The file you are reading right now
  1. License

Copyright (C) 2015 - David Oberhollenzer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].