Debian Codegraph @

gobi-api/Gobi_2012-06-18-1054/Gobi3000Translation/Gobi3000TranslationNAS.cpp

raw
1 /*===========================================================================
2 FILE:
3 Gobi3000TranslationNAS.cpp
4
5 DESCRIPTION:
6 QUALCOMM Translation for Gobi 3000 (NAS Service)
7
8 Copyright (c) 2012, Code Aurora Forum. All rights reserved.
9
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright
13 notice, this list of conditions and the following disclaimer.
14 * Redistributions in binary form must reproduce the above copyright
15 notice, this list of conditions and the following disclaimer in the
16 documentation and/or other materials provided with the distribution.
17 * Neither the name of Code Aurora Forum nor
18 the names of its contributors may be used to endorse or promote
19 products derived from this software without specific prior written
20 permission.
21
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
34 ==========================================================================*/
35
36 //---------------------------------------------------------------------------
37 // Include Files
38 //---------------------------------------------------------------------------
39 #include "Gobi3000Translation.h"
40
41 // Maximum length for a scanned network description
42 const ULONG MAX_SNI_DESCRIPTION_LEN = 255;
43
44 //---------------------------------------------------------------------------
45 // Pragmas (pack structs)
46 //---------------------------------------------------------------------------
47 #pragma pack( push, 1 )
48
49 /*=========================================================================*/
50 // Struct sEVDOCustomSCPConfig
51 // Struct to represent CDMA 1xEV-DO custom SCP config
52 /*=========================================================================*/
53 struct sEVDOCustomSCPConfig
54 {
55 public:
56 BYTE mbActive;
57 ULONG mProtocolMask;
58 ULONG mBroadcastMask;
59 ULONG mApplicationMask;
60 };
61
62 /*=========================================================================*/
63 // Struct sScannedNetworkInfo
64 // Struct to represent scanned network information
65 /*=========================================================================*/
66 struct sScannedNetworkInfo
67 {
68 public:
69 USHORT mMCC;
70 USHORT mMNC;
71 ULONG mInUse;
72 ULONG mRoaming;
73 ULONG mForbidden;
74 ULONG mPreferred;
75 CHAR mDescription[MAX_SNI_DESCRIPTION_LEN];
76 };
77
78 /*=========================================================================*/
79 // Struct sScannedNetworkRATInfo
80 // Struct to represent scanned network RAT information
81 /*=========================================================================*/
82 struct sScannedNetworkRATInfo
83 {
84 public:
85 USHORT mMCC;
86 USHORT mMNC;
87 ULONG mRAT;
88 };
89
90 //---------------------------------------------------------------------------
91 // Pragmas
92 //---------------------------------------------------------------------------
93 #pragma pack( pop )
94
95 /*===========================================================================
96 METHOD:
97 ParseGetANAAAAuthenticationStatus
98
99 DESCRIPTION:
100 This function gets the AN-AAA authentication status
101
102 PARAMETERS:
103 inLen [ I ] - Length of input buffer
104 pIn [ I ] - Input buffer
105 pStatus [ O ] - AN-AAA authentication status
106
107 RETURN VALUE:
108 ULONG - Return code
109 ===========================================================================*/
110 ULONG ParseGetANAAAAuthenticationStatus(
111 ULONG inLen,
112 const BYTE * pIn,
113 ULONG * pStatus )
114 {
115 // Validate arguments
116 if (pIn == 0 || pStatus == 0)
117 {
118 return eGOBI_ERR_INVALID_ARG;
119 }
120
121 // Find the TLV
122 const sNASGetANAAAAuthenticationStatusResponse_Status * pTLVx01;
123 ULONG outLenx01;
124 ULONG rc = GetTLV( inLen, pIn, 0x01, &outLenx01, (const BYTE **)&pTLVx01 );
125 if (rc != eGOBI_ERR_NONE)
126 {
127 return rc;
128 }
129
130 // Is the TLV large enough?
131 if (outLenx01 < sizeof( sNASGetANAAAAuthenticationStatusResponse_Status ))
132 {
133 return eGOBI_ERR_MALFORMED_RSP;
134 }
135
136 *pStatus = pTLVx01->mANAAAAuthenticationStatus;
137
138 return eGOBI_ERR_NONE;
139 }
140
141 /*===========================================================================
142 METHOD:
143 ParseGetSignalStrength
144
145 DESCRIPTION:
146 This function gets the current signal strength (in dBm) as measured by
147 the device, the signal strength returned will be one of the currently
148 available technologies with preference CDMA 1xEV-DO, CDMA, AMPS,
149 WCDMA, GSM
150
151 PARAMETERS:
152 inLen [ I ] - Length of input buffer
153 pIn [ I ] - Input buffer
154 pSignalStrength [ O ] - Received signal strength (dBm)
155 pRadioInterface [ O ] - Radio interface technology
156
157 RETURN VALUE:
158 ULONG - Return code
159 ===========================================================================*/
160 ULONG ParseGetSignalStrength(
161 ULONG inLen,
162 const BYTE * pIn,
163 INT8 * pSignalStrength,
164 ULONG * pRadioInterface )
165 {
166 // Validate arguments
167 if (pSignalStrength == 0 || pRadioInterface == 0)
168 {
169 return eGOBI_ERR_INVALID_ARG;
170 }
171
172 ULONG sigSz = 12;
173 INT8 sigs[12];
174 ULONG radios[12];
175 ULONG qcErr = ParseGetSignalStrengths( inLen,
176 pIn,
177 &sigSz,
178 &sigs[0],
179 &radios[0] );
180 if (qcErr != eGOBI_ERR_NONE)
181 {
182 return qcErr;
183 }
184
185 std::map <ULONG, INT8> sigMap;
186 for (ULONG s = 0; s < sigSz; s++)
187 {
188 sigMap[radios[s]] = sigs[s];
189 }
190
191 std::map <ULONG, INT8>::const_iterator pIter;
192
193 // HDR?
194 pIter = sigMap.find( 2 );
195 if (pIter != sigMap.end())
196 {
197 *pSignalStrength = pIter->second;
198 *pRadioInterface = pIter->first;
199
200 return eGOBI_ERR_NONE;
201 }
202
203 // CDMA?
204 pIter = sigMap.find( 1 );
205 if (pIter != sigMap.end())
206 {
207 *pSignalStrength = pIter->second;
208 *pRadioInterface = pIter->first;
209
210 return eGOBI_ERR_NONE;
211 }
212
213 // AMPS?
214 pIter = sigMap.find( 3 );
215 if (pIter != sigMap.end())
216 {
217 *pSignalStrength = pIter->second;
218 *pRadioInterface = pIter->first;
219
220 return eGOBI_ERR_NONE;
221 }
222
223 // WCDMA?
224 pIter = sigMap.find( 5 );
225 if (pIter != sigMap.end())
226 {
227 *pSignalStrength = pIter->second;
228 *pRadioInterface = pIter->first;
229
230 return eGOBI_ERR_NONE;
231 }
232
233 // GSM?
234 pIter = sigMap.find( 4 );
235 if (pIter != sigMap.end())
236 {
237 *pSignalStrength = pIter->second;
238 *pRadioInterface = pIter->first;
239
240 return eGOBI_ERR_NONE;
241 }
242
243 // Error values
244 *pSignalStrength = -128;
245 *pRadioInterface = 0;
246
247 return eGOBI_ERR_NO_SIGNAL;
248 }
249
250 /*===========================================================================
251 METHOD:
252 ParseGetSignalStrengths
253
254 DESCRIPTION:
255 This function gets the current available signal strengths (in dBm)
256 as measured by the device
257
258 PARAMETERS:
259 inLen [ I ] - Length of input buffer
260 pIn [ I ] - Input buffer
261 pArraySizes [I/O] - Upon input the maximum number of elements
262 that each array can contain can contain.
263 Upon successful output the actual number
264 of elements in each array
265 pSignalStrengths [ O ] - Received signal strength array (dBm)
266 pRadioInterfaces [ O ] - Radio interface technology array
267
268 RETURN VALUE:
269 ULONG - Return code
270 ===========================================================================*/
271 ULONG ParseGetSignalStrengths(
272 ULONG inLen,
273 const BYTE * pIn,
274 ULONG * pArraySizes,
275 INT8 * pSignalStrengths,
276 ULONG * pRadioInterfaces )
277 {
278 // Validate arguments
279 if (pIn == 0
280 || pArraySizes == 0
281 || *pArraySizes == 0
282 || pSignalStrengths == 0
283 || pRadioInterfaces == 0)
284 {
285 return eGOBI_ERR_INVALID_ARG;
286 }
287
288 ULONG maxSignals = (ULONG)*pArraySizes;
289
290 // Assume failure
291 *pArraySizes = 0;
292
293 // Find the first signal strength value
294 const sNASGetSignalStrengthResponse_SignalStrength * pTLVx01;
295 ULONG outLenx01;
296 ULONG rc = GetTLV( inLen, pIn, 0x01, &outLenx01, (const BYTE **)&pTLVx01 );
297 if (rc != eGOBI_ERR_NONE)
298 {
299 return rc;
300 }
301
302 // Is the TLV large enough?
303 if (outLenx01 < sizeof( sNASGetSignalStrengthResponse_SignalStrength ))
304 {
305 return eGOBI_ERR_MALFORMED_RSP;
306 }
307
308 // Weed out bogus values
309 std::map <ULONG, INT8> sigMap;
310
311 INT8 sigVal = pTLVx01->mSignalStrengthdBm;
312 ULONG radioVal = pTLVx01->mRadioInterface;
313 if (sigVal <= -30 && sigVal > -125 && radioVal != 0)
314 {
315 sigMap[radioVal] = sigVal;
316 }
317
318 // Handle list, if present
319 const sNASGetSignalStrengthResponse_SignalStrengthList * pTLVx10;
320 ULONG outLenx10;
321 rc = GetTLV( inLen, pIn, 0x10, &outLenx10, (const BYTE **)&pTLVx10 );
322 if (rc == eGOBI_ERR_NONE)
323 {
324 if (outLenx10 < sizeof( sNASGetSignalStrengthResponse_SignalStrengthList ))
325 {
326 return eGOBI_ERR_MALFORMED_RSP;
327 }
328
329 ULONG auxSigs = pTLVx10->mNumberOfInfoInstances;
330 if (auxSigs > maxSignals)
331 {
332 auxSigs = maxSignals;
333 }
334
335 const sNASGetSignalStrengthResponse_SignalStrengthList::sInfo * pInfo;
336
337 // Verify there is room for the array in the TLV
338 if (outLenx10 < sizeof( sNASGetSignalStrengthResponse_SignalStrengthList )
339 + sizeof( sNASGetSignalStrengthResponse_SignalStrengthList::sInfo )
340 * auxSigs)
341 {
342 return eGOBI_ERR_MALFORMED_RSP;
343 }
344
345 // Align to the first array element
346 pInfo = (const sNASGetSignalStrengthResponse_SignalStrengthList::sInfo *)
347 ((const BYTE *)pTLVx10
348 + sizeof( sNASGetSignalStrengthResponse_SignalStrengthList ));
349
350 for (ULONG s = 0; s < auxSigs; s++)
351 {
352 sigVal = pInfo->mSignalStrengthdBm;
353 radioVal = pInfo->mRadioInterface;
354 if (sigVal <= -30 && sigVal > -125 && radioVal != 0)
355 {
356 sigMap[radioVal] = sigVal;
357 }
358
359 // Move pInfo forward one element
360 pInfo++;
361 }
362 }
363
364 ULONG sigCount = 0;
365 std::map <ULONG, INT8>::const_iterator pIter;
366 for (pIter = sigMap.begin(); pIter != sigMap.end(); pIter++, sigCount++)
367 {
368 if (sigCount < maxSignals)
369 {
370 pSignalStrengths[sigCount] = pIter->second;
371 pRadioInterfaces[sigCount] = pIter->first;
372 *pArraySizes = sigCount + 1;
373 }
374 }
375
376 // No valid signals?
377 if (sigCount == 0)
378 {
379 return eGOBI_ERR_NO_SIGNAL;
380 }
381
382 return eGOBI_ERR_NONE;
383 }
384
385 /*===========================================================================
386 METHOD:
387 ParseGetRFInfo
388
389 DESCRIPTION:
390 This function gets the current RF information
391
392 PARAMETERS:
393 inLen [ I ] - Length of input buffer
394 pIn [ I ] - Input buffer
395 pInstanceSize [I/O] - Upon input the maximum number of elements that the
396 RF info instance array can contain. Upon success
397 the actual number of elements in the RF info
398 instance array
399 pInstances [ O ] - The RF info instance array
400
401 RETURN VALUE:
402 ULONG - Return code
403 ===========================================================================*/
404 ULONG ParseGetRFInfo(
405 ULONG inLen,
406 const BYTE * pIn,
407 BYTE * pInstanceSize,
408 BYTE * pInstances )
409 {
410 // Validate arguments
411 if (pIn == 0
412 || pInstanceSize == 0
413 || *pInstanceSize == 0
414 || pInstances == 0)
415 {
416 return eGOBI_ERR_INVALID_ARG;
417 }
418
419 // Assume failure
420 BYTE maxInstances = *pInstanceSize;
421 *pInstanceSize = 0;
422
423 // Find the TLV
424 const sNASGetRFInfoResponse_RFInfo * pTLVx01;
425 ULONG outLenx01;
426 ULONG rc = GetTLV( inLen, pIn, 0x01, &outLenx01, (const BYTE **)&pTLVx01 );
427 if (rc != eGOBI_ERR_NONE)
428 {
429 return rc;
430 }
431
432 // Is the TLV large enough?
433 if (outLenx01 < sizeof( sNASGetRFInfoResponse_RFInfo ))
434 {
435 return eGOBI_ERR_MALFORMED_RSP;
436 }
437
438 BYTE ifaceCount = pTLVx01->mNumberOfInstances;
439 if (ifaceCount > maxInstances)
440 {
441 ifaceCount = maxInstances;
442 }
443
444 const sNASGetRFInfoResponse_RFInfo::sInstance * pInstance;
445
446 // Verify there is room for the array in the TLV
447 if (outLenx01 < sizeof( sNASGetRFInfoResponse_RFInfo )
448 + sizeof( sNASGetRFInfoResponse_RFInfo::sInstance )
449 * ifaceCount)
450 {
451 return eGOBI_ERR_MALFORMED_RSP;
452 }
453
454 // Align to the first array element
455 pInstance = (const sNASGetRFInfoResponse_RFInfo::sInstance *)
456 ((const BYTE *)pTLVx01
457 + sizeof( sNASGetRFInfoResponse_RFInfo ));
458
459 ULONG * pOutput = (ULONG *)pInstances;
460 for (BYTE i = 0; i < ifaceCount; i++)
461 {
462 *pOutput++ = pInstance->mRadioInterface;
463 *pOutput++ = pInstance->mActiveBandClass;
464 *pOutput++ = pInstance->mActiveChannel;
465
466 // Move pInstance forward one element
467 pInstance++;
468 }
469
470 *pInstanceSize = ifaceCount;
471
472 return eGOBI_ERR_NONE;
473 }
474
475 /*===========================================================================
476 METHOD:
477 ParsePerformNetworkScan
478
479 DESCRIPTION:
480 This function performs a scan for available networks
481
482 PARAMETERS:
483 inLen [ I ] - Length of input buffer
484 pIn [ I ] - Input buffer
485 pInstanceSize [I/O] - Upon input the maximum number of elements that the
486 network info instance array can contain. Upon
487 success the actual number of elements in the
488 network info instance array
489 pInstances [ O ] - The network info instance array
490
491 RETURN VALUE:
492 ULONG - Return code
493 ===========================================================================*/
494 ULONG ParsePerformNetworkScan(
495 ULONG inLen,
496 const BYTE * pIn,
497 BYTE * pInstanceSize,
498 BYTE * pInstances )
499 {
500 // Validate arguments
501 if (pIn == 0
502 || pInstanceSize == 0
503 || *pInstanceSize == 0
504 || pInstances == 0)
505 {
506 return eGOBI_ERR_INVALID_ARG;
507 }
508
509 BYTE maxInstances = *pInstanceSize;
510
511 // Assume failure
512 *pInstanceSize = 0;
513
514 // Find the TLV
515 const sNASPerformNetworkScanResponse_NetworkInfo * pTLVx10;
516 ULONG outLenx10;
517 ULONG rc = GetTLV( inLen, pIn, 0x10, &outLenx10, (const BYTE **)&pTLVx10 );
518 if (rc != eGOBI_ERR_NONE)
519 {
520 return rc;
521 }
522
523 // Is the TLV large enough?
524 if (outLenx10 < sizeof( sNASPerformNetworkScanResponse_NetworkInfo ))
525 {
526 return eGOBI_ERR_MALFORMED_RSP;
527 }
528
529 UINT16 netCount = pTLVx10->mNumberOfInfoInstances;
530 if (netCount > maxInstances)
531 {
532 netCount = maxInstances;
533 }
534
535 const sNASPerformNetworkScanResponse_NetworkInfo::sNetworkInfo * pNetInfo;
536
537 // Align to the first array element
538 pNetInfo = (const sNASPerformNetworkScanResponse_NetworkInfo::sNetworkInfo *)
539 ((const BYTE *)pTLVx10
540 + sizeof( sNASPerformNetworkScanResponse_NetworkInfo ));
541 ULONG offset = sizeof( sNASPerformNetworkScanResponse_NetworkInfo );
542
543 sScannedNetworkInfo * pNet = (sScannedNetworkInfo *)pInstances;
544 for (BYTE i = 0; i < netCount; i++)
545 {
546 // Check TLV size
547 if (offset > outLenx10)
548 {
549 return eGOBI_ERR_MALFORMED_RSP;
550 }
551
552 pNet->mMCC = pNetInfo->mMobileCountryCode;
553 pNet->mMNC = pNetInfo->mMobileNetworkCode;
554 pNet->mInUse = pNetInfo->mInUseStatus;
555 pNet->mRoaming = pNetInfo->mRoamingStatus;
556 pNet->mForbidden = pNetInfo->mForbiddenStatus;
557 pNet->mPreferred = pNetInfo->mPreferredStatus;
558
559 memset( &pNet->mDescription[0], 0, MAX_SNI_DESCRIPTION_LEN );
560
561 BYTE descLen = pNetInfo->mDescriptionLength;
562 if (descLen > 0)
563 {
564 // Move pNetInfo forward
565 pNetInfo++;
566 offset += sizeof( sNASPerformNetworkScanResponse_NetworkInfo::sNetworkInfo );
567
568 // Check TLV size
569 if (offset > outLenx10)
570 {
571 return eGOBI_ERR_MALFORMED_RSP;
572 }
573
574 std::string netDesc( (LPCSTR)pNetInfo );
575
576 ULONG actualLen = (ULONG)netDesc.size();
577 if (actualLen >= MAX_SNI_DESCRIPTION_LEN)
578 {
579 actualLen = MAX_SNI_DESCRIPTION_LEN - 1;
580 }
581
582 LPCSTR pNetDesc = netDesc.c_str();
583 memcpy( &pNet->mDescription[0], pNetDesc, actualLen );
584
585 // Move pNetInfo past string
586 pNetInfo = (const sNASPerformNetworkScanResponse_NetworkInfo::sNetworkInfo *)
587 ((const BYTE *)pNetInfo + descLen);
588 offset += descLen;
589 }
590
591 pNet++;
592 }
593
594 *pInstanceSize = (BYTE)netCount;
595
596 return eGOBI_ERR_NONE;
597 }
598
599 /*===========================================================================
600 METHOD:
601 ParsePerformNetworkRATScan
602
603 DESCRIPTION:
604 This function performs a scan for available networks (includes RAT)
605
606 PARAMETERS:
607 inLen [ I ] - Length of input buffer
608 pIn [ I ] - Input buffer
609 pInstanceSize [I/O] - Upon input the maximum number of elements that the
610 network info instance array can contain. Upon
611 success the actual number of elements in the
612 network info instance array
613 pInstances [ O ] - The network info instance array
614 pRATSize [I/O] - Upon input the maximum number of elements that the
615 RAT info instance array can contain. Upon success
616 the actual number of elements in the RAT info
617 instance array
618 pRATInstances [ O ] - The RAT info instance array
619
620 RETURN VALUE:
621 ULONG - Return code
622 ===========================================================================*/
623 ULONG ParsePerformNetworkRATScan(
624 ULONG inLen,
625 const BYTE * pIn,
626 BYTE * pInstanceSize,
627 BYTE * pInstances,
628 BYTE * pRATSize,
629 BYTE * pRATInstances )
630 {
631 // Validate arguments
632 if (pIn == 0
633 || pInstanceSize == 0
634 || *pInstanceSize == 0
635 || pInstances == 0
636 || pRATSize == 0
637 || *pRATSize == 0
638 || pRATInstances == 0)
639 {
640 return eGOBI_ERR_INVALID_ARG;
641 }
642
643 BYTE maxRATInstances = *pRATSize;
644
645 // Assume failure
646 *pInstanceSize = 0;
647 *pRATSize = 0;
648
649 // First, generate the instances using ParsePerformNetworkScan
650 ULONG rc = ParsePerformNetworkScan( inLen, pIn, pInstanceSize, pInstances );
651 if (rc != eGOBI_ERR_NONE)
652 {
653 return rc;
654 }
655
656 // Now find the RAT info too
657
658 // Find the TLV
659 const sNASPerformNetworkScanResponse_NetworkRAT * pTLVx11;
660 ULONG outLenx11;
661 rc = GetTLV( inLen, pIn, 0x11, &outLenx11, (const BYTE **)&pTLVx11 );
662 if (rc != eGOBI_ERR_NONE)
663 {
664 return rc;
665 }
666
667 // Is the TLV large enough?
668 if (outLenx11 < sizeof( sNASPerformNetworkScanResponse_NetworkRAT ))
669 {
670 return eGOBI_ERR_MALFORMED_RSP;
671 }
672
673 UINT16 ratCount = pTLVx11->mNumberOfInfoInstances;
674 if (ratCount > maxRATInstances)
675 {
676 ratCount = maxRATInstances;
677 }
678
679 const sNASPerformNetworkScanResponse_NetworkRAT::sInfo * pRatInfo;
680
681 // Verify there is room for the array in the TLV
682 if (outLenx11 < sizeof( sNASPerformNetworkScanResponse_NetworkRAT )
683 + sizeof( sNASPerformNetworkScanResponse_NetworkRAT::sInfo )
684 * ratCount)
685 {
686 return eGOBI_ERR_MALFORMED_RSP;
687 }
688
689 // Align to the first array element
690 pRatInfo = (const sNASPerformNetworkScanResponse_NetworkRAT::sInfo *)
691 ((const BYTE *)pTLVx11
692 + sizeof( sNASPerformNetworkScanResponse_NetworkRAT ));
693
694 sScannedNetworkRATInfo * pRAT = (sScannedNetworkRATInfo *)pRATInstances;
695 for (BYTE r = 0; r < ratCount; r++)
696 {
697 pRAT->mMCC = pRatInfo->mMobileCountryCode;
698 pRAT->mMNC = pRatInfo->mMobileNetworkCode;
699 pRAT->mRAT = pRatInfo->mRadioAccessTechnology;
700
701 pRAT++;
702 pRatInfo++;
703 }
704
705 *pRATSize = (BYTE)ratCount;
706
707 return eGOBI_ERR_NONE;
708 }
709
710 /*===========================================================================
711 METHOD:
712 PackInitiateNetworkRegistration
713
714 DESCRIPTION:
715 This function initiates a network registration
716
717 PARAMETERS:
718 pOutLen [I/O] - Upon input the maximum number of BYTEs pOut can
719 contain, upon output the number of BYTEs copied
720 to pOut
721 pOut [ O ] - Output buffer
722 regType [ I ] - Registration type
723 mcc [ I ] - Mobile country code (ignored for auto registration)
724 mnc [ I ] - Mobile network code (ignored for auto registration)
725 rat [ I ] - Radio access type (ignored for auto registration)
726
727 RETURN VALUE:
728 ULONG - Return code
729 ===========================================================================*/
730 ULONG PackInitiateNetworkRegistration(
731 ULONG * pOutLen,
732 BYTE * pOut,
733 ULONG regType,
734 WORD mcc,
735 WORD mnc,
736 ULONG rat )
737 {
738 // Validate arguments
739 if (pOut == 0)
740 {
741 return eGOBI_ERR_INVALID_ARG;
742 }
743
744 // Set the action
745
746 // Check size
747 WORD tlvx01Sz = sizeof( sNASInitiateNetworkRegisterRequest_Action );
748 if (*pOutLen < sizeof( sQMIRawContentHeader ) + tlvx01Sz)
749 {
750 return eGOBI_ERR_BUFFER_SZ;
751 }
752
753 sQMIRawContentHeader * pHeader = (sQMIRawContentHeader*)pOut;
754 pHeader->mTypeID = 0x01;
755 pHeader->mLength = tlvx01Sz;
756
757 ULONG offset = sizeof( sQMIRawContentHeader );
758
759 sNASInitiateNetworkRegisterRequest_Action * pTLVx01;
760 pTLVx01 = (sNASInitiateNetworkRegisterRequest_Action*)(pOut + offset);
761 memset( pTLVx01, 0, tlvx01Sz );
762
763 // Set the value
764 pTLVx01->mRegisterAction = (eQMINASRegisterActions)regType;
765
766 offset += tlvx01Sz;
767
768 // Set the info
769
770 // Check size
771 WORD tlvx10Sz = sizeof( sNASInitiateNetworkRegisterRequest_ManualInfo );
772 if (*pOutLen < offset + sizeof( sQMIRawContentHeader ) + tlvx10Sz)
773 {
774 return eGOBI_ERR_BUFFER_SZ;
775 }
776
777 pHeader = (sQMIRawContentHeader*)(pOut + offset);
778 pHeader->mTypeID = 0x10;
779 pHeader->mLength = tlvx10Sz;
780
781 offset = sizeof( sQMIRawContentHeader );
782
783 sNASInitiateNetworkRegisterRequest_ManualInfo * pTLVx10;
784 pTLVx10 = (sNASInitiateNetworkRegisterRequest_ManualInfo*)(pOut + offset);
785 memset( pTLVx10, 0, tlvx10Sz );
786
787 // Set the value
788 pTLVx10->mMobileCountryCode = mcc;
789 pTLVx10->mMobileNetworkCode = mnc;
790 pTLVx10->mRadioAccessTechnology = (eQMINASRadioAccessTechnologies)rat;
791
792 offset += tlvx10Sz;
793
794 *pOutLen = offset;
795 return eGOBI_ERR_NONE;
796 }
797
798 /*===========================================================================
799 METHOD:
800 PackInitiateDomainAttach
801
802 DESCRIPTION:
803 This function initiates a domain attach (or detach)
804
805 PARAMETERS:
806 pOutLen [I/O] - Upon input the maximum number of BYTEs pOut can
807 contain, upon output the number of BYTEs copied
808 to pOut
809 pOut [ O ] - Output buffer
810 action [ I ] - PS attach action (attach or detach)
811
812 RETURN VALUE:
813 ULONG - Return code
814 ===========================================================================*/
815 ULONG PackInitiateDomainAttach(
816 ULONG * pOutLen,
817 BYTE * pOut,
818 ULONG action )
819 {
820 // Validate arguments
821 if (pOut == 0)
822 {
823 return eGOBI_ERR_INVALID_ARG;
824 }
825
826 // Check size
827 WORD tlvx10Sz = sizeof( sNASInitiateAttachRequest_Action );
828 if (*pOutLen < sizeof( sQMIRawContentHeader ) + tlvx10Sz)
829 {
830 return eGOBI_ERR_BUFFER_SZ;
831 }
832
833 sQMIRawContentHeader * pHeader = (sQMIRawContentHeader*)pOut;
834 pHeader->mTypeID = 0x10;
835 pHeader->mLength = tlvx10Sz;
836
837 ULONG offset = sizeof( sQMIRawContentHeader );
838
839 sNASInitiateAttachRequest_Action * pTLVx10;
840 pTLVx10 = (sNASInitiateAttachRequest_Action*)(pOut + offset);
841 memset( pTLVx10, 0, tlvx10Sz );
842
843 // Set the value
844 pTLVx10->mPSAttachAction = (eQMINASPSAttachActions)action;
845
846 offset += tlvx10Sz;
847
848 *pOutLen = offset;
849 return eGOBI_ERR_NONE;
850 }
851
852 /*===========================================================================
853 METHOD:
854 ParseGetServingNetwork
855
856 DESCRIPTION:
857 Gets information regarding the system that currently provides service
858 to the device
859
860 PARAMETERS:
861 inLen [ I ] - Length of input buffer
862 pIn [ I ] - Input buffer
863 pRegistrationState [ O ] - Registration state
864 pCSDomain [ O ] - Circuit switch domain status
865 pPSDomain [ O ] - Packet switch domain status
866 pRAN [ O ] - Radio access network
867 pRadioIfacesSize [I/O] - Upon input the maximum number of elements
868 that the radio interfaces can contain. Upon
869 successful output the actual number of elements
870 in the radio interface array
871 pRadioIfaces [ O ] - The radio interface array
872 pRoaming [ O ] - Roaming indicator (0xFFFFFFFF - Unknown)
873 pMCC [ O ] - Mobile country code (0xFFFF - Unknown)
874 pMNC [ O ] - Mobile network code (0xFFFF - Unknown)
875 nameSize [ I ] - The maximum number of characters (including
876 NULL terminator) that the network name array
877 can contain
878 pName [ O ] - The network name or description represented
879 as a NULL terminated string (empty string
880 returned when unknown)
881
882 RETURN VALUE:
883 ULONG - Return code
884 ===========================================================================*/
885 ULONG ParseGetServingNetwork(
886 ULONG inLen,
887 const BYTE * pIn,
888 ULONG * pRegistrationState,
889 ULONG * pCSDomain,
890 ULONG * pPSDomain,
891 ULONG * pRAN,
892 BYTE * pRadioIfacesSize,
893 BYTE * pRadioIfaces,
894 ULONG * pRoaming,
895 WORD * pMCC,
896 WORD * pMNC,
897 BYTE nameSize,
898 CHAR * pName )
899 {
900 // Validate arguments
901 if (pIn == 0
902 || pRegistrationState == 0
903 || pCSDomain == 0
904 || pPSDomain == 0
905 || pRAN == 0
906 || pRadioIfacesSize == 0
907 || *pRadioIfacesSize == 0
908 || pRadioIfaces == 0
909 || pRoaming == 0
910 || pMCC == 0
911 || pMNC == 0
912 || nameSize == 0
913 || pName == 0)
914 {
915 return eGOBI_ERR_INVALID_ARG;
916 }
917
918 BYTE maxRadioIfaces = *pRadioIfacesSize;
919
920 // Assume failure
921 *pRadioIfacesSize = 0;
922 *pRoaming = 0xffffffff;
923 *pMCC = 0xffff;
924 *pMNC = 0xffff;
925 *pName = 0;
926
927 // Parse the serving system (mandatory)
928
929 // Find the TLV
930 const sNASGetServingSystemResponse_ServingSystem * pTLVx01;
931 ULONG outLenx01;
932 ULONG rc = GetTLV( inLen, pIn, 0x01, &outLenx01, (const BYTE **)&pTLVx01 );
933 if (rc != eGOBI_ERR_NONE)
934 {
935 return rc;
936 }
937
938 // Is the TLV large enough?
939 if (outLenx01 < sizeof( sNASGetServingSystemResponse_ServingSystem ))
940 {
941 return eGOBI_ERR_MALFORMED_RSP;
942 }
943
944 // Populate the variables
945 *pRegistrationState = pTLVx01->mRegistrationState;
946 *pCSDomain = pTLVx01->mCSAttachState;
947 *pPSDomain = pTLVx01->mPSAttachState;
948 *pRAN = pTLVx01->mRegisteredNetwork;
949
950 BYTE activeRadioIfaces = pTLVx01->mNumberOfRadioInterfacesInUse;
951 if (activeRadioIfaces > maxRadioIfaces)
952 {
953 activeRadioIfaces = maxRadioIfaces;
954 }
955
956 const eQMINASRadioInterfaces * pRadioInfo;
957
958 // Verify there is room for the array in the TLV
959 if (outLenx01 < sizeof( sNASGetServingSystemResponse_ServingSystem )
960 + sizeof( eQMINASRadioInterfaces ) * activeRadioIfaces)
961 {
962 return eGOBI_ERR_MALFORMED_RSP;
963 }
964
965 // Align to the first array element
966 pRadioInfo = (const eQMINASRadioInterfaces *)
967 ((const BYTE *)pTLVx01
968 + sizeof( sNASGetServingSystemResponse_ServingSystem ));
969
970 ULONG * pOutRadioIfaces = (ULONG *)pRadioIfaces;
971 for (ULONG r = 0; r < activeRadioIfaces; r++)
972 {
973 *pOutRadioIfaces = *pRadioInfo;
974 pOutRadioIfaces++;
975 pRadioInfo++;
976 }
977
978 *pRadioIfacesSize = activeRadioIfaces;
979
980 // Find the roaming indicator (optional)
981 const sNASGetServingSystemResponse_RoamingIndicator * pTLVx10;
982 ULONG outLenx10;
983 rc = GetTLV( inLen, pIn, 0x10, &outLenx10, (const BYTE **)&pTLVx10 );
984 if (rc == eGOBI_ERR_NONE)
985 {
986 if (outLenx10 < sizeof( sNASGetServingSystemResponse_RoamingIndicator ))
987 {
988 return eGOBI_ERR_MALFORMED_RSP;
989 }
990
991 // Get the values
992 *pRoaming = (eQMINASRoamingIndicators)pTLVx10->mRoamingIndicator;
993 }
994
995 // Find the PLMN (optional)
996 const sNASGetServingSystemResponse_CurrentPLMN * pTLVx12;
997 ULONG outLenx12;
998 rc = GetTLV( inLen, pIn, 0x12, &outLenx12, (const BYTE **)&pTLVx12 );
999 if (rc == eGOBI_ERR_NONE)
1000 {
1001 if (outLenx12 < sizeof( sNASGetServingSystemResponse_CurrentPLMN ))
1002 {
1003 return eGOBI_ERR_MALFORMED_RSP;
1004 }
1005
1006 *pMCC = pTLVx12->mMobileCountryCode;
1007 *pMNC = pTLVx12->mMobileNetworkCode;
1008
1009 ULONG descLen = pTLVx12->mDescriptionLength;
1010 const CHAR * pDesc;
1011
1012 // Verify there is room for the array in the TLV
1013 if (outLenx12 < sizeof( sNASGetServingSystemResponse_CurrentPLMN )
1014 + sizeof( CHAR ) * descLen)
1015 {
1016 return eGOBI_ERR_MALFORMED_RSP;
1017 }
1018
1019 // Space to perform the copy?
1020 if (nameSize < descLen + 1)
1021 {
1022 return eGOBI_ERR_BUFFER_SZ;
1023 }
1024
1025 // Align to the first array element
1026 pDesc = (const CHAR *)((const BYTE *)pTLVx12
1027 + sizeof( sNASGetServingSystemResponse_CurrentPLMN ));
1028
1029 memcpy( pName, pDesc, descLen );
1030 pName[descLen] = 0;
1031 }
1032
1033 return eGOBI_ERR_NONE;
1034 }
1035
1036 /*===========================================================================
1037 METHOD:
1038 ParseGetServingNetworkCapabilities
1039
1040 DESCRIPTION:
1041 Gets information regarding the data capabilities of the system that
1042 currently provides service to the device
1043
1044 PARAMETERS:
1045 inLen [ I ] - Length of input buffer
1046 pIn [ I ] - Input buffer
1047 pDataCapsSize [I/O] - Upon input the maximum number of elements that the
1048 data capabilities array can contain. Upon success
1049 the actual number of elements in the data
1050 capabilities array
1051 pDataCaps [ O ] - The data capabilities array
1052
1053 RETURN VALUE:
1054 ULONG - Return code
1055 ===========================================================================*/
1056 ULONG ParseGetServingNetworkCapabilities(
1057 ULONG inLen,
1058 const BYTE * pIn,
1059 BYTE * pDataCapsSize,
1060 BYTE * pDataCaps )
1061 {
1062 // Validate arguments
1063 if (pIn == 0
1064 || pDataCapsSize == 0
1065 || *pDataCapsSize == 0
1066 || pDataCaps == 0)
1067 {
1068 return eGOBI_ERR_INVALID_ARG;
1069 }
1070
1071 BYTE maxDataCaps = *pDataCapsSize;
1072
1073 // Assume failure
1074 *pDataCapsSize = 0;
1075
1076 // Find the TLV
1077 const sNASGetServingSystemResponse_DataServices * pTLVx11;
1078 ULONG outLenx11;
1079 ULONG rc = GetTLV( inLen, pIn, 0x11, &outLenx11, (const BYTE **)&pTLVx11 );
1080 if (rc != eGOBI_ERR_NONE)
1081 {
1082 return rc;
1083 }
1084
1085 // Is the TLV large enough?
1086 if (outLenx11 < sizeof( sNASGetServingSystemResponse_DataServices ))
1087 {
1088 return eGOBI_ERR_MALFORMED_RSP;
1089 }
1090
1091 BYTE activeDataCaps = pTLVx11->mNumberOfDataCapabilities;
1092 if (activeDataCaps > maxDataCaps)
1093 {
1094 activeDataCaps = maxDataCaps;
1095 }
1096
1097 const eQMINASDataServiceCapabilities2 * pInDataCaps;
1098
1099 // Verify there is room for the array in the TLV
1100 if (outLenx11 < sizeof( sNASGetServingSystemResponse_DataServices )
1101 + sizeof( eQMINASDataServiceCapabilities2 ) * activeDataCaps)
1102 {
1103 return eGOBI_ERR_MALFORMED_RSP;
1104 }
1105
1106 // Align to the first array element
1107 pInDataCaps = (const eQMINASDataServiceCapabilities2 *)
1108 ((const BYTE *)pTLVx11
1109 + sizeof( sNASGetServingSystemResponse_DataServices ));
1110
1111 ULONG * pOutDataCaps = (ULONG *)pDataCaps;
1112 for (ULONG d = 0; d < activeDataCaps; d++)
1113 {
1114 *pOutDataCaps = *pInDataCaps;
1115 pOutDataCaps++;
1116 pInDataCaps++;
1117 }
1118
1119 *pDataCapsSize = activeDataCaps;
1120
1121 return eGOBI_ERR_NONE;
1122 }
1123
1124 /*===========================================================================
1125 METHOD:
1126 ParseGetHomeNetwork
1127
1128 DESCRIPTION:
1129 This function retrieves information about the home network of the device
1130
1131 PARAMETERS:
1132 inLen [ I ] - Length of input buffer
1133 pIn [ I ] - Input buffer
1134 pMCC [ O ] - Mobile country code
1135 pMNC [ O ] - Mobile network code
1136 nameSize [ I ] - The maximum number of characters (including NULL
1137 terminator) that the network name array can contain
1138 pName [ O ] - The network name or description represented as a NULL
1139 terminated string (empty string returned when unknown)
1140 pSID [ O ] - Home network system ID (0xFFFF - Unknown)
1141 pNID [ O ] - Home network ID (0xFFFF - Unknown)
1142
1143 RETURN VALUE:
1144 ULONG - Return code
1145 ===========================================================================*/
1146 ULONG ParseGetHomeNetwork(
1147 ULONG inLen,
1148 const BYTE * pIn,
1149 WORD * pMCC,
1150 WORD * pMNC,
1151 BYTE nameSize,
1152 CHAR * pName,
1153 WORD * pSID,
1154 WORD * pNID )
1155 {
1156 // Validate arguments
1157 if (pIn == 0
1158 || pMCC == 0
1159 || pMNC == 0
1160 || nameSize == 0
1161 || pName == 0
1162 || pSID == 0)
1163 {
1164 return eGOBI_ERR_INVALID_ARG;
1165 }
1166
1167 // Assume failure
1168 *pName = 0;
1169 *pSID = 0xffff;
1170 *pNID = 0xffff;
1171
1172 // Find the name (mandatory)
1173 const sNASGetHomeNetworkResponse_HomeNetwork * pTLVx01;
1174 ULONG outLenx01;
1175 ULONG rc = GetTLV( inLen, pIn, 0x01, &outLenx01, (const BYTE **)&pTLVx01 );
1176 if (rc != eGOBI_ERR_NONE)
1177 {
1178 return rc;
1179 }
1180
1181 if (outLenx01 < sizeof( sNASGetHomeNetworkResponse_HomeNetwork ))
1182 {
1183 return eGOBI_ERR_MALFORMED_RSP;
1184 }
1185
1186 // Populate the variables
1187 *pMCC = pTLVx01->mMobileCountryCode;
1188 *pMNC = pTLVx01->mMobileNetworkCode;
1189
1190 ULONG descLen = pTLVx01->mDescriptionLength;
1191 const CHAR * pDesc;
1192
1193 // Verify there is room for the array in the TLV
1194 if (outLenx01 < sizeof( sNASGetHomeNetworkResponse_HomeNetwork )
1195 + sizeof( CHAR ) * descLen)
1196 {
1197 return eGOBI_ERR_MALFORMED_RSP;
1198 }
1199
1200 // Space to perform the copy?
1201 if (nameSize < descLen + 1)
1202 {
1203 return eGOBI_ERR_BUFFER_SZ;
1204 }
1205
1206 // Align to the first array element
1207 pDesc = (const CHAR *)((const BYTE *)pTLVx01
1208 + sizeof( sNASGetHomeNetworkResponse_HomeNetwork ));
1209
1210 memcpy( pName, pDesc, descLen );
1211 pName[descLen] = 0;
1212
1213
1214 // Find the SID/NID (optional)
1215 const sNASGetHomeNetworkResponse_HomeIDs * pTLVx10;
1216 ULONG outLenx10;
1217 rc = GetTLV( inLen, pIn, 0x10, &outLenx10, (const BYTE **)&pTLVx10 );
1218 if (rc == eGOBI_ERR_NONE)
1219 {
1220 if (outLenx10 < sizeof( sNASGetHomeNetworkResponse_HomeIDs ))
1221 {
1222 return eGOBI_ERR_MALFORMED_RSP;
1223 }
1224
1225 *pSID = pTLVx10->mSystemID;
1226 *pNID = pTLVx10->mNetworkID;
1227 }
1228
1229 return eGOBI_ERR_NONE;
1230 }
1231
1232 /*===========================================================================
1233 METHOD:
1234 PackSetNetworkPreference
1235
1236 DESCRIPTION:
1237 This function sets the network registration preference
1238
1239 PARAMETERS:
1240 pOutLen [I/O] - Upon input the maximum number of BYTEs pOut can
1241 contain, upon output the number of BYTEs copied
1242 to pOut
1243 pOut [ O ] - Output buffer
1244 technologyPref [ I ] - Technology preference bitmap
1245 duration [ I ] - Duration of active preference
1246
1247 RETURN VALUE:
1248 ULONG - Return code
1249 ===========================================================================*/
1250 ULONG PackSetNetworkPreference(
1251 ULONG * pOutLen,
1252 BYTE * pOut,
1253 ULONG technologyPref,
1254 ULONG duration )
1255 {
1256 // Validate arguments
1257 if (pOut == 0)
1258 {
1259 return eGOBI_ERR_INVALID_ARG;
1260 }
1261
1262 // Check size
1263 WORD tlvx01Sz = sizeof( sNASSetTechnologyPreferenceRequest_Preference );
1264 if (*pOutLen < sizeof( sQMIRawContentHeader ) + tlvx01Sz)
1265 {
1266 return eGOBI_ERR_BUFFER_SZ;
1267 }
1268
1269 sQMIRawContentHeader * pHeader = (sQMIRawContentHeader*)pOut;
1270 pHeader->mTypeID = 0x01;
1271 pHeader->mLength = tlvx01Sz;
1272
1273 ULONG offset = sizeof( sQMIRawContentHeader );
1274
1275 sNASSetTechnologyPreferenceRequest_Preference * pTLVx01;
1276 pTLVx01 = (sNASSetTechnologyPreferenceRequest_Preference*)(pOut + offset);
1277 memset( pTLVx01, 0, tlvx01Sz );
1278
1279 // Copy technology preference WORD as-is
1280 memcpy( &pTLVx01->mValOfTechnology, &technologyPref, 2 );
1281
1282 pTLVx01->mDuration = (eQMINASTechPrefDurations)duration;
1283
1284 offset += tlvx01Sz;
1285
1286 *pOutLen = offset;
1287 return eGOBI_ERR_NONE;
1288 }
1289
1290 /*===========================================================================
1291 METHOD:
1292 ParseGetNetworkPreference
1293
1294 DESCRIPTION:
1295 This function returns the network registration preference
1296
1297 PARAMETERS:
1298 inLen [ I ] - Length of input buffer
1299 pIn [ I ] - Input buffer
1300 pTechnologyPref [ O ] - Technology preference bitmap
1301 pDuration [ O ] - Duration of active preference
1302 pPersistentTechnologyPref [ O ] - Persistent technology preference bitmap
1303
1304 RETURN VALUE:
1305 ULONG - Return code
1306 ===========================================================================*/
1307 ULONG ParseGetNetworkPreference(
1308 ULONG inLen,
1309 const BYTE * pIn,
1310 ULONG * pTechnologyPref,
1311 ULONG * pDuration,
1312 ULONG * pPersistentTechnologyPref )
1313 {
1314 // Validate arguments
1315 if (pIn == 0
1316 || pTechnologyPref == 0
1317 || pDuration == 0
1318 || pPersistentTechnologyPref == 0)
1319 {
1320 return eGOBI_ERR_INVALID_ARG;
1321 }
1322
1323 // Find the preference (mandatory)
1324 const sNASGetTechnologyPreferenceResponse_ActivePreference * pTLVx01;
1325 ULONG outLenx01;
1326 ULONG rc = GetTLV( inLen, pIn, 0x01, &outLenx01, (const BYTE **)&pTLVx01 );
1327 if (rc != eGOBI_ERR_NONE)
1328 {
1329 return rc;
1330 }
1331
1332 if (outLenx01 < sizeof( sNASGetTechnologyPreferenceResponse_ActivePreference ))
1333 {
1334 return eGOBI_ERR_MALFORMED_RSP;
1335 }
1336
1337 // Copy technology preference WORD as-is
1338 *pTechnologyPref = 0;
1339 memcpy( pTechnologyPref, &pTLVx01->mValOfTechnology, 2 );
1340
1341 *pDuration = pTLVx01->mDuration;
1342
1343
1344 // Until we know any better the persistent setting is the current setting
1345 *pPersistentTechnologyPref = *pTechnologyPref;
1346
1347 // Find the persistant technology preference (optional)
1348 const sNASGetTechnologyPreferenceResponse_PersistentPreference * pTLVx10;
1349 ULONG outLenx10;
1350 rc = GetTLV( inLen, pIn, 0x10, &outLenx10, (const BYTE **)&pTLVx10 );
1351 if (rc == eGOBI_ERR_NONE)
1352 {
1353 if (outLenx10 < sizeof( sNASGetTechnologyPreferenceResponse_PersistentPreference ))
1354 {
1355 return eGOBI_ERR_MALFORMED_RSP;
1356 }
1357
1358 // Copy technology preference WORD as-is
1359 *pTechnologyPref = 0;
1360 memcpy( pPersistentTechnologyPref, &pTLVx10->mValOfTechnology, 2 );
1361 }
1362
1363 return eGOBI_ERR_NONE;
1364 }
1365
1366 /*===========================================================================
1367 METHOD:
1368 PackSetCDMANetworkParameters
1369
1370 DESCRIPTION:
1371 This function sets the desired CDMA network parameters
1372
1373 PARAMETERS:
1374 pOutLen [I/O] - Upon input the maximum number of BYTEs pOut can
1375 contain, upon output the number of BYTEs copied
1376 to pOut
1377 pOut [ O ] - Output buffer
1378 pSPC [ I ] - Six digit service programming code
1379 pForceRev0 [ I ] - (Optional) Force CDMA 1x-EV-DO Rev. 0 mode?
1380 pCustomSCP [ I ] - (Optional) Use a custom config for CDMA 1x-EV-DO SCP?
1381 pProtocol [ I ] - (Optional) Protocol mask for custom SCP config
1382 pBroadcast [ I ] - (Optional) Broadcast mask for custom SCP config
1383 pApplication [ I ] - (Optional) Application mask for custom SCP config
1384 pRoaming [ I ] - (Optional) Roaming preference
1385
1386 RETURN VALUE:
1387 ULONG - Return code
1388 ===========================================================================*/
1389 ULONG PackSetCDMANetworkParameters(
1390 ULONG * pOutLen,
1391 BYTE * pOut,
1392 CHAR * pSPC,
1393 BYTE * pForceRev0,
1394 BYTE * pCustomSCP,
1395 ULONG * pProtocol,
1396 ULONG * pBroadcast,
1397 ULONG * pApplication,
1398 ULONG * pRoaming )
1399 {
1400 // Validate arguments
1401 if (pOut == 0)
1402 {
1403 return eGOBI_ERR_INVALID_ARG;
1404 }
1405
1406 // If you specify one of the custom SCP config fields then you must
1407 // specify them all
1408 ULONG scpCount = 0;
1409 if (pCustomSCP != 0)
1410 {
1411 scpCount++;
1412 }
1413
1414 if (pProtocol != 0)
1415 {
1416 scpCount++;
1417 }
1418
1419 if (pBroadcast != 0)
1420 {
1421 scpCount++;
1422 }
1423
1424 if (pApplication != 0)
1425 {
1426 scpCount++;
1427 }
1428
1429 if (scpCount != 0 && scpCount != 4)
1430 {
1431 return eGOBI_ERR_INVALID_ARG;
1432 }
1433
1434 // Rev. 0 and SCP custom config are mutually exclusive
1435 if (pForceRev0 != 0 && scpCount == 4)
1436 {
1437 if (*pForceRev0 != 0 && *pCustomSCP != 0)
1438 {
1439 return eGOBI_ERR_INVALID_ARG;
1440 }
1441 }
1442
1443 sQMIRawContentHeader * pHeader;
1444 ULONG offset = 0;
1445
1446 // Need to start with SPC?
1447 if (pForceRev0 != 0 || scpCount == 4)
1448 {
1449 // Validate arguments
1450 if (pSPC == 0 || pSPC[0] == 0)
1451 {
1452 return eGOBI_ERR_INVALID_ARG;
1453 }
1454
1455 std::string spc( pSPC );
1456 if (spc.size() > 6)
1457 {
1458 return eGOBI_ERR_INVALID_ARG;
1459 }
1460
1461 if (spc.find_first_not_of( "0123456789" ) != std::string::npos )
1462 {
1463 return eGOBI_ERR_INVALID_ARG;
1464 }
1465
1466 // Check size
1467 WORD tlvx10Sz = sizeof( sNASSetNetworkParametersRequest_SPC );
1468 if (*pOutLen < offset + sizeof( sQMIRawContentHeader ) + tlvx10Sz)
1469 {
1470 return eGOBI_ERR_BUFFER_SZ;
1471 }
1472
1473 pHeader = (sQMIRawContentHeader*)(pOut + offset);
1474 pHeader->mTypeID = 0x10;
1475 pHeader->mLength = tlvx10Sz;
1476
1477 offset += sizeof( sQMIRawContentHeader );
1478
1479 sNASSetNetworkParametersRequest_SPC * pTLVx10;
1480 pTLVx10 = (sNASSetNetworkParametersRequest_SPC*)(pOut + offset);
1481 memset( pTLVx10, 0, tlvx10Sz );
1482
1483 // Set the values
1484 memcpy( &pTLVx10->mSPC[0], spc.c_str(), spc.size() );
1485
1486 offset += tlvx10Sz;
1487 }
1488
1489 // Force Rev. 0?
1490 if (pForceRev0 != 0)
1491 {
1492 // Check size
1493 WORD tlvx14Sz = sizeof( sNASSetNetworkParametersRequest_CDMA1xEVDORevision );
1494 if (*pOutLen < offset + sizeof( sQMIRawContentHeader ) + tlvx14Sz)
1495 {
1496 return eGOBI_ERR_BUFFER_SZ;
1497 }
1498
1499 pHeader = (sQMIRawContentHeader*)(pOut + offset);
1500 pHeader->mTypeID = 0x14;
1501 pHeader->mLength = tlvx14Sz;
1502
1503 offset += sizeof( sQMIRawContentHeader );
1504
1505 sNASSetNetworkParametersRequest_CDMA1xEVDORevision * pTLVx14;
1506 pTLVx14 = (sNASSetNetworkParametersRequest_CDMA1xEVDORevision*)(pOut + offset);
1507 memset( pTLVx14, 0, tlvx14Sz );
1508
1509 // Set the value
1510 pTLVx14->mForceCDMA1xEVDORev0 = (*pForceRev0 == 0 ? 0 : 1);
1511
1512 offset += tlvx14Sz;
1513 }
1514
1515 if (scpCount == 4)
1516 {
1517 // Check size
1518 WORD tlvx15Sz = sizeof( sNASSetNetworkParametersRequest_CDMA1xEVDOSCPCustom );
1519 if (*pOutLen < offset + sizeof( sQMIRawContentHeader ) + tlvx15Sz)
1520 {
1521 return eGOBI_ERR_BUFFER_SZ;
1522 }
1523
1524 pHeader = (sQMIRawContentHeader*)(pOut + offset);
1525 pHeader->mTypeID = 0x15;
1526 pHeader->mLength = tlvx15Sz;
1527
1528 offset += sizeof( sQMIRawContentHeader );
1529
1530 sNASSetNetworkParametersRequest_CDMA1xEVDOSCPCustom * pTLVx15;
1531 pTLVx15 = (sNASSetNetworkParametersRequest_CDMA1xEVDOSCPCustom*)(pOut + offset);
1532 memset( pTLVx15, 0, tlvx15Sz );
1533
1534 // Set the values
1535 pTLVx15->mCDMA1xEVDOSCPCustomConfig = (*pCustomSCP == 0 ? 0 : 1);
1536
1537 // The pProtocol bitmask
1538 pTLVx15->mSubtype2PhysicalLayer = (*pProtocol & 0x00000001 ? 1 : 0);
1539 pTLVx15->mEnhancedCCMAC = (*pProtocol & 0x00000002 ? 1 : 0);
1540 pTLVx15->mEnhancedACMAC = (*pProtocol & 0x00000004 ? 1 : 0);
1541 pTLVx15->mEnhancedFTCMAC = (*pProtocol & 0x00000008 ? 1 : 0);
1542 pTLVx15->mSubtype3RTCMAC = (*pProtocol & 0x00000010 ? 1 : 0);
1543 pTLVx15->mSubtype1RTCMAC = (*pProtocol & 0x00000020 ? 1 : 0);
1544 pTLVx15->mEnhancedIdle = (*pProtocol & 0x00000040 ? 1 : 0);
1545 pTLVx15->mGenericMultimodeCapableDiscPort
1546 = (*pProtocol & 0x00000080 ? 1 : 0);
1547
1548 pTLVx15->mGenericBroadcast = (*pBroadcast & 0x00000001 ? 1 : 0);
1549
1550 pTLVx15->mSNMultiflowPacketApplication
1551 = (*pApplication & 0x00000001 ? 1 : 0);
1552
1553 pTLVx15->mSNEnhancedMultiflowPacketApplication
1554 = (*pApplication & 0x00000002 ? 1 : 0);
1555
1556 offset += tlvx15Sz;
1557 }
1558
1559 if (pRoaming != 0)
1560 {
1561 // Check size
1562 WORD tlvx16Sz = sizeof( sNASSetNetworkParametersRequest_Roaming );
1563 if (*pOutLen < offset + sizeof( sQMIRawContentHeader ) + tlvx16Sz)
1564 {
1565 return eGOBI_ERR_BUFFER_SZ;
1566 }
1567
1568 pHeader = (sQMIRawContentHeader*)(pOut + offset);
1569 pHeader->mTypeID = 0x16;
1570 pHeader->mLength = tlvx16Sz;
1571
1572 offset += sizeof( sQMIRawContentHeader );
1573
1574 sNASSetNetworkParametersRequest_Roaming * pTLVx16;
1575 pTLVx16 = (sNASSetNetworkParametersRequest_Roaming*)(pOut + offset);
1576 memset( pTLVx16, 0, tlvx16Sz );
1577
1578 // Set the values
1579 pTLVx16->mRoamPreference = (eQMINASRoamingPreferences)*pRoaming;
1580
1581 offset += tlvx16Sz;
1582 }
1583
1584 // At least one of the optional parameters must have been set
1585 if (offset == 0)
1586 {
1587 return eGOBI_ERR_INVALID_ARG;
1588 }
1589
1590 *pOutLen = offset;
1591 return eGOBI_ERR_NONE;
1592 }
1593
1594 /*===========================================================================
1595 METHOD:
1596 ParseGetCDMANetworkParameters
1597
1598 DESCRIPTION:
1599 This function gets the current CDMA network parameters
1600
1601 PARAMETERS:
1602 inLen [ I ] - Length of input buffer
1603 pIn [ I ] - Input buffer
1604 pSCI [ O ] - Slot cycle index
1605 pSCM [ O ] - Station class mark
1606 pRegHomeSID [ O ] - Register on home SID?
1607 pRegForeignSID [ O ] - Register on foreign SID?
1608 pRegForeignNID [ O ] - Register on foreign NID?
1609 pForceRev0 [ O ] - Force CDMA 1x-EV-DO Rev. 0 mode?
1610 pCustomSCP [ O ] - Use a custom config for CDMA 1x-EV-DO SCP?
1611 pProtocol [ O ] - Protocol mask for custom SCP config
1612 pBroadcast [ O ] - Broadcast mask for custom SCP config
1613 pApplication [ O ] - Application mask for custom SCP config
1614 pRoaming [ O ] - Roaming preference
1615
1616 RETURN VALUE:
1617 ULONG - Return code
1618 ===========================================================================*/
1619 ULONG ParseGetCDMANetworkParameters(
1620 ULONG inLen,
1621 const BYTE * pIn,
1622 BYTE * pSCI,
1623 BYTE * pSCM,
1624 BYTE * pRegHomeSID,
1625 BYTE * pRegForeignSID,
1626 BYTE * pRegForeignNID,
1627 BYTE * pForceRev0,
1628 BYTE * pCustomSCP,
1629 ULONG * pProtocol,
1630 ULONG * pBroadcast,
1631 ULONG * pApplication,
1632 ULONG * pRoaming )
1633 {
1634 // Validate arguments
1635 if (pIn == 0
1636 || pSCI == 0
1637 || pSCM == 0
1638 || pRegHomeSID == 0
1639 || pRegForeignSID == 0
1640 || pRegForeignNID == 0
1641 || pForceRev0 == 0
1642 || pCustomSCP == 0
1643 || pProtocol == 0
1644 || pBroadcast == 0
1645 || pApplication == 0
1646 || pRoaming == 0)
1647 {
1648 return eGOBI_ERR_INVALID_ARG;
1649 }
1650
1651 *pSCI = 0xff;
1652 *pSCM = 0xff;
1653 *pRegHomeSID = 0xff;
1654 *pRegForeignSID = 0xff;
1655 *pRegForeignNID = 0xff;
1656 *pForceRev0 = 0xff;
1657 *pCustomSCP = 0xff;
1658 *pProtocol = 0xffffffff;
1659 *pBroadcast = 0xffffffff;
1660 *pApplication = 0xffffffff;
1661 *pRoaming = 0xff;
1662
1663 // Find the SCI
1664 const sNASGetNetworkParametersResponse_SCI * pTLVx11;
1665 ULONG outLenx11;
1666 ULONG rc = GetTLV( inLen, pIn, 0x11, &outLenx11, (const BYTE **)&pTLVx11 );
1667 if (rc == eGOBI_ERR_NONE)
1668 {
1669 if (outLenx11 < sizeof( sNASGetNetworkParametersResponse_SCI ))
1670 {
1671 return eGOBI_ERR_MALFORMED_RSP;
1672 }
1673
1674 *pSCI = pTLVx11->mSlotCycleIndex;
1675 }
1676
1677 // Find the SCM
1678 const sNASGetNetworkParametersResponse_SCM * pTLVx12;
1679 ULONG outLenx12;
1680 rc = GetTLV( inLen, pIn, 0x12, &outLenx12, (const BYTE **)&pTLVx12 );
1681 if (rc == eGOBI_ERR_NONE)
1682 {
1683 if (outLenx12 < sizeof( sNASGetNetworkParametersResponse_SCM ))
1684 {
1685 return eGOBI_ERR_MALFORMED_RSP;
1686 }
1687
1688 *pSCM = pTLVx12->mStationClassMark;
1689 }
1690
1691 // Find the Registration
1692 const sNASGetNetworkParametersResponse_Registration * pTLVx13;
1693 ULONG outLenx13;
1694 rc = GetTLV( inLen, pIn, 0x13, &outLenx13, (const BYTE **)&pTLVx13 );
1695 if (rc == eGOBI_ERR_NONE)
1696 {
1697 if (outLenx13 < sizeof( sNASGetNetworkParametersResponse_Registration ))
1698 {
1699 return eGOBI_ERR_MALFORMED_RSP;
1700 }
1701
1702 *pRegHomeSID = pTLVx13->mRegisterOnHomeSystem;
1703 *pRegForeignSID = pTLVx13->mRegisterOnForeignSystem;
1704 *pRegForeignNID = pTLVx13->mRegisterOnForeignNetwork;
1705 }
1706
1707 // Rev. 0?
1708 const sNASGetNetworkParametersResponse_CDMA1xEVDORevision * pTLVx14;
1709 ULONG outLenx14;
1710 rc = GetTLV( inLen, pIn, 0x14, &outLenx14, (const BYTE **)&pTLVx14 );
1711 if (rc == eGOBI_ERR_NONE)
1712 {
1713 if (outLenx14 < sizeof( sNASGetNetworkParametersResponse_CDMA1xEVDORevision ))
1714 {
1715 return eGOBI_ERR_MALFORMED_RSP;
1716 }
1717
1718 *pRegHomeSID = pTLVx14->mForceCDMA1xEVDORev0;
1719 }
1720
1721 // We're lazy, so we'll just typecast all the bitmask members from
1722 // sNASGetNetworkParametersResponse_CDMA1xEVDOSCPCustom into their
1723 // respective container parameters
1724 const sEVDOCustomSCPConfig * pTLVx15;
1725 ULONG outLenx15;
1726 rc = GetTLV( inLen, pIn, 0x15, &outLenx15, (const BYTE **)&pTLVx15 );
1727 if (rc == eGOBI_ERR_NONE)
1728 {
1729 if (outLenx15 < sizeof( sEVDOCustomSCPConfig ))
1730 {
1731 return eGOBI_ERR_MALFORMED_RSP;
1732 }
1733
1734 *pCustomSCP = pTLVx15->mbActive;
1735 *pProtocol = pTLVx15->mProtocolMask;
1736 *pBroadcast = pTLVx15->mBroadcastMask;
1737 *pApplication = pTLVx15->mApplicationMask;
1738 }
1739
1740 // Roaming?
1741 const sNASGetNetworkParametersResponse_Roaming * pTLVx16;
1742 ULONG outLenx16;
1743 rc = GetTLV( inLen, pIn, 0x16, &outLenx16, (const BYTE **)&pTLVx16 );
1744 if (rc == eGOBI_ERR_NONE)
1745 {
1746 if (outLenx16 < sizeof( sNASGetNetworkParametersResponse_Roaming ))
1747 {
1748 return eGOBI_ERR_MALFORMED_RSP;
1749 }
1750
1751 *pRoaming = (eQMINASRoamingPreferences)pTLVx16->mRoamPreference;
1752 }
1753
1754 return eGOBI_ERR_NONE;
1755 }
1756
1757 /*===========================================================================
1758 METHOD:
1759 ParseGetACCOLC
1760
1761 DESCRIPTION:
1762 This function returns the Access Overload Class (ACCOLC) of the device
1763
1764 PARAMETERS:
1765 inLen [ I ] - Length of input buffer
1766 pIn [ I ] - Input buffer
1767 pACCOLC [ O ] - The ACCOLC
1768
1769 RETURN VALUE:
1770 ULONG - Return code
1771 ===========================================================================*/
1772 ULONG ParseGetACCOLC(
1773 ULONG inLen,
1774 const BYTE * pIn,
1775 BYTE * pACCOLC )
1776 {
1777 // Validate arguments
1778 if (pIn == 0 || pACCOLC == 0)
1779 {
1780 return eGOBI_ERR_INVALID_ARG;
1781 }
1782
1783 // Find the ACCOLC (mandatory)
1784 const sNASGetACCOLCResponse_ACCOLC * pTLVx01;
1785 ULONG outLenx01;
1786 ULONG rc = GetTLV( inLen, pIn, 0x01, &outLenx01, (const BYTE **)&pTLVx01 );
1787 if (rc != eGOBI_ERR_NONE)
1788 {
1789 return rc;
1790 }
1791
1792 if (outLenx01 < sizeof( sNASGetACCOLCResponse_ACCOLC ))
1793 {
1794 return eGOBI_ERR_MALFORMED_RSP;
1795 }
1796
1797 *pACCOLC = pTLVx01->mACCOLC;
1798
1799 return eGOBI_ERR_NONE;
1800 }
1801
1802 /*===========================================================================
1803 METHOD:
1804 PackSetACCOLC
1805
1806 DESCRIPTION:
1807 This function sets the Access Overload Class (ACCOLC) of the device
1808
1809 PARAMETERS:
1810 pOutLen [I/O] - Upon input the maximum number of BYTEs pOut can
1811 contain, upon output the number of BYTEs copied
1812 to pOut
1813 pOut [ O ] - Output buffer
1814 pSPC [ I ] - NULL terminated string representing the six digit
1815 service programming code
1816 accolc [ I ] - The ACCOLC
1817
1818 RETURN VALUE:
1819 ULONG - Return code
1820 ===========================================================================*/
1821 ULONG PackSetACCOLC(
1822 ULONG * pOutLen,
1823 BYTE * pOut,
1824 CHAR * pSPC,
1825 BYTE accolc )
1826 {
1827 // Validate arguments
1828 if (pOut == 0 || pSPC == 0 || pSPC[0] == 0)
1829 {
1830 return eGOBI_ERR_INVALID_ARG;
1831 }
1832
1833 std::string spc( pSPC );
1834 if (spc.size() > 6)
1835 {
1836 return eGOBI_ERR_INVALID_ARG;
1837 }
1838
1839 if (spc.find_first_not_of( "0123456789" ) != std::string::npos )
1840 {
1841 return eGOBI_ERR_INVALID_ARG;
1842 }
1843
1844 // Check size
1845 WORD tlvx01Sz = sizeof( sNASSetACCOLCRequest_ACCOLC );
1846 if (*pOutLen < sizeof( sQMIRawContentHeader ) + tlvx01Sz)
1847 {
1848 return eGOBI_ERR_BUFFER_SZ;
1849 }
1850
1851 sQMIRawContentHeader * pHeader = (sQMIRawContentHeader*)pOut;
1852 pHeader->mTypeID = 0x01;
1853 pHeader->mLength = tlvx01Sz;
1854
1855 ULONG offset = sizeof( sQMIRawContentHeader );
1856
1857 sNASSetACCOLCRequest_ACCOLC * pTLVx01;
1858 pTLVx01 = (sNASSetACCOLCRequest_ACCOLC*)(pOut + offset);
1859 memset( pTLVx01, 0, tlvx01Sz );
1860
1861 // Set the values
1862 memcpy( &pTLVx01->mSPC[0], spc.c_str(), spc.size() );
1863 pTLVx01->mACCOLC = accolc;
1864
1865 offset += tlvx01Sz;
1866 *pOutLen = offset;
1867
1868 return eGOBI_ERR_NONE;
1869 }
1870
1871 /*===========================================================================
1872 METHOD:
1873 ParseGetPLMNMode
1874
1875 DESCRIPTION:
1876 This function returns the PLMN mode from the CSP
1877
1878 PARAMETERS:
1879 inLen [ I ] - Length of input buffer
1880 pIn [ I ] - Input buffer
1881 pMode [ O ] - PLMN mode
1882
1883 RETURN VALUE:
1884 ULONG - Return code
1885 ===========================================================================*/
1886 ULONG ParseGetPLMNMode(
1887 ULONG inLen,
1888 const BYTE * pIn,
1889 ULONG * pMode )
1890 {
1891 // Validate arguments
1892 if (pIn == 0 || pMode == 0)
1893 {
1894 return eGOBI_ERR_INVALID_ARG;
1895 }
1896
1897 // Find the mode (mandatory)
1898 const sNASGetCSPPLMNModeResponse_Mode * pTLVx10;
1899 ULONG outLenx10;
1900 ULONG rc = GetTLV( inLen, pIn, 0x10, &outLenx10, (const BYTE **)&pTLVx10 );
1901 if (rc != eGOBI_ERR_NONE)
1902 {
1903 return rc;
1904 }
1905
1906 if (outLenx10 < sizeof( sNASGetCSPPLMNModeResponse_Mode ))
1907 {
1908 return eGOBI_ERR_MALFORMED_RSP;
1909 }
1910
1911 *pMode = pTLVx10->mRestrictManualPLMNSelection;
1912
1913 return eGOBI_ERR_NONE;
1914 }
1915
1916 /*===========================================================================
1917 METHOD:
1918 PackGetPLMNName
1919
1920 DESCRIPTION:
1921 This function returns PLMN name information for the given MCC/MNC
1922
1923 PARAMETERS:
1924 pOutLen [I/O] - Upon input the maximum number of BYTEs pOut can
1925 contain, upon output the number of BYTEs copied
1926 to pOut
1927 pOut [ O ] - Output buffer
1928 mcc [ I ] - Mobile country code
1929 mnc [ I ] - Mobile network code
1930
1931 RETURN VALUE:
1932 ULONG - Return code
1933 ===========================================================================*/
1934 ULONG PackGetPLMNName(
1935 ULONG * pOutLen,
1936 BYTE * pOut,
1937 USHORT mcc,
1938 USHORT mnc )
1939 {
1940 // Validate arguments
1941 if (pOut == 0)
1942 {
1943 return eGOBI_ERR_INVALID_ARG;
1944 }
1945
1946 // Check size
1947 WORD tlvx01Sz = sizeof( sNASGetPLMNNameRequest_PLMN );
1948 if (*pOutLen < sizeof( sQMIRawContentHeader ) + tlvx01Sz)
1949 {
1950 return eGOBI_ERR_BUFFER_SZ;
1951 }
1952
1953 sQMIRawContentHeader * pHeader = (sQMIRawContentHeader*)pOut;
1954 pHeader->mTypeID = 0x01;
1955 pHeader->mLength = tlvx01Sz;
1956
1957 ULONG offset = sizeof( sQMIRawContentHeader );
1958
1959 sNASGetPLMNNameRequest_PLMN * pTLVx01;
1960 pTLVx01 = (sNASGetPLMNNameRequest_PLMN*)(pOut + offset);
1961 memset( pTLVx01, 0, tlvx01Sz );
1962
1963 // Set the values
1964 pTLVx01->mMobileCountryCode = mcc;
1965 pTLVx01->mMobileNetworkCode = mnc;
1966
1967 offset += tlvx01Sz;
1968 *pOutLen = offset;
1969
1970 return eGOBI_ERR_NONE;
1971 }
1972
1973 /*===========================================================================
1974 METHOD:
1975 ParseGetPLMNName
1976
1977 DESCRIPTION:
1978 This function returns PLMN name information for the given MCC/MNC
1979
1980 PARAMETERS:
1981 inLen [ I ] - Length of input buffer
1982 pIn [ I ] - Input buffer
1983 pNamesSize [I/O] - Upon input the size in BYTEs of the name structure
1984 array. Upon success the actual number of BYTEs
1985 copied to the name structure array
1986 pNames [ O ] - The name structure array
1987
1988 RETURN VALUE:
1989 ULONG - Return code
1990 ===========================================================================*/
1991 ULONG ParseGetPLMNName(
1992 ULONG inLen,
1993 const BYTE * pIn,
1994 ULONG * pNamesSize,
1995 BYTE * pNames )
1996 {
1997 // Validate arguments
1998 if (pIn == 0 || *pNamesSize == 0 || pNames == 0)
1999 {
2000 return eGOBI_ERR_INVALID_ARG;
2001 }
2002
2003 const BYTE * pTLVx10;
2004 ULONG outLenx10;
2005 ULONG rc = GetTLV( inLen, pIn, 0x10, &outLenx10, (const BYTE **)&pTLVx10 );
2006 if (rc != eGOBI_ERR_NONE)
2007 {
2008 return rc;
2009 }
2010
2011 // The output format just happens to be the same as
2012 // sNASGetPLMNNameResponse_Name. Copy the full TLV to pNames
2013 if (outLenx10 > *pNamesSize)
2014 {
2015 return eGOBI_ERR_BUFFER_SZ;
2016 }
2017
2018 memcpy( pNames, pTLVx10, outLenx10 );
2019 *pNamesSize = outLenx10;
2020
2021 return eGOBI_ERR_NONE;
2022 }