| 589 | //////////////////////////////////////////////////////////////////////////// |
| 590 | |
| 591 | int ASNDerWriteToken(unsigned char* pbData, unsigned char ucType, |
| 592 | unsigned char* pbTokenValue, long nLength) |
| 593 | { |
| 594 | int nTotalBytesWrittenOut = 0L; |
| 595 | int nNumLengthBytesWritten = 0L; |
| 596 | |
| 597 | // Write out the type |
| 598 | *pbData = ucType; |
| 599 | |
| 600 | // Wrote 1 byte, and move data pointer |
| 601 | nTotalBytesWrittenOut++; |
| 602 | pbData++; |
| 603 | |
| 604 | // Now write out the length and adjust the number of bytes written out |
| 605 | nNumLengthBytesWritten = ASNDerWriteLength(pbData, nLength); |
| 606 | |
| 607 | nTotalBytesWrittenOut += nNumLengthBytesWritten; |
| 608 | pbData += nNumLengthBytesWritten; |
| 609 | |
| 610 | // Write out the token value if we got one. The assumption is that the |
| 611 | // nLength value indicates how many bytes are in pbTokenValue. |
| 612 | |
| 613 | if (NULL != pbTokenValue) |
| 614 | { |
| 615 | memcpy(pbData, pbTokenValue, nLength); |
| 616 | nTotalBytesWrittenOut += nLength; |
| 617 | } |
| 618 | |
| 619 | return nTotalBytesWrittenOut; |
| 620 | } |
| 621 | |
| 622 | |
| 623 | ///////////////////////////////////////////////////////////////////////////// |
no test coverage detected