Jonas Oreland | bdcee28 | 2017-10-10 12:01:40 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 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 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 11 | #ifndef API_TURN_CUSTOMIZER_H_ |
| 12 | #define API_TURN_CUSTOMIZER_H_ |
Jonas Oreland | bdcee28 | 2017-10-10 12:01:40 | [diff] [blame] | 13 | |
| 14 | #include <stdlib.h> |
| 15 | |
Mirko Bonadei | 9d9c2d5 | 2022-10-07 21:47:49 | [diff] [blame] | 16 | #include "api/transport/stun.h" |
| 17 | |
Jonas Oreland | bdcee28 | 2017-10-10 12:01:40 | [diff] [blame] | 18 | namespace cricket { |
| 19 | class PortInterface; |
Jonas Oreland | bdcee28 | 2017-10-10 12:01:40 | [diff] [blame] | 20 | } // namespace cricket |
| 21 | |
Jonas Oreland | bdcee28 | 2017-10-10 12:01:40 | [diff] [blame] | 22 | namespace webrtc { |
| 23 | |
| 24 | class TurnCustomizer { |
| 25 | public: |
| 26 | // This is called before a TURN message is sent. |
| 27 | // This could be used to add implementation specific attributes to a request. |
| 28 | virtual void MaybeModifyOutgoingStunMessage( |
| 29 | cricket::PortInterface* port, |
| 30 | cricket::StunMessage* message) = 0; |
| 31 | |
| 32 | // TURN can send data using channel data messages or Send indication. |
Artem Titov | 0e61fdd | 2021-07-25 19:50:14 | [diff] [blame] | 33 | // This method should return false if `data` should be sent using |
Jonas Oreland | bdcee28 | 2017-10-10 12:01:40 | [diff] [blame] | 34 | // a Send indication instead of a ChannelData message, even if a |
| 35 | // channel is bound. |
| 36 | virtual bool AllowChannelData(cricket::PortInterface* port, |
| 37 | const void* data, |
| 38 | size_t size, |
| 39 | bool payload) = 0; |
| 40 | |
| 41 | virtual ~TurnCustomizer() {} |
| 42 | }; |
| 43 | |
| 44 | } // namespace webrtc |
| 45 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 46 | #endif // API_TURN_CUSTOMIZER_H_ |