Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1610)

Unified Diff: net/quic/quartc/quartc_session_interface.h

Issue 2324833004: Define Stable API for WebRTC/Quartc (Closed)
Patch Set: Code style fix. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/quic/quartc/quartc_session_interface.h
diff --git a/net/quic/quartc/quartc_session_interface.h b/net/quic/quartc/quartc_session_interface.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf6effdd40defcb0657003bfeb438e6c2f15c793
--- /dev/null
+++ b/net/quic/quartc/quartc_session_interface.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_
+#define NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_
+
+#include "net/quic/quartc/quartc_reliable_stream_interface.h"
+
+namespace net {
+class QuartcSessionInterface {
+ public:
+ virtual void StartCryptoHandshake() = 0;
+
+ // Only needed when using SRTP with QuicTransport
+ // Key Exporter interface from RFC 5705
+ // Arguments are:
+ // label -- the exporter label.
+ // part of the RFC defining each exporter
+ // usage (IN)
+ // context/context_len -- a context to bind to for this connection indicating
+ // where and how the keying material will be used.
+ virtual bool ExportKeyingMaterial(const std::string& label,
+ const uint8_t* context,
+ size_t context_len,
+ uint8_t* result,
+ size_t result_len) = 0;
+
+ // For forward-compatibility
+ struct OutgoingStreamParameters {};
+ virtual QuartcReliableStreamInterface* CreateOutgoingStream(
+ const OutgoingStreamParameters& params) = 0;
+
+ // Implemented by WebRTC (ICE) code. Used by QUIC for sending and receiving
+ // (hopefully UDP) packets.
+ class Transport {
+ public:
+ // Called by the QuartcPacketWriter to check if the underneath transport
+ // writable.
+ virtual bool CanWrite() = 0;
+ // Called by the QuartcPacketWriter when writing packets to the network.
+ virtual int Write(const char* buffer, size_t buf_len) = 0;
+
+ // Implemented by QUIC code.
+ class Observer {
+ virtual void OnCanWrite() = 0;
+ virtual bool OnReceived(const char* data, size_t data_len) = 0;
+ };
+ virtual void SetObserver(Observer* observer) = 0;
+ };
+ virtual void SetTransport(Transport*) = 0;
+
+ // Implemented by WebRTC code.
+ class Observer {
+ public:
+ virtual void OnCryptoHandshakeComplete() = 0;
+
+ virtual void OnIncomingStream(QuartcReliableStreamInterface* stream) = 0;
+
+ // TODO(zhihuang) Create mapping from integer error code to WebRTC error
+ // code.
+ virtual void OnConnectionClosed(int error_code, bool from_remote) = 0;
+
+ // TODO(zhihuang): Proof verification.
+ };
+ virtual void SetObserver(Observer* observer) = 0;
+};
+} // namespace net
+
+#endif // NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_

Powered by Google App Engine
This is Rietveld 408576698