jiangtaoli2016 | 20b9f94 | 2017-04-07 12:50:33 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright 2017, Google Inc. |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| 9 | * |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following disclaimer |
| 14 | * in the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * * Neither the name of Google Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | */ |
| 33 | |
jiangtaoli2016 | e0e961a | 2017-04-24 09:11:44 -0700 | [diff] [blame] | 34 | #ifndef GRPC_CORE_TSI_TRANSPORT_SECURITY_ADAPTER_H |
| 35 | #define GRPC_CORE_TSI_TRANSPORT_SECURITY_ADAPTER_H |
jiangtaoli2016 | 20b9f94 | 2017-04-07 12:50:33 -0700 | [diff] [blame] | 36 | |
| 37 | #include "src/core/tsi/transport_security_interface.h" |
| 38 | |
| 39 | #ifdef __cplusplus |
| 40 | extern "C" { |
| 41 | #endif |
| 42 | |
| 43 | /* Create a tsi handshaker that takes an implementation of old interface and |
jiangtaoli2016 | c195502 | 2017-04-11 09:36:19 -0700 | [diff] [blame] | 44 | converts into an implementation of new interface. In the old interface, |
| 45 | there are get_bytes_to_send_to_peer, process_bytes_from_peer, get_result, |
| 46 | extract_peer, and create_frame_protector. In the new interface, only next |
| 47 | method is needed. See transport_security_interface.h for details. Note that |
| 48 | this tsi adapter handshaker is temporary. It will be removed once TSI has |
| 49 | been fully migrated to the new interface. |
jiangtaoli2016 | 20b9f94 | 2017-04-07 12:50:33 -0700 | [diff] [blame] | 50 | Ownership of input tsi_handshaker is transferred to this new adapter. */ |
| 51 | tsi_handshaker *tsi_create_adapter_handshaker(tsi_handshaker *wrapped); |
| 52 | |
jiangtaoli2016 | c195502 | 2017-04-11 09:36:19 -0700 | [diff] [blame] | 53 | /* Given a tsi adapter handshaker, return the original wrapped handshaker. The |
| 54 | adapter still owns the wrapped handshaker which should not be destroyed by |
| 55 | the caller. */ |
jiangtaoli2016 | 20b9f94 | 2017-04-07 12:50:33 -0700 | [diff] [blame] | 56 | tsi_handshaker *tsi_adapter_handshaker_get_wrapped(tsi_handshaker *adapter); |
| 57 | |
| 58 | #ifdef __cplusplus |
| 59 | } |
| 60 | #endif |
| 61 | |
jiangtaoli2016 | f2263e1 | 2017-04-24 15:32:03 -0700 | [diff] [blame] | 62 | #endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_ADAPTER_H */ |