How davidmoreno/onion works
Main Components
a) Core Library Components (Central Layer):
• HTTP/HTTPS Server Core (src/onion/onion.c)
• Request/Response Handlers (src/onion/handler.c, src/onion/request.c, src/onion/response.c)
• URL Router (src/onion/url.c)
• Session Management (src/onion/sessions.c)
• WebSocket Support (src/onion/websocket.c)
b) Network Layer (Bottom Layer):
• Listen Points (src/onion/listen_point.c)
• Poller Implementations:
• epoll (Linux)
• libev integration
• libevent integration
c) Security Layer (Cross-cutting):
• SSL/TLS Support (via GnuTLS)
• PAM Authentication
• Random Number Generation
d) Storage Backends (Side Layer):
• SQLite3 Session Storage
• Redis Session Storage
• Memory Session Storage
e) Extension Components (Top Layer):
• Static File Handler
• WebDAV Support
• Template Engine (otemplate)
• Asset Packer (opack)
[Extensions/Tools Layer]
• ↕
[Core Library Layer]
• ↕
[Network/IO Layer]
Connection Flows
• Request flow from network layer through handlers
• Session data flow to storage backends
• Template processing flow
• Security integration points
Important Details
a) Integration Points:
• C++ Bindings interface
• Template Engine integration
• External library dependencies
b) Threading Models (show as parallel paths):
• Single-threaded
• Multi-threaded per connection
• Thread pool with epoll
Specific Implementation Notes
• Optional components (those requiring external libraries)
• Supported platforms (Linux, FreeBSD, Darwin)
• Available session backend options
• Threading model options
Key Architectural Patterns to Highlight
• Handler Chain pattern for request processing
• Plugin architecture for handlers
• Event-driven I/O model
• Template processing pipeline
Remember to include version compatibility notes and indicate which components are part of the stable API vs. internal implementation details.