Line
Link Here
|
0 |
-- talk/base/asynctcpsocket.cc |
0 |
++ talk/base/asynctcpsocket.cc |
Lines 32-43
Link Here
|
32 |
#include "talk/base/byteorder.h" |
32 |
#include "talk/base/byteorder.h" |
33 |
#include "talk/base/common.h" |
33 |
#include "talk/base/common.h" |
34 |
#include "talk/base/logging.h" |
34 |
#include "talk/base/logging.h" |
|
|
35 |
#include <string.h> |
35 |
|
36 |
|
36 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
|
|
37 |
namespace std { |
37 |
namespace std { |
38 |
using ::strerror; |
38 |
using ::strerror; |
39 |
} |
39 |
} |
40 |
#endif |
|
|
41 |
|
40 |
|
42 |
#ifdef POSIX |
41 |
#ifdef POSIX |
43 |
extern "C" { |
42 |
extern "C" { |
44 |
-- talk/base/bytebuffer.cc |
43 |
++ talk/base/bytebuffer.cc |
Lines 30-35
Link Here
|
30 |
#include "talk/base/byteorder.h" |
30 |
#include "talk/base/byteorder.h" |
31 |
#include <algorithm> |
31 |
#include <algorithm> |
32 |
#include <cassert> |
32 |
#include <cassert> |
|
|
33 |
#include <string.h> |
33 |
|
34 |
|
34 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
35 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
35 |
namespace std { |
36 |
namespace std { |
36 |
-- talk/base/host.cc |
37 |
++ talk/base/host.cc |
Lines 33-38
Link Here
|
33 |
#include <iostream> |
33 |
#include <iostream> |
34 |
#include <cassert> |
34 |
#include <cassert> |
35 |
#include <errno.h> |
35 |
#include <errno.h> |
|
|
36 |
#include <cstdlib> |
36 |
|
37 |
|
37 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
38 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
38 |
namespace std { |
39 |
namespace std { |
39 |
-- talk/base/logging.cc |
40 |
++ talk/base/logging.cc |
Lines 33-38
Link Here
|
33 |
|
33 |
|
34 |
#include <iostream> |
34 |
#include <iostream> |
35 |
#include <iomanip> |
35 |
#include <iomanip> |
|
|
36 |
#include <string.h> |
36 |
|
37 |
|
37 |
#include "talk/base/logging.h" |
38 |
#include "talk/base/logging.h" |
38 |
#include "talk/base/stream.h" |
39 |
#include "talk/base/stream.h" |
39 |
-- talk/base/messagequeue.h |
40 |
++ talk/base/messagequeue.h |
Lines 35-40
Link Here
|
35 |
#include <vector> |
35 |
#include <vector> |
36 |
#include <queue> |
36 |
#include <queue> |
37 |
#include <algorithm> |
37 |
#include <algorithm> |
|
|
38 |
#include <string.h> |
38 |
|
39 |
|
39 |
namespace cricket { |
40 |
namespace cricket { |
40 |
|
41 |
|
41 |
-- talk/base/physicalsocketserver.cc |
42 |
++ talk/base/physicalsocketserver.cc |
Lines 30-35
Link Here
|
30 |
#endif |
30 |
#endif |
31 |
|
31 |
|
32 |
#include <cassert> |
32 |
#include <cassert> |
|
|
33 |
#include <string.h> |
34 |
#include <algorithm> |
33 |
|
35 |
|
34 |
#ifdef POSIX |
36 |
#ifdef POSIX |
35 |
extern "C" { |
37 |
extern "C" { |
36 |
-- talk/base/protocolinfo.cc |
38 |
++ talk/base/protocolinfo.cc |
Lines 27-32
Link Here
|
27 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 |
*/ |
28 |
*/ |
29 |
|
29 |
|
|
|
30 |
#include <string.h> |
30 |
#include "talk/base/protocolinfo.h" |
31 |
#include "talk/base/protocolinfo.h" |
31 |
|
32 |
|
32 |
namespace cricket { |
33 |
namespace cricket { |
33 |
-- talk/base/socketadapters.cc |
34 |
++ talk/base/socketadapters.cc |
Lines 134-140
Link Here
|
134 |
int len = socket_->Recv(buffer_ + data_len_, buffer_size_ - data_len_); |
134 |
int len = socket_->Recv(buffer_ + data_len_, buffer_size_ - data_len_); |
135 |
if (len < 0) { |
135 |
if (len < 0) { |
136 |
// TODO: Do something better like forwarding the error to the user. |
136 |
// TODO: Do something better like forwarding the error to the user. |
137 |
LOG(INFO) << "Recv: " << errno << " " << std::strerror(errno); |
137 |
LOG(INFO) << "Recv: " << errno << " " << strerror(errno); |
138 |
return; |
138 |
return; |
139 |
} |
139 |
} |
140 |
|
140 |
|
141 |
-- talk/base/stream.cc |
141 |
++ talk/base/stream.cc |
Lines 29-34
Link Here
|
29 |
#include <sys/stat.h> |
29 |
#include <sys/stat.h> |
30 |
#include <errno.h> |
30 |
#include <errno.h> |
31 |
#include <string> |
31 |
#include <string> |
|
|
32 |
#include <string.h> |
32 |
#include "talk/base/basictypes.h" |
33 |
#include "talk/base/basictypes.h" |
33 |
#include "talk/base/common.h" |
34 |
#include "talk/base/common.h" |
34 |
#include "talk/base/stream.h" |
35 |
#include "talk/base/stream.h" |
35 |
-- talk/base/stringutils.h |
36 |
++ talk/base/stringutils.h |
Lines 36-41
Link Here
|
36 |
#endif // WIN32 |
36 |
#endif // WIN32 |
37 |
|
37 |
|
38 |
#include <string> |
38 |
#include <string> |
|
|
39 |
#include <string.h> |
39 |
|
40 |
|
40 |
/////////////////////////////////////////////////////////////////////////////// |
41 |
/////////////////////////////////////////////////////////////////////////////// |
41 |
// Rename a bunch of common string functions so they are consistent across |
42 |
// Rename a bunch of common string functions so they are consistent across |
42 |
-- talk/base/xmpppassword.h |
43 |
++ talk/base/xmpppassword.h |
Lines 30-35
Link Here
|
30 |
|
30 |
|
31 |
#include "talk/base/linked_ptr.h" |
31 |
#include "talk/base/linked_ptr.h" |
32 |
#include "talk/base/scoped_ptr.h" |
32 |
#include "talk/base/scoped_ptr.h" |
|
|
33 |
#include <string.h> |
33 |
|
34 |
|
34 |
namespace buzz { |
35 |
namespace buzz { |
35 |
|
36 |
|
36 |
-- talk/p2p/base/port.cc |
37 |
++ talk/p2p/base/port.cc |
Lines 265-271
Link Here
|
265 |
|
265 |
|
266 |
if (stun_msg->type() == STUN_BINDING_REQUEST) { |
266 |
if (stun_msg->type() == STUN_BINDING_REQUEST) { |
267 |
if ((remote_frag_len < 0) |
267 |
if ((remote_frag_len < 0) |
268 |
|| (std::memcmp(username_attr->bytes(), |
268 |
|| (::memcmp(username_attr->bytes(), |
269 |
username_frag_.c_str(), username_frag_.size()) != 0)) { |
269 |
username_frag_.c_str(), username_frag_.size()) != 0)) { |
270 |
LOG(LERROR) << "Received STUN request with bad username"; |
270 |
LOG(LERROR) << "Received STUN request with bad username"; |
271 |
SendBindingErrorResponse(stun_msg.get(), addr, STUN_ERROR_BAD_REQUEST, |
271 |
SendBindingErrorResponse(stun_msg.get(), addr, STUN_ERROR_BAD_REQUEST, |
Lines 278-284
Link Here
|
278 |
} else if ((stun_msg->type() == STUN_BINDING_RESPONSE) |
278 |
} else if ((stun_msg->type() == STUN_BINDING_RESPONSE) |
279 |
|| (stun_msg->type() == STUN_BINDING_ERROR_RESPONSE)) { |
279 |
|| (stun_msg->type() == STUN_BINDING_ERROR_RESPONSE)) { |
280 |
if ((remote_frag_len < 0) |
280 |
if ((remote_frag_len < 0) |
281 |
|| (std::memcmp(username_attr->bytes() + remote_frag_len, |
281 |
|| (::memcmp(username_attr->bytes() + remote_frag_len, |
282 |
username_frag_.c_str(), username_frag_.size()) != 0)) { |
282 |
username_frag_.c_str(), username_frag_.size()) != 0)) { |
283 |
LOG(LERROR) << "Received STUN response with bad username"; |
283 |
LOG(LERROR) << "Received STUN response with bad username"; |
284 |
// Do not send error response to a response |
284 |
// Do not send error response to a response |
Lines 723-729
Link Here
|
723 |
if (valid) { |
723 |
if (valid) { |
724 |
std::string username_fragment = port_->username_fragment(); |
724 |
std::string username_fragment = port_->username_fragment(); |
725 |
int offset = (int)(username_attr->length() - username_fragment.size()); |
725 |
int offset = (int)(username_attr->length() - username_fragment.size()); |
726 |
if (std::memcmp(username_attr->bytes() + offset, |
726 |
if (::memcmp(username_attr->bytes() + offset, |
727 |
username_fragment.c_str(), username_fragment.size()) != 0) { |
727 |
username_fragment.c_str(), username_fragment.size()) != 0) { |
728 |
LOG(LERROR) << "Received STUN response with bad username"; |
728 |
LOG(LERROR) << "Received STUN response with bad username"; |
729 |
valid = false; |
729 |
valid = false; |
730 |
-- talk/p2p/base/pseudotcp.cc |
730 |
++ talk/p2p/base/pseudotcp.cc |
Lines 33-38
Link Here
|
33 |
#include "talk/base/socket.h" |
33 |
#include "talk/base/socket.h" |
34 |
#include "talk/base/time.h" |
34 |
#include "talk/base/time.h" |
35 |
#include "talk/p2p/base/pseudotcp.h" |
35 |
#include "talk/p2p/base/pseudotcp.h" |
|
|
36 |
#include <string.h> |
37 |
#include <stdlib.h> |
36 |
|
38 |
|
37 |
#define _DBG_NONE 0 |
39 |
#define _DBG_NONE 0 |
38 |
#define _DBG_NORMAL 1 |
40 |
#define _DBG_NORMAL 1 |
39 |
-- talk/p2p/base/relayport.cc |
41 |
++ talk/p2p/base/relayport.cc |
Lines 37-42
Link Here
|
37 |
#ifdef OSX |
37 |
#ifdef OSX |
38 |
#include <errno.h> |
38 |
#include <errno.h> |
39 |
#endif |
39 |
#endif |
|
|
40 |
#include <string.h> |
40 |
|
41 |
|
41 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
42 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
42 |
namespace std { |
43 |
namespace std { |
Lines 212-218
Link Here
|
212 |
if (size < 24 + magic_cookie_.size()) { |
213 |
if (size < 24 + magic_cookie_.size()) { |
213 |
return false; |
214 |
return false; |
214 |
} else { |
215 |
} else { |
215 |
return 0 == std::memcmp(data + 24, |
216 |
return 0 == ::memcmp(data + 24, |
216 |
magic_cookie_.c_str(), |
217 |
magic_cookie_.c_str(), |
217 |
magic_cookie_.size()); |
218 |
magic_cookie_.size()); |
218 |
} |
219 |
} |
Lines 375-381
Link Here
|
375 |
|
376 |
|
376 |
socket_->SignalReadPacket.connect(this, &RelayEntry::OnReadPacket); |
377 |
socket_->SignalReadPacket.connect(this, &RelayEntry::OnReadPacket); |
377 |
if (socket_->Bind(local_addr_) < 0) |
378 |
if (socket_->Bind(local_addr_) < 0) |
378 |
LOG(INFO) << "bind: " << std::strerror(socket_->GetError()); |
379 |
LOG(INFO) << "bind: " << ::strerror(socket_->GetError()); |
379 |
|
380 |
|
380 |
for (unsigned i = 0; i < port_->options().size(); ++i) |
381 |
for (unsigned i = 0; i < port_->options().size(); ++i) |
381 |
socket_->SetOption(port_->options()[i].first, port_->options()[i].second); |
382 |
socket_->SetOption(port_->options()[i].first, port_->options()[i].second); |
Lines 568-574
Link Here
|
568 |
} |
569 |
} |
569 |
int sent = socket_->SendTo(data, size, ra->address); |
570 |
int sent = socket_->SendTo(data, size, ra->address); |
570 |
if (sent <= 0) { |
571 |
if (sent <= 0) { |
571 |
LOG(LS_VERBOSE) << "sendto: " << std::strerror(socket_->GetError()); |
572 |
LOG(LS_VERBOSE) << "sendto: " << ::strerror(socket_->GetError()); |
572 |
assert(sent < 0); |
573 |
assert(sent < 0); |
573 |
} |
574 |
} |
574 |
return sent; |
575 |
return sent; |
575 |
-- talk/p2p/base/relayserver_main.cc |
576 |
++ talk/p2p/base/relayserver_main.cc |
Lines 30-35
Link Here
|
30 |
#include "talk/base/host.h" |
30 |
#include "talk/base/host.h" |
31 |
#include "talk/base/thread.h" |
31 |
#include "talk/base/thread.h" |
32 |
#include "talk/p2p/base/relayserver.h" |
32 |
#include "talk/p2p/base/relayserver.h" |
|
|
33 |
#include <string.h> |
33 |
|
34 |
|
34 |
#ifdef POSIX |
35 |
#ifdef POSIX |
35 |
extern "C" { |
36 |
extern "C" { |
Lines 53-65
Link Here
|
53 |
|
54 |
|
54 |
AsyncUDPSocket* int_socket = CreateAsyncUDPSocket(pthMain->socketserver()); |
55 |
AsyncUDPSocket* int_socket = CreateAsyncUDPSocket(pthMain->socketserver()); |
55 |
if (int_socket->Bind(int_addr) < 0) { |
56 |
if (int_socket->Bind(int_addr) < 0) { |
56 |
std::cerr << "bind: " << std::strerror(errno) << std::endl; |
57 |
std::cerr << "bind: " << ::strerror(errno) << std::endl; |
57 |
return 1; |
58 |
return 1; |
58 |
} |
59 |
} |
59 |
|
60 |
|
60 |
AsyncUDPSocket* ext_socket = CreateAsyncUDPSocket(pthMain->socketserver()); |
61 |
AsyncUDPSocket* ext_socket = CreateAsyncUDPSocket(pthMain->socketserver()); |
61 |
if (ext_socket->Bind(ext_addr) < 0) { |
62 |
if (ext_socket->Bind(ext_addr) < 0) { |
62 |
std::cerr << "bind: " << std::strerror(errno) << std::endl; |
63 |
std::cerr << "bind: " << ::strerror(errno) << std::endl; |
63 |
return 1; |
64 |
return 1; |
64 |
} |
65 |
} |
65 |
|
66 |
|
66 |
-- talk/p2p/base/stun.cc |
67 |
++ talk/p2p/base/stun.cc |
Lines 29-34
Link Here
|
29 |
#include "talk/p2p/base/stun.h" |
29 |
#include "talk/p2p/base/stun.h" |
30 |
#include <iostream> |
30 |
#include <iostream> |
31 |
#include <cassert> |
31 |
#include <cassert> |
|
|
32 |
#include <string.h> |
32 |
|
33 |
|
33 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
34 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
34 |
namespace std { |
35 |
namespace std { |
Lines 384-390
Link Here
|
384 |
|
385 |
|
385 |
void StunByteStringAttribute::CopyBytes(const void* bytes, uint16 length) { |
386 |
void StunByteStringAttribute::CopyBytes(const void* bytes, uint16 length) { |
386 |
char* new_bytes = new char[length]; |
387 |
char* new_bytes = new char[length]; |
387 |
std::memcpy(new_bytes, bytes, length); |
388 |
memcpy(new_bytes, bytes, length); |
388 |
SetBytes(new_bytes, length); |
389 |
SetBytes(new_bytes, length); |
389 |
} |
390 |
} |
390 |
|
391 |
|
391 |
-- talk/p2p/base/stunserver.cc |
392 |
++ talk/p2p/base/stunserver.cc |
Lines 28-33
Link Here
|
28 |
#include "talk/base/bytebuffer.h" |
28 |
#include "talk/base/bytebuffer.h" |
29 |
#include "talk/p2p/base/stunserver.h" |
29 |
#include "talk/p2p/base/stunserver.h" |
30 |
#include <iostream> |
30 |
#include <iostream> |
|
|
31 |
#include <string.h> |
31 |
|
32 |
|
32 |
#ifdef POSIX |
33 |
#ifdef POSIX |
33 |
extern "C" { |
34 |
extern "C" { |
Lines 154-160
Link Here
|
154 |
// TODO: Allow response addr attribute if sent from another stun server. |
155 |
// TODO: Allow response addr attribute if sent from another stun server. |
155 |
|
156 |
|
156 |
if (socket_->SendTo(buf.Data(), buf.Length(), addr) < 0) |
157 |
if (socket_->SendTo(buf.Data(), buf.Length(), addr) < 0) |
157 |
std::cerr << "sendto: " << std::strerror(errno) << std::endl; |
158 |
std::cerr << "sendto: " << ::strerror(errno) << std::endl; |
158 |
} |
159 |
} |
159 |
|
160 |
|
160 |
} // namespace cricket |
161 |
} // namespace cricket |
161 |
-- talk/p2p/base/stunserver_main.cc |
162 |
++ talk/p2p/base/stunserver_main.cc |
Lines 50-56
Link Here
|
50 |
|
50 |
|
51 |
AsyncUDPSocket* server_socket = CreateAsyncUDPSocket(pthMain->socketserver()); |
51 |
AsyncUDPSocket* server_socket = CreateAsyncUDPSocket(pthMain->socketserver()); |
52 |
if (server_socket->Bind(server_addr) < 0) { |
52 |
if (server_socket->Bind(server_addr) < 0) { |
53 |
std::cerr << "bind: " << std::strerror(errno) << std::endl; |
53 |
std::cerr << "bind: " << ::strerror(errno) << std::endl; |
54 |
return 1; |
54 |
return 1; |
55 |
} |
55 |
} |
56 |
|
56 |
|
57 |
-- talk/p2p/base/tcpport.cc |
57 |
++ talk/p2p/base/tcpport.cc |
Lines 35-40
Link Here
|
35 |
#endif // WIN32 |
35 |
#endif // WIN32 |
36 |
#include <iostream> |
36 |
#include <iostream> |
37 |
#include <cassert> |
37 |
#include <cassert> |
|
|
38 |
#include <string.h> |
38 |
|
39 |
|
39 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
40 |
#if defined(_MSC_VER) && _MSC_VER < 1300 |
40 |
namespace std { |
41 |
namespace std { |
Lines 61-67
Link Here
|
61 |
socket_ = thread->socketserver()->CreateAsyncSocket(SOCK_STREAM); |
62 |
socket_ = thread->socketserver()->CreateAsyncSocket(SOCK_STREAM); |
62 |
socket_->SignalReadEvent.connect(this, &TCPPort::OnAcceptEvent); |
63 |
socket_->SignalReadEvent.connect(this, &TCPPort::OnAcceptEvent); |
63 |
if (socket_->Bind(address) < 0) |
64 |
if (socket_->Bind(address) < 0) |
64 |
LOG(INFO) << "bind: " << std::strerror(socket_->GetError()); |
65 |
LOG(INFO) << "bind: " << ::strerror(socket_->GetError()); |
65 |
} |
66 |
} |
66 |
|
67 |
|
67 |
TCPPort::~TCPPort() { |
68 |
TCPPort::~TCPPort() { |
Lines 111-117
Link Here
|
111 |
#endif // WIN32 |
112 |
#endif // WIN32 |
112 |
if (allow_listen) { |
113 |
if (allow_listen) { |
113 |
if (socket_->Listen(5) < 0) |
114 |
if (socket_->Listen(5) < 0) |
114 |
LOG(INFO) << "listen: " << std::strerror(socket_->GetError()); |
115 |
LOG(INFO) << "listen: " << ::strerror(socket_->GetError()); |
115 |
} else { |
116 |
} else { |
116 |
LOG(INFO) << "not listening due to firewall restrictions"; |
117 |
LOG(INFO) << "not listening due to firewall restrictions"; |
117 |
} |
118 |
} |
Lines 157-163
Link Here
|
157 |
AsyncSocket * newsocket = static_cast<AsyncSocket *>(socket->Accept(&incoming.addr)); |
158 |
AsyncSocket * newsocket = static_cast<AsyncSocket *>(socket->Accept(&incoming.addr)); |
158 |
if (!newsocket) { |
159 |
if (!newsocket) { |
159 |
// TODO: Do something better like forwarding the error to the user. |
160 |
// TODO: Do something better like forwarding the error to the user. |
160 |
LOG(INFO) << "accept: " << socket_->GetError() << " " << std::strerror(socket_->GetError()); |
161 |
LOG(INFO) << "accept: " << socket_->GetError() << " " << ::strerror(socket_->GetError()); |
161 |
return; |
162 |
return; |
162 |
} |
163 |
} |
163 |
incoming.socket = new AsyncTCPSocket(newsocket); |
164 |
incoming.socket = new AsyncTCPSocket(newsocket); |
164 |
-- talk/session/phone/voicechannel.cc |
165 |
++ talk/session/phone/voicechannel.cc |
Lines 159-165
Link Here
|
159 |
channel_->OnPacketReceived(data, (int)len); |
159 |
channel_->OnPacketReceived(data, (int)len); |
160 |
} |
160 |
} |
161 |
|
161 |
|
162 |
void VoiceChannel::SendPacket(const void *data, unsigned int len) { |
162 |
void VoiceChannel::SendPacket(const void *data, size_t len) { |
163 |
// SendPacket gets called from MediaEngine; send to socket |
163 |
// SendPacket gets called from MediaEngine; send to socket |
164 |
// MediaEngine will call us on a random thread. The Send operation on the socket is |
164 |
// MediaEngine will call us on a random thread. The Send operation on the socket is |
165 |
// special in that it can handle this. |
165 |
// special in that it can handle this. |