FreeRDP
ber.h File Reference
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <winpr/stream.h>
This graph shows which files directly or indirectly include this file:

Macros

#define BER_CLASS_MASK   0xC0
 
#define BER_CLASS_UNIV   0x00 /* 0 0 */
 
#define BER_CLASS_APPL   0x40 /* 0 1 */
 
#define BER_CLASS_CTXT   0x80 /* 1 0 */
 
#define BER_CLASS_PRIV   0xC0 /* 1 1 */
 
#define BER_PC_MASK   0x20
 
#define BER_PRIMITIVE   0x00 /* 0 */
 
#define BER_CONSTRUCT   0x20 /* 1 */
 
#define BER_TAG_MASK   0x1F
 
#define BER_TAG_BOOLEAN   0x01
 
#define BER_TAG_INTEGER   0x02
 
#define BER_TAG_BIT_STRING   0x03
 
#define BER_TAG_OCTET_STRING   0x04
 
#define BER_TAG_OBJECT_IDENFIER   0x06
 
#define BER_TAG_ENUMERATED   0x0A
 
#define BER_TAG_SEQUENCE   0x10
 
#define BER_TAG_SEQUENCE_OF   0x10
 
#define BER_PC(_pc)   (_pc ? BER_CONSTRUCT : BER_PRIMITIVE)
 

Functions

FREERDP_API BOOL ber_read_length (wStream *s, size_t *length)
 
FREERDP_API size_t ber_write_length (wStream *s, size_t length)
 
FREERDP_API size_t _ber_sizeof_length (size_t length)
 
FREERDP_API BOOL ber_read_universal_tag (wStream *s, BYTE tag, BOOL pc)
 
FREERDP_API size_t ber_write_universal_tag (wStream *s, BYTE tag, BOOL pc)
 
FREERDP_API BOOL ber_read_application_tag (wStream *s, BYTE tag, size_t *length)
 
FREERDP_API void ber_write_application_tag (wStream *s, BYTE tag, size_t length)
 
FREERDP_API BOOL ber_read_enumerated (wStream *s, BYTE *enumerated, BYTE count)
 
FREERDP_API void ber_write_enumerated (wStream *s, BYTE enumerated, BYTE count)
 
FREERDP_API BOOL ber_read_contextual_tag (wStream *s, BYTE tag, size_t *length, BOOL pc)
 
FREERDP_API size_t ber_write_contextual_tag (wStream *s, BYTE tag, size_t length, BOOL pc)
 
FREERDP_API size_t ber_sizeof_contextual_tag (size_t length)
 
FREERDP_API BOOL ber_read_sequence_tag (wStream *s, size_t *length)
 
FREERDP_API size_t ber_write_sequence_tag (wStream *s, size_t length)
 
FREERDP_API size_t ber_sizeof_sequence (size_t length)
 
FREERDP_API size_t ber_sizeof_sequence_tag (size_t length)
 
FREERDP_API BOOL ber_read_bit_string (wStream *s, size_t *length, BYTE *padding)
 
FREERDP_API BOOL ber_read_octet_string_tag (wStream *s, size_t *length)
 
FREERDP_API BOOL ber_read_octet_string (wStream *s, BYTE **content, size_t *length)
 
FREERDP_API size_t ber_write_octet_string_tag (wStream *s, size_t length)
 
FREERDP_API size_t ber_sizeof_octet_string (size_t length)
 
FREERDP_API size_t ber_sizeof_contextual_octet_string (size_t length)
 
FREERDP_API size_t ber_write_char_to_unicode_octet_string (wStream *s, const char *str)
 
FREERDP_API size_t ber_write_contextual_char_to_unicode_octet_string (wStream *s, BYTE tag, const char *oct_str)
 
FREERDP_API size_t ber_write_octet_string (wStream *s, const BYTE *oct_str, size_t length)
 
FREERDP_API BOOL ber_read_char_from_unicode_octet_string (wStream *s, char **str)
 
FREERDP_API BOOL ber_read_unicode_octet_string (wStream *s, LPWSTR *str)
 
FREERDP_API size_t ber_write_contextual_octet_string (wStream *s, BYTE tag, const BYTE *oct_str, size_t length)
 
FREERDP_API size_t ber_write_contextual_unicode_octet_string (wStream *s, BYTE tag, LPWSTR str)
 
FREERDP_API BOOL ber_read_BOOL (wStream *s, BOOL *value)
 Read a BER BOOLEAN. More...
 
FREERDP_API void ber_write_BOOL (wStream *s, BOOL value)
 
FREERDP_API BOOL ber_read_integer (wStream *s, UINT32 *value)
 
FREERDP_API size_t ber_write_integer (wStream *s, UINT32 value)
 
FREERDP_API size_t ber_write_contextual_integer (wStream *s, BYTE tag, UINT32 value)
 
FREERDP_API BOOL ber_read_integer_length (wStream *s, size_t *length)
 
FREERDP_API size_t ber_sizeof_integer (UINT32 value)
 
FREERDP_API size_t ber_sizeof_contextual_integer (UINT32 value)
 

Macro Definition Documentation

◆ BER_CLASS_APPL

#define BER_CLASS_APPL   0x40 /* 0 1 */

◆ BER_CLASS_CTXT

#define BER_CLASS_CTXT   0x80 /* 1 0 */

◆ BER_CLASS_MASK

#define BER_CLASS_MASK   0xC0

FreeRDP: A Remote Desktop Protocol Implementation ASN.1 Basic Encoding Rules (BER)

Copyright 2011-2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

◆ BER_CLASS_PRIV

#define BER_CLASS_PRIV   0xC0 /* 1 1 */

◆ BER_CLASS_UNIV

#define BER_CLASS_UNIV   0x00 /* 0 0 */

◆ BER_CONSTRUCT

#define BER_CONSTRUCT   0x20 /* 1 */

◆ BER_PC

#define BER_PC (   _pc)    (_pc ? BER_CONSTRUCT : BER_PRIMITIVE)

◆ BER_PC_MASK

#define BER_PC_MASK   0x20

◆ BER_PRIMITIVE

#define BER_PRIMITIVE   0x00 /* 0 */

◆ BER_TAG_BIT_STRING

#define BER_TAG_BIT_STRING   0x03

◆ BER_TAG_BOOLEAN

#define BER_TAG_BOOLEAN   0x01

◆ BER_TAG_ENUMERATED

#define BER_TAG_ENUMERATED   0x0A

◆ BER_TAG_INTEGER

#define BER_TAG_INTEGER   0x02

◆ BER_TAG_MASK

#define BER_TAG_MASK   0x1F

◆ BER_TAG_OBJECT_IDENFIER

#define BER_TAG_OBJECT_IDENFIER   0x06

◆ BER_TAG_OCTET_STRING

#define BER_TAG_OCTET_STRING   0x04

◆ BER_TAG_SEQUENCE

#define BER_TAG_SEQUENCE   0x10

◆ BER_TAG_SEQUENCE_OF

#define BER_TAG_SEQUENCE_OF   0x10

Function Documentation

◆ _ber_sizeof_length()

FREERDP_API size_t _ber_sizeof_length ( size_t  length)
Here is the caller graph for this function:

◆ ber_read_application_tag()

FREERDP_API BOOL ber_read_application_tag ( wStream s,
BYTE  tag,
size_t *  length 
)

Read BER Application tag.

Parameters
sstream
tagBER application-defined tag
lengthlength
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_read_bit_string()

FREERDP_API BOOL ber_read_bit_string ( wStream s,
size_t *  length,
BYTE padding 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_read_BOOL()

FREERDP_API BOOL ber_read_BOOL ( wStream s,
BOOL *  value 
)

Read a BER BOOLEAN.

Parameters
sThe stream to read from.
valueA pointer to the value read, must not be NULL
Returns
TRUE for success, FALSE for any failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_read_char_from_unicode_octet_string()

FREERDP_API BOOL ber_read_char_from_unicode_octet_string ( wStream s,
char **  str 
)
Here is the call graph for this function:

◆ ber_read_contextual_tag()

FREERDP_API BOOL ber_read_contextual_tag ( wStream s,
BYTE  tag,
size_t *  length,
BOOL  pc 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_read_enumerated()

FREERDP_API BOOL ber_read_enumerated ( wStream s,
BYTE enumerated,
BYTE  count 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_read_integer()

FREERDP_API BOOL ber_read_integer ( wStream s,
UINT32 *  value 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_read_integer_length()

FREERDP_API BOOL ber_read_integer_length ( wStream s,
size_t *  length 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_read_length()

FREERDP_API BOOL ber_read_length ( wStream s,
size_t *  length 
)
Here is the caller graph for this function:

◆ ber_read_octet_string()

FREERDP_API BOOL ber_read_octet_string ( wStream s,
BYTE **  content,
size_t *  length 
)
Here is the call graph for this function:

◆ ber_read_octet_string_tag()

FREERDP_API BOOL ber_read_octet_string_tag ( wStream s,
size_t *  length 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_read_sequence_tag()

FREERDP_API BOOL ber_read_sequence_tag ( wStream s,
size_t *  length 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_read_unicode_octet_string()

FREERDP_API BOOL ber_read_unicode_octet_string ( wStream s,
LPWSTR *  str 
)
Here is the call graph for this function:

◆ ber_read_universal_tag()

FREERDP_API BOOL ber_read_universal_tag ( wStream s,
BYTE  tag,
BOOL  pc 
)

Read BER Universal tag.

Parameters
sThe stream to read from
tagBER universally-defined tag
Returns
TRUE for success, FALSE otherwise
Here is the caller graph for this function:

◆ ber_sizeof_contextual_integer()

FREERDP_API size_t ber_sizeof_contextual_integer ( UINT32  value)
Here is the call graph for this function:

◆ ber_sizeof_contextual_octet_string()

FREERDP_API size_t ber_sizeof_contextual_octet_string ( size_t  length)
Here is the call graph for this function:

◆ ber_sizeof_contextual_tag()

FREERDP_API size_t ber_sizeof_contextual_tag ( size_t  length)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_sizeof_integer()

FREERDP_API size_t ber_sizeof_integer ( UINT32  value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_sizeof_octet_string()

FREERDP_API size_t ber_sizeof_octet_string ( size_t  length)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_sizeof_sequence()

FREERDP_API size_t ber_sizeof_sequence ( size_t  length)
Here is the call graph for this function:

◆ ber_sizeof_sequence_tag()

FREERDP_API size_t ber_sizeof_sequence_tag ( size_t  length)
Here is the call graph for this function:

◆ ber_write_application_tag()

FREERDP_API void ber_write_application_tag ( wStream s,
BYTE  tag,
size_t  length 
)

Write BER Application tag.

Parameters
sstream
tagBER application-defined tag
lengthlength
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_write_BOOL()

FREERDP_API void ber_write_BOOL ( wStream s,
BOOL  value 
)

Write a BER BOOLEAN

Parameters
sA pointer to the stream to write to
valueThe value to write
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_write_char_to_unicode_octet_string()

FREERDP_API size_t ber_write_char_to_unicode_octet_string ( wStream s,
const char *  str 
)
Here is the call graph for this function:

◆ ber_write_contextual_char_to_unicode_octet_string()

FREERDP_API size_t ber_write_contextual_char_to_unicode_octet_string ( wStream s,
BYTE  tag,
const char *  oct_str 
)
Here is the call graph for this function:

◆ ber_write_contextual_integer()

FREERDP_API size_t ber_write_contextual_integer ( wStream s,
BYTE  tag,
UINT32  value 
)
Here is the call graph for this function:

◆ ber_write_contextual_octet_string()

FREERDP_API size_t ber_write_contextual_octet_string ( wStream s,
BYTE  tag,
const BYTE oct_str,
size_t  length 
)
Here is the call graph for this function:

◆ ber_write_contextual_tag()

FREERDP_API size_t ber_write_contextual_tag ( wStream s,
BYTE  tag,
size_t  length,
BOOL  pc 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_write_contextual_unicode_octet_string()

FREERDP_API size_t ber_write_contextual_unicode_octet_string ( wStream s,
BYTE  tag,
LPWSTR  str 
)
Here is the call graph for this function:

◆ ber_write_enumerated()

FREERDP_API void ber_write_enumerated ( wStream s,
BYTE  enumerated,
BYTE  count 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_write_integer()

FREERDP_API size_t ber_write_integer ( wStream s,
UINT32  value 
)

Write a BER INTEGER

Parameters
sA pointer to the stream to write to
valueThe value to write
Returns
The size in bytes that were written
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_write_length()

FREERDP_API size_t ber_write_length ( wStream s,
size_t  length 
)

Write BER length.

Parameters
sstream
lengthlength
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_write_octet_string()

FREERDP_API size_t ber_write_octet_string ( wStream s,
const BYTE oct_str,
size_t  length 
)

Write a BER OCTET_STRING

Parameters
sstream
oct_stroctet string
lengthstring length
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_write_octet_string_tag()

FREERDP_API size_t ber_write_octet_string_tag ( wStream s,
size_t  length 
)
Here is the call graph for this function:

◆ ber_write_sequence_tag()

FREERDP_API size_t ber_write_sequence_tag ( wStream s,
size_t  length 
)

Write BER SEQUENCE tag.

Parameters
sstream
lengthlength
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ber_write_universal_tag()

FREERDP_API size_t ber_write_universal_tag ( wStream s,
BYTE  tag,
BOOL  pc 
)

Write BER Universal tag.

Parameters
sstream
tagBER universally-defined tag
pcprimitive (FALSE) or constructed (TRUE)
Here is the call graph for this function:
Here is the caller graph for this function: