Home | History | Annotate | Download | only in wire
      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_WIRE_POLOWIRELISTENER_H_
     16 #define POLO_WIRE_POLOWIRELISTENER_H_
     17 
     18 #include <stdint.h>
     19 #include <vector>
     20 
     21 namespace polo {
     22 namespace wire {
     23 
     24 // Listener that receives bytes from a wire interface.
     25 class PoloWireListener {
     26  public:
     27   virtual ~PoloWireListener() {}
     28 
     29   // Handles bytes received over the interface.
     30   // @param data the array of bytes that was received
     31   virtual void OnBytesReceived(const std::vector<uint8_t>& data) = 0;
     32 
     33   // Handles a protocol error from the wire interface if there was an error
     34   // sending or receiving data. This should be treated as a fatal error and the
     35   // Polo session should be aborted.
     36   virtual void OnError() = 0;
     37 };
     38 
     39 }  // namespace wire
     40 }  // namespace polo
     41 
     42 #endif  // POLO_WIRE_POLOWIRELISTENER_H_
     43