/* * Copyright 2004 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
// Simulates UDP semantics over TCP. Send and Recv packet sizes // are preserved, and drops packets silently on Send, rather than // buffer them in user space. class AsyncTCPSocketBase : public AsyncPacketSocket { public:
AsyncTCPSocketBase(Socket* socket, size_t max_packet_size);
~AsyncTCPSocketBase() override;
// Pure virtual methods to send and recv data. int Send(constvoid* pv,
size_t cb, const rtc::PacketOptions& options) override = 0; // Must return the number of bytes processed. virtual size_t ProcessInput(rtc::ArrayView<const uint8_t> data) = 0;
State GetState() const override; int GetOption(Socket::Option opt, int* value) override; int SetOption(Socket::Option opt, int value) override; int GetError() const override; void SetError(int error) override;
protected: // Binds and connects `socket` and creates AsyncTCPSocket for // it. Takes ownership of `socket`. Returns null if bind() or // connect() fail (`socket` is destroyed in that case). static Socket* ConnectSocket(Socket* socket, const SocketAddress& bind_address, const SocketAddress& remote_address); int FlushOutBuffer(); // Add data to `outbuf_`. void AppendToOutBuffer(constvoid* pv, size_t cb);
class AsyncTCPSocket : public AsyncTCPSocketBase { public: // Binds and connects `socket` and creates AsyncTCPSocket for // it. Takes ownership of `socket`. Returns null if bind() or // connect() fail (`socket` is destroyed in that case). static AsyncTCPSocket* Create(Socket* socket, const SocketAddress& bind_address, const SocketAddress& remote_address); explicit AsyncTCPSocket(Socket* socket);
~AsyncTCPSocket() override {}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.