summaryrefslogtreecommitdiff
path: root/src/gmrequest.h
blob: 500ed71bd2d4f7eaf3edfe2f59095f98633a0af7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include <the_Foundation/audience.h>
#include <the_Foundation/tlsrequest.h>

#include "gmutil.h"

iDeclareClass(GmRequest)
iDeclareObjectConstruction(GmRequest)

iDeclareNotifyFunc(GmRequest, Updated)
iDeclareNotifyFunc(GmRequest, Finished)
iDeclareAudienceGetter(GmRequest, updated)
iDeclareAudienceGetter(GmRequest, finished)

void    setUrl_GmRequest    (iGmRequest *, const iString *url);
void    submit_GmRequest    (iGmRequest *);

enum iGmRequestCertFlags {
    available_GmRequestCertFlag      = iBit(1), /* certificate provided by server */
    trusted_GmRequestCertFlag        = iBit(2), /* TOFU status */
    timeVerified_GmRequestCertFlag   = iBit(3), /* has not expired */
    domainVerified_GmRequestCertFlag = iBit(4), /* cert matches server domain */
};

iBool               isFinished_GmRequest    (const iGmRequest *);
enum iGmStatusCode  status_GmRequest        (const iGmRequest *);
const iString *     meta_GmRequest          (const iGmRequest *);
const iBlock  *     body_GmRequest          (const iGmRequest *);
const iString *     url_GmRequest           (const iGmRequest *);

int                 certFlags_GmRequest         (const iGmRequest *);
iDate               certExpirationDate_GmRequest(const iGmRequest *);