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 *);
25 
26  unsigned char m_id_len {0};
27  unsigned char m_kind_len {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*);
39 
40  unsigned char m_comp_count {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*);
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_assoc_tag {0};
56  unsigned short m_selector_len {0};
57  char *m_selector_data {nullptr};
58 };
59 
61 {
62  public:
63  BiopConnbinder() = default;
64  int Process(const unsigned char*);
65 
66  unsigned long m_component_tag {0};
67  unsigned char m_component_data_len {0};
68  unsigned char m_taps_count {0};
70 };
71 
73 {
74  public:
75  BiopObjLocation() = default;
76  ~BiopObjLocation() = default;
77 
78  int Process(const unsigned char*);
79 
80  unsigned long m_component_tag {0};
82  char m_version_major {0};
83  char m_version_minor {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  virtual ~ProfileBodyFull() = default;
100  int Process(const unsigned char *) override; // ProfileBody
101  DSMCCCacheReference *GetReference() override // ProfileBody
102  { return &m_obj_loc.m_Reference; }
103 
104  protected:
105  unsigned long m_data_len {0};
106  char m_byte_order {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 *) 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_type_id);
135  delete m_profile_body;
136  }
137 
138  int Process(const unsigned char *);
139  void AddTap(Dsmcc *pStatus);
140 
141  unsigned long m_type_id_len {0};
142  char *m_type_id {nullptr};
143  unsigned long m_tagged_profiles_count {0};
144  unsigned long m_profile_id_tag {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_binding_type {0};
161  unsigned int m_objinfo_len {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_version_major {0};
189  unsigned char m_version_minor {0};
190  unsigned int m_message_size {0};
192  unsigned long m_objkind_len {0};
193  unsigned int m_objinfo_len {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_mod_timeout;
218  unsigned long m_block_timeout;
219  unsigned long m_min_blocktime;
220  unsigned char m_taps_count;
222 
224 };
225 
227 {
228  public:
229  unsigned short m_module_id;
230  unsigned long m_module_size;
231  unsigned char m_module_version;
232  unsigned char m_module_info_len;
233  unsigned char *m_data {nullptr};
234  unsigned int m_curp;
236 };
237 
238 #endif
DSMCCCacheReference * GetReference() override
Definition: dsmccbiop.h:101
char * m_kind
Definition: dsmccbiop.h:29
unsigned char * m_data
Definition: dsmccbiop.h:233
BiopObjLocation m_obj_loc
Definition: dsmccbiop.h:108
unsigned short m_id
Definition: dsmccbiop.h:52
unsigned long m_module_size
Definition: dsmccbiop.h:230
int Process(const unsigned char *)
Definition: dsmccbiop.cpp:458
unsigned int m_objinfo_len
Definition: dsmccbiop.h:193
ModuleDescriptorData()=default
ProfileBody * m_profile_body
Definition: dsmccbiop.h:145
bool ProcessFile(DSMCCCacheModuleData *cachep, DSMCCCache *cache, unsigned char *data, unsigned long *curp)
Definition: dsmccbiop.cpp:283
BiopObjLocation()=default
BiopTap m_tap
Definition: dsmccbiop.h:221
int Process(const unsigned char *Data)
Definition: dsmccbiop.cpp:361
unsigned long m_originalSize
Definition: dsmccbiop.h:209
BiopName()=default
void AddTap(Dsmcc *pStatus)
Definition: dsmccbiop.cpp:586
Definition: dsmcc.h:75
BiopIor()=default
unsigned long m_type_id_len
Definition: dsmccbiop.h:141
unsigned short m_module_id
Definition: dsmccbiop.h:229
int Process(const unsigned char *)
Definition: dsmccbiop.cpp:24
char * m_objinfo
Definition: dsmccbiop.h:162
unsigned long m_block_timeout
Definition: dsmccbiop.h:218
ProfileBodyFull()=default
unsigned char m_id_len
Definition: dsmccbiop.h:26
char * m_type_id
Definition: dsmccbiop.h:142
char m_binding_type
Definition: dsmccbiop.h:159
char * m_objkind
Definition: dsmccbiop.h:197
unsigned short m_use
Definition: dsmccbiop.h:53
BiopConnbinder()=default
virtual DSMCCCacheReference * GetReference()=0
char * m_objinfo
Definition: dsmccbiop.h:194
int Process(const unsigned char *)
Definition: dsmccbiop.cpp:396
unsigned short m_selector_len
Definition: dsmccbiop.h:56
unsigned long m_min_blocktime
Definition: dsmccbiop.h:219
DSMCCCacheKey m_objkey
Definition: dsmccbiop.h:191
unsigned char m_version_major
Definition: dsmccbiop.h:188
int Process(const unsigned char *)
Definition: dsmccbiop.cpp:47
unsigned int m_curp
Definition: dsmccbiop.h:234
unsigned char m_version_minor
Definition: dsmccbiop.h:189
unsigned char m_taps_count
Definition: dsmccbiop.h:220
virtual ~ProfileBody()=default
BiopNameComp()=default
DSMCCCacheReference m_Reference
Definition: dsmccbiop.h:84
unsigned int m_objinfo_len
Definition: dsmccbiop.h:161
unsigned char m_module_version
Definition: dsmccbiop.h:231
BiopModuleInfo m_modinfo
Definition: dsmccbiop.h:235
unsigned char m_module_info_len
Definition: dsmccbiop.h:232
bool Process(DSMCCCacheModuleData *cachep, DSMCCCache *cache, unsigned char *data, unsigned long *curp)
Definition: dsmccbiop.cpp:108
BiopTap m_tap
Definition: dsmccbiop.h:69
char m_lite_components_count
Definition: dsmccbiop.h:107
unsigned char m_comp_count
Definition: dsmccbiop.h:40
ModuleDescriptorData m_descriptorData
Definition: dsmccbiop.h:223
DSMCCCacheModuleData contains information about a module and holds the blocks for a partly completed ...
unsigned char m_component_data_len
Definition: dsmccbiop.h:67
unsigned long m_tagged_profiles_count
Definition: dsmccbiop.h:143
unsigned short m_assoc_tag
Definition: dsmccbiop.h:55
BiopIor m_ior
Definition: dsmccbiop.h:160
unsigned char m_taps_count
Definition: dsmccbiop.h:68
The object carousel is transmitted as a directed graph.
Definition: dsmcccache.h:94
DSMCCCacheReference * GetReference() override
Definition: dsmccbiop.h:123
unsigned char m_kind_len
Definition: dsmccbiop.h:27
int Process(const unsigned char *data)
Definition: dsmccbiop.cpp:69
unsigned int m_message_size
Definition: dsmccbiop.h:190
char m_component_data_len
Definition: dsmccbiop.h:81
char m_version_minor
Definition: dsmccbiop.h:83
unsigned long m_data_len
Definition: dsmccbiop.h:105
unsigned long m_objkind_len
Definition: dsmccbiop.h:192
int Process(const unsigned char *)
Definition: dsmccbiop.cpp:429
virtual int Process(const unsigned char *)=0
int Process(const unsigned char *) override
Definition: dsmccbiop.cpp:494
int Process(const unsigned char *)
Definition: dsmccbiop.cpp:538
void Process(const unsigned char *data, int length)
Definition: dsmccbiop.cpp:323
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
bool ProcessMsgHdr(const unsigned char *data, unsigned long *curp)
Definition: dsmccbiop.cpp:151
BiopTap()=default
unsigned long m_component_tag
Definition: dsmccbiop.h:66
BiopName m_name
Definition: dsmccbiop.h:158
char * m_id
Definition: dsmccbiop.h:28
unsigned long m_profile_id_tag
Definition: dsmccbiop.h:144
char m_version_major
Definition: dsmccbiop.h:82
virtual ~ProfileBodyFull()=default
BiopNameComp * m_comps
Definition: dsmccbiop.h:41
unsigned long m_mod_timeout
Definition: dsmccbiop.h:217
unsigned long m_component_tag
Definition: dsmccbiop.h:80
int Process(const unsigned char *) override
Definition: dsmccbiop.cpp:500
~BiopIor()
Definition: dsmccbiop.h:132
BiopMessage()=default
char * m_selector_data
Definition: dsmccbiop.h:57
~BiopObjLocation()=default
BiopConnbinder m_dsm_conn
Definition: dsmccbiop.h:112