Last active
November 26, 2018 07:23
-
-
Save xquery/b1c7983702d4ca3c2f4150e5931d538e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef HEADER_CURL_ALTSVC_H | |
#define HEADER_CURL_ALTSVC_H | |
/*************************************************************************** | |
* _ _ ____ _ | |
* Project ___| | | | _ \| | | |
* / __| | | | |_) | | | |
* | (__| |_| | _ <| |___ | |
* \___|\___/|_| \_\_____| | |
* | |
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. | |
* | |
* This software is licensed as described in the file COPYING, which | |
* you should have received as part of this distribution. The terms | |
* are also available at https://curl.haxx.se/docs/copyright.html. | |
* | |
* You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
* copies of the Software, and permit persons to whom the Software is | |
* furnished to do so, under the terms of the COPYING file. | |
* | |
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
* KIND, either express or implied. | |
* | |
***************************************************************************/ | |
#include "curl_setup.h" | |
#ifdef USE_ALTSVC | |
struct AltSvc { | |
struct AltSvc *next; | |
char *src_protocol; | |
char *src_host_name; | |
int src_port_number; | |
char *dest_protocol; | |
char *dest_host_name; | |
int dest_port_number; | |
time_t expiry_time; | |
int priority; | |
}; | |
#define ALTSVC_HASH_SIZE 256 | |
struct AltSvcList { | |
/* linked list of altsvc */ | |
struct AltSvc *altservices[ALTSVC_HASH_SIZE]; | |
char *filename; | |
long numaltsvc; | |
int lastct; /* last creation-time used */ | |
}; | |
/* add ALT-SVC header response to in memory linked list */ | |
struct AltSvc *Curl_altsvc_add(struct Curl_easy *data, | |
struct AltSvcList *, | |
char *src_protocol, | |
char *src_host_name, | |
int src_port_number, | |
char *dest_protocol, | |
char *dest_host_name, | |
int dest_port_number, | |
time_t expiry_time, | |
int priority); | |
/* retrieve list (TBA- do we need to filter/narrow down ?) */ | |
struct AltSvc *Curl_altsvc_getlist(struct AltSvc *, | |
const char *src_protocol, | |
const char *src_host_name, | |
const char *src_port_number); | |
/* clear structs, free mem, etc */ | |
void Curl_altsvc_cleanup(struct AltSvcList *); | |
/* load file, instantiate linked list, define behavior (eg. CURLOPT_ALTSVC_CTRL, override w/ direct-to-h3 ) */ | |
struct AltSvcList *Curl_altsvc_init(struct Curl_easy *data, | |
const char *file, | |
struct AltSvcList *, | |
bool newsession); | |
/* load altsvc file, as indicated by CURLOPT_ALTSVC */ | |
void Curl_altsvc_load(struct Curl_easy *data); | |
/* persist current in memory linked list to file as indicated by CURLOPT_ALTSVC (?) */ | |
void Curl_altsvc_save(struct Curl_easy *data); | |
#endif /* USE_ALTSVC */ | |
#endif /* HEADER_CURL_ALTSVC_H */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment