• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef LIBBRILLO_BRILLO_STREAMS_OPENSSL_STREAM_BIO_H_
6 #define LIBBRILLO_BRILLO_STREAMS_OPENSSL_STREAM_BIO_H_
7 
8 #include <brillo/brillo_export.h>
9 
10 // Forward-declare BIO as an alias to OpenSSL's internal bio_st structure.
11 using BIO = struct bio_st;
12 
13 namespace brillo {
14 
15 class Stream;
16 
17 // Creates a new BIO that uses the brillo::Stream as the back-end storage.
18 // The created BIO does *NOT* own the |stream| and the stream must out-live
19 // the BIO.
20 // At the moment, only BIO_read and BIO_write operations are supported as well
21 // as BIO_flush. More functionality could be added to this when/if needed.
22 // The returned BIO performs *NON-BLOCKING* IO on the underlying stream.
23 BRILLO_EXPORT BIO* BIO_new_stream(brillo::Stream* stream);
24 
25 }  // namespace brillo
26 
27 #endif  // LIBBRILLO_BRILLO_STREAMS_OPENSSL_STREAM_BIO_H_
28