113498266Sopenharmony_ci#ifndef HEADER_CURL_HSTS_H 213498266Sopenharmony_ci#define HEADER_CURL_HSTS_H 313498266Sopenharmony_ci/*************************************************************************** 413498266Sopenharmony_ci * _ _ ____ _ 513498266Sopenharmony_ci * Project ___| | | | _ \| | 613498266Sopenharmony_ci * / __| | | | |_) | | 713498266Sopenharmony_ci * | (__| |_| | _ <| |___ 813498266Sopenharmony_ci * \___|\___/|_| \_\_____| 913498266Sopenharmony_ci * 1013498266Sopenharmony_ci * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 1113498266Sopenharmony_ci * 1213498266Sopenharmony_ci * This software is licensed as described in the file COPYING, which 1313498266Sopenharmony_ci * you should have received as part of this distribution. The terms 1413498266Sopenharmony_ci * are also available at https://curl.se/docs/copyright.html. 1513498266Sopenharmony_ci * 1613498266Sopenharmony_ci * You may opt to use, copy, modify, merge, publish, distribute and/or sell 1713498266Sopenharmony_ci * copies of the Software, and permit persons to whom the Software is 1813498266Sopenharmony_ci * furnished to do so, under the terms of the COPYING file. 1913498266Sopenharmony_ci * 2013498266Sopenharmony_ci * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 2113498266Sopenharmony_ci * KIND, either express or implied. 2213498266Sopenharmony_ci * 2313498266Sopenharmony_ci * SPDX-License-Identifier: curl 2413498266Sopenharmony_ci * 2513498266Sopenharmony_ci ***************************************************************************/ 2613498266Sopenharmony_ci#include "curl_setup.h" 2713498266Sopenharmony_ci 2813498266Sopenharmony_ci#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_HSTS) 2913498266Sopenharmony_ci#include <curl/curl.h> 3013498266Sopenharmony_ci#include "llist.h" 3113498266Sopenharmony_ci 3213498266Sopenharmony_ci#ifdef DEBUGBUILD 3313498266Sopenharmony_ciextern time_t deltatime; 3413498266Sopenharmony_ci#endif 3513498266Sopenharmony_ci 3613498266Sopenharmony_cistruct stsentry { 3713498266Sopenharmony_ci struct Curl_llist_element node; 3813498266Sopenharmony_ci const char *host; 3913498266Sopenharmony_ci bool includeSubDomains; 4013498266Sopenharmony_ci curl_off_t expires; /* the timestamp of this entry's expiry */ 4113498266Sopenharmony_ci}; 4213498266Sopenharmony_ci 4313498266Sopenharmony_ci/* The HSTS cache. Needs to be able to tailmatch host names. */ 4413498266Sopenharmony_cistruct hsts { 4513498266Sopenharmony_ci struct Curl_llist list; 4613498266Sopenharmony_ci char *filename; 4713498266Sopenharmony_ci unsigned int flags; 4813498266Sopenharmony_ci}; 4913498266Sopenharmony_ci 5013498266Sopenharmony_cistruct hsts *Curl_hsts_init(void); 5113498266Sopenharmony_civoid Curl_hsts_cleanup(struct hsts **hp); 5213498266Sopenharmony_ciCURLcode Curl_hsts_parse(struct hsts *h, const char *hostname, 5313498266Sopenharmony_ci const char *sts); 5413498266Sopenharmony_cistruct stsentry *Curl_hsts(struct hsts *h, const char *hostname, 5513498266Sopenharmony_ci bool subdomain); 5613498266Sopenharmony_ciCURLcode Curl_hsts_save(struct Curl_easy *data, struct hsts *h, 5713498266Sopenharmony_ci const char *file); 5813498266Sopenharmony_ciCURLcode Curl_hsts_loadfile(struct Curl_easy *data, 5913498266Sopenharmony_ci struct hsts *h, const char *file); 6013498266Sopenharmony_ciCURLcode Curl_hsts_loadcb(struct Curl_easy *data, 6113498266Sopenharmony_ci struct hsts *h); 6213498266Sopenharmony_civoid Curl_hsts_loadfiles(struct Curl_easy *data); 6313498266Sopenharmony_ci#else 6413498266Sopenharmony_ci#define Curl_hsts_cleanup(x) 6513498266Sopenharmony_ci#define Curl_hsts_loadcb(x,y) CURLE_OK 6613498266Sopenharmony_ci#define Curl_hsts_save(x,y,z) 6713498266Sopenharmony_ci#define Curl_hsts_loadfiles(x) 6813498266Sopenharmony_ci#endif /* CURL_DISABLE_HTTP || CURL_DISABLE_HSTS */ 6913498266Sopenharmony_ci#endif /* HEADER_CURL_HSTS_H */ 70