summaryrefslogtreecommitdiff
path: root/utils/http/strict-transport-security.h
blob: 4e52419fcc7a7f141c032857304206a6a8aed6ac (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Copyright 2018 John-Mark Bell <jmb@netsurf-browser.org>
 *
 * This file is part of NetSurf, http://www.netsurf-browser.org/
 *
 * NetSurf is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * NetSurf is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef NETSURF_UTILS_HTTP_STRICT_TRANSPORT_SECURITY_H_
#define NETSURF_UTILS_HTTP_STRICT_TRANSPORT_SECURITY_H_

#include <libwapcaplet/libwapcaplet.h>

typedef struct http_strict_transport_security http_strict_transport_security;

/**
 * Parse an HTTP Strict-Transport-Security header value
 *
 * \param header_value  Header value to parse
 * \param result        Pointer to location to receive result
 * \return NSERROR_OK on success,
 *         NSERROR_NOMEM on memory exhaustion,
 *         appropriate error otherwise
 */
nserror http_parse_strict_transport_security(const char *header_value,
		http_strict_transport_security **result);

/**
 * Destroy a strict transport security object
 *
 * \param victim  Object to destroy
 */
void http_strict_transport_security_destroy(
		http_strict_transport_security *victim);

/**
 * Get the value of a strict transport security's max-age
 *
 * \param sts Object to inspect
 * \return Max age, in delta-seconds
 */
uint32_t http_strict_transport_security_max_age(
		http_strict_transport_security *sts);

/**
 * Get the value of a strict transport security's includeSubDomains flag
 *
 * \param sts Object to inspect
 * \return Whether subdomains should be included
 */
bool http_strict_transport_security_include_subdomains(
		http_strict_transport_security *sts);

#endif