/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// This file is autogenerated by:
//   cbindgen --config cbindgen.toml doh.rs >doh.h
// Don't modify manually.

#pragma once

/* Generated with cbindgen:0.15.0 */

#include <stdint.h>
#include <sys/types.h>

/// Context for a running DoH engine and associated thread.
struct DohServer;

extern "C" {

/// Performs static initialization fo the DoH engine.
const char* doh_init();

/// Creates and returns a DoH engine instance.
/// The returned object must be freed with doh_delete().
DohServer* doh_new(const char* url, const char* ip_addr, uint32_t mark, const char* cert_path);

/// Deletes a DoH engine created by doh_new().
void doh_delete(DohServer* doh);

/// Sends a DNS query and waits for the response.
ssize_t doh_query(DohServer* doh, uint8_t* query, size_t query_len, uint8_t* response,
                  size_t response_len);

}  // extern "C"