Tor 0.4.9.0-alpha-dev
lib Directory Reference

lib: low-level functionality.

More...

Directories

directory  arch
 lib/arch: Compatibility code for handling different CPU architectures.
 
directory  buf
 lib/buf: An efficient byte queue.
 
directory  cc
 lib/cc: Macros for managing the C compiler and language.
 
directory  compress
 lib/compress: Wraps several compression libraries
 
directory  conf
 lib/conf: Types and macros for declaring configuration options.
 
directory  confmgt
 lib/confmgt: Parse, encode, manipulate configuration files.
 
directory  container
 lib/container: Hash tables, dynamic arrays, bit arrays, etc.
 
directory  crypt_ops
 lib/crypt_ops: Cryptographic operations.
 
directory  ctime
 lib/ctime: Constant-time code to avoid side-channels.
 
directory  defs
 lib/defs: Lowest-level constants, used in many places.
 
directory  dispatch
 lib/dispatch: In-process message delivery.
 
directory  encoding
 lib/encoding: Encoding data in various forms, types, and transformations
 
directory  err
 lib/err: Lowest-level error handling code.
 
directory  evloop
 lib/evloop: Low-level event loop.
 
directory  fdio
 lib/fdio: Code to read/write on file descriptors.
 
directory  fs
 lib/fs: Files, filenames, directories, etc.
 
directory  geoip
 lib/geoip: IP-to-country mapping
 
directory  intmath
 lib/intmath: Integer mathematics.
 
directory  llharden
 lib/llharden: low-level unconditional process hardening
 
directory  lock
 lib/lock: Simple locking support.
 
directory  log
 lib/log: Log messages to files, syslogs, etc.
 
directory  malloc
 lib/malloc: Wrappers and utilities for memory management.
 
directory  math
 lib/math: Floating-point math utilities.
 
directory  memarea
 lib/memarea: A fast arena-style allocator.
 
directory  meminfo
 lib/meminfo: Inspecting system memory availability.
 
directory  metrics
 lib/metrics: Metrics collection API
 
directory  net
 lib/net: Low-level network-related code.
 
directory  osinfo
 lib/osinfo: For inspecting the OS version and capabilities.
 
directory  process
 lib/process: Launch and manage subprocesses.
 
directory  pubsub
 lib/pubsub: Publish-subscribe message passing.
 
directory  sandbox
 lib/sandbox: Linux seccomp2-based sandbox.
 
directory  smartlist_core
 lib/smartlist_core: Minimal dynamic array implementation
 
directory  string
 lib/string: Low-level string manipulation.
 
directory  subsys
 lib/subsys: Types for declaring a "subsystem".
 
directory  term
 lib/term: Terminal operations (password input).
 
directory  testsupport
 lib/testsupport: Helpers for test-only code and for function mocking.
 
directory  thread
 lib/thread: Mid-level threading.
 
directory  time
 lib/time: Higher-level time functions
 
directory  tls
 lib/tls: TLS library wrappers
 
directory  trace
 lib/trace: Function-tracing functionality API.
 
directory  version
 lib/version: holds the current version of Tor.
 
directory  wallclock
 lib/wallclock: Inspect and manipulate the current time.
 

Detailed Description

lib: low-level functionality.

The "lib" directory contains low-level functionality. In general, this code is not necessarily Tor-specific, but is instead possibly useful for other applications.

The modules in lib are currently well-factored: each one depends only on lower-level modules. You can see an up-to-date list of the modules, sorted from lowest to highest level, by running ./scripts/maint/practracker/includes.py --toposort.

As of this writing, the library modules are (from lowest to highest level):

What belongs in lib?

In general, if you can imagine some program wanting the functionality you're writing, even if that program had nothing to do with Tor, your functionality belongs in lib.

If it falls into one of the existing "lib" categories, your functionality belongs in lib.

If you are using platform-specific ifdefs to manage compatibility issues among platforms, you should probably consider whether you can put your code into lib.