Home | History | Annotate | Download | only in message
      1 // 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_MESSAGE_MESSAGELISTENER_H_
     16 #define POLO_PAIRING_MESSAGE_MESSAGELISTENER_H_
     17 
     18 #include "polo/pairing/poloerror.h"
     19 #include "polo/pairing/message/configurationackmessage.h"
     20 #include "polo/pairing/message/configurationmessage.h"
     21 #include "polo/pairing/message/optionsmessage.h"
     22 #include "polo/pairing/message/pairingrequestackmessage.h"
     23 #include "polo/pairing/message/pairingrequestmessage.h"
     24 #include "polo/pairing/message/secretackmessage.h"
     25 #include "polo/pairing/message/secretmessage.h"
     26 
     27 namespace polo {
     28 namespace pairing {
     29 namespace message {
     30 
     31 // A listener interface for Polo messages.
     32 class MessageListener {
     33  public:
     34   virtual ~MessageListener() {}
     35 
     36   // Handles a message containing the peer's configuration.
     37   virtual void OnConfigurationMessage(
     38       const ConfigurationMessage& message) = 0;
     39 
     40   // Handles an acknowledgment that the peer received the local configuration.
     41   virtual void OnConfigurationAckMessage(
     42       const ConfigurationAckMessage& message) = 0;
     43 
     44   // Handles a message containing the peer's supported pairing options.
     45   virtual void OnOptionsMessage(const OptionsMessage& message) = 0;
     46 
     47   // Handles a message from the peer requesting a pairing session.
     48   virtual void OnPairingRequestMessage(
     49       const PairingRequestMessage& message) = 0;
     50 
     51   // Handles a message from the peer acknowledging a pairing request.
     52   virtual void OnPairingRequestAckMessage(
     53       const PairingRequestAckMessage& message) = 0;
     54 
     55   // Handles a challenge message from the peer.
     56   virtual void OnSecretMessage(const SecretMessage& message) = 0;
     57 
     58   // Handles an challenge response from the peer.
     59   virtual void OnSecretAckMessage(const SecretAckMessage& message) = 0;
     60 
     61   // Handles a Polo error.
     62   virtual void OnError(PoloError error) = 0;
     63 };
     64 
     65 }  // namespace message
     66 }  // namespace pairing
     67 }  // namespace polo
     68 
     69 #endif  // POLO_PAIRING_MESSAGE_MESSAGELISTENER_H_
     70