1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 // -*- c++ -*- 19 #ifndef PACKET_IO_H 20 #define PACKET_IO_H 21 22 #include "packet.h" 23 24 typedef enum 25 { 26 PACKET_IO_SUCCESS = 0, 27 PACKET_IO_FAILURE 28 } TPvPacketIoStatus; 29 30 class PacketInputObserver 31 { 32 public: ~PacketInputObserver()33 virtual ~PacketInputObserver() {} 34 virtual void PacketInComplete(TPvPacketIoStatus status) = 0; 35 }; 36 37 /* A PacketInput interface is implemented to receive packets. */ 38 class PacketInput 39 { 40 public: PacketInput()41 PacketInput() : iPacketInputObserver(NULL) 42 { 43 44 } 45 virtual void PacketIn(Packet* pack) = 0; PacketIn(Packet * pack,bool,int32)46 virtual void PacketIn(Packet* pack, bool /*crc_error*/, int32 /*seq_num_error*/) 47 { 48 PacketIn(pack); 49 } ~PacketInput()50 virtual ~PacketInput() {} SetPacketInputObserver(PacketInputObserver * observer)51 virtual void SetPacketInputObserver(PacketInputObserver* observer) 52 { 53 iPacketInputObserver = observer; 54 } 55 protected: 56 PacketInputObserver* iPacketInputObserver; 57 }; 58 59 /* PacketOutput interface is implemented to indicate packets via the PacketInput interface */ 60 class PacketOutput 61 { 62 public: PacketOutput()63 PacketOutput() : pPktOutput(NULL) 64 { 65 } SetPacketOutput(PacketInput * packet_output)66 void SetPacketOutput(PacketInput* packet_output) 67 { 68 pPktOutput = packet_output; 69 } ResetPacketOutput(void)70 void ResetPacketOutput(void) 71 { 72 pPktOutput = NULL; 73 } 74 protected: 75 PacketInput* pPktOutput; 76 }; 77 78 #endif 79