bugfix in hexdump()
[senf.git] / Examples / DVBAdapter / ULEdec.hh
1 // $Id: ULEdec.cc 355 2007-07-26 14:17:02Z tho $
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 // Definition of non-inline non-template functions
24
25 #include <string>
26 #include <iostream>
27 #include <iomanip>
28 #include <sys/ioctl.h>
29 #include <linux/sockios.h>
30 #include <linux/dvb/dmx.h> 
31
32 #include "Scheduler/Scheduler.hh"
33 #include "Packets/DefaultBundle/EthernetPacket.hh"
34 #include "Packets/MPEGDVBBundle/TransportPacket.hh"
35 #include "Packets/MPEGDVBBundle/SNDUPacket.hh"
36 #include "Utils/membind.hh"
37 #include "Socket/Protocols/DVB/DVBDemuxHandles.hh"
38 #include "Packets/ParseInt.hh"
39 #include "Packets/Packet.hh"
40 #include "Packets/PacketData.hh"
41 #include "Packets/ParseInt.hh"
42
43
44 class ULEdec
45 {
46 public:
47     ULEdec();
48
49 private:
50     typedef senf::PacketData::iterator iterator;
51     
52     enum ReceiverState {
53         Idle,
54         Reassembly
55     };
56     
57     senf::DVBDemuxPESHandle demuxHandle;
58     senf::DVBDvrHandle dvrHandle;
59     
60     senf::SNDUPacket snduPacket;
61     
62     ReceiverState receiver_state;
63     unsigned char priv_tscc;
64     bool priv_sndu_type_1;
65     iterator snduPacketData_iter;
66
67     void handleEvent(senf::FileHandle, senf::Scheduler::EventId event);
68     void handleTSPacket(senf::TransportPacket tsPacket);
69     void handleSNDUPacket();
70     
71     iterator readNewSNDUPacket(iterator i_start, iterator i_end);
72     iterator readContSNDUPacket(iterator i_start, iterator i_end);
73     iterator readRawSNDUPacketData(iterator i_start, iterator i_end);
74     
75     inline bool isSDNUPacketComplete(); 
76     inline iterator::difference_type snduPacketBytesLeft();
77     
78 };
79
80 \f
81 // Local Variables:
82 // mode: c++
83 // fill-column: 100
84 // c-file-style: "senf"
85 // indent-tabs-mode: nil
86 // ispell-local-dictionary: "american"
87 // compile-command: "scons -u test"
88 // comment-column: 40
89 // End: