Sergey Sukhanov | 3852698 | 2021-09-20 11:35:59 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | #ifndef NET_DCSCTP_COMMON_HANDOVER_TESTING_H_ |
| 11 | #define NET_DCSCTP_COMMON_HANDOVER_TESTING_H_ |
| 12 | |
| 13 | #include "net/dcsctp/public/dcsctp_handover_state.h" |
| 14 | |
| 15 | namespace dcsctp { |
| 16 | // This global function is to facilitate testing of the socket handover state |
| 17 | // (`DcSctpSocketHandoverState`) serialization. dcSCTP library users have to |
| 18 | // implement state serialization if it's needed. To test the serialization one |
| 19 | // can set a custom `g_handover_state_transformer_for_test` at startup, link to |
| 20 | // the dcSCTP tests and run the resulting binary. Custom function can serialize |
| 21 | // and deserialize the passed state. All dcSCTP handover tests call |
| 22 | // `g_handover_state_transformer_for_test`. If some part of the state is |
| 23 | // serialized incorrectly or is forgotten, high chance that it will fail the |
| 24 | // tests. |
| 25 | extern void (*g_handover_state_transformer_for_test)( |
| 26 | DcSctpSocketHandoverState*); |
| 27 | } // namespace dcsctp |
| 28 | |
| 29 | #endif // NET_DCSCTP_COMMON_HANDOVER_TESTING_H_ |