Ginga  0.13.6
 All Classes Namespaces Functions Variables
DsmccMessageHeader.h
1 /******************************************************************************
2 Este arquivo eh parte da implementacao do ambiente declarativo do middleware
3 Ginga (Ginga-NCL).
4 
5 Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia
6 
7 Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob
8 os termos da Licenca Publica Geral GNU versao 2 conforme publicada pela Free
9 Software Foundation.
10 
11 Este programa eh distribuido na expectativa de que seja util, porem, SEM
12 NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU
13 ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do
14 GNU versao 2 para mais detalhes.
15 
16 Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto
17 com este programa; se nao, escreva para a Free Software Foundation, Inc., no
18 endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
19 
20 Para maiores informacoes:
21 ncl @ telemidia.puc-rio.br
22 http://www.ncl.org.br
23 http://www.ginga.org.br
24 http://www.telemidia.puc-rio.br
25 ******************************************************************************
26 This file is part of the declarative environment of middleware Ginga (Ginga-NCL)
27 
28 Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
29 
30 This program is free software; you can redistribute it and/or modify it under
31 the terms of the GNU General Public License version 2 as published by
32 the Free Software Foundation.
33 
34 This program is distributed in the hope that it will be useful, but WITHOUT ANY
35 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
36 PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
37 details.
38 
39 You should have received a copy of the GNU General Public License version 2
40 along with this program; if not, write to the Free Software
41 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
42 
43 For further information contact:
44 ncl @ telemidia.puc-rio.br
45 http://www.ncl.org.br
46 http://www.ginga.org.br
47 http://www.telemidia.puc-rio.br
48 *******************************************************************************/
49 
50 #ifndef DSMCCMESSAGEHEADER_H_
51 #define DSMCCMESSAGEHEADER_H_
52 
53 extern "C" {
54  #include <sys/stat.h>
55  #include <stdio.h>
56  #include <stdio.h>
57  #include <string.h>
58 }
59 
60 #include <iostream>
61 #include <string>
62 using namespace std;
63 
64 namespace br {
65 namespace pucrio {
66 namespace telemidia {
67 namespace ginga {
68 namespace core {
69 namespace dataprocessing {
70 namespace carousel {
72  private:
73  //origin es is
74  unsigned int pid;
75  string fileName;
76 
77  //
78  // ISO/IEC 13818-6 DSM-CC MESSAGE HEADER
79  //
80 
81  // Must be 0x11 for DSMCC message. (1 byte)
82  unsigned int protocolDiscriminator;
83 
84  // Defines message type. (1 byte)
85  // 0x01 Configuration message
86  // 0x02 Session message
87  // 0x03 Download message
88  // 0x04 Channel change
89  // 0x05 Passthru message
90  unsigned int dsmccType;
91 
92  // Indicates the message type depending on
93  // DSMCC type. (2 bytes)
94  // 0x1001 Dowload info request
95  // 0x1002 Download info response or DII
96  // 0x1003 Download data block (actual data)
97  // 0x1004 Download data request
98  // 0x1005 Download cancel
99  // 0x1006 Download server initiate (DSI)
100  unsigned int messageId;
101 
102  // Used for session integrity and
103  // error. (4 bytes)
104  unsigned int transactionId;
105 
106  // RESERVED BYTE, must be 0xFF.
107 
108  // Indicates the lenght in bytes of the
109  // adaptation header. (1 byte)
110  unsigned int adaptationLength;
111 
112  // The total lenght in bytes of this message
113  // following this field. This lenght includes
114  // any adaptation headers. (2 bytes)
115  unsigned int messageLength;
116 
117  public:
119  int readMessageFromFile(string fileName, unsigned int pid);
120  unsigned int getESId();
121  string getFileName();
122  unsigned int getDsmccType();
123  unsigned int getMessageId();
124  unsigned int getTrasnsactionId();
125  unsigned int getAdaptationLength();
126  unsigned int getMessageLength();
127  void print();
128  };
129 }
130 }
131 }
132 }
133 }
134 }
135 }
136 
137 #endif /*DSMCCMESSAGEHEADER_H_*/