blob: db6f7702488284483e8233272eb7263564084d3a [file] [log] [blame]
jat@google.com5e86cbd2009-08-22 23:59:24 +00001#ifndef __PROTOCOLVERSIONMESSAGE_H
2#define __PROTOCOLVERSIONMESSAGE_H
3/*
4 * Copyright 2009 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7 * use this file except in compliance with the License. You may obtain a copy of
8 * the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 * License for the specific language governing permissions and limitations under
16 * the License.
17 */
18
19#include <string>
20#include "Message.h"
21#include "BrowserChannel.h"
22#include "Value.h"
23
24class HostChannel;
25
26/**
27 * Class representing a ProtocolVersion message received from the server, and a
28 * way to send one.
29 *
30 * This message indicates which version of the protocol the server has chosen
31 * for the remainder of the communication.
32 */
33class ProtocolVersionMessage : public Message {
34public:
35 static const char TYPE = MESSAGE_TYPE_PROTOCOL_VERSION;
36private:
37 int version;
38
39protected:
40 /**
41 * @param version selected protocol version
42 */
43 ProtocolVersionMessage(int version) : version(version) {}
44
45public:
46 ~ProtocolVersionMessage();
47 virtual char getType() const;
48
49 int getVersion() const { return version; }
50
51 static ProtocolVersionMessage* receive(HostChannel& channel);
52 static bool send(HostChannel& channel, int version);
53};
54#endif