blob: 793074ca73b8dfcf93a336ebf01fc7ce0ddd431f [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_CLIENTPAIRINGSESSION_H_
16#define POLO_PAIRING_CLIENTPAIRINGSESSION_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 client pairing session. This handles the logic for sending and
27// receiving Polo messages during a pairing session.
28class ClientPairingSession : public PairingSession {
29 public:
30 // Creates a new client 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
34 // @param service_name the service name
35 // @param client_name the client name
36 ClientPairingSession(wire::PoloWireAdapter* wire,
37 PairingContext* context,
38 PoloChallengeResponse* challenge,
39 const std::string& service_name,
40 const std::string& client_name);
41
42 virtual ~ClientPairingSession();
43
44 // @override
45 virtual void OnConfigurationAckMessage(
46 const message::ConfigurationAckMessage& message);
47
48 // @override
49 virtual void OnOptionsMessage(const message::OptionsMessage& message);
50
51 // @override
52 virtual void OnPairingRequestAckMessage(
53 const message::PairingRequestAckMessage& message);
54
55 // @override
56 virtual void OnConfigurationMessage(
57 const message::ConfigurationMessage& message);
58
59 // @override
60 virtual void OnPairingRequestMessage(
61 const message::PairingRequestMessage& message);
62
63 protected:
64 // @override
65 virtual void DoInitializationPhase();
66
67 // @override
68 virtual void DoConfigurationPhase();
69
70 private:
71 std::string service_name_;
72 std::string client_name_;
73};
74
75} // namespace pairing
76} // namespace polo
77
78#endif // POLO_PAIRING_CLIENTPAIRINGSESSION_H_