blob: 2bbfa17bf560311cfb0fa0b6b890701dafbf049c [file] [log] [blame]
Jerome Poichet7c997852014-05-20 10:50:05 -07001// Copyright 2012 Google Inc. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef POLO_PAIRING_SERVERPAIRINGSESSION_H_
16#define POLO_PAIRING_SERVERPAIRINGSESSION_H_
17
18#include <string>
19
20#include "polo/pairing/pairingsession.h"
21#include "polo/pairing/pairinglistener.h"
22
23namespace polo {
24namespace pairing {
25
26// A Polo server pairing session. This handles the logic for sending and
27// receiving Polo messages during a pairing session.
28class ServerPairingSession : public PairingSession {
29 public:
30 // Creates a new server pairing session.
31 // @param wire the wire adapter used to send and receive Polo messages
32 // @param context the Polo pairing context
33 // @param challenge the challenge response
34 // @param server_name the server name
35 ServerPairingSession(wire::PoloWireAdapter *wire,
36 PairingContext *context,
37 PoloChallengeResponse* challenge,
38 const std::string &server_name);
39
40 ~ServerPairingSession();
41
42 // @override
43 virtual void OnPairingRequestMessage(
44 const message::PairingRequestMessage& message);
45
46 // @override
47 virtual void OnOptionsMessage(
48 const message::OptionsMessage& message);
49
50 // @override
51 virtual void OnConfigurationMessage(
52 const message::ConfigurationMessage& message);
53
54 // @override
55 virtual void OnConfigurationAckMessage(
56 const message::ConfigurationAckMessage& message);
57
58 // @override
59 virtual void OnPairingRequestAckMessage(
60 const message::PairingRequestAckMessage& message);
61
62 protected:
63 // @override
64 virtual void DoInitializationPhase();
65
66 // @override
67 virtual void DoConfigurationPhase();
68
69 private:
70 std::string server_name_;
71};
72
73} // namespace pairing
74} // namespace polo
75
76#endif // POLO_PAIRING_SERVERPAIRINGSESSION_H_