[#BloombergLP-balber-BerUtil]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balber.adoc[balber]::BerUtil
:relfileprefix: ../../
:mrdocs:

This utility contains functions to encode and decode primitive BER constructs and simple value semantic types&period; By convention, all functions return 0 on success, and a non&hyphen;zero value otherwise&period; Also by convention, all the &quot;get&quot; functions take an `accumNumBytesConsumed`&semi; each of the functions will add to this variable the number of bytes consumed within the scope of the function&period;

== Synopsis

Declared in `&lt;balber&lowbar;berutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
struct BerUtil;
----

== Enums

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/balber/BerUtil/_04enum.adoc[`Unnamed enum`] 
| Length sentinel indicating an indefinite BER element length&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/balber/BerUtil/getEndOfContentOctets.adoc[`getEndOfContentOctets`] 
| Decode the &quot;end&hyphen;of&hyphen;content&quot; octets (two consecutive zero&hyphen;octets) from the specified `streamBuf` and add the number of bytes consumed (which is always 2) to the specified `accumNumBytesConsumed`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/balber/BerUtil/getIdentifierOctets.adoc[`getIdentifierOctets`] 
| Decode the identifier octets from the specified `streamBuf` and load the tag class, tag type, and tag number to the specified `tagClass`, `tagType`, and `tagNumber` respectively&period; Add the number of bytes consumed to the specified `accumNumBytesConsumed`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/balber/BerUtil/getLength.adoc[`getLength`] 
| Decode the length octets from the specified `streamBuf` and load the result to the specified `result`&period; If the length is indefinite (i&period;e&period;, contents will be terminated by &quot;end&hyphen;of&hyphen;content&quot; octets) then `result` will be set to `k&lowbar;INDEFINITE&lowbar;LENGTH`&period; Add the number of bytes consumed to the specified `accumNumBytesConsumed`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/balber/BerUtil/getValue-0b.adoc[`getValue`] 
| `getValue` overloads
| xref:BloombergLP/balber/BerUtil/putEndOfContentOctets.adoc[`putEndOfContentOctets`] 
| Encode the &quot;end&hyphen;of&hyphen;content&quot; octets (two consecutive zero&hyphen;octets) to the specified `streamBuf`&period; The &quot;end&hyphen;of&hyphen;content&quot; octets act as the termination bytes for objects that have indefinite length&period; Return 0 on success, and a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/balber/BerUtil/putIdentifierOctets.adoc[`putIdentifierOctets`] 
| Encode the identifier octets for the specified `tagClass`, `tagType` and `tagNumber` to the specified `streamBuf`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/balber/BerUtil/putIndefiniteLengthOctet.adoc[`putIndefiniteLengthOctet`] 
| Encode the &quot;indefinite&hyphen;length&quot; octet onto the specified `streamBuf`&period; This octet signifies that the length of the contents is indefinite (i&period;e&period;, contents will be terminated by end of content octets)&period; Return 0 on success, and a non&hyphen;zero value otherwise&period;
| xref:BloombergLP/balber/BerUtil/putLength.adoc[`putLength`] 
| Encode the specified `length` to the specified `streamBuf`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; The behavior is undefined unless `0 &lt;&equals; length`&period;
| xref:BloombergLP/balber/BerUtil/putValue.adoc[`putValue`] 
| Encode the specified `value` to the specified `streamBuf`&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; Note that the value consists of the length and contents primitives&period; Also note that only fundamental C&plus;&plus; types, `bsl&colon;&colon;string`, `bsl&colon;&colon;string&lowbar;view`, `bslstl&colon;&colon;StringRef`, and BDE date&sol;time types are supported&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
