3.0 Migration
[platform/core/messaging/msg-service.git] / plugin / sms_plugin / SmsPluginTpduCodec.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15 */
16
17 #include <stdio.h>
18 #include <string.h>
19
20 #include "MsgDebug.h"
21 #include "MsgCppTypes.h"
22 #include "MsgException.h"
23 #include "MsgGconfWrapper.h"
24
25 #include "SmsPluginTpduCodec.h"
26 #include "SmsPluginParamCodec.h"
27 #include "SmsPluginUDCodec.h"
28
29
30 /*==================================================================================================
31                                      IMPLEMENTATION OF SmsPluginTpduCodec - Member Functions
32 ==================================================================================================*/
33 SmsPluginTpduCodec::SmsPluginTpduCodec()
34 {
35
36
37 }
38
39
40 SmsPluginTpduCodec::~SmsPluginTpduCodec()
41 {
42
43
44 }
45
46
47 int SmsPluginTpduCodec::encodeTpdu(const SMS_TPDU_S *pSmsTpdu, char *pTpdu)
48 {
49         int tpduLen = 0;
50
51         switch (pSmsTpdu->tpduType)
52         {
53                 case SMS_TPDU_SUBMIT:
54                         tpduLen = encodeSubmit(&(pSmsTpdu->data.submit), pTpdu);
55                 break;
56
57                 case SMS_TPDU_DELIVER:
58                         tpduLen = encodeDeliver(&(pSmsTpdu->data.deliver), pTpdu);
59                 break;
60
61                 case SMS_TPDU_DELIVER_REP:
62                         tpduLen = encodeDeliverReport(&(pSmsTpdu->data.deliverRep), pTpdu);
63                 break;
64
65                 case SMS_TPDU_STATUS_REP:
66                         tpduLen = encodeStatusReport(&(pSmsTpdu->data.statusRep), pTpdu);
67                 break;
68         }
69
70         return tpduLen;
71 }
72
73
74 int SmsPluginTpduCodec::decodeTpdu(const unsigned char *pTpdu, int TpduLen, SMS_TPDU_S *pSmsTpdu)
75 {
76         int decodeLen = 0;
77
78         char mti = pTpdu[0] & 0x03;
79
80         switch (mti)
81         {
82                 case 0x00:
83                         pSmsTpdu->tpduType = SMS_TPDU_DELIVER;
84                         decodeLen = decodeDeliver(pTpdu, TpduLen, &(pSmsTpdu->data.deliver));
85                 break;
86
87                 case 0x01:
88                         pSmsTpdu->tpduType = SMS_TPDU_SUBMIT;
89                         decodeLen = decodeSubmit(pTpdu, TpduLen, &(pSmsTpdu->data.submit));
90                 break;
91
92                 case 0x02:
93                         pSmsTpdu->tpduType = SMS_TPDU_STATUS_REP;
94                         decodeLen = decodeStatusReport(pTpdu, TpduLen, &(pSmsTpdu->data.statusRep));
95                 break;
96         }
97
98         return decodeLen;
99 }
100
101
102 int SmsPluginTpduCodec::encodeSubmit(const SMS_SUBMIT_S *pSubmit, char *pTpdu)
103 {
104         int offset = 0, length = 0, encodeSize = 0;
105
106         char* address = NULL;
107         unique_ptr<char*, void(*)(char**)> addressBuf(&address, unique_ptr_deleter);
108
109         char* dcs = NULL;
110         unique_ptr<char*, void(*)(char**)> dcsBuf(&dcs, unique_ptr_deleter);
111
112         char* vpTime = NULL;
113         unique_ptr<char*, void(*)(char**)> vpBuf(&vpTime, unique_ptr_deleter);
114
115         //TP-MTI
116         pTpdu[offset] = 0x01;
117
118         //TP-RD
119         if(pSubmit->bRejectDup == true)
120                 pTpdu[offset] |= 0x04;
121
122         //TP-VPF
123         switch (pSubmit->vpf)
124         {
125                 case SMS_VPF_NOT_PRESENT:
126                         break;
127                 case SMS_VPF_ENHANCED:
128                         pTpdu[offset] |= 0x08;
129                         break;
130                 case SMS_VPF_RELATIVE:
131                         pTpdu[offset] |= 0x10;
132                         break;
133                 case SMS_VPF_ABSOLUTE:
134                         pTpdu[offset] |= 0x18;
135                         break;
136                 default:
137                         break;
138         }
139
140         //TP-SRR
141         if (pSubmit->bStatusReport == true)
142                 pTpdu[offset] |= 0x20;
143
144         MSG_DEBUG("TP-SRR pSubmit->bStatusReport : %d.", pSubmit->bStatusReport);
145
146         //TP-UDHI
147         if (pSubmit->bHeaderInd == true)
148                 pTpdu[offset] |= 0x40;
149
150         //TP-RP
151         if (pSubmit->bReplyPath == true)
152                 pTpdu[offset] |= 0x80;
153
154         offset++;
155
156         //TP-MR
157         pTpdu[offset++] = pSubmit->msgRef;
158
159         MSG_DEBUG("TP-MR pSubmit->msgRef : %d.", pSubmit->msgRef);
160
161         //TP-DA
162         length = SmsPluginParamCodec::encodeAddress(&pSubmit->destAddress, &address);
163         memcpy(&(pTpdu[offset]), address, length);
164         offset += length;
165
166         MSG_DEBUG("TP-DA length : %d.", length);
167
168         //TP-PID
169         pTpdu[offset++] = pSubmit->pid;
170
171         MSG_DEBUG("TP-PID pSubmit->pid : %d.", pSubmit->pid);
172
173         //TP-DCS
174         length = SmsPluginParamCodec::encodeDCS(&pSubmit->dcs, &dcs);
175         memcpy(&(pTpdu[offset]), dcs, length);
176         offset += length;
177
178         MSG_DEBUG("TP-DCS length : %d.", length);
179
180         //TP-VP
181         if (pSubmit->vpf != SMS_VPF_NOT_PRESENT)
182         {
183                 length = SmsPluginParamCodec::encodeTime(&pSubmit->validityPeriod, &vpTime);
184
185                 if (length > 0)
186                 {
187                         memcpy(&(pTpdu[offset]), vpTime, length);
188                         offset += length;
189                 }
190         }
191
192         encodeSize = SmsPluginUDCodec::encodeUserData(&(pSubmit->userData), pSubmit->dcs.codingScheme, &(pTpdu[offset]));
193
194 MSG_DEBUG("encodeSize : %d", encodeSize);
195
196         offset += encodeSize;
197
198 #if 0
199         printf("\n\n[encodeSubmit] pTpdu data.\n");
200         for (int i = 0; i < offset; i++)
201         {
202                 printf(" [%02x]", pTpdu[i]);
203         }
204         printf("\n\n");
205 #endif
206
207         return offset;
208 }
209
210
211 int SmsPluginTpduCodec::encodeDeliver(const SMS_DELIVER_S *pDeliver, char *pTpdu)
212 {
213         int offset = 0, length = 0, encodeSize = 0;
214
215         char* address = NULL;
216         unique_ptr<char*, void(*)(char**)> addressBuf(&address, unique_ptr_deleter);
217
218         char* dcs = NULL;
219         unique_ptr<char*, void(*)(char**)> dcsBuf(&dcs, unique_ptr_deleter);
220
221         char* scts = NULL;
222         unique_ptr<char*, void(*)(char**)> timeBuf(&scts, unique_ptr_deleter);
223
224         // TP-MTI : 00
225         pTpdu[offset] = 0x00;
226
227         // TP-MMS
228         if (pDeliver->bMoreMsg == false)
229                 pTpdu[offset] |= 0x04;
230
231         // TP-SRI
232         if (pDeliver->bStatusReport == true)
233                 pTpdu[offset] |= 0x20;
234
235         // TP-UDHI
236         if (pDeliver->bHeaderInd == true)
237                 pTpdu[offset] |= 0x40;
238
239         // TP-RP
240         if (pDeliver->bReplyPath == true)
241                 pTpdu[offset] |= 0x80;
242
243         offset++;
244
245         // TP-OA
246         length = SmsPluginParamCodec::encodeAddress(&pDeliver->originAddress, &address);
247         memcpy(&(pTpdu[offset]), address, length);
248         offset += length;
249
250         // TP-PID
251         pTpdu[offset++] = pDeliver->pid;
252
253         // TP-DCS
254         length = SmsPluginParamCodec::encodeDCS(&pDeliver->dcs, &dcs);
255         memcpy(&(pTpdu[offset]), dcs, length);
256         offset += length;
257
258         // TP-SCTS
259         length = SmsPluginParamCodec::encodeTime(&pDeliver->timeStamp, &scts);
260         memcpy(&(pTpdu[offset]), scts, length);
261         offset += length;
262
263         // TP-UDL & TP-UD
264         encodeSize = SmsPluginUDCodec::encodeUserData(&(pDeliver->userData), pDeliver->dcs.codingScheme, &(pTpdu[offset]));
265
266         MSG_DEBUG("encodeSize : %d", encodeSize);
267
268         offset += encodeSize;
269
270         return offset;
271 }
272
273
274 int SmsPluginTpduCodec::encodeDeliverReport(const SMS_DELIVER_REPORT_S *pDeliverRep, char *pTpdu)
275 {
276         int offset = 0;
277
278         // TP-MTI : 00
279         pTpdu[offset] = 0x00;
280
281         // TP-UDHI
282         if (pDeliverRep->bHeaderInd == true)
283                 pTpdu[offset] |= 0x40;
284
285         offset++;
286
287         // TP-FCS
288         if (pDeliverRep->reportType == SMS_REPORT_NEGATIVE) {
289                 pTpdu[offset++] = pDeliverRep->failCause;
290                 MSG_DEBUG("Delivery report : fail cause = [%02x]", pDeliverRep->failCause);
291         }
292
293         // TP-PI
294         pTpdu[offset++] = pDeliverRep->paramInd;
295
296         // TP-PID
297         if (pDeliverRep->paramInd & 0x01)
298                 pTpdu[offset++] = pDeliverRep->pid;
299
300         // TP-DCS
301         if (pDeliverRep->paramInd & 0x02)
302         {
303                 int length = 0;
304
305                 char* dcs = NULL;
306                 unique_ptr<char*, void(*)(char**)> dcsBuf(&dcs, unique_ptr_deleter);
307
308                 length = SmsPluginParamCodec::encodeDCS(&pDeliverRep->dcs, &dcs);
309                 memcpy(&(pTpdu[offset]), dcs, length);
310
311                 offset += length;
312         }
313
314         // TP-UDL & TP-UD
315         if (pDeliverRep->paramInd & 0x04)
316         {
317                 int encodeSize = 0;
318
319                 encodeSize = SmsPluginUDCodec::encodeUserData(&(pDeliverRep->userData), pDeliverRep->dcs.codingScheme, &(pTpdu[offset]));
320
321                 MSG_DEBUG("encodeSize : %d", encodeSize);
322
323                 offset += encodeSize;
324         }
325
326         pTpdu[offset] = '\0';
327
328         return offset;
329 }
330
331
332 int SmsPluginTpduCodec::encodeStatusReport(const SMS_STATUS_REPORT_S *pStatusRep, char *pTpdu)
333 {
334         int offset = 0, length = 0;
335
336         char* address = NULL;
337         unique_ptr<char*, void(*)(char**)> addressBuf(&address, unique_ptr_deleter);
338
339         char* scts = NULL;
340         unique_ptr<char*, void(*)(char**)> sctsBuf(&scts, unique_ptr_deleter);
341
342         char* dt = NULL;
343         unique_ptr<char*, void(*)(char**)> dtBuf(&dt, unique_ptr_deleter);
344
345         // TP-MTI : 10
346         pTpdu[offset] = 0x02;
347
348         // TP-MMS
349         if (pStatusRep->bMoreMsg == true)
350                 pTpdu[offset] |= 0x04;
351
352         // TP-SRQ
353         if (pStatusRep->bStatusReport == true)
354                 pTpdu[offset] |= 0x20;
355
356         // TP-UDHI
357         if (pStatusRep->bHeaderInd == true)
358                 pTpdu[offset] |= 0x40;
359
360         offset++;
361
362         // TP-MR
363         pTpdu[offset++] = pStatusRep->msgRef;
364
365         // TP-RA
366         length = SmsPluginParamCodec::encodeAddress(&pStatusRep->recipAddress, &address);
367         memcpy(&(pTpdu[offset]), address, length);
368         offset += length;
369
370         // TP-SCTS
371         length = SmsPluginParamCodec::encodeTime(&pStatusRep->timeStamp, &scts);
372         memcpy(&(pTpdu[offset]), scts, length);
373         offset += length;
374
375         // TP-DT
376         length = SmsPluginParamCodec::encodeTime(&pStatusRep->dischargeTime, &dt);
377         memcpy(&(pTpdu[offset]), dt, length);
378         offset += length;
379
380         // TP-Status
381         pTpdu[offset++] = pStatusRep->status;
382
383         // TP-PI
384         pTpdu[offset++] = pStatusRep->paramInd;
385
386         // TP-PID
387         if (pStatusRep->paramInd & 0x01)
388                 pTpdu[offset++] = pStatusRep->pid;
389
390         // TP-DCS
391         if (pStatusRep->paramInd & 0x02)
392         {
393                 int length = 0;
394
395                 char* dcs = NULL;
396                 unique_ptr<char*, void(*)(char**)> dcsBuf(&dcs, unique_ptr_deleter);
397
398                 length = SmsPluginParamCodec::encodeDCS(&pStatusRep->dcs, &dcs);
399                 memcpy(&(pTpdu[offset]), dcs, length);
400
401                 offset += length;
402         }
403
404         // TP-UDL & TP-UD
405         if (pStatusRep->paramInd & 0x04)
406         {
407                 int encodeSize = 0;
408
409                 encodeSize = SmsPluginUDCodec::encodeUserData(&(pStatusRep->userData), pStatusRep->dcs.codingScheme, &(pTpdu[offset]));
410
411                 MSG_DEBUG("encodeSize : %d", encodeSize);
412
413                 offset += encodeSize;
414         }
415
416         pTpdu[offset] = '\0';
417
418         return offset;
419 }
420
421
422 int SmsPluginTpduCodec::decodeSubmit(const unsigned char *pTpdu, int TpduLen, SMS_SUBMIT_S *pSubmit)
423 {
424         int offset = 0, udLen = 0;
425
426         // TP-RD
427         if (pTpdu[offset] & 0x04)
428                 pSubmit->bRejectDup = false;
429         else
430                 pSubmit->bRejectDup = true;
431
432         // TP-VPF
433         pSubmit->vpf = (SMS_VPF_T)(pTpdu[offset] & 0x18);
434
435         // TP-SRR
436         if (pTpdu[offset] & 0x20)
437                 pSubmit->bStatusReport = true;
438         else
439                 pSubmit->bStatusReport = false;
440
441         // TP-UDHI
442         if (pTpdu[offset] & 0x40)
443                 pSubmit->bHeaderInd = true;
444         else
445                 pSubmit->bHeaderInd = false;
446
447         // TP-RP
448         if (pTpdu[offset] & 0x80)
449                 pSubmit->bReplyPath = true;
450         else
451                 pSubmit->bReplyPath = false;
452
453         offset++;
454
455         // TP-MR
456         pSubmit->msgRef = pTpdu[offset++];
457
458         // TP-DA
459         offset += SmsPluginParamCodec::decodeAddress(pTpdu+offset, &(pSubmit->destAddress));
460
461         // TP-PID
462         pSubmit->pid = pTpdu[offset++];
463
464         // TP-DCS
465         offset += SmsPluginParamCodec::decodeDCS(pTpdu+offset, &(pSubmit->dcs));
466
467         // TP-VP
468         if (pSubmit->vpf != SMS_VPF_NOT_PRESENT)
469         {
470                 // Decode VP
471         }
472
473         // TP-UDL & TP-UD
474         udLen = SmsPluginUDCodec::decodeUserData(pTpdu+offset, TpduLen, pSubmit->bHeaderInd, pSubmit->dcs.codingScheme, &(pSubmit->userData));
475
476         return udLen;
477 }
478
479
480 int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, SMS_DELIVER_S *pDeliver)
481 {
482         int offset = 0, udLen = 0, tmpOffset = 0;
483
484
485         char tpduTmp[(TpduLen*2)+1];
486         memset(tpduTmp, 0x00, sizeof(tpduTmp));
487         for (int i = 0; i < TpduLen; i++) {
488                 snprintf(tpduTmp+(i*2), sizeof(tpduTmp)-(i*2), "%02X", pTpdu[i]);
489         }
490         MSG_DEBUG("Deliver TPDU.");
491         MSG_INFO("[%s]", tpduTmp);
492
493
494         // TP-MMS
495         if (pTpdu[offset] & 0x04)
496                 pDeliver->bMoreMsg = false;
497         else
498                 pDeliver->bMoreMsg = true;
499
500         // TP-SRI
501         if (pTpdu[offset] & 0x20)
502                 pDeliver->bStatusReport = true;
503         else
504                 pDeliver->bStatusReport = false;
505
506         // TP-UDHI
507         if (pTpdu[offset] & 0x40)
508                 pDeliver->bHeaderInd = true;
509         else
510                 pDeliver->bHeaderInd = false;
511
512         // TP-RP
513         if (pTpdu[offset] & 0x80)
514                 pDeliver->bReplyPath = true;
515         else
516                 pDeliver->bReplyPath = false;
517
518         offset++;
519
520         tmpOffset = offset;
521 #if 1
522         // TP-OA
523         offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pDeliver->originAddress));
524
525         // TP-PID
526         pDeliver->pid = pTpdu[offset++];
527
528         // TP-DCS
529         offset += SmsPluginParamCodec::decodeDCS(&pTpdu[offset], &(pDeliver->dcs));
530
531         // Support KSC5601 :: Coding group bits == 0x84
532         if (pTpdu[offset-1] == 0x84) {
533                 pDeliver->dcs.codingScheme = SMS_CHARSET_EUCKR;
534         }
535
536 #else
537         //For alphanumeric address test
538
539         offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pDeliver->originAddress));
540
541         char* address = new char[15];
542         address[0] = 0x04;
543         address[1] = 0xd0;
544         address[2] = 0x11;
545         address[3] = 0x00;
546         address[4] = 0x20;
547         address[5] = 0xF2;
548         address[6] = 0x01;
549         address[7] = 0x01;
550         address[8] = 0x11;
551         address[9] = 0x61;
552         address[10] = 0x40;
553         address[11] = 0x82;
554         address[12] = 0x2b;
555         address[13] = 0x01;
556         address[14] = 0x20;
557
558         SmsPluginParamCodec::decodeAddress((unsigned char*)address, &(pDeliver->originAddress));
559
560         pDeliver->pid = 0x20;
561         offset++;
562         offset += SmsPluginParamCodec::decodeDCS((unsigned char*)address, &(pDeliver->dcs));
563         // end test
564 #endif
565
566         if (pDeliver->pid == 0x20 && pDeliver->originAddress.ton == SMS_TON_ALPHANUMERIC) {
567                 int setType = -1;
568                 int indType = -1;
569
570                 bool bVmi = SmsPluginParamCodec::checkCphsVmiMsg(&pTpdu[tmpOffset], &setType, &indType);
571
572                 MSG_DEBUG("bVmi = [%d], setType=[%d], indType=[%d]", bVmi, setType, indType);
573
574                 if (bVmi) {
575                         pDeliver->dcs.bMWI = true;
576
577                         if (setType == 0) {
578                                 pDeliver->dcs.bIndActive = false;
579                         } else {
580                                 pDeliver->dcs.bIndActive = true;
581                         }
582
583                         if (indType == 0)
584                                 pDeliver->dcs.indType = SMS_VOICE_INDICATOR;
585                         else if (indType == 1)
586                                 pDeliver->dcs.indType = SMS_VOICE2_INDICATOR;
587                 }
588         }
589
590         // TP-SCTS
591         offset += SmsPluginParamCodec::decodeTime(&pTpdu[offset], &(pDeliver->timeStamp));
592
593         // TP-UD
594         udLen = SmsPluginUDCodec::decodeUserData(&pTpdu[offset], TpduLen, pDeliver->bHeaderInd, pDeliver->dcs.codingScheme, &(pDeliver->userData), &(pDeliver->udData));
595
596         return udLen;
597 }
598
599
600 int SmsPluginTpduCodec::decodeStatusReport(const unsigned char *pTpdu, int TpduLen, SMS_STATUS_REPORT_S *pStatusRep)
601 {
602 #ifdef LOG_ENABLE
603         printf("\n\n[decodeStatusReport] pTpdu data - Length [%d]\n", TpduLen);
604
605         for (int i = 0; i < TpduLen; i++)
606         {
607                 printf(" [%02x]", pTpdu[i]);
608         }
609         printf("\n\n");
610 #endif
611
612         int offset = 0, udLen = 0;
613
614         char* address = NULL;
615         unique_ptr<char*, void(*)(char**)> addressBuf(&address, unique_ptr_deleter);
616
617         char* scts = NULL;
618         unique_ptr<char*, void(*)(char**)> sctsBuf(&scts, unique_ptr_deleter);
619
620         char* dt = NULL;
621         unique_ptr<char*, void(*)(char**)> dtBuf(&dt, unique_ptr_deleter);
622
623         // TP-MMS
624         if (pTpdu[offset] & 0x04)
625                 pStatusRep->bMoreMsg = false;
626         else
627                 pStatusRep->bMoreMsg = true;
628
629         // TP-SRQ
630         if (pTpdu[offset] & 0x20)
631                 pStatusRep->bStatusReport = true;
632         else
633                 pStatusRep->bStatusReport = false;
634
635         // TP-UDHI
636         if (pTpdu[offset] & 0x40)
637                 pStatusRep->bHeaderInd = true;
638         else
639                 pStatusRep->bHeaderInd = false;
640
641         offset++;
642
643         // TP-MR
644         pStatusRep->msgRef = pTpdu[offset++];
645
646         // TP-RA
647         offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pStatusRep->recipAddress));
648
649         // TP-SCTS
650         // Decode timestamp
651         offset += SmsPluginParamCodec::decodeTime(&pTpdu[offset], &(pStatusRep->timeStamp));
652
653         // TP-DT
654         // Decode timestamp
655         offset += SmsPluginParamCodec::decodeTime(&pTpdu[offset], &(pStatusRep->dischargeTime));
656
657         // TP-Status
658         pStatusRep->status = pTpdu[offset++];
659
660         // TP-PI
661         pStatusRep->paramInd = pTpdu[offset++];
662
663         // No Parameters
664         if (pStatusRep->paramInd == 0)
665         {
666                 pStatusRep->pid = SMS_PID_NORMAL;
667
668                 pStatusRep->dcs.bCompressed = false;
669                 pStatusRep->dcs.bMWI = false;
670                 pStatusRep->dcs.bIndActive = false;
671
672                 pStatusRep->dcs.msgClass = MSG_CLASS_NONE;
673                 pStatusRep->dcs.codingScheme = SMS_CHARSET_7BIT;
674                 pStatusRep->dcs.codingGroup = SMS_GROUP_GENERAL;
675                 pStatusRep->dcs.indType = SMS_OTHER_INDICATOR;
676
677                 pStatusRep->userData.headerCnt = 0;
678                 pStatusRep->userData.length = 0;
679                 memset(pStatusRep->userData.data, 0x00, MAX_USER_DATA_LEN+1);
680         }
681
682         // TP-PID
683         if (pStatusRep->paramInd & 0x01)
684                 pStatusRep->pid = pTpdu[offset++];
685
686         // TP-DCS
687         if (pStatusRep->paramInd & 0x02)
688         {
689                 offset += SmsPluginParamCodec::decodeDCS(&pTpdu[offset], &(pStatusRep->dcs));
690         }
691
692         // TP-UDL & TP-UD
693         if (pStatusRep->paramInd & 0x04)
694         {
695                 // Decode User Data
696                 udLen = SmsPluginUDCodec::decodeUserData(&pTpdu[offset], TpduLen, pStatusRep->bHeaderInd, pStatusRep->dcs.codingScheme, &(pStatusRep->userData));
697         }
698
699         return udLen;
700 }
701