dfu-cc.pb.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. /**
  2. * Copyright (c) 2017 - 2019, 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 Tue Sep 11 14:37:18 2018. */
  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_EXTERNAL_APPLICATION = 4
  60. } dfu_fw_type_t;
  61. #define DFU_FW_TYPE_MIN DFU_FW_TYPE_APPLICATION
  62. #define DFU_FW_TYPE_MAX DFU_FW_TYPE_EXTERNAL_APPLICATION
  63. #define DFU_FW_TYPE_ARRAYSIZE ((dfu_fw_type_t)(DFU_FW_TYPE_EXTERNAL_APPLICATION+1))
  64. typedef enum
  65. {
  66. DFU_HASH_TYPE_NO_HASH = 0,
  67. DFU_HASH_TYPE_CRC = 1,
  68. DFU_HASH_TYPE_SHA128 = 2,
  69. DFU_HASH_TYPE_SHA256 = 3,
  70. DFU_HASH_TYPE_SHA512 = 4
  71. } dfu_hash_type_t;
  72. #define DFU_HASH_TYPE_MIN DFU_HASH_TYPE_NO_HASH
  73. #define DFU_HASH_TYPE_MAX DFU_HASH_TYPE_SHA512
  74. #define DFU_HASH_TYPE_ARRAYSIZE ((dfu_hash_type_t)(DFU_HASH_TYPE_SHA512+1))
  75. typedef enum
  76. {
  77. DFU_OP_CODE_INIT = 1
  78. } dfu_op_code_t;
  79. #define DFU_OP_CODE_MIN DFU_OP_CODE_INIT
  80. #define DFU_OP_CODE_MAX DFU_OP_CODE_INIT
  81. #define DFU_OP_CODE_ARRAYSIZE ((dfu_op_code_t)(DFU_OP_CODE_INIT+1))
  82. typedef enum
  83. {
  84. DFU_VALIDATION_TYPE_NO_VALIDATION = 0,
  85. DFU_VALIDATION_TYPE_VALIDATE_GENERATED_CRC = 1,
  86. DFU_VALIDATION_TYPE_VALIDATE_SHA256 = 2,
  87. DFU_VALIDATION_TYPE_VALIDATE_ECDSA_P256_SHA256 = 3
  88. } dfu_validation_type_t;
  89. #define DFU_VALIDATION_TYPE_MIN DFU_VALIDATION_TYPE_NO_VALIDATION
  90. #define DFU_VALIDATION_TYPE_MAX DFU_VALIDATION_TYPE_VALIDATE_ECDSA_P256_SHA256
  91. #define DFU_VALIDATION_TYPE_ARRAYSIZE ((dfu_validation_type_t)(DFU_VALIDATION_TYPE_VALIDATE_ECDSA_P256_SHA256+1))
  92. typedef enum
  93. {
  94. DFU_SIGNATURE_TYPE_ECDSA_P256_SHA256 = 0,
  95. DFU_SIGNATURE_TYPE_ED25519 = 1
  96. } dfu_signature_type_t;
  97. #define DFU_SIGNATURE_TYPE_MIN DFU_SIGNATURE_TYPE_ECDSA_P256_SHA256
  98. #define DFU_SIGNATURE_TYPE_MAX DFU_SIGNATURE_TYPE_ED25519
  99. #define DFU_SIGNATURE_TYPE_ARRAYSIZE ((dfu_signature_type_t)(DFU_SIGNATURE_TYPE_ED25519+1))
  100. /* Struct definitions */
  101. typedef PB_BYTES_ARRAY_T(64) dfu_boot_validation_bytes_t;
  102. typedef struct {
  103. dfu_validation_type_t type;
  104. dfu_boot_validation_bytes_t bytes;
  105. /* @@protoc_insertion_point(struct:dfu_boot_validation_t) */
  106. } dfu_boot_validation_t;
  107. typedef PB_BYTES_ARRAY_T(32) dfu_hash_hash_t;
  108. typedef struct {
  109. dfu_hash_type_t hash_type;
  110. dfu_hash_hash_t hash;
  111. /* @@protoc_insertion_point(struct:dfu_hash_t) */
  112. } dfu_hash_t;
  113. typedef struct {
  114. bool has_fw_version;
  115. uint32_t fw_version;
  116. bool has_hw_version;
  117. uint32_t hw_version;
  118. pb_size_t sd_req_count;
  119. uint32_t sd_req[16];
  120. bool has_type;
  121. dfu_fw_type_t type;
  122. bool has_sd_size;
  123. uint32_t sd_size;
  124. bool has_bl_size;
  125. uint32_t bl_size;
  126. bool has_app_size;
  127. uint32_t app_size;
  128. bool has_hash;
  129. dfu_hash_t hash;
  130. bool has_is_debug;
  131. bool is_debug;
  132. pb_size_t boot_validation_count;
  133. dfu_boot_validation_t boot_validation[3];
  134. /* @@protoc_insertion_point(struct:dfu_init_command_t) */
  135. } dfu_init_command_t;
  136. typedef struct {
  137. bool has_op_code;
  138. dfu_op_code_t op_code;
  139. bool has_init;
  140. dfu_init_command_t init;
  141. /* @@protoc_insertion_point(struct:dfu_command_t) */
  142. } dfu_command_t;
  143. typedef PB_BYTES_ARRAY_T(64) dfu_signed_command_signature_t;
  144. typedef struct {
  145. dfu_command_t command;
  146. dfu_signature_type_t signature_type;
  147. dfu_signed_command_signature_t signature;
  148. /* @@protoc_insertion_point(struct:dfu_signed_command_t) */
  149. } dfu_signed_command_t;
  150. typedef struct {
  151. bool has_command;
  152. dfu_command_t command;
  153. bool has_signed_command;
  154. dfu_signed_command_t signed_command;
  155. /* @@protoc_insertion_point(struct:dfu_packet_t) */
  156. } dfu_packet_t;
  157. /* Default values for struct fields */
  158. extern const bool dfu_init_command_is_debug_default;
  159. /* Initializer values for message structs */
  160. #define DFU_HASH_INIT_DEFAULT {(dfu_hash_type_t)0, {0, {0}}}
  161. #define DFU_BOOT_VALIDATION_INIT_DEFAULT {(dfu_validation_type_t)0, {0, {0}}}
  162. #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, 0, {DFU_BOOT_VALIDATION_INIT_DEFAULT, DFU_BOOT_VALIDATION_INIT_DEFAULT, DFU_BOOT_VALIDATION_INIT_DEFAULT}}
  163. #define DFU_COMMAND_INIT_DEFAULT {false, (dfu_op_code_t)0, false, DFU_INIT_COMMAND_INIT_DEFAULT}
  164. #define DFU_SIGNED_COMMAND_INIT_DEFAULT {DFU_COMMAND_INIT_DEFAULT, (dfu_signature_type_t)0, {0, {0}}}
  165. #define DFU_PACKET_INIT_DEFAULT {false, DFU_COMMAND_INIT_DEFAULT, false, DFU_SIGNED_COMMAND_INIT_DEFAULT}
  166. #define DFU_HASH_INIT_ZERO {(dfu_hash_type_t)0, {0, {0}}}
  167. #define DFU_BOOT_VALIDATION_INIT_ZERO {(dfu_validation_type_t)0, {0, {0}}}
  168. #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, 0, {DFU_BOOT_VALIDATION_INIT_ZERO, DFU_BOOT_VALIDATION_INIT_ZERO, DFU_BOOT_VALIDATION_INIT_ZERO}}
  169. #define DFU_COMMAND_INIT_ZERO {false, (dfu_op_code_t)0, false, DFU_INIT_COMMAND_INIT_ZERO}
  170. #define DFU_SIGNED_COMMAND_INIT_ZERO {DFU_COMMAND_INIT_ZERO, (dfu_signature_type_t)0, {0, {0}}}
  171. #define DFU_PACKET_INIT_ZERO {false, DFU_COMMAND_INIT_ZERO, false, DFU_SIGNED_COMMAND_INIT_ZERO}
  172. /* Field tags (for use in manual encoding/decoding) */
  173. #define DFU_BOOT_VALIDATION_TYPE_TAG 1
  174. #define DFU_BOOT_VALIDATION_BYTES_TAG 2
  175. #define DFU_HASH_HASH_TYPE_TAG 1
  176. #define DFU_HASH_HASH_TAG 2
  177. #define DFU_INIT_COMMAND_FW_VERSION_TAG 1
  178. #define DFU_INIT_COMMAND_HW_VERSION_TAG 2
  179. #define DFU_INIT_COMMAND_SD_REQ_TAG 3
  180. #define DFU_INIT_COMMAND_TYPE_TAG 4
  181. #define DFU_INIT_COMMAND_SD_SIZE_TAG 5
  182. #define DFU_INIT_COMMAND_BL_SIZE_TAG 6
  183. #define DFU_INIT_COMMAND_APP_SIZE_TAG 7
  184. #define DFU_INIT_COMMAND_HASH_TAG 8
  185. #define DFU_INIT_COMMAND_IS_DEBUG_TAG 9
  186. #define DFU_INIT_COMMAND_BOOT_VALIDATION_TAG 10
  187. #define DFU_COMMAND_OP_CODE_TAG 1
  188. #define DFU_COMMAND_INIT_TAG 2
  189. #define DFU_SIGNED_COMMAND_COMMAND_TAG 1
  190. #define DFU_SIGNED_COMMAND_SIGNATURE_TYPE_TAG 2
  191. #define DFU_SIGNED_COMMAND_SIGNATURE_TAG 3
  192. #define DFU_PACKET_COMMAND_TAG 1
  193. #define DFU_PACKET_SIGNED_COMMAND_TAG 2
  194. /* Struct field encoding specification for nanopb */
  195. extern const pb_field_t dfu_hash_fields[3];
  196. extern const pb_field_t dfu_boot_validation_fields[3];
  197. extern const pb_field_t dfu_init_command_fields[11];
  198. extern const pb_field_t dfu_command_fields[3];
  199. extern const pb_field_t dfu_signed_command_fields[4];
  200. extern const pb_field_t dfu_packet_fields[3];
  201. /* Maximum encoded size of messages (where known) */
  202. #define DFU_HASH_SIZE 36
  203. #define DFU_BOOT_VALIDATION_SIZE 68
  204. #define DFU_INIT_COMMAND_SIZE 378
  205. #define DFU_COMMAND_SIZE 383
  206. #define DFU_SIGNED_COMMAND_SIZE 454
  207. #define DFU_PACKET_SIZE 843
  208. /* Message IDs (where set with "msgid" option) */
  209. #ifdef PB_MSGID
  210. #define DFU_CC_MESSAGES \
  211. #endif
  212. #ifdef __cplusplus
  213. } /* extern "C" */
  214. #endif
  215. /* @@protoc_insertion_point(eof) */
  216. #endif