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

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

Issue 2324833004: Define Stable API for WebRTC/Quartc (Closed)
Patch Set: Create Quartc API 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..e4195d754e91d9c6a2755b37d7d5fe1c66c505cc
--- /dev/null
+++ b/net/quic/quartc/quartc_session_interface.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2012 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"
honghaiz 2016/09/22 18:57:03 Probably do not need to include this. Is it enough
zhihuang1 2016/09/22 19:24:41 We need this for QuartcReliableStreamInterface in
+
+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
honghaiz 2016/09/22 18:57:04 Please explain all arguments.
zhihuang1 2016/09/22 19:24:40 Done.
+ // usage (IN)
honghaiz 2016/09/22 18:57:03 This can be merged to the previous line?
zhihuang1 2016/09/22 19:24:41 Done.
+ // 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
honghaiz 2016/09/22 18:57:05 Can you explain a little more? forward compatibili
zhihuang1 2016/09/22 19:24:41 Done.
+ 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.
honghaiz 2016/09/22 18:57:01 writable => "is writable"
zhihuang1 2016/09/22 19:24:41 Done.
+ virtual bool CanWrite() = 0;
honghaiz 2016/09/22 18:57:06 Is Writable a better name? And below, OnWritable()
zhihuang1 2016/09/22 19:24:40 We choose this is to make it consistent with the n
+ // 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