File: CCSParam.h

package info (click to toggle)
capi4hylafax 1%3A01.02.03-10sarge2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,856 kB
  • ctags: 2,966
  • sloc: cpp: 20,126; sh: 7,703; makefile: 215; perl: 36
file content (489 lines) | stat: -rw-r--r-- 16,244 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
/*---------------------------------------------------------------------------*\

    Copyright (C) 2000 AVM GmbH. All rights reserved.

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY, without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, and WITHOUT
    ANY LIABILITY FOR ANY DAMAGES arising out of or in connection
    with the use or performance of this software. See the
    GNU General Public License for further details.

\*---------------------------------------------------------------------------*/

#ifndef _CCSPARAM_H_
#define _CCSPARAM_H_

#include "CCStruct.h"

#pragma pack(1)
/*===========================================================================*\
\*===========================================================================*/

class cp_content_dword : public CCStruct {
public:
    cp_content_dword (c_dword val = 0)
      : CCStruct (cxt_StructData, &Value, sizeof (c_dword)),
        Value (val) {}

    c_dword Value;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_content_string : public CCStruct {
public:
    cp_content_string (CDynamicString *str = 0)
      : CCStruct (&pString, cxf_STRING),
        pString (str) {}

    CDynamicString *pString;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_content_packet : public CCStruct {
public:
    cp_content_packet (CDataPacket *pack = 0)
      : CCStruct (&pPacket, cxf_PACKET),
        pPacket (pack) {}

    CDataPacket *pPacket;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_content_selector : public CCStruct {
public:
    cp_content_selector (c_dword select = 0, CCStruct *param = 0)
      : CCStruct (&Selector, cxf_04 cxf_STRUCT),
        Selector (select),
        pParameter (param) {}

    c_dword   Selector;
    CCStruct *pParameter;
};

class cp_content_selector_store : public cp_content_selector {
public:
    cp_content_selector_store (c_dword select = 0)
      : cp_content_selector (select, &m_Parameter) {}

private:
    CCStructStore m_Parameter;
};


/*===========================================================================*\
\*===========================================================================*/

class cp_callednumber : public CCStruct {
public:
    cp_callednumber (CDynamicString *num = 0)
      : CCStruct (cxt_CalledPartyNumber, &Type, cxf_01 cxf_STRING),
        Type (0x80),
        pNumber (num) {}

    c_byte          Type;
    CDynamicString *pNumber;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_callingnumber : public CCStruct {
public:
    cp_callingnumber (c_byte indicator = CALLNUM_INDICATOR_DEFAULT)
      : CCStruct (cxt_CallingPartyNumber, &Type, cxf_02 cxf_STRING),
        Type (0x00),
        Indicator (indicator),
        pNumber (&m_Number) {}

    c_byte          Type;
    c_byte          Indicator;
    CDynamicString *pNumber;

    void ResetNumber (void) {
        Type      = 0x00;
        Indicator = CALLNUM_INDICATOR_DEFAULT;
        pNumber   = &m_Number;
        m_Number.RemoveAll();
    };

private:
    CDynamicString m_Number;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

typedef cp_callingnumber cp_connectednumber;


/*===========================================================================*\
\*===========================================================================*/

class cp_bprotocol : public CCStruct {
public:
    cp_bprotocol (c_b1prot b1prot = b1prot_HDLC, c_b2prot b2prot = b2prot_X75,
                  c_b3prot b3prot = b3prot_Transparent, CCStruct *pb1config = 0, CCStruct *pb2config = 0,
                  CCStruct *pb3config = 0, CCStruct *pgconfig = 0)
      : CCStruct (cxt_BProtocol, &B1Protocol, cxf_B1PROT cxf_B2PROT cxf_B3PROT cxf_STRUCT cxf_STRUCT cxf_STRUCT cxf_STRUCT),
        B1Protocol (b1prot),
        B2Protocol (b2prot),
        B3Protocol (b3prot),
        pB1Configuration (pb1config),
        pB2Configuration (pb2config),
        pB3Configuration (pb3config),
        pGlobalConfiguration (pgconfig) {}

    c_b1prot  B1Protocol;
    c_b2prot  B2Protocol;
    c_b3prot  B3Protocol;
    CCStruct *pB1Configuration;
    CCStruct *pB2Configuration;
    CCStruct *pB3Configuration;
    CCStruct *pGlobalConfiguration;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_bprotocol_store : public cp_bprotocol {
public:
    cp_bprotocol_store (void)
     : cp_bprotocol (b1prot_HDLC, b2prot_X75, b3prot_Transparent, &m_B1Configuration,
                     &m_B2Configuration, &m_B3Configuration, &m_GlobalConfiguration) {}
private:
    CCStructStore m_B1Configuration;
    CCStructStore m_B2Configuration;
    CCStructStore m_B3Configuration;
    CCStructStore m_GlobalConfiguration;
};


/*===========================================================================*\
\*===========================================================================*/

class cp_b1configuration : public CCStruct {
protected:
    cp_b1configuration (tCapiStructType type, void *data, tFormatChar *format)
      : CCStruct (type, data, format) {}
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_b1configuration_atm : public cp_b1configuration {
public:
    cp_b1configuration_atm (c_word vcc = 0, c_word vpi = 0, c_word vci = 0)
      : cp_b1configuration (cxt_B1Config, &VCC, cxf_06),
        VCC (vcc),
        VPI (vpi),
        VCI (vci) {}

    c_word VCC;
    c_word VPI;
    c_word VCI;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_b1configuration_all : public cp_b1configuration {
public:
    cp_b1configuration_all (c_b1prot b1prot)
      : cp_b1configuration (cxt_B1Config, &MaximumBitRate, &m_Format[0]),
        MaximumBitRate (0),
        BitsPerCharacter (0),
        Parity (0),
        StopBits (0),
        Options (0),
        SpeedNegotiation (0),
        TransmitLevelInDB (0),
        ATM_VCC (0),
        ATM_VPI (0),
        ATM_VCI (0) {

        switch (b1prot) {
        default:
            // dwarning (0);
            // no break;
        case b1prot_HDLC:
        case b1prot_Transparent:
        case b1prot_invertedHDLC:
        case b1prot_56kBitTransparent:
            s_strncpy (&m_Format[0], cxf_CONST, 2);
            break;
        case b1prot_V110_asynch:
        case b1prot_V110_synch:
            s_strncpy (&m_Format[0], cxf_08, 2);
            break;
        case b1prot_G3Fax:
            s_strncpy (&m_Format[0], cxf_08 cxf_I_04 cxf_02, 4);
            break;
        case b1prot_Modem_negotiate:
        case b1prot_Modem_asynch:
        case b1prot_Modem_synch:
            s_strncpy (&m_Format[0], cxf_0C, 2);
            break;
        case b1prot_ATM:
            s_strncpy (&m_Format[0], cxf_I_0E cxf_06, 3);
            break;
        }
    }

    c_word MaximumBitRate;                 // 2, 3, 4, 7, 8, 9
    c_word BitsPerCharacter;               // 2, 7, 8
    c_word Parity;                         // 2, 7, 8
    c_word StopBits;                       // 2, 7, 8
    c_word Options;                        // 7, 8, 9
    c_word SpeedNegotiation;               // 7, 8, 9
    c_word TransmitLevelInDB;              // 4
    c_word ATM_VCC;                        // 28
    c_word ATM_VPI;                        // 28
    c_word ATM_VCI;                        // 28

private:
    tFormatChar m_Format[4];
};


/*===========================================================================*\
\*===========================================================================*/

class cp_b3configuration : public CCStruct {
protected:
    cp_b3configuration (void *data, tFormatChar *format)
      : CCStruct (cxt_B1Config, data, format) {}
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_b3configuration_faxext : public cp_b3configuration {
public:
    cp_b3configuration_faxext (c_word opts = 0, CDynamicString *station = 0, CDynamicString *head = 0)
      : cp_b3configuration (&Options, cxf_02 cxf_Z_02 cxf_STRUCT cxf_STRUCT),
        Options (opts),
        pStationID (&m_StationID),
        pHeadLine (&m_HeadLine),
        m_StationID (station),
        m_HeadLine (head) {}

    c_word             Options;
    cp_content_string *pStationID;
    cp_content_string *pHeadLine;

private:
    tFormatChar       m_Format[7];
    cp_content_string m_StationID;
    cp_content_string m_HeadLine;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_b3configuration_all : public cp_b3configuration {
public:
    cp_b3configuration_all (c_b3prot b3prot, CDynamicString *station = 0, CDynamicString *head = 0)
      : cp_b3configuration (&LIC, &m_Format[0]),
        LIC (0),
        HIC (0),
        LTC (0),
        HTC (0),
        LOC (0),
        HOC (0),
        ModuloMode (0),
        WindowSize (0),
        Resolution (0),
        Options (0),
        Format (0),
        pStationID (&m_StationID),
        pHeadLine (&m_HeadLine),
        m_StationID (station),
        m_HeadLine (head) {

        switch (b3prot) {
        default:
            // dwarning (0);
            // no break!
        case b3prot_Transparent:
        case b3prot_Modem:
        case b3prot_ADSL:
            s_strncpy (&m_Format[0], cxf_CONST, 2);
            break;
        case b3prot_T90NL:
        case b3prot_ISO8208:
        case b3prot_X25:
            s_strncpy (&m_Format[0], cxf_10, 2);
            break;
        case b3prot_G3Fax:
            s_strncpy (&m_Format[0], cxf_I_10 cxf_02 cxf_I_02 cxf_02 cxf_STRUCT cxf_STRUCT, 7);
            break;
        case b3prot_G3Fax_extended:
            s_strncpy (&m_Format[0], cxf_I_12 cxf_04 cxf_STRUCT cxf_STRUCT, 5);
            break;
        }
    }

    c_word             LIC;                            // 1, 2, 3
    c_word             HIC;                            // 1, 2, 3
    c_word             LTC;                            // 1, 2, 3
    c_word             HTC;                            // 1, 2, 3
    c_word             LOC;                            // 1, 2, 3
    c_word             HOC;                            // 1, 2, 3
    c_word             ModuloMode;                     // 1, 2, 3
    c_word             WindowSize;                     // 1, 2, 3
    c_word             Resolution;                     // 4
    c_word             Options;                        // 5
    c_word             Format;                         // 4, 5
    cp_content_string *pStationID;                     // 4, 5
    cp_content_string *pHeadLine;                      // 4, 5

private:
    tFormatChar       m_Format[7];
    cp_content_string m_StationID;
    cp_content_string m_HeadLine;
};


/*===========================================================================*\
\*===========================================================================*/

class cp_addinfo : public CCStruct {
public:
    cp_addinfo (CCStruct *chinfo = 0, CCStruct *keyfac = 0, CCStruct *useruser = 0, CCStruct *facdata = 0)
      : CCStruct (cxt_AdditionalInfo, &pBChannelInformation, cxf_STRUCT cxf_STRUCT cxf_STRUCT cxf_STRUCT),
        pBChannelInformation (chinfo),
        pKeypadFacility (keyfac),
        pUserUserData (useruser),
        pFacilityDataArray (facdata) {}

    CCStruct *pBChannelInformation;
    CCStruct *pKeypadFacility;
    CCStruct *pUserUserData;
    CCStruct *pFacilityDataArray;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_addinfo_store : public cp_addinfo {
public:
    cp_addinfo_store (void)
      : cp_addinfo (&m_BChannelInformation, &m_KeypadFacility, &m_UserUserData, &m_FacilityDataArray) {}

private:
    CCStructStore m_BChannelInformation;
    CCStructStore m_KeypadFacility;
    CCStructStore m_UserUserData;
    CCStructStore m_FacilityDataArray;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_addinfo_ref : public cp_addinfo {
public:
    cp_addinfo_ref (void)
      : cp_addinfo (&m_BChannelInformation, &m_KeypadFacility, &m_UserUserData, &m_FacilityDataArray) {}

private:
    CCStruct m_BChannelInformation;
    CCStruct m_KeypadFacility;
    CCStruct m_UserUserData;
    CCStruct m_FacilityDataArray;
};


/*===========================================================================*\
\*===========================================================================*/

class cp_ncpi : public CCStruct {
protected:
    cp_ncpi (void *data, tFormatChar *format)
      : CCStruct (cxt_Ncpi, data, format) {}
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_ncpi_faxext : public cp_ncpi {
public:
    cp_ncpi_faxext (c_word opt = 0)
      : cp_ncpi (&Options, cxf_Z_02 cxf_02 cxf_Z_05),
        Options (opt) {}

    c_word Options;
};

/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/

class cp_ncpi_all : public cp_ncpi {
public:
    cp_ncpi_all (c_b3prot b3prot)
      : cp_ncpi (&Rate, &m_Format[0]),
        Rate (0),
        Protocol (0),
        Options (0),
        Resolution (0),
        Format (0),
        Pages (0),
        Flags (0),
        Group (0),
        Channel (0),
        pReceiveID (&m_ReceiveID) {

        switch (b3prot) {
        case b3prot_ISO8208:
        case b3prot_X25:
            s_strncpy (&m_Format[0], cxf_I_0C cxf_03, 3);
            break;
        case b3prot_G3Fax:
            s_strncpy (&m_Format[0], cxf_02 cxf_I_04 cxf_06 cxf_I_03 cxf_STRUCT, 6);
            break;
        case b3prot_G3Fax_extended:
            s_strncpy (&m_Format[0], cxf_02 cxf_I_02 cxf_02 cxf_I_02 cxf_04 cxf_I_03 cxf_STRUCT, 8);
            break;
        case b3prot_Modem:
            s_strncpy (&m_Format[0], cxf_04, 2);
            break;
        default:
            // nothing to do
            break;
        }
    }

    c_word    Rate;                           // 4, 5, 7
    c_word    Protocol;                       // 7
    c_word    Options;                        // 5
    c_word    Resolution;                     // 4
    c_word    Format;                         // 4, 5
    c_word    Pages;                          // 4, 5
    c_byte    Flags;                          // 2, 3
    c_byte    Group;                          // 2, 3
    c_byte    Channel;                        // 2, 3
    CCStruct *pReceiveID;                     // 4, 5

private:
    tFormatChar m_Format[8];
    CCStruct    m_ReceiveID;
};


/*===========================================================================*\
\*===========================================================================*/
#pragma pack()

#endif