Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/lib/altsvc.h
2065 views
1
#ifndef HEADER_CURL_ALTSVC_H
2
#define HEADER_CURL_ALTSVC_H
3
/***************************************************************************
4
* _ _ ____ _
5
* Project ___| | | | _ \| |
6
* / __| | | | |_) | |
7
* | (__| |_| | _ <| |___
8
* \___|\___/|_| \_\_____|
9
*
10
* Copyright (C) Daniel Stenberg, <[email protected]>, et al.
11
*
12
* This software is licensed as described in the file COPYING, which
13
* you should have received as part of this distribution. The terms
14
* are also available at https://curl.se/docs/copyright.html.
15
*
16
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
17
* copies of the Software, and permit persons to whom the Software is
18
* furnished to do so, under the terms of the COPYING file.
19
*
20
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
* KIND, either express or implied.
22
*
23
* SPDX-License-Identifier: curl
24
*
25
***************************************************************************/
26
#include "curl_setup.h"
27
28
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
29
#include <curl/curl.h>
30
#include "llist.h"
31
32
struct althost {
33
char *host;
34
unsigned short port;
35
enum alpnid alpnid;
36
};
37
38
struct altsvc {
39
struct althost src;
40
struct althost dst;
41
time_t expires;
42
struct Curl_llist_node node;
43
unsigned int prio;
44
BIT(persist);
45
};
46
47
struct altsvcinfo {
48
char *filename;
49
struct Curl_llist list; /* list of entries */
50
long flags; /* the publicly set bitmask */
51
};
52
53
const char *Curl_alpnid2str(enum alpnid id);
54
struct altsvcinfo *Curl_altsvc_init(void);
55
CURLcode Curl_altsvc_load(struct altsvcinfo *asi, const char *file);
56
CURLcode Curl_altsvc_save(struct Curl_easy *data,
57
struct altsvcinfo *asi, const char *file);
58
CURLcode Curl_altsvc_ctrl(struct altsvcinfo *asi, const long ctrl);
59
void Curl_altsvc_cleanup(struct altsvcinfo **altsvc);
60
CURLcode Curl_altsvc_parse(struct Curl_easy *data,
61
struct altsvcinfo *altsvc, const char *value,
62
enum alpnid srcalpn, const char *srchost,
63
unsigned short srcport);
64
bool Curl_altsvc_lookup(struct altsvcinfo *asi,
65
enum alpnid srcalpnid, const char *srchost,
66
int srcport,
67
struct altsvc **dstentry,
68
const int versions); /* CURLALTSVC_H* bits */
69
#else
70
/* disabled */
71
#define Curl_altsvc_save(a,b,c)
72
#define Curl_altsvc_cleanup(x)
73
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_ALTSVC */
74
#endif /* HEADER_CURL_ALTSVC_H */
75
76