| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "webrtc/p2p/base/relayserver.h" | 13 #include "webrtc/p2p/base/relayserver.h" |
| 14 #include "webrtc/base/gunit.h" | 14 #include "webrtc/base/gunit.h" |
| 15 #include "webrtc/base/helpers.h" | 15 #include "webrtc/base/helpers.h" |
| 16 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" |
| 17 #include "webrtc/base/physicalsocketserver.h" | 17 #include "webrtc/base/physicalsocketserver.h" |
| 18 #include "webrtc/base/socketaddress.h" | 18 #include "webrtc/base/socketaddress.h" |
| 19 #include "webrtc/base/ssladapter.h" | 19 #include "webrtc/base/ssladapter.h" |
| 20 #include "webrtc/base/testclient.h" | 20 #include "webrtc/base/testclient.h" |
| 21 #include "webrtc/base/thread.h" | 21 #include "webrtc/base/thread.h" |
| 22 #include "webrtc/base/virtualsocketserver.h" | 22 #include "webrtc/base/virtualsocketserver.h" |
| 23 | 23 |
| 24 using rtc::SocketAddress; | 24 using rtc::SocketAddress; |
| 25 using namespace cricket; | 25 using namespace cricket; |
| 26 | 26 |
| 27 static const uint32 LIFETIME = 4; // seconds | 27 static const uint32_t LIFETIME = 4; // seconds |
| 28 static const SocketAddress server_int_addr("127.0.0.1", 5000); | 28 static const SocketAddress server_int_addr("127.0.0.1", 5000); |
| 29 static const SocketAddress server_ext_addr("127.0.0.1", 5001); | 29 static const SocketAddress server_ext_addr("127.0.0.1", 5001); |
| 30 static const SocketAddress client1_addr("127.0.0.1", 6000 + (rand() % 1000)); | 30 static const SocketAddress client1_addr("127.0.0.1", 6000 + (rand() % 1000)); |
| 31 static const SocketAddress client2_addr("127.0.0.1", 7000 + (rand() % 1000)); | 31 static const SocketAddress client2_addr("127.0.0.1", 7000 + (rand() % 1000)); |
| 32 static const char* bad = "this is a completely nonsensical message whose only " | 32 static const char* bad = "this is a completely nonsensical message whose only " |
| 33 "purpose is to make the parser go 'ack'. it doesn't " | 33 "purpose is to make the parser go 'ack'. it doesn't " |
| 34 "look anything like a normal stun message"; | 34 "look anything like a normal stun message"; |
| 35 static const char* msg1 = "spamspamspamspamspamspamspambakedbeansspam"; | 35 static const char* msg1 = "spamspamspamspamspamspamspambakedbeansspam"; |
| 36 static const char* msg2 = "Lobster Thermidor a Crevette with a mornay sauce..."; | 36 static const char* msg2 = "Lobster Thermidor a Crevette with a mornay sauce..."; |
| 37 | 37 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 const StunErrorCodeAttribute* err = res->GetErrorCode(); | 520 const StunErrorCodeAttribute* err = res->GetErrorCode(); |
| 521 ASSERT_TRUE(err != NULL); | 521 ASSERT_TRUE(err != NULL); |
| 522 EXPECT_EQ(6, err->eclass()); | 522 EXPECT_EQ(6, err->eclass()); |
| 523 EXPECT_EQ(0, err->number()); | 523 EXPECT_EQ(0, err->number()); |
| 524 EXPECT_EQ("Operation Not Supported", err->reason()); | 524 EXPECT_EQ("Operation Not Supported", err->reason()); |
| 525 | 525 |
| 526 // Also verify that traffic from the external client is ignored. | 526 // Also verify that traffic from the external client is ignored. |
| 527 SendRaw2(msg2, static_cast<int>(strlen(msg2))); | 527 SendRaw2(msg2, static_cast<int>(strlen(msg2))); |
| 528 EXPECT_TRUE(ReceiveRaw1().empty()); | 528 EXPECT_TRUE(ReceiveRaw1().empty()); |
| 529 } | 529 } |
| OLD | NEW |