Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
instance_p.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <sonde/sonde_core_export.h>
7
8#include <QtCore/QString>
9#include <QtNetwork/QHostAddress>
10
11#include <optional>
12
13namespace Sonde::Instance {
14
17constexpr quint16 kDefaultPortLow = 28600;
19constexpr quint16 kDefaultPortHigh = 29599;
20
23{
24 quint16 low = kDefaultPortLow;
27};
28
34SONDE_CORE_EXPORT QString canonicalPath(const QString &path);
35
37SONDE_CORE_EXPORT QString executablePath();
38
40quint64 keyBits(const QString &path);
41
43QString expandLocal(const QString &value);
44
48std::optional<PortRange> portRange(const QString &value, QString *error);
49
52SONDE_CORE_EXPORT std::optional<PortRange> portRange(const QString &value,
53 const QString &executable, QString *error);
54
58quint16 freePort(const QHostAddress &host, const PortRange &range);
59
63std::optional<QString> expandHttp(const QString &value, QString *error);
64
66SONDE_CORE_EXPORT std::optional<QString> expandHttp(const QString &value, const QString &executable,
67 QString *error);
68
69} // namespace Sonde::Instance
QString executablePath()
canonicalPath() of the application's executable.
Definition instance.cpp:79
quint16 freePort(const QHostAddress &host, const PortRange &range)
The first port of range, from its first choice on and wrapping around, that host can listen on right ...
Definition instance.cpp:136
QString canonicalPath(const QString &path)
path as sonde computes it too: absolute, with links resolved, or empty if it doesn't exist.
Definition instance.cpp:67
QString expandLocal(const QString &value)
value with {instance} replaced by the instance key.
Definition instance.cpp:93
std::optional< QString > expandHttp(const QString &value, QString *error)
value with {instance} or {instance:<low>-<high>} replaced by the key's first-choice port.
Definition instance.cpp:148
quint64 keyBits(const QString &path)
The 33-bit number behind the instance key of path.
Definition instance.cpp:84
std::optional< PortRange > portRange(const QString &value, QString *error)
The range of {instance} or {instance:<low>-<high>} in value.
Definition instance.cpp:110
constexpr quint16 kDefaultPortLow
The first port of the default {instance} range (design 0019: away from common development ports,...
Definition instance_p.h:17
constexpr quint16 kDefaultPortHigh
The last port of the default {instance} range.
Definition instance_p.h:19
The ports {instance} in a SONDE_HTTP value may use, and the first choice.
Definition instance_p.h:23
quint16 first
The key's choice, tried first.
Definition instance_p.h:26
quint16 high
Last port of the range.
Definition instance_p.h:25
quint16 low
First port of the range.
Definition instance_p.h:24