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..fbd493dc2c65262911da1bd911315284fbe58df2 |
--- /dev/null |
+++ b/net/quic/quartc/quartc_session_interface.h |
@@ -0,0 +1,75 @@ |
+// 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 { |
Ryan Hamilton
2016/09/23 19:56:45
nit: newline after
|
+class QuartcSessionInterface { |
Ryan Hamilton
2016/09/23 19:56:45
nit: class comment, please
|
+ public: |
+ virtual void StartCryptoHandshake() = 0; |
Ryan Hamilton
2016/09/23 19:56:45
What does this method do when the underlying sessi
zhihuang1
2016/09/24 06:54:05
Then it just call QuicSession::Initialize().
I t
|
+ |
+ // 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; |
+ // optional, can be NULL, 0 (IN) |
+ // use_context -- whether to use the context value |
+ // (needed to distinguish no context from |
+ // zero-length ones). |
+ // result -- where to put the computed value |
+ // result_len -- the length of the computed value |
+ virtual bool ExportKeyingMaterial(const std::string& label, |
+ const uint8_t* context, |
+ size_t context_len, |
+ bool used_context, |
+ uint8_t* result, |
+ size_t result_len) = 0; |
+ |
+ // For forward-compatibility. We can add more parameters to the function |
Ryan Hamilton
2016/09/23 19:56:45
nit: Avoid using first person in comments.
zhihuang1
2016/09/24 06:54:05
Done.
|
+ // through the struct without actually changing the API. |
+ 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; |
Ryan Hamilton
2016/09/23 19:56:44
nit: newlines between methods, please
zhihuang1
2016/09/24 06:54:05
Done.
|
+ // 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. |
Ryan Hamilton
2016/09/23 19:56:44
Can you add a comment to explain what this class d
zhihuang1
2016/09/24 06:54:06
Sure. I should have done this.
|
+ class Observer { |
Ryan Hamilton
2016/09/23 19:56:45
I think the same Observer->Delegate change would b
zhihuang1
2016/09/24 06:54:06
Done.
|
+ virtual void OnCanWrite() = 0; |
+ virtual bool OnReceived(const char* data, size_t data_len) = 0; |
+ }; |
+ virtual void SetObserver(Observer* observer) = 0; |
+ }; |
+ |
+ // Implemented by WebRTC code. |
+ class Observer { |
Ryan Hamilton
2016/09/23 19:56:45
I think the same Observer->Delegate change would b
zhihuang1
2016/09/24 06:54:06
Done.
|
+ 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_ |