1 /*
2  *  Copyright (c) 2019 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 TEST_PEER_SCENARIO_SIGNALING_ROUTE_H_
11 #define TEST_PEER_SCENARIO_SIGNALING_ROUTE_H_
12 
13 #include <string>
14 #include <utility>
15 
16 #include "test/network/network_emulation_manager.h"
17 #include "test/peer_scenario/peer_scenario_client.h"
18 
19 namespace webrtc {
20 namespace test {
21 
22 // Helper class to reduce the amount of boilerplate required for ICE signalling
23 // ad SDP negotiation.
24 class SignalingRoute {
25  public:
26   SignalingRoute(PeerScenarioClient* caller,
27                  PeerScenarioClient* callee,
28                  TrafficRoute* send_route,
29                  TrafficRoute* ret_route);
30 
31   void StartIceSignaling();
32 
33   // TODO(srte): Handle lossy links.
34   void NegotiateSdp(
35       std::function<void(SessionDescriptionInterface* offer)> modify_offer,
36       std::function<void(const SessionDescriptionInterface& answer)>
37           exchange_finished);
38   void NegotiateSdp(
39       std::function<void(const SessionDescriptionInterface& answer)>
40           exchange_finished);
reverse()41   SignalingRoute reverse() {
42     return SignalingRoute(callee_, caller_, ret_route_, send_route_);
43   }
44 
45  private:
46   PeerScenarioClient* const caller_;
47   PeerScenarioClient* const callee_;
48   TrafficRoute* const send_route_;
49   TrafficRoute* const ret_route_;
50 };
51 
52 }  // namespace test
53 }  // namespace webrtc
54 
55 #endif  // TEST_PEER_SCENARIO_SIGNALING_ROUTE_H_
56