blob: d04feb45f853b1734614586b0da01cb43229152f [file] [log] [blame]
Luke Huangfd17c542021-03-17 14:27:28 +08001/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// This file is autogenerated by:
18// cbindgen --config cbindgen.toml doh.rs >doh.h
19// Don't modify manually.
20
21#pragma once
22
23/* Generated with cbindgen:0.15.0 */
24
25#include <stdint.h>
26#include <sys/types.h>
27
28/// Context for a running DoH engine and associated thread.
29struct DohServer;
30
31extern "C" {
32
33/// Performs static initialization fo the DoH engine.
34const char* doh_init();
35
36/// Creates and returns a DoH engine instance.
37/// The returned object must be freed with doh_delete().
38DohServer* doh_new(const char* url, const char* ip_addr, uint32_t mark, const char* cert_path);
39
40/// Deletes a DoH engine created by doh_new().
41void doh_delete(DohServer* doh);
42
43/// Sends a DNS query and waits for the response.
44ssize_t doh_query(DohServer* doh, uint8_t* query, size_t query_len, uint8_t* response,
45 size_t response_len);
46
47} // extern "C"