blob: 1551418fc8ce05e8497f1d8e8d51dcede12864ea [file] [log] [blame]
Ben Schwartzded1b702017-10-25 14:41:02 -04001/*
2 * Copyright (C) 2018 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#ifndef _DNS_IDNSTLSSOCKET_H
18#define _DNS_IDNSTLSSOCKET_H
19
20#include <cstdint>
21#include <cstddef>
22
23#include <netdutils/Slice.h>
24
25#include "dns/DnsTlsServer.h"
26
27namespace android {
28namespace net {
29
30class IDnsTlsSocketObserver;
31class DnsTlsSessionCache;
32
33// A class for managing a TLS socket that sends and receives messages in
34// [length][value] format, with a 2-byte length (i.e. DNS-over-TCP format).
35class IDnsTlsSocket {
36public:
37 virtual ~IDnsTlsSocket() {};
38 // Send a query on the provided SSL socket. |query| contains
39 // the body of a query, not including the ID bytes. Returns the server's response.
40 virtual DnsTlsServer::Result query(uint16_t id, const netdutils::Slice query) = 0;
41};
42
43} // end of namespace net
44} // end of namespace android
45
46#endif // _DNS_IDNSTLSSOCKET_H