Debian Codegraph @

src/librssguard/network-web/gemini/geminiclient.h

raw symbols SCIP
1 // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/network-web/gemini/geminiclient.h`/
2 //
3 // This file is heavily inspired by https://github.com/ikskuh/kristall.
4
5 #ifndef GEMINICLIENT_H
6 #define GEMINICLIENT_Hcxx . . $ `src/librssguard/network-web/gemini/geminiclient.h:6:9`!
7
8 #include <QMimeType>
9 #include <QObject>
10 #include <QSslCertificate>
11 #include <QSslKey>
12 #include <QSslSocket>
13 #include <QUrl>
14
15 #define GEMINI_MIME_TYPEcxx . . $ `src/librssguard/network-web/gemini/geminiclient.h:15:9`! "text/gemini"
16
17 //! Cryptographic user identitiy consisting
18 //! of a key-certificate pair and some user information.
19 struct CryptoIdentitycxx . . $ CryptoIdentity# {
20 //! The certificate that is used for cryptography
21 QSslCertificatecxx . . $ QSslCertificate# certificatecxx . . $ CryptoIdentity#certificate.;
22
23 //! The actual private key that is used for cryptography
24 QSslKeycxx . . $ QSslKey# private_keycxx . . $ CryptoIdentity#private_key.;
25
26 //! The title with which the identity is presented to the user.
27 QStringcxx . . $ QString# display_namecxx . . $ CryptoIdentity#display_name.;
28
29 //! Notes that the user can have per identity for improved identity management
30 QStringcxx . . $ QString# user_notescxx . . $ CryptoIdentity#user_notes.;
31
32 //! True for long-lived identities
33 bool is_persistentcxx . . $ CryptoIdentity#is_persistent. = false;
34
35 //! If not empty, Kristall will check
36 QStringcxx . . $ QString# host_filtercxx . . $ CryptoIdentity#host_filter. = ""cxx . . $ QString#QString(85c52e162fed56f9).;
37
38 //! When this is set to true and the host_filter is not empty,
39 //! the certificate will be automatically enabled for hosts matching the filter.
40 bool auto_enablecxx . . $ CryptoIdentity#auto_enable. = false;
41
42 bool isValidcxx . . $ CryptoIdentity#isValid(50ce9a9e25b4a850).() const;
43
44 //! returns true if a host does not match the filter criterion
45 bool isHostFilteredcxx . . $ CryptoIdentity#isHostFiltered(dd54f9efb9153ea5).(const QUrlcxx . . $ QUrl#& url) const;
46
47 //! returns true when the identity should be enabled on url
48 bool isAutomaticallyEnabledOncxx . . $ CryptoIdentity#isAutomaticallyEnabledOn(dd54f9efb9153ea5).(const QUrlcxx . . $ QUrl#& url) const;
49 };
50
51 class GeminiClientcxx . . $ GeminiClient# : public QObjectcxx . . $ QObject# {
52 Q_OBJECTcxx . . $ GeminiClient#qt_staticMetaObjectStaticContent.
53
54 public:
55 enum class RequestStatecxx . . $ GeminiClient#RequestState# {
56 Nonecxx . . $ GeminiClient#RequestState#None. = 0,
57 Startedcxx . . $ GeminiClient#RequestState#Started. = 1,
58 HostFoundcxx . . $ GeminiClient#RequestState#HostFound. = 2,
59 Connectedcxx . . $ GeminiClient#RequestState#Connected. = 3,
60
61 StartedWebcxx . . $ GeminiClient#RequestState#StartedWeb. = 255,
62 };
63
64 enum NetworkErrorcxx . . $ GeminiClient#NetworkError# {
65 UnknownErrorcxx . . $ GeminiClient#UnknownError., //!< There was an unhandled network error
66 ProtocolViolationcxx . . $ GeminiClient#ProtocolViolation., //!< The server responded with something unexpected and violated the protocol
67 HostNotFoundcxx . . $ GeminiClient#HostNotFound., //!< The host was not found by the client
68 ConnectionRefusedcxx . . $ GeminiClient#ConnectionRefused., //!< The host refused connection on that port
69 ResourceNotFoundcxx . . $ GeminiClient#ResourceNotFound., //!< The requested resource was not found on the server
70 BadRequestcxx . . $ GeminiClient#BadRequest., //!< Our client misbehaved and did a request the server cannot understand
71 ProxyRequestcxx . . $ GeminiClient#ProxyRequest., //!< We requested a proxy operation, but the server does not allow that
72 InternalServerErrorcxx . . $ GeminiClient#InternalServerError.,
73 InvalidClientCertificatecxx . . $ GeminiClient#InvalidClientCertificate.,
74 UntrustedHostcxx . . $ GeminiClient#UntrustedHost., //!< We don't know the host, and we don't trust it
75 MistrustedHostcxx . . $ GeminiClient#MistrustedHost., //!< We know the host and it's not the server identity we've seen before
76 Unauthorizedcxx . . $ GeminiClient#Unauthorized., //!< The requested resource could not be accessed.
77 TlsFailurecxx . . $ GeminiClient#TlsFailure., //!< Unspecified TLS failure
78 Timeoutcxx . . $ GeminiClient#Timeout., //!< The network connection timed out.
79 };
80
81 enum RequestOptionscxx . . $ GeminiClient#RequestOptions# {
82 Defaultcxx . . $ GeminiClient#Default. = 0,
83 IgnoreTlsErrorscxx . . $ GeminiClient#IgnoreTlsErrors. = 1,
84 };
85
86 explicit GeminiClientcxx . . $ GeminiClient#GeminiClient(749de1b6ae65bddd).(QObjectcxx . . $ QObject#* parent = nullptr);
87 virtual ~cxx . . $ GeminiClient#`~GeminiClient`(ced63f7c635d850d).GeminiClientcxx . . $ GeminiClient#();
88
89 bool supportsUrlcxx . . $ GeminiClient#supportsUrl(f3b39adf77d9c36c).(const QStringcxx . . $ QString#& url) const;
90 bool supportsUrlcxx . . $ GeminiClient#supportsUrl(dd54f9efb9153ea5).(const QUrlcxx . . $ QUrl#& url) const;
91
92 bool startRequestcxx . . $ GeminiClient#startRequest(cefe749ea8d0af37).(const QUrlcxx . . $ QUrl#& url, RequestOptionscxx . . $ GeminiClient#RequestOptions# options);
93 bool inProgresscxx . . $ GeminiClient#inProgress(50ce9a9e25b4a850).() const;
94 bool cancelRequestcxx . . $ GeminiClient#cancelRequest(c9857a73d68e59ba).();
95
96 bool enableClientCertificatecxx . . $ GeminiClient#enableClientCertificate(1b1dd513197a4d59).(const CryptoIdentitycxx . . $ CryptoIdentity#& ident);
97 void disableClientCertificatecxx . . $ GeminiClient#disableClientCertificate(49f6e7a06ebc5aa8).();
98
99 QUrlcxx . . $ QUrl# targetUrlcxx . . $ GeminiClient#targetUrl(36d9834fe7321282).() const;
100
101 signalscxx . . $ `<external>/4830994369567095248/qtmetamacros.h:43:14`!:
102 //! We successfully transferred some bytes from the server
103 void requestProgresscxx . . $ GeminiClient#requestProgress(35cb52607f6af42f).(qint64cxx . . $ qint64# transferred);
104
105 //! The request completed with the given data and mime type
106 void requestCompletecxx . . $ GeminiClient#requestComplete(84d6cb2703da46aa).(const QByteArraycxx . . $ QByteArray#& data, const QStringcxx . . $ QString#& mime);
107
108 //! The state of the request has changed
109 void requestStateChangecxx . . $ GeminiClient#requestStateChange(75300df2abd8e70).(RequestStatecxx . . $ GeminiClient#RequestState# state);
110
111 //! Server redirected us to another URL
112 void redirectedcxx . . $ GeminiClient#redirected(61e5b15e0cd21ddb).(const QUrlcxx . . $ QUrl#& uri, bool is_permanent);
113
114 //! The server needs some information from the user to process this query.
115 void inputRequiredcxx . . $ GeminiClient#inputRequired(37c160c81b6367f7).(const QStringcxx . . $ QString#& user_query, bool is_sensitive);
116
117 //! There was an error while processing the request
118 void networkErrorcxx . . $ GeminiClient#networkError(bf7ef9a2ade9db5c).(NetworkErrorcxx . . $ GeminiClient#NetworkError# error, const QStringcxx . . $ QString#& reason);
119
120 //! The server wants us to use a client certificate
121 void certificateRequiredcxx . . $ GeminiClient#certificateRequired(3520e46b33348bf6).(const QStringcxx . . $ QString#& info);
122
123 //! The server uses TLS and has a certificate.
124 void hostCertificateLoadedcxx . . $ GeminiClient#hostCertificateLoaded(78ac2807b13824e1).(const QSslCertificatecxx . . $ QSslCertificate#& cert);
125
126 protected:
127 void emitNetworkErrorcxx . . $ GeminiClient#emitNetworkError(42ce75a38071931f).(QAbstractSocketcxx . . $ QAbstractSocket#::SocketErrorcxx . . $ QAbstractSocket#SocketError# error_code, const QStringcxx . . $ QString#& textual_description);
128
129 private slotscxx . . $ `<external>/4830994369567095248/qtmetamacros.h:42:14`!:
130 void socketEncryptedcxx . . $ GeminiClient#socketEncrypted(49f6e7a06ebc5aa8).();
131 void socketReadyReadcxx . . $ GeminiClient#socketReadyRead(49f6e7a06ebc5aa8).();
132 void socketDisconnectedcxx . . $ GeminiClient#socketDisconnected(49f6e7a06ebc5aa8).();
133 void sslErrorscxx . . $ GeminiClient#sslErrors(a6189817b1df8092).(const QListcxx . . $ QList#<QSslErrorcxx . . $ QSslError#>& errors);
134 void socketErrorcxx . . $ GeminiClient#socketError(c866838463bd22b).(QAbstractSocketcxx . . $ QAbstractSocket#::SocketErrorcxx . . $ QAbstractSocket#SocketError# socketError);
135
136 private:
137 bool m_isReceivingBodycxx . . $ GeminiClient#m_isReceivingBody.;
138 bool m_suppressSocketTlsErrorscxx . . $ GeminiClient#m_suppressSocketTlsErrors.;
139 bool m_inErrorStatecxx . . $ GeminiClient#m_inErrorState.;
140
141 QUrlcxx . . $ QUrl# m_targetUrlcxx . . $ GeminiClient#m_targetUrl.;
142 QSslSocketcxx . . $ QSslSocket# m_socketcxx . . $ GeminiClient#m_socket.;
143 QByteArraycxx . . $ QByteArray# m_buffercxx . . $ GeminiClient#m_buffer.;
144 QByteArraycxx . . $ QByteArray# m_bodycxx . . $ GeminiClient#m_body.;
145 QStringcxx . . $ QString# m_mimeTypecxx . . $ GeminiClient#m_mimeType.;
146 RequestOptionscxx . . $ GeminiClient#RequestOptions# m_optionscxx . . $ GeminiClient#m_options.;
147 };
148
149 #endif // GEMINICLIENT_H