BitDecoderChannel.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright (C) 2007-2010 Siemens AG
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published
  6. * by the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*******************************************************************
  18. *
  19. * @author Daniel.Peintner.EXT@siemens.com
  20. * @version 0.3.1
  21. * @contact Joerg.Heuer@siemens.com
  22. *
  23. ********************************************************************/
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #include "EXITypes.h"
  28. #ifndef BIT_DECODER_CHANNEL_H
  29. #define BIT_DECODER_CHANNEL_H
  30. /**
  31. * Decode a single boolean value. The value false is represented by the bit
  32. * 0, and the value true is represented by the bit 1.
  33. */
  34. int decodeBoolean(bitstream_t* stream, int* b);
  35. /**
  36. * Decodes and returns an n-bit unsigned integer.
  37. */
  38. int decodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t* uint32);
  39. /**
  40. * Decode an arbitrary precision non negative integer using a sequence of
  41. * octets. The most significant bit of the last octet is set to zero to
  42. * indicate sequence termination. Only seven bits per octet are used to
  43. * store the integer's value.
  44. */
  45. int decodeUnsignedInteger16(bitstream_t* stream, uint16_t* uint16);
  46. /**
  47. * Decode an arbitrary precision non negative integer using a sequence of
  48. * octets. The most significant bit of the last octet is set to zero to
  49. * indicate sequence termination. Only seven bits per octet are used to
  50. * store the integer's value.
  51. */
  52. int decodeUnsignedInteger32(bitstream_t* stream, uint32_t* uint32);
  53. /**
  54. * Decode an arbitrary precision non negative integer using a sequence of
  55. * octets. The most significant bit of the last octet is set to zero to
  56. * indicate sequence termination. Only seven bits per octet are used to
  57. * store the integer's value.
  58. */
  59. int decodeUnsignedInteger64(bitstream_t* stream, uint64_t* uint64);
  60. /**
  61. * Decode an arbitrary precision integer using a sign bit followed by a
  62. * sequence of octets. The most significant bit of the last octet is set to
  63. * zero to indicate sequence termination. Only seven bits per octet are used
  64. * to store the integer's value.
  65. */
  66. int decodeInteger32(bitstream_t* stream, int32_t* int32);
  67. /**
  68. * Decode an arbitrary precision integer using a sign bit followed by a
  69. * sequence of octets. The most significant bit of the last octet is set to
  70. * zero to indicate sequence termination. Only seven bits per octet are used
  71. * to store the integer's value.
  72. */
  73. int decodeInteger64(bitstream_t* stream, int64_t* int64);
  74. /**
  75. * Decode a Float datatype as two consecutive Integers.
  76. * The first Integer represents the mantissa of the floating point
  77. * number and the second Integer represents the base-10 exponent
  78. * of the floating point number.
  79. */
  80. int decodeFloat(bitstream_t* stream, float_me_t* f);
  81. /**
  82. * Decode a sequence of characters for a given length.
  83. */
  84. int decodeStringOnly(bitstream_t* stream, uint16_t len, string_ucs_t* s);
  85. /**
  86. * Decode a length prefixed sequence of characters.
  87. */
  88. int decodeString(bitstream_t* stream, string_ucs_t* s);
  89. /**
  90. * Decode a length prefixed sequence of characters in the sense of string tables.
  91. * length == 0, local value partition hit
  92. * length == 1, global value partition hit
  93. * --> string literal is encoded as a String with the length incremented by two
  94. */
  95. int decodeStringValue(bitstream_t* stream, string_ucs_t* s);
  96. /**
  97. * Decode a sequence of characters according to a given length.
  98. */
  99. int decodeCharacters(bitstream_t* stream, uint16_t len, uint32_t* chars);
  100. /**
  101. * Decode a binary value as a length-prefixed sequence of octets.
  102. */
  103. int decodeBinary(bitstream_t* stream, bytes_t* bytes);
  104. #endif
  105. #ifdef __cplusplus
  106. }
  107. #endif