unpack_define.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * MessagePack unpacking routine template
  3. *
  4. * Copyright (C) 2008-2010 FURUHASHI Sadayuki
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #ifndef MSGPACK_UNPACK_DEFINE_H__
  19. #define MSGPACK_UNPACK_DEFINE_H__
  20. #include "msgpack/sysdep.h"
  21. #include <stdlib.h>
  22. #include <string.h>
  23. #include <assert.h>
  24. #include <stdio.h>
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. #ifndef MSGPACK_EMBED_STACK_SIZE
  29. #define MSGPACK_EMBED_STACK_SIZE 32
  30. #endif
  31. // CS is first byte & 0x1f
  32. typedef enum {
  33. CS_HEADER = 0x00, // nil
  34. //CS_ = 0x01,
  35. //CS_ = 0x02, // false
  36. //CS_ = 0x03, // true
  37. CS_BIN_8 = 0x04,
  38. CS_BIN_16 = 0x05,
  39. CS_BIN_32 = 0x06,
  40. CS_EXT_8 = 0x07,
  41. CS_EXT_16 = 0x08,
  42. CS_EXT_32 = 0x09,
  43. CS_FLOAT = 0x0a,
  44. CS_DOUBLE = 0x0b,
  45. CS_UINT_8 = 0x0c,
  46. CS_UINT_16 = 0x0d,
  47. CS_UINT_32 = 0x0e,
  48. CS_UINT_64 = 0x0f,
  49. CS_INT_8 = 0x10,
  50. CS_INT_16 = 0x11,
  51. CS_INT_32 = 0x12,
  52. CS_INT_64 = 0x13,
  53. //CS_FIXEXT1 = 0x14,
  54. //CS_FIXEXT2 = 0x15,
  55. //CS_FIXEXT4 = 0x16,
  56. //CS_FIXEXT8 = 0x17,
  57. //CS_FIXEXT16 = 0x18,
  58. CS_RAW_8 = 0x19,
  59. CS_RAW_16 = 0x1a,
  60. CS_RAW_32 = 0x1b,
  61. CS_ARRAY_16 = 0x1c,
  62. CS_ARRAY_32 = 0x1d,
  63. CS_MAP_16 = 0x1e,
  64. CS_MAP_32 = 0x1f,
  65. ACS_RAW_VALUE,
  66. ACS_BIN_VALUE,
  67. ACS_EXT_VALUE,
  68. } msgpack_unpack_state;
  69. typedef enum {
  70. CT_ARRAY_ITEM,
  71. CT_MAP_KEY,
  72. CT_MAP_VALUE,
  73. } msgpack_container_type;
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif /* msgpack/unpack_define.h */