00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef PLAINPACKET_H 00025 #define PLAINPACKET_H 00026 00027 #include "PlainFile.h" 00028 00029 /**********************************************************************/ 00030 /* PlainPacket */ 00031 /**********************************************************************/ 00032 00033 class PlainPacket 00034 { 00035 int _stopword; 00036 PlainReader* _reader; 00037 unsigned int _stop_pattern[8]; 00038 unsigned int _bytes; 00039 bool _ok; 00040 unsigned _discard_head_bits : 3; 00041 unsigned _discard_to_first_stopword : 1; 00042 unsigned _initialized : 1; 00043 00044 void init(); 00045 00046 int discardBeforeStopWord( ); 00047 00048 public: 00049 PlainPacket( PlainReader* reader, int stopword ); 00050 00067 int copyToStopWord( unsigned char* dest, 00068 unsigned int& max, 00069 unsigned int& discard_head, 00070 unsigned int& discard_tail ); 00071 }; 00072 00073 /**********************************************************************/ 00074 /* PlainFilePacket */ 00075 /**********************************************************************/ 00076 00077 class PlainFilePacket 00078 : public PlainFileReader 00079 , public PlainPacket 00080 { 00081 public: 00082 PlainFilePacket( int fd, int stopword ); 00083 }; 00084 00085 /**********************************************************************/ 00086 /* PlainRopePacket */ 00087 /**********************************************************************/ 00088 00089 class PlainRopePacket 00090 : public PlainRopeReader 00091 , public PlainPacket 00092 { 00093 public: 00094 PlainRopePacket( SH::SinkEndpoint* pull_here, int stopword ); 00095 }; 00096 00097 #endif /* PLAINPACKET_H */ 00098