-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathmpc.c
668 lines (557 loc) · 23.3 KB
/
mpc.c
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
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
/* MPC.C (c) Copyright Jan Jaeger, 2010-2012 */
/* (c) Copyright Ian Shorter, 2011-2012 */
/* (c) Copyright Harold Grovesteen, 2011-2012 */
/* MPC (Multi-Path Channel) functions */
/* This implementation is based on the S/390 Linux implementation */
#include "hstdinc.h"
#if !defined(_HENGINE_DLL_)
#define _HENGINE_DLL_
#endif
#if !defined(_MPC_C_)
#define _MPC_C_
#endif
#include "hercules.h"
#include "mpc.h"
/*--------------------------------------------------------------------*/
/* mpc_point_ipa(): */
/*--------------------------------------------------------------------*/
DLL_EXPORT MPC_IPA* mpc_point_ipa( DEVBLK* pDEVBLK, MPC_TH* pMPC_TH, MPC_RRH* pMPC_RRH )
{
MPC_PH* pMPC_PH;
MPC_IPA* pMPC_IPA;
U32 uOffData;
U16 uOffPH;
UNREFERENCED( pDEVBLK );
// Point to the MPC_PH.
FETCH_HW( uOffPH, pMPC_RRH->offph );
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_RRH + uOffPH);
// Get the length of and point to the data referenced by the
// MPC_PH. The data contain a MPC_IPA.
FETCH_FW( uOffData, pMPC_PH->offdata );
pMPC_IPA = (MPC_IPA*)((BYTE*)pMPC_TH + uOffData);
return pMPC_IPA;
} /* End function mpc_point_ipa() */
/*--------------------------------------------------------------------*/
/* mpc_point_puk(): */
/*--------------------------------------------------------------------*/
DLL_EXPORT MPC_PUK* mpc_point_puk( DEVBLK* pDEVBLK, MPC_TH* pMPC_TH, MPC_RRH* pMPC_RRH )
{
MPC_PH* pMPC_PH;
MPC_PUK* pMPC_PUK;
U32 uOffData;
U16 uOffPH;
UNREFERENCED( pDEVBLK );
// Point to the MPC_PH.
FETCH_HW( uOffPH, pMPC_RRH->offph );
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_RRH + uOffPH);
// Get the length of and point to the data referenced by the
// MPC_PH. The data contain a MPC_PUK and one or more MPC_PUSs.
FETCH_FW( uOffData, pMPC_PH->offdata );
pMPC_PUK = (MPC_PUK*)((BYTE*)pMPC_TH + uOffData);
return pMPC_PUK;
} /* End function mpc_point_puk() */
/*--------------------------------------------------------------------*/
/* mpc_point_pus(): */
/*--------------------------------------------------------------------*/
/* Return a pointer to the MPC_PUS of the required type. If the */
/* required type is not found a null pointer is returned. Although */
/* never seen, if multiple MPC_PUS of the required type exist, only */
/* the first MPC_PUS of the required type will ever be returned. */
DLL_EXPORT MPC_PUS* mpc_point_pus( DEVBLK* pDEVBLK, MPC_PUK* pMPC_PUK, BYTE bType )
{
MPC_PUS* pMPC_PUS;
int iTotLenPUS;
U16 uTotLenPUS;
U16 uLenPUS;
U16 uLenPUK;
UNREFERENCED( pDEVBLK );
/* Get the length of the MPC_PUK, the total length of the */
/* following MPC_PUSs, then point to the first MPC_PUS. */
FETCH_HW( uLenPUK, pMPC_PUK->length );
FETCH_HW( uTotLenPUS, pMPC_PUK->lenpus );
iTotLenPUS = uTotLenPUS;
pMPC_PUS = (MPC_PUS*)((BYTE*)pMPC_PUK + uLenPUK);
/* Find the required MPC_PUS. */
while( iTotLenPUS > 0 )
{
/* Ensure there are at least the first 4-bytes of an MPC_PUS. */
if( iTotLenPUS < 4 )
return NULL;
/* Get the length of the MPC_PUS. */
FETCH_HW( uLenPUS, pMPC_PUS->length );
if( uLenPUS == 0 ) /* Better safe than sorry */
return NULL;
/* Ensure there is the whole of the MPC_PUS. */
if( iTotLenPUS < uLenPUS )
return NULL;
/* Check for the required MPC_PUS. */
if( pMPC_PUS->type == bType )
return pMPC_PUS;
/* Point to the next MPC_PUS. */
pMPC_PUS = (MPC_PUS*)((BYTE*)pMPC_PUS + uLenPUS);
iTotLenPUS -= uLenPUS;
}
return NULL;
} /* End function mpc_point_pus() */
/*--------------------------------------------------------------------*/
/* mpc_display_description(): */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_description( DEVBLK* pDEVBLK, char* pDesc )
{
/* Display description, if one has been provided. */
if( pDesc )
{
if( pDEVBLK )
{
// HHC03983 "%1d:%04X %s: %s
WRMSG(HHC03983, "D", SSID_TO_LCSS(pDEVBLK->ssid), pDEVBLK->devnum, pDEVBLK->typname, pDesc );
}
else
{
// HHC03984 "%s"
WRMSG(HHC03984, "D", pDesc );
}
}
return;
} /* End function mpc_display_description() */
/*--------------------------------------------------------------------*/
/* mpc_display_stuff() */
/*--------------------------------------------------------------------*/
/* Function to display storage. */
DLL_EXPORT void mpc_display_stuff( DEVBLK* pDEVBLK, char* cWhat, BYTE* pAddr, int iLen, BYTE bDir )
{
int offset;
unsigned int i;
u_char c = '\0';
u_char e = '\0';
char print_ascii[17];
char print_ebcdic[17];
char print_line[64];
char tmp[32];
for( offset = 0; offset < iLen; )
{
memset( print_ascii, ' ', sizeof(print_ascii)-1 ); /* set to spaces */
print_ascii[sizeof(print_ascii)-1] = '\0'; /* with null termination */
memset( print_ebcdic, ' ', sizeof(print_ebcdic)-1 ); /* set to spaces */
print_ebcdic[sizeof(print_ebcdic)-1] = '\0'; /* with null termination */
memset( print_line, 0, sizeof( print_line ) );
snprintf( (char*)print_line, sizeof(print_line), "+%4.4X%c ", offset, bDir );
print_line[sizeof(print_line)-1] = '\0'; /* force null termination */
for( i = 0; i < 16; i++ )
{
c = *pAddr++;
if( offset < iLen )
{
snprintf((char *) tmp, 32, "%2.2X", c );
tmp[sizeof(tmp)-1] = '\0';
strlcat((char *) print_line, (char *) tmp, sizeof(print_line) );
print_ebcdic[i] = print_ascii[i] = '.';
e = guest_to_host( c );
if( isprint( e ) )
print_ebcdic[i] = e;
if( isprint( c ) )
print_ascii[i] = c;
}
else
{
strlcat((char *) print_line, " ", sizeof(print_line) );
}
offset++;
if( ( offset & 3 ) == 0 )
{
strlcat((char *) print_line, " ", sizeof(print_line) );
}
}
if( pDEVBLK )
{
// HHC03981 "%1d:%04X %s: %s: %s %s %s"
WRMSG(HHC03981, "D", SSID_TO_LCSS(pDEVBLK->ssid), pDEVBLK->devnum, pDEVBLK->typname,
cWhat, print_line, print_ascii, print_ebcdic );
}
else
{
// HHC03982 "%s: %s %s %s"
WRMSG(HHC03982, "D", cWhat, print_line, print_ascii, print_ebcdic );
}
}
return;
} /* End function mpc_display_stuff() */
/*--------------------------------------------------------------------*/
/* mpc_display_th(): Display Transport Header (MPC_TH) */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_th( DEVBLK* pDEVBLK, MPC_TH* pMPC_TH, BYTE bDir )
{
U32 uOffRRH;
// Display the MPC_TH.
FETCH_FW( uOffRRH, pMPC_TH->offrrh );
mpc_display_stuff( pDEVBLK, "TH ", (BYTE*)pMPC_TH, uOffRRH, bDir );
return;
} /* End function mpc_display_th() */
/*--------------------------------------------------------------------*/
/* mpc_display_rrh(): Display Request/Response Header (MPC_RRH) */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_rrh( DEVBLK* pDEVBLK, MPC_RRH* pMPC_RRH, BYTE bDir )
{
U16 uOffPH;
// Display the MPC_RRH.
FETCH_HW( uOffPH, pMPC_RRH->offph );
mpc_display_stuff( pDEVBLK, "RRH", (BYTE*)pMPC_RRH, uOffPH, bDir );
return;
} /* End function mpc_display_rrh() */
/*--------------------------------------------------------------------*/
/* mpc_display_ph(): Display Protocol Data Unit Header (MPC_PH) */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_ph( DEVBLK* pDEVBLK, MPC_PH* pMPC_PH, BYTE bDir )
{
// Display the MPC_PH.
mpc_display_stuff( pDEVBLK, "PH ", (BYTE*)pMPC_PH, SIZE_PH, bDir );
return;
} /* End function mpc_display_ph() */
/*--------------------------------------------------------------------*/
/* mpc_display_rrh_and_puk(): */
/*--------------------------------------------------------------------*/
/* In all cases that have been seen, on both OSA and PTP, when */
/* MPC_RRH->proto == PROTOCOL_UNKNOWN (0x7E), the MPC_RRH is followed */
/* by a single MPC_PH, which is followed by a single MPC_PUK, which */
/* is followed by up to four MPC_PUSs. */
DLL_EXPORT void mpc_display_rrh_and_puk( DEVBLK* pDEVBLK, MPC_TH* pMPC_TH, MPC_RRH* pMPC_RRH, BYTE bDir )
{
MPC_PH* pMPC_PH;
MPC_PUK* pMPC_PUK;
MPC_PUS* pMPC_PUS;
int iTotLenPUS;
U32 uOffData;
U16 uTotLenPUS;
U16 uLenPUS;
U16 uLenPUK;
U16 uOffPH;
// Display the MPC_RRH.
FETCH_HW( uOffPH, pMPC_RRH->offph );
mpc_display_stuff( pDEVBLK, "RRH", (BYTE*)pMPC_RRH, uOffPH, bDir );
// Point to and display the MPC_PH.
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_RRH + uOffPH);
mpc_display_stuff( pDEVBLK, "PH ", (BYTE*)pMPC_PH, SIZE_PH, bDir );
// Get the length of and point to the data referenced by the
// MPC_PH. The data contain a MPC_PUK and one or more MPC_PUSs.
FETCH_FW( uOffData, pMPC_PH->offdata );
pMPC_PUK = (MPC_PUK*)((BYTE*)pMPC_TH + uOffData);
// Display the MPC_PUK.
FETCH_HW( uLenPUK, pMPC_PUK->length );
mpc_display_stuff( pDEVBLK, "PUK", (BYTE*)pMPC_PUK, uLenPUK, bDir );
// Get the total length of the following MPC_PUSs, then point to
// the first MPC_PUS.
FETCH_HW( uTotLenPUS, pMPC_PUK->lenpus );
iTotLenPUS = uTotLenPUS;
pMPC_PUS = (MPC_PUS*)((BYTE*)pMPC_PUK + uLenPUK);
// Display all of the MPC_PUSs.
while( iTotLenPUS > 0 )
{
// Ensure there are at least the first 4-bytes of the MPC_PUS.
if( iTotLenPUS < 4 )
{
mpc_display_stuff( pDEVBLK, "???", (BYTE*)pMPC_PUS, iTotLenPUS, bDir );
break;
}
// Get the length of the MPC_PUS.
FETCH_HW( uLenPUS, pMPC_PUS->length );
if( uLenPUS == 0 ) /* Better safe than sorry */
{
mpc_display_stuff( pDEVBLK, "???", (BYTE*)pMPC_PUS, iTotLenPUS, bDir );
break;
}
// Ensure there is the whole of the MPC_PUS.
if( iTotLenPUS < uLenPUS )
{
mpc_display_stuff( pDEVBLK, "???", (BYTE*)pMPC_PUS, iTotLenPUS, bDir );
break;
}
// Display the MPC_PUS.
mpc_display_stuff( pDEVBLK, "PUS", (BYTE*)pMPC_PUS, uLenPUS, bDir );
// Point to the next MPC_PUS
pMPC_PUS = (MPC_PUS*)((BYTE*)pMPC_PUS + uLenPUS);
iTotLenPUS -= uLenPUS;
}
return;
} /* End function mpc_display_rrh_and_puk() */
/*--------------------------------------------------------------------*/
/* mpc_display_rrh_and_pix(): */
/*--------------------------------------------------------------------*/
/* In all cases that have been seen, only on PTP, when MPC_RRH->type */
/* == RRH_TYPE_IPA (0xC1) and MPC_RRH->proto == PROTOCOL_LAYER2 */
/* (0x08), the MPC_RRH is followed by a single MPC_PH, which is */
/* followed by a single MPC_PIX. */
DLL_EXPORT void mpc_display_rrh_and_pix( DEVBLK* pDEVBLK, MPC_TH* pMPC_TH, MPC_RRH* pMPC_RRH, BYTE bDir )
{
MPC_PH* pMPC_PH;
MPC_PIX* pMPC_PIX;
U32 uOffData;
U32 uLenData;
U16 uOffPH;
// Display the MPC_RRH.
FETCH_HW( uOffPH, pMPC_RRH->offph );
mpc_display_stuff( pDEVBLK, "RRH", (BYTE*)pMPC_RRH, uOffPH, bDir );
// Point to and display the MPC_PH.
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_RRH + uOffPH);
mpc_display_stuff( pDEVBLK, "PH ", (BYTE*)pMPC_PH, SIZE_PH, bDir );
// Point to and display the MPC_PIX.
FETCH_F3( uLenData, pMPC_PH->lendata );
FETCH_FW( uOffData, pMPC_PH->offdata );
pMPC_PIX = (MPC_PIX*)((BYTE*)pMPC_TH + uOffData);
mpc_display_stuff( pDEVBLK, "PIX", (BYTE*)pMPC_PIX, uLenData, bDir );
return;
} /* End function mpc_display_rrh_and_pix() */
/*--------------------------------------------------------------------*/
/* mpc_display_rrh_and_ipa(): */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_rrh_and_ipa( DEVBLK* pDEVBLK, MPC_TH* pMPC_TH, MPC_RRH* pMPC_RRH, BYTE bDir )
{
MPC_PH* pMPC_PH;
MPC_IPA* pMPC_IPA;
BYTE* pMPC_IPA_CMD;
U32 uOffData;
U32 uLenData;
U16 uOffPH;
int iLenIPA;
int iLenCmd;
// Display the MPC_RRH.
FETCH_HW( uOffPH, pMPC_RRH->offph );
mpc_display_stuff( pDEVBLK, "RRH", (BYTE*)pMPC_RRH, uOffPH, bDir );
// Point to and display the MPC_PH.
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_RRH + uOffPH);
mpc_display_stuff( pDEVBLK, "PH ", (BYTE*)pMPC_PH, SIZE_PH, bDir );
/* Point to and display the MPC_IPA (and commands, if any). */
FETCH_F3( uLenData, pMPC_PH->lendata );
FETCH_FW( uOffData, pMPC_PH->offdata );
if( uLenData > sizeof(MPC_IPA) )
{
iLenIPA = sizeof(MPC_IPA);
iLenCmd = uLenData - sizeof(MPC_IPA);
}
else
{
iLenIPA = uLenData;
iLenCmd = 0;
}
pMPC_IPA = (MPC_IPA*)((BYTE*)pMPC_TH + uOffData);
mpc_display_stuff( pDEVBLK, "IPA", (BYTE*)pMPC_IPA, iLenIPA, bDir );
if( iLenCmd )
{
pMPC_IPA_CMD = (BYTE*)pMPC_IPA + iLenIPA;
mpc_display_stuff( pDEVBLK, "Cmd", (BYTE*)pMPC_IPA_CMD, iLenCmd, bDir );
}
return;
} /* End function mpc_display_rrh_and_ipa() */
/*--------------------------------------------------------------------*/
/* mpc_display_rrh_and_pkt(): */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_rrh_and_pkt( DEVBLK* pDEVBLK, MPC_TH* pMPC_TH, MPC_RRH* pMPC_RRH, BYTE bDir, int iLimit )
{
MPC_PH* pMPC_PH;
U16 uNumPH;
U16 uOffPH;
int iForPH;
int iDone;
U32 uLenData;
U32 uOffData;
BYTE* pData;
/* Display the MPC_RRH.*/
FETCH_HW( uOffPH, pMPC_RRH->offph );
mpc_display_stuff( pDEVBLK, "RRH", (BYTE*)pMPC_RRH, uOffPH, bDir );
/* Display the MPC_PH(s). */
FETCH_HW( uNumPH, pMPC_RRH->numph );
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_RRH + uOffPH);
for( iForPH = 1; iForPH <= uNumPH; iForPH++ )
{
mpc_display_stuff( pDEVBLK, "PH ", (BYTE*)pMPC_PH, SIZE_PH, bDir );
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_PH + SIZE_PH);
}
/* Display the data referenced by the MPC_PH(s). */
/* if limit is negative or a silly number, don't display the */
/* data. If limit is zero, display all of the data, otherwise */
/* limit the length of the data displayed. */
iDone = 0;
if( iLimit >= 0 && iLimit <= 65535 )
{
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_RRH + uOffPH);
for( iForPH = 1; iForPH <= uNumPH; iForPH++ )
{
FETCH_F3( uLenData, pMPC_PH->lendata );
FETCH_FW( uOffData, pMPC_PH->offdata );
pData = (BYTE*)pMPC_TH + uOffData;
if( iLimit > 0 )
{
if( iDone >= iLimit )
break;
if( (int)uLenData > ( iLimit - iDone ) )
uLenData = ( iLimit - iDone );
iDone += uLenData;
}
mpc_display_stuff( pDEVBLK, "Pkt", pData, uLenData, bDir );
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_PH + SIZE_PH);
}
}
return;
} /* End function mpc_display_rrh_and_pkt() */
/*--------------------------------------------------------------------*/
/* mpc_display_rrh_and_pdu(): */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_rrh_and_pdu( DEVBLK* pDEVBLK, MPC_TH* pMPC_TH, MPC_RRH* pMPC_RRH, BYTE bDir, int iLimit )
{
MPC_PH* pMPC_PH;
U16 uNumPH;
U16 uOffPH;
int iForPH;
int iDone;
U32 uLenData;
U32 uOffData;
BYTE* pData;
/* Display the MPC_RRH.*/
FETCH_HW( uOffPH, pMPC_RRH->offph );
mpc_display_stuff( pDEVBLK, "RRH", (BYTE*)pMPC_RRH, uOffPH, bDir );
/* Display the MPC_PH(s). */
FETCH_HW( uNumPH, pMPC_RRH->numph );
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_RRH + uOffPH);
for( iForPH = 1; iForPH <= uNumPH; iForPH++ )
{
mpc_display_stuff( pDEVBLK, "PH ", (BYTE*)pMPC_PH, SIZE_PH, bDir );
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_PH + SIZE_PH);
}
/* Display the data referenced by the MPC_PH(s). */
/* if limit is negative or a silly number, don't display the */
/* data. If limit is zero, display all of the data, otherwise */
/* limit the length of the data displayed. */
iDone = 0;
if( iLimit >= 0 && iLimit <= 65535 )
{
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_RRH + uOffPH);
for( iForPH = 1; iForPH <= uNumPH; iForPH++ )
{
FETCH_F3( uLenData, pMPC_PH->lendata );
FETCH_FW( uOffData, pMPC_PH->offdata );
pData = (BYTE*)pMPC_TH + uOffData;
if( iLimit > 0 )
{
if( iDone >= iLimit )
break;
if( (int)uLenData > ( iLimit - iDone ) )
uLenData = ( iLimit - iDone );
iDone += uLenData;
}
mpc_display_stuff( pDEVBLK, "PDU", pData, uLenData, bDir );
pMPC_PH = (MPC_PH*)((BYTE*)pMPC_PH + SIZE_PH);
}
}
return;
} /* End function mpc_display_rrh_and_pdu() */
/*--------------------------------------------------------------------*/
/* mpc_display_osa_iea(): */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_osa_iea( DEVBLK* pDEVBLK, MPC_IEA* pMPC_IEA, BYTE bDir, int iSize )
{
/* Display MPC_IEA. */
mpc_display_stuff( pDEVBLK, "IEA", (BYTE*)pMPC_IEA, iSize, bDir );
return;
} /* End function mpc_display_osa_iea() */
/*--------------------------------------------------------------------*/
/* mpc_display_osa_iear(): */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_osa_iear( DEVBLK* pDEVBLK, MPC_IEAR* pMPC_IEAR, BYTE bDir, int iSize )
{
/* Display MPC_IEAR. */
mpc_display_stuff( pDEVBLK, "IEAR", (BYTE*)pMPC_IEAR, iSize, bDir );
return;
} /* End function mpc_display_osa_iear() */
/*--------------------------------------------------------------------*/
/* mpc_display_osa_th_etc(): */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_osa_th_etc( DEVBLK* pDEVBLK, MPC_TH* pMPC_TH, BYTE bDir, int iLimit )
{
MPC_RRH* pMPC_RRH;
int iForRRH;
U32 uOffRRH;
U16 uNumRRH;
/* Display MPC_TH. */
mpc_display_th( pDEVBLK, pMPC_TH, bDir );
/* Get the number of MPC_RRHs and the displacement from */
/* the start of the MPC_TH to the first (or only) MPC_RRH. */
FETCH_HW( uNumRRH, pMPC_TH->numrrh );
FETCH_FW( uOffRRH, pMPC_TH->offrrh );
/* Process each of the MPC_RRHs. */
for( iForRRH = 1; iForRRH <= uNumRRH; iForRRH++ )
{
/* Point to the first or subsequent MPC_RRH. */
pMPC_RRH = (MPC_RRH*)((BYTE*)pMPC_TH + uOffRRH);
/* Display the MPC_RRH etc. */
if( pMPC_RRH->type == RRH_TYPE_CM ||
pMPC_RRH->type == RRH_TYPE_ULP )
{
/* Display MPC_RRH and following MPC_PUK etc. */
mpc_display_rrh_and_puk( pDEVBLK, pMPC_TH, pMPC_RRH, bDir );
}
else if( pMPC_RRH->type == RRH_TYPE_IPA )
{
/* Display MPC_RRH and following MPC_IPA etc. */
mpc_display_rrh_and_ipa( pDEVBLK, pMPC_TH, pMPC_RRH, bDir );
}
else
{
/* Display MPC_RRH and following PDU. */
mpc_display_rrh_and_pdu( pDEVBLK, pMPC_TH, pMPC_RRH, bDir, iLimit );
}
/* Get the displacement from the start of the MPC_TH to the */
/* next MPC_RRH. pMPC_RRH->offrrh will contain zero if this */
/* is the last MPC_RRH. */
FETCH_FW( uOffRRH, pMPC_RRH->offrrh );
}
return;
} /* End function mpc_display_osa_th_etc() */
/*--------------------------------------------------------------------*/
/* mpc_display_ptp_th_etc(): */
/*--------------------------------------------------------------------*/
DLL_EXPORT void mpc_display_ptp_th_etc( DEVBLK* pDEVBLK, MPC_TH* pMPC_TH, BYTE bDir, int iLimit )
{
MPC_RRH* pMPC_RRH;
int iForRRH;
U32 uOffRRH;
U16 uNumRRH;
/* Display MPC_TH. */
mpc_display_th( pDEVBLK, pMPC_TH, bDir );
/* Get the number of MPC_RRHs and the displacement from */
/* the start of the MPC_TH to the first (or only) MPC_RRH. */
FETCH_HW( uNumRRH, pMPC_TH->numrrh );
FETCH_FW( uOffRRH, pMPC_TH->offrrh );
/* Process each of the MPC_RRHs. */
for( iForRRH = 1; iForRRH <= uNumRRH; iForRRH++ )
{
/* Point to the first or subsequent MPC_RRH. */
pMPC_RRH = (MPC_RRH*)((BYTE*)pMPC_TH + uOffRRH);
/* Display the MPC_RRH etc. */
if( pMPC_RRH->proto == PROTOCOL_LAYER2 &&
pMPC_RRH->type == RRH_TYPE_CM )
{
/* Display MPC_RRH and following packet data. */
mpc_display_rrh_and_pkt( pDEVBLK, pMPC_TH, pMPC_RRH, bDir, iLimit );
}
else if( pMPC_RRH->proto == PROTOCOL_LAYER2 &&
pMPC_RRH->type == RRH_TYPE_IPA )
{
/* Display MPC_RRH and following MPC_PIX etc. */
mpc_display_rrh_and_pix( pDEVBLK, pMPC_TH, pMPC_RRH, bDir );
}
else if( pMPC_RRH->proto == PROTOCOL_UNKNOWN )
{
/* Display MPC_RRH and following MPC_PUK etc. */
mpc_display_rrh_and_puk( pDEVBLK, pMPC_TH, pMPC_RRH, bDir );
}
else
{
/* Display MPC_RRH */
mpc_display_rrh( pDEVBLK, pMPC_RRH, bDir );
}
/* Get the displacement from the start of the MPC_TH to the */
/* next MPC_RRH. pMPC_RRH->offrrh will contain zero if this */
/* is the last MPC_RRH. */
FETCH_FW( uOffRRH, pMPC_RRH->offrrh );
}
return;
} /* End function mpc_display_ptp_th_etc() */