MythTV  master
dsmccbiop.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) David C.J. Matthews 2005, 2006
3  * Derived from libdsmcc by Richard Palmer
4  */
5 #ifndef DSMCC_BIOP_H
6 #define DSMCC_BIOP_H
7 
8 #include <array>
9 #include <cstdlib>
10 
11 #include "dsmcccache.h"
12 
13 #define BIOP_OBJ_OFFSET 11
14 #define BIOP_TAG_OFFSET 17
15 
17 class Dsmcc;
18 
20 {
21  public:
22  BiopNameComp() = default;
23  ~BiopNameComp();
24 
25  int Process(const unsigned char *data);
26 
27  unsigned char m_idLen {0};
28  unsigned char m_kindLen {0};
29  char *m_id {nullptr};
30  char *m_kind {nullptr};
31 };
32 
33 class BiopName
34 {
35  public:
36  BiopName() = default;
37  ~BiopName();
38 
39  int Process(const unsigned char *data);
40 
41  unsigned char m_compCount {0};
42  BiopNameComp *m_comps {nullptr};
43 };
44 
45 class BiopTap
46 {
47  public:
48  BiopTap() = default;
49  ~BiopTap();
50 
51  int Process(const unsigned char *data);
52 
53  unsigned short m_id {0};
54  unsigned short m_use {0};
55  // Only the association tag is currently used.
56  unsigned short m_assocTag {0};
57  unsigned short m_selectorLen {0};
58  char *m_selectorData {nullptr};
59 };
60 
62 {
63  public:
64  BiopConnbinder() = default;
65  int Process(const unsigned char *data);
66 
67  unsigned long m_componentTag {0};
68  unsigned char m_componentDataLen {0};
69  unsigned char m_tapsCount {0};
71 };
72 
74 {
75  public:
76  BiopObjLocation() = default;
77  ~BiopObjLocation() = default;
78 
79  int Process(const unsigned char *data);
80 
81  unsigned long m_componentTag {0};
83  char m_versionMajor {0};
84  char m_versionMinor {0};
86 };
87 
89 {
90  public:
91  virtual ~ProfileBody() = default;
93  virtual int Process(const unsigned char *) = 0;
94 };
95 
97 {
98  public:
99  ProfileBodyFull() = default;
100  ~ProfileBodyFull() override = default;
101  int Process(const unsigned char *data) override; // ProfileBody
102  DSMCCCacheReference *GetReference() override // ProfileBody
103  { return &m_objLoc.m_reference; }
104 
105  protected:
106  unsigned long m_dataLen {0};
107  char m_byteOrder {0};
110 
111  /* Just for the moment make this public */
112  public:
114  /* ignore the rest */
115 };
116 
118 {
119  public:
120 
121  int Process(const unsigned char *data) override; // ProfileBody
122 
123  // TODO Not currently implemented
124  DSMCCCacheReference *GetReference() override // ProfileBody
125  { return nullptr; }
126 };
127 
128 // IOR - Interoperable Object Reference.
129 class BiopIor
130 {
131  public:
132  BiopIor() = default;
134  {
135  free(m_typeId);
136  delete m_profileBody;
137  }
138 
139  int Process(const unsigned char *data);
140  void AddTap(Dsmcc *pStatus) const;
141 
142  unsigned long m_typeIdLen {0};
143  char *m_typeId {nullptr};
144  unsigned long m_taggedProfilesCount {0};
145  unsigned long m_profileIdTag {0};
147 
148  /* UKProfile - ignore other profiles */
149 };
150 
152 {
153  public:
154  BiopBinding() = default;
155  ~BiopBinding();
156 
157  int Process(const unsigned char *data);
158 
160  char m_bindingType {0};
162  unsigned int m_objInfoLen {0};
163  char *m_objInfo {nullptr};
164 };
165 
166 class ObjCarousel;
167 
169 {
170  public:
171  BiopMessage() = default;
172  ~BiopMessage();
173 
174  bool Process(DSMCCCacheModuleData *cachep, DSMCCCache *cache,
175  unsigned char *data, unsigned long *curp);
176 
177  protected:
178  // Process directories and service gateways.
179  bool ProcessDir(bool isSrg,
180  DSMCCCacheModuleData *cachep, DSMCCCache *cache,
181  const unsigned char *data, unsigned long *curp);
182  // Process files.
183  bool ProcessFile(DSMCCCacheModuleData *cachep, DSMCCCache *cache,
184  unsigned char *data, unsigned long *curp);
185 
186  bool ProcessMsgHdr(const unsigned char *data, unsigned long *curp);
187 
188  protected:
189  unsigned char m_versionMajor {0};
190  unsigned char m_versionMinor {0};
191  unsigned int m_messageSize {0};
193  unsigned long m_objKindLen {0};
194  unsigned int m_objInfoLen {0};
195  char *m_objInfo {nullptr};
196 
197  public:
198  char *m_objKind {nullptr};
199 };
200 
201 // Data extracted from the descriptors in a BiopModuleInfo message
203 {
204  public:
205  ModuleDescriptorData() = default;
206 
207  void Process(const unsigned char *data, int length);
208 
209  bool m_isCompressed {false};
210  unsigned long m_originalSize {0};
211 };
212 
214 {
215  public:
216  int Process(const unsigned char *Data);
217 
218  unsigned long m_modTimeout {0};
219  unsigned long m_blockTimeout {0};
220  unsigned long m_minBlockTime {0};
221  unsigned char m_tapsCount {0};
223 
225 };
226 
228 {
229  public:
230  unsigned short m_moduleId {0};
231  unsigned long m_moduleSize {0};
232  unsigned char m_moduleVersion {0};
233  unsigned char m_moduleInfoLen {0};
234  unsigned char *m_data {nullptr};
235  unsigned int m_curp {0};
237 };
238 
239 #endif
BiopBinding::BiopBinding
BiopBinding()=default
BiopObjLocation
Definition: dsmccbiop.h:74
BiopIor::m_profileIdTag
unsigned long m_profileIdTag
Definition: dsmccbiop.h:145
BiopNameComp::m_idLen
unsigned char m_idLen
Definition: dsmccbiop.h:27
BiopIor::m_profileBody
ProfileBody * m_profileBody
Definition: dsmccbiop.h:146
BiopIor::m_typeIdLen
unsigned long m_typeIdLen
Definition: dsmccbiop.h:142
BiopMessage::ProcessDir
bool ProcessDir(bool isSrg, DSMCCCacheModuleData *cachep, DSMCCCache *cache, const unsigned char *data, unsigned long *curp)
Process a Directory message.
Definition: dsmccbiop.cpp:215
DsmccModuleInfo::m_moduleVersion
unsigned char m_moduleVersion
Definition: dsmccbiop.h:232
BiopMessage::ProcessMsgHdr
bool ProcessMsgHdr(const unsigned char *data, unsigned long *curp)
Definition: dsmccbiop.cpp:151
BiopModuleInfo::m_tap
BiopTap m_tap
Definition: dsmccbiop.h:222
BiopModuleInfo
Definition: dsmccbiop.h:214
BiopMessage::~BiopMessage
~BiopMessage()
Definition: dsmccbiop.cpp:145
BiopNameComp::Process
int Process(const unsigned char *data)
Definition: dsmccbiop.cpp:24
dsmcccache.h
BiopTap::m_use
unsigned short m_use
Definition: dsmccbiop.h:54
DSMCCCacheModuleData
DSMCCCacheModuleData contains information about a module and holds the blocks for a partly completed ...
Definition: dsmccobjcarousel.h:25
BiopMessage::BiopMessage
BiopMessage()=default
BiopMessage::ProcessFile
bool ProcessFile(DSMCCCacheModuleData *cachep, DSMCCCache *cache, unsigned char *data, unsigned long *curp)
Definition: dsmccbiop.cpp:283
BiopName::m_compCount
unsigned char m_compCount
Definition: dsmccbiop.h:41
BiopMessage::m_objInfoLen
unsigned int m_objInfoLen
Definition: dsmccbiop.h:194
BiopObjLocation::BiopObjLocation
BiopObjLocation()=default
BiopBinding::~BiopBinding
~BiopBinding()
Definition: dsmccbiop.cpp:103
DSMCCCache
The object carousel is transmitted as a directed graph.
Definition: dsmcccache.h:87
BiopIor::m_typeId
char * m_typeId
Definition: dsmccbiop.h:143
DsmccModuleInfo::m_moduleId
unsigned short m_moduleId
Definition: dsmccbiop.h:230
BiopObjLocation::m_versionMinor
char m_versionMinor
Definition: dsmccbiop.h:84
BiopModuleInfo::Process
int Process(const unsigned char *Data)
Definition: dsmccbiop.cpp:351
BiopNameComp::m_kind
char * m_kind
Definition: dsmccbiop.h:30
BiopIor
Definition: dsmccbiop.h:130
ProfileBodyLite
Definition: dsmccbiop.h:118
DsmccModuleInfo::m_data
unsigned char * m_data
Definition: dsmccbiop.h:234
BiopTap::m_assocTag
unsigned short m_assocTag
Definition: dsmccbiop.h:56
BiopNameComp::m_kindLen
unsigned char m_kindLen
Definition: dsmccbiop.h:28
ProfileBodyLite::Process
int Process(const unsigned char *data) override
Definition: dsmccbiop.cpp:483
BiopTap::Process
int Process(const unsigned char *data)
Definition: dsmccbiop.cpp:385
BiopMessage::m_objKind
char * m_objKind
Definition: dsmccbiop.h:198
BiopName
Definition: dsmccbiop.h:34
ProfileBodyFull::m_objLoc
BiopObjLocation m_objLoc
Definition: dsmccbiop.h:109
BiopTap::m_selectorLen
unsigned short m_selectorLen
Definition: dsmccbiop.h:57
BiopTap::m_id
unsigned short m_id
Definition: dsmccbiop.h:53
ModuleDescriptorData::Process
void Process(const unsigned char *data, int length)
Definition: dsmccbiop.cpp:321
ProfileBodyLite::GetReference
DSMCCCacheReference * GetReference() override
Definition: dsmccbiop.h:124
BiopName::BiopName
BiopName()=default
BiopMessage::m_objInfo
char * m_objInfo
Definition: dsmccbiop.h:195
BiopIor::Process
int Process(const unsigned char *data)
Definition: dsmccbiop.cpp:527
ProfileBodyFull::Process
int Process(const unsigned char *data) override
Definition: dsmccbiop.cpp:489
BiopModuleInfo::m_descriptorData
ModuleDescriptorData m_descriptorData
Definition: dsmccbiop.h:224
BiopName::Process
int Process(const unsigned char *data)
Definition: dsmccbiop.cpp:47
BiopMessage::m_versionMajor
unsigned char m_versionMajor
Definition: dsmccbiop.h:189
BiopConnbinder
Definition: dsmccbiop.h:62
ProfileBody::GetReference
virtual DSMCCCacheReference * GetReference()=0
BiopIor::AddTap
void AddTap(Dsmcc *pStatus) const
Definition: dsmccbiop.cpp:575
BiopBinding
Definition: dsmccbiop.h:152
BiopName::~BiopName
~BiopName()
Definition: dsmccbiop.cpp:42
ProfileBodyFull::m_dataLen
unsigned long m_dataLen
Definition: dsmccbiop.h:106
ObjCarousel
Definition: dsmccobjcarousel.h:64
DsmccModuleInfo
Definition: dsmccbiop.h:228
BiopObjLocation::m_componentDataLen
char m_componentDataLen
Definition: dsmccbiop.h:82
ProfileBodyFull::m_dsmConn
BiopConnbinder m_dsmConn
Definition: dsmccbiop.h:113
ProfileBodyFull::~ProfileBodyFull
~ProfileBodyFull() override=default
BiopIor::m_taggedProfilesCount
unsigned long m_taggedProfilesCount
Definition: dsmccbiop.h:144
ModuleDescriptorData::ModuleDescriptorData
ModuleDescriptorData()=default
ModuleDescriptorData::m_isCompressed
bool m_isCompressed
Definition: dsmccbiop.h:209
BiopModuleInfo::m_minBlockTime
unsigned long m_minBlockTime
Definition: dsmccbiop.h:220
BiopNameComp::~BiopNameComp
~BiopNameComp()
Definition: dsmccbiop.cpp:16
ProfileBodyFull::GetReference
DSMCCCacheReference * GetReference() override
Definition: dsmccbiop.h:102
BiopObjLocation::m_reference
DSMCCCacheReference m_reference
Definition: dsmccbiop.h:85
BiopBinding::m_bindingType
char m_bindingType
Definition: dsmccbiop.h:160
BiopTap::BiopTap
BiopTap()=default
ModuleDescriptorData::m_originalSize
unsigned long m_originalSize
Definition: dsmccbiop.h:210
BiopConnbinder::Process
int Process(const unsigned char *data)
Definition: dsmccbiop.cpp:418
BiopMessage::m_versionMinor
unsigned char m_versionMinor
Definition: dsmccbiop.h:190
BiopObjLocation::Process
int Process(const unsigned char *data)
Definition: dsmccbiop.cpp:447
DsmccModuleInfo::m_moduleInfoLen
unsigned char m_moduleInfoLen
Definition: dsmccbiop.h:233
ProfileBodyFull::ProfileBodyFull
ProfileBodyFull()=default
ProfileBody::~ProfileBody
virtual ~ProfileBody()=default
BiopNameComp::m_id
char * m_id
Definition: dsmccbiop.h:29
BiopNameComp::BiopNameComp
BiopNameComp()=default
Dsmcc
Definition: dsmcc.h:78
BiopConnbinder::BiopConnbinder
BiopConnbinder()=default
BiopObjLocation::m_componentTag
unsigned long m_componentTag
Definition: dsmccbiop.h:81
BiopConnbinder::m_componentTag
unsigned long m_componentTag
Definition: dsmccbiop.h:67
DsmccModuleInfo::m_modInfo
BiopModuleInfo m_modInfo
Definition: dsmccbiop.h:236
BiopTap::m_selectorData
char * m_selectorData
Definition: dsmccbiop.h:58
DsmccModuleInfo::m_moduleSize
unsigned long m_moduleSize
Definition: dsmccbiop.h:231
BiopTap::~BiopTap
~BiopTap()
Definition: dsmccbiop.cpp:582
BiopBinding::m_name
BiopName m_name
Definition: dsmccbiop.h:159
BiopBinding::m_objInfo
char * m_objInfo
Definition: dsmccbiop.h:163
DSMCCCacheKey
Definition: dsmcccache.h:22
BiopMessage
Definition: dsmccbiop.h:169
BiopMessage::Process
bool Process(DSMCCCacheModuleData *cachep, DSMCCCache *cache, unsigned char *data, unsigned long *curp)
Definition: dsmccbiop.cpp:108
ProfileBodyFull
Definition: dsmccbiop.h:97
BiopMessage::m_messageSize
unsigned int m_messageSize
Definition: dsmccbiop.h:191
BiopMessage::m_objKindLen
unsigned long m_objKindLen
Definition: dsmccbiop.h:193
BiopBinding::m_objInfoLen
unsigned int m_objInfoLen
Definition: dsmccbiop.h:162
BiopBinding::Process
int Process(const unsigned char *data)
Definition: dsmccbiop.cpp:69
BiopMessage::m_objKey
DSMCCCacheKey m_objKey
Definition: dsmccbiop.h:192
ModuleDescriptorData
Definition: dsmccbiop.h:203
BiopModuleInfo::m_tapsCount
unsigned char m_tapsCount
Definition: dsmccbiop.h:221
ProfileBody
Definition: dsmccbiop.h:89
BiopName::m_comps
BiopNameComp * m_comps
Definition: dsmccbiop.h:42
BiopBinding::m_ior
BiopIor m_ior
Definition: dsmccbiop.h:161
BiopModuleInfo::m_blockTimeout
unsigned long m_blockTimeout
Definition: dsmccbiop.h:219
BiopConnbinder::m_componentDataLen
unsigned char m_componentDataLen
Definition: dsmccbiop.h:68
BiopModuleInfo::m_modTimeout
unsigned long m_modTimeout
Definition: dsmccbiop.h:218
BiopIor::BiopIor
BiopIor()=default
DsmccModuleInfo::m_curp
unsigned int m_curp
Definition: dsmccbiop.h:235
BiopIor::~BiopIor
~BiopIor()
Definition: dsmccbiop.h:133
BiopTap
Definition: dsmccbiop.h:46
BiopNameComp
Definition: dsmccbiop.h:20
BiopObjLocation::~BiopObjLocation
~BiopObjLocation()=default
BiopConnbinder::m_tap
BiopTap m_tap
Definition: dsmccbiop.h:70
ProfileBodyFull::m_byteOrder
char m_byteOrder
Definition: dsmccbiop.h:107
ProfileBodyFull::m_liteComponentsCount
char m_liteComponentsCount
Definition: dsmccbiop.h:108
ProfileBody::Process
virtual int Process(const unsigned char *)=0
DSMCCCacheReference
Definition: dsmcccache.h:34
BiopConnbinder::m_tapsCount
unsigned char m_tapsCount
Definition: dsmccbiop.h:69
BiopObjLocation::m_versionMajor
char m_versionMajor
Definition: dsmccbiop.h:83