dfu-cc.pb.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /**
  2. * Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Nordic
  13. * Semiconductor ASA integrated circuit in a product or a software update for
  14. * such product, must reproduce the above copyright notice, this list of
  15. * conditions and the following disclaimer in the documentation and/or other
  16. * materials provided with the distribution.
  17. *
  18. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * 4. This software, with or without modification, must only be used with a
  23. * Nordic Semiconductor ASA integrated circuit.
  24. *
  25. * 5. Any software provided in binary form under this license must not be reverse
  26. * engineered, decompiled, modified and/or disassembled.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  29. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. /* Automatically generated nanopb header */
  41. /* Generated by nanopb-0.3.6-dev at Wed Dec 13 13:37:53 2017. */
  42. #ifndef PB_DFU_CC_PB_H_INCLUDED
  43. #define PB_DFU_CC_PB_H_INCLUDED
  44. #include <pb.h>
  45. /* @@protoc_insertion_point(includes) */
  46. #if PB_PROTO_HEADER_VERSION != 30
  47. #error Regenerate this file with the current version of nanopb generator.
  48. #endif
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52. /* Enum definitions */
  53. typedef enum
  54. {
  55. DFU_FW_TYPE_APPLICATION = 0,
  56. DFU_FW_TYPE_SOFTDEVICE = 1,
  57. DFU_FW_TYPE_BOOTLOADER = 2,
  58. DFU_FW_TYPE_SOFTDEVICE_BOOTLOADER = 3
  59. } dfu_fw_type_t;
  60. #define DFU_FW_TYPE_MIN DFU_FW_TYPE_APPLICATION
  61. #define DFU_FW_TYPE_MAX DFU_FW_TYPE_SOFTDEVICE_BOOTLOADER
  62. #define DFU_FW_TYPE_ARRAYSIZE ((dfu_fw_type_t)(DFU_FW_TYPE_SOFTDEVICE_BOOTLOADER+1))
  63. typedef enum
  64. {
  65. DFU_HASH_TYPE_NO_HASH = 0,
  66. DFU_HASH_TYPE_CRC = 1,
  67. DFU_HASH_TYPE_SHA128 = 2,
  68. DFU_HASH_TYPE_SHA256 = 3,
  69. DFU_HASH_TYPE_SHA512 = 4
  70. } dfu_hash_type_t;
  71. #define DFU_HASH_TYPE_MIN DFU_HASH_TYPE_NO_HASH
  72. #define DFU_HASH_TYPE_MAX DFU_HASH_TYPE_SHA512
  73. #define DFU_HASH_TYPE_ARRAYSIZE ((dfu_hash_type_t)(DFU_HASH_TYPE_SHA512+1))
  74. typedef enum
  75. {
  76. DFU_SIGNATURE_TYPE_ECDSA_P256_SHA256 = 0,
  77. DFU_SIGNATURE_TYPE_ED25519 = 1
  78. } dfu_signature_type_t;
  79. #define DFU_SIGNATURE_TYPE_MIN DFU_SIGNATURE_TYPE_ECDSA_P256_SHA256
  80. #define DFU_SIGNATURE_TYPE_MAX DFU_SIGNATURE_TYPE_ED25519
  81. #define DFU_SIGNATURE_TYPE_ARRAYSIZE ((dfu_signature_type_t)(DFU_SIGNATURE_TYPE_ED25519+1))
  82. typedef enum
  83. {
  84. DFU_COMMAND_OP_CODE_INIT = 1
  85. } dfu_command_op_code_t;
  86. #define DFU_COMMAND_OP_CODE_MIN DFU_COMMAND_OP_CODE_INIT
  87. #define DFU_COMMAND_OP_CODE_MAX DFU_COMMAND_OP_CODE_INIT
  88. #define DFU_COMMAND_OP_CODE_ARRAYSIZE ((dfu_command_op_code_t)(DFU_COMMAND_OP_CODE_INIT+1))
  89. /* Struct definitions */
  90. typedef PB_BYTES_ARRAY_T(32) dfu_hash_hash_t;
  91. typedef struct {
  92. dfu_hash_type_t hash_type;
  93. dfu_hash_hash_t hash;
  94. /* @@protoc_insertion_point(struct:dfu_hash_t) */
  95. } dfu_hash_t;
  96. typedef struct {
  97. bool has_fw_version;
  98. uint32_t fw_version;
  99. bool has_hw_version;
  100. uint32_t hw_version;
  101. pb_size_t sd_req_count;
  102. uint32_t sd_req[16];
  103. bool has_type;
  104. dfu_fw_type_t type;
  105. bool has_sd_size;
  106. uint32_t sd_size;
  107. bool has_bl_size;
  108. uint32_t bl_size;
  109. bool has_app_size;
  110. uint32_t app_size;
  111. bool has_hash;
  112. dfu_hash_t hash;
  113. bool has_is_debug;
  114. bool is_debug;
  115. /* @@protoc_insertion_point(struct:dfu_init_command_t) */
  116. } dfu_init_command_t;
  117. typedef struct {
  118. bool has_op_code;
  119. dfu_command_op_code_t op_code;
  120. bool has_init;
  121. dfu_init_command_t init;
  122. /* @@protoc_insertion_point(struct:dfu_command_t) */
  123. } dfu_command_t;
  124. typedef PB_BYTES_ARRAY_T(64) dfu_signed_command_signature_t;
  125. typedef struct {
  126. dfu_command_t command;
  127. dfu_signature_type_t signature_type;
  128. dfu_signed_command_signature_t signature;
  129. /* @@protoc_insertion_point(struct:dfu_signed_command_t) */
  130. } dfu_signed_command_t;
  131. typedef struct {
  132. bool has_command;
  133. dfu_command_t command;
  134. bool has_signed_command;
  135. dfu_signed_command_t signed_command;
  136. /* @@protoc_insertion_point(struct:dfu_packet_t) */
  137. } dfu_packet_t;
  138. /* Default values for struct fields */
  139. extern const bool dfu_init_command_is_debug_default;
  140. /* Initializer values for message structs */
  141. #define DFU_HASH_INIT_DEFAULT {(dfu_hash_type_t)0, {0, {0}}}
  142. #define DFU_INIT_COMMAND_INIT_DEFAULT {false, 0, false, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, false, (dfu_fw_type_t)0, false, 0, false, 0, false, 0, false, DFU_HASH_INIT_DEFAULT, false, false}
  143. #define DFU_COMMAND_INIT_DEFAULT {false, (dfu_command_op_code_t)0, false, DFU_INIT_COMMAND_INIT_DEFAULT}
  144. #define DFU_SIGNED_COMMAND_INIT_DEFAULT {DFU_COMMAND_INIT_DEFAULT, (dfu_signature_type_t)0, {0, {0}}}
  145. #define DFU_PACKET_INIT_DEFAULT {false, DFU_COMMAND_INIT_DEFAULT, false, DFU_SIGNED_COMMAND_INIT_DEFAULT}
  146. #define DFU_HASH_INIT_ZERO {(dfu_hash_type_t)0, {0, {0}}}
  147. #define DFU_INIT_COMMAND_INIT_ZERO {false, 0, false, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, false, (dfu_fw_type_t)0, false, 0, false, 0, false, 0, false, DFU_HASH_INIT_ZERO, false, 0}
  148. #define DFU_COMMAND_INIT_ZERO {false, (dfu_command_op_code_t)0, false, DFU_INIT_COMMAND_INIT_ZERO}
  149. #define DFU_SIGNED_COMMAND_INIT_ZERO {DFU_COMMAND_INIT_ZERO, (dfu_signature_type_t)0, {0, {0}}}
  150. #define DFU_PACKET_INIT_ZERO {false, DFU_COMMAND_INIT_ZERO, false, DFU_SIGNED_COMMAND_INIT_ZERO}
  151. /* Field tags (for use in manual encoding/decoding) */
  152. #define DFU_HASH_HASH_TYPE_TAG 1
  153. #define DFU_HASH_HASH_TAG 2
  154. #define DFU_INIT_COMMAND_FW_VERSION_TAG 1
  155. #define DFU_INIT_COMMAND_HW_VERSION_TAG 2
  156. #define DFU_INIT_COMMAND_SD_REQ_TAG 3
  157. #define DFU_INIT_COMMAND_TYPE_TAG 4
  158. #define DFU_INIT_COMMAND_SD_SIZE_TAG 5
  159. #define DFU_INIT_COMMAND_BL_SIZE_TAG 6
  160. #define DFU_INIT_COMMAND_APP_SIZE_TAG 7
  161. #define DFU_INIT_COMMAND_HASH_TAG 8
  162. #define DFU_INIT_COMMAND_IS_DEBUG_TAG 9
  163. #define DFU_COMMAND_OP_CODE_TAG 1
  164. #define DFU_COMMAND_INIT_TAG 2
  165. #define DFU_SIGNED_COMMAND_COMMAND_TAG 1
  166. #define DFU_SIGNED_COMMAND_SIGNATURE_TYPE_TAG 2
  167. #define DFU_SIGNED_COMMAND_SIGNATURE_TAG 3
  168. #define DFU_PACKET_COMMAND_TAG 1
  169. #define DFU_PACKET_SIGNED_COMMAND_TAG 2
  170. /* Struct field encoding specification for nanopb */
  171. extern const pb_field_t dfu_hash_fields[3];
  172. extern const pb_field_t dfu_init_command_fields[10];
  173. extern const pb_field_t dfu_command_fields[3];
  174. extern const pb_field_t dfu_signed_command_fields[4];
  175. extern const pb_field_t dfu_packet_fields[3];
  176. /* Maximum encoded size of messages (where known) */
  177. #define DFU_HASH_SIZE 36
  178. #define DFU_INIT_COMMAND_SIZE 168
  179. #define DFU_COMMAND_SIZE 173
  180. #define DFU_SIGNED_COMMAND_SIZE 244
  181. #define DFU_PACKET_SIZE 423
  182. /* Message IDs (where set with "msgid" option) */
  183. #ifdef PB_MSGID
  184. #define DFU_CC_MESSAGES \
  185. #endif
  186. #ifdef __cplusplus
  187. } /* extern "C" */
  188. #endif
  189. /* @@protoc_insertion_point(eof) */
  190. #endif