-
Notifications
You must be signed in to change notification settings - Fork 1
/
mhd_util.h
35 lines (23 loc) · 944 Bytes
/
mhd_util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CUPS_PROXY_MHD_UTIL_H_
#define CUPS_PROXY_MHD_UTIL_H_
#include <memory>
#include <base/files/file_util.h>
#include <microhttpd.h>
#include "cups_proxy/mojo_handler.h"
namespace cups_proxy {
struct MHDResponseDeleter {
void operator()(MHD_Response* response) { MHD_destroy_response(response); }
};
// Smart ptr wrapper for MHD_Response
using ScopedMHDResponse = std::unique_ptr<MHD_Response, MHDResponseDeleter>;
struct MHDDaemonDeleter {
void operator()(MHD_Daemon* daemon) { MHD_stop_daemon(daemon); }
};
// Smart ptr wrapper for MHD_daemon
using ScopedMHDDaemon = std::unique_ptr<MHD_Daemon, MHDDaemonDeleter>;
ScopedMHDDaemon StartMHDDaemon(base::ScopedFD fd, MojoHandler* mojo_handler);
} // namespace cups_proxy
#endif // CUPS_PROXY_MHD_UTIL_H_