summaryrefslogtreecommitdiffstats
path: root/net/quic/quic_crypto_client_stream.cc
blob: cfc237fef2fc5822c60fead3e98d6541b89877a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 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.

#include "net/quic/quic_crypto_client_stream.h"

#include "net/quic/crypto/crypto_protocol.h"
#include "net/quic/quic_protocol.h"

namespace net {

QuicCryptoClientStream::QuicCryptoClientStream(QuicSession* session)
    : QuicCryptoStream(session) {
}


void QuicCryptoClientStream::OnHandshakeMessage(
    const CryptoHandshakeMessage& message) {
  // Do not process handshake messages after the handshake is complete.
  if (handshake_complete()) {
    CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE);
    return;
  }

  if (message.tag != kSHLO) {
    CloseConnection(QUIC_INVALID_CRYPTO_MESSAGE_TYPE);
    return;
  }

  // TODO(rch): correctly validate the message
  SetHandshakeComplete(QUIC_NO_ERROR);
  return;
}

}  // namespace net