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