# greenbone/gsad architecture

> Architecture diagram of the GitHub repository greenbone/gsad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/greenbone/gsad
- Repository: https://github.com/greenbone/gsad

## Overview

gsad is Greenbone’s HTTP server for the vulnerability-management interface. A user’s request enters the server, is validated and routed by URL and method, then reaches login/session handling, static-content handlers, or GMP request handlers. Manager connection code authenticates to gvmd, which supplies vulnerability-management results for HTTP responses. The tree and excerpts support these principal stages and named capabilities; several runtime files were not sampled, so detailed links between their subsystems are intentionally omitted.

Main entry points: [`src/gsad_http_handler_functions.c`](https://github.com/greenbone/gsad/blob/main/src/gsad_http_handler_functions.c) (Request Handlers), [`src/gsad_gmp_request.c`](https://github.com/greenbone/gsad/blob/main/src/gsad_gmp_request.c) (GMP Requests), [`src/gsad_http.c`](https://github.com/greenbone/gsad/blob/main/src/gsad_http.c) (HTTP Service), [`src/gsad.c`](https://github.com/greenbone/gsad/blob/main/src/gsad.c) (gsad Daemon)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["HTTP Server"]
  node_daemon["gsad Daemon<br/>[gsad.c]"]
  node_args["CLI and Environment<br/>[gsad_args.c]"]
  node_settings["Runtime Settings<br/>[gsad_settings.c]"]
  node_http["HTTP Service<br/>[gsad_http.c]"]
  node_logging["Logging<br/>[gsad_logging.c]"]
end

subgraph group_routing["Request Routing"]
  node_request["Request Handling"]
  node_handler["Handler Chain"]
  node_urlroute["URL Routing"]
  node_methodroute["Method Routing"]
  node_functions["Request Handlers"]
  node_validation["Request Validation<br/>[gsad_validator.c]"]
  node_connection["Connection Context"]
end

subgraph group_identity["Identity and Sessions"]
  node_userstate["User and Session"]
  node_session["Session State<br/>[gsad_session.c]"]
end

subgraph group_manager["Manager Access"]
  node_gmp["GMP Requests<br/>[gsad_gmp_request.c]"]
  node_gmpargs["GMP Arguments"]
  node_managerconn["Manager Connection<br/>[gsad_manager.c]"]
  node_response["Command Response"]
end

subgraph group_content["Web Content"]
  node_static["Static Content"]
  node_i18n["Internationalization<br/>[gsad_i18n.c]"]
end

node_user(("Web User"))
node_gvmd{{"gvmd"}}

node_user -->|"sends request"| node_http
node_daemon -->|"reads options"| node_args
node_daemon -->|"starts service"| node_http
node_http -->|"handles request"| node_request
node_request -->|"records context"| node_connection
node_request -->|"dispatches"| node_handler
node_handler -->|"routes URL"| node_urlroute
node_urlroute -->|"selects method"| node_methodroute
node_methodroute -->|"calls handler"| node_functions
node_functions -->|"validates input"| node_validation
node_functions -->|"sets up identity"| node_userstate
node_userstate -->|"uses session"| node_session
node_functions -->|"serves content"| node_static
node_functions -->|"handles GMP"| node_gmp
node_gmp -->|"builds arguments"| node_gmpargs
node_gmp -->|"uses connection"| node_managerconn
node_managerconn -->|"connects and authenticates"| node_gvmd
node_gmp -->|"exchanges GMP"| node_gvmd
node_gmp -->|"sets response data"| node_response
node_static -->|"returns content"| node_user
node_response -->|"returns result"| node_user
node_settings -->|"configures service"| node_http
node_daemon -->|"logs activity"| node_logging

click node_daemon "https://github.com/greenbone/gsad/blob/main/src/gsad.c"
click node_args "https://github.com/greenbone/gsad/blob/main/src/gsad_args.c"
click node_settings "https://github.com/greenbone/gsad/blob/main/src/gsad_settings.c"
click node_http "https://github.com/greenbone/gsad/blob/main/src/gsad_http.c"
click node_request "https://github.com/greenbone/gsad/blob/main/src/gsad_http_handle_request.c"
click node_handler "https://github.com/greenbone/gsad/blob/main/src/gsad_http_handler.c"
click node_urlroute "https://github.com/greenbone/gsad/blob/main/src/gsad_http_url_handler.c"
click node_methodroute "https://github.com/greenbone/gsad/blob/main/src/gsad_http_method_handler.c"
click node_functions "https://github.com/greenbone/gsad/blob/main/src/gsad_http_handler_functions.c"
click node_validation "https://github.com/greenbone/gsad/blob/main/src/gsad_validator.c"
click node_connection "https://github.com/greenbone/gsad/blob/main/src/gsad_connection_info.c"
click node_userstate "https://github.com/greenbone/gsad/blob/main/src/gsad_user_session.c"
click node_session "https://github.com/greenbone/gsad/blob/main/src/gsad_session.c"
click node_gmp "https://github.com/greenbone/gsad/blob/main/src/gsad_gmp_request.c"
click node_gmpargs "https://github.com/greenbone/gsad/blob/main/src/gsad_gmp_arguments.c"
click node_managerconn "https://github.com/greenbone/gsad/blob/main/src/gsad_manager.c"
click node_response "https://github.com/greenbone/gsad/blob/main/src/gsad_command_response_data.c"
click node_static "https://github.com/greenbone/gsad/blob/main/src/gsad_http_handler_functions.c"
click node_i18n "https://github.com/greenbone/gsad/blob/main/src/gsad_i18n.c"
click node_logging "https://github.com/greenbone/gsad/blob/main/src/gsad_logging.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_daemon,node_args,node_settings,node_http,node_logging,node_user toneBlue
class node_request,node_handler,node_urlroute,node_methodroute,node_functions,node_validation,node_connection toneAmber
class node_userstate,node_session toneMint
class node_gmp,node_gmpargs,node_managerconn,node_response toneRose
class node_static,node_i18n,node_gvmd toneIndigo
```

## Components

### HTTP Server

- [gsad Daemon](https://github.com/greenbone/gsad/blob/main/src/gsad.c): `src/gsad.c`
- [CLI and Environment](https://github.com/greenbone/gsad/blob/main/src/gsad_args.c): `src/gsad_args.c`
- [Runtime Settings](https://github.com/greenbone/gsad/blob/main/src/gsad_settings.c): `src/gsad_settings.c`
- [HTTP Service](https://github.com/greenbone/gsad/blob/main/src/gsad_http.c): `src/gsad_http.c`
- [Logging](https://github.com/greenbone/gsad/blob/main/src/gsad_logging.c): `src/gsad_logging.c`

### Request Routing

- [Request Handling](https://github.com/greenbone/gsad/blob/main/src/gsad_http_handle_request.c): `src/gsad_http_handle_request.c`
- [Handler Chain](https://github.com/greenbone/gsad/blob/main/src/gsad_http_handler.c): `src/gsad_http_handler.c`
- [URL Routing](https://github.com/greenbone/gsad/blob/main/src/gsad_http_url_handler.c): `src/gsad_http_url_handler.c`
- [Method Routing](https://github.com/greenbone/gsad/blob/main/src/gsad_http_method_handler.c): `src/gsad_http_method_handler.c`
- [Request Handlers](https://github.com/greenbone/gsad/blob/main/src/gsad_http_handler_functions.c): `src/gsad_http_handler_functions.c`
- [Request Validation](https://github.com/greenbone/gsad/blob/main/src/gsad_validator.c): `src/gsad_validator.c`
- [Connection Context](https://github.com/greenbone/gsad/blob/main/src/gsad_connection_info.c): `src/gsad_connection_info.c`

### Identity and Sessions

- [User and Session](https://github.com/greenbone/gsad/blob/main/src/gsad_user_session.c): `src/gsad_user_session.c`
- [Session State](https://github.com/greenbone/gsad/blob/main/src/gsad_session.c): `src/gsad_session.c`

### Manager Access

- [GMP Requests](https://github.com/greenbone/gsad/blob/main/src/gsad_gmp_request.c): `src/gsad_gmp_request.c`
- [GMP Arguments](https://github.com/greenbone/gsad/blob/main/src/gsad_gmp_arguments.c): `src/gsad_gmp_arguments.c`
- [Manager Connection](https://github.com/greenbone/gsad/blob/main/src/gsad_manager.c): `src/gsad_manager.c`
- [Command Response](https://github.com/greenbone/gsad/blob/main/src/gsad_command_response_data.c): `src/gsad_command_response_data.c`

### Web Content

- [Static Content](https://github.com/greenbone/gsad/blob/main/src/gsad_http_handler_functions.c): `src/gsad_http_handler_functions.c`
- [Internationalization](https://github.com/greenbone/gsad/blob/main/src/gsad_i18n.c): `src/gsad_i18n.c`

### Other components

- **Web User**
- **gvmd**

## Connections

- Web User → HTTP Service: sends request
- gsad Daemon → CLI and Environment: reads options
- gsad Daemon → HTTP Service: starts service
- HTTP Service → Request Handling: handles request
- Request Handling → Connection Context: records context
- Request Handling → Handler Chain: dispatches
- Handler Chain → URL Routing: routes URL
- URL Routing → Method Routing: selects method
- Method Routing → Request Handlers: calls handler
- Request Handlers → Request Validation: validates input
- Request Handlers → User and Session: sets up identity
- User and Session → Session State: uses session
- Request Handlers → Static Content: serves content
- Request Handlers → GMP Requests: handles GMP
- GMP Requests → GMP Arguments: builds arguments
- GMP Requests → Manager Connection: uses connection
- Manager Connection → gvmd: connects and authenticates
- GMP Requests → gvmd: exchanges GMP
- GMP Requests → Command Response: sets response data
- Static Content → Web User: returns content
- Command Response → Web User: returns result
- Runtime Settings → HTTP Service: configures service
- gsad Daemon → Logging: logs activity
