diff --git a/Makefile b/Makefile
index d204e2b5..bd9526be 100644
--- a/Makefile
+++ b/Makefile
@@ -93,6 +93,7 @@ endif
# vendor/printf
DEFINES += PRINTF_DISABLE_SUPPORT_FLOAT PRINTF_DISABLE_SUPPORT_EXPONENTIAL PRINTF_DISABLE_SUPPORT_PTRDIFF_T
DEFINES += PRINTF_FTOA_BUFFER_SIZE=0
+DEFINES += PB_NO_STATIC_ASSERT
# U2F
DEFINES += HAVE_U2F HAVE_IO_U2F
diff --git a/proto/basic_types.pb.c b/proto/basic_types.pb.c
index 36c64644..7caea496 100644
--- a/proto/basic_types.pb.c
+++ b/proto/basic_types.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/basic_types.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/basic_types.pb.h b/proto/basic_types.pb.h
index 0e019d6e..e7759a4a 100644
--- a/proto/basic_types.pb.h
+++ b/proto/basic_types.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_BASIC_TYPES_PB_H_INCLUDED
#define PB_HEDERA_PROTO_BASIC_TYPES_PB_H_INCLUDED
@@ -18,17 +18,32 @@ typedef PB_BYTES_ARRAY_T(32) Hedera_AccountID_alias_t;
typedef struct _Hedera_AccountID {
/* *
The shard number (nonnegative) */
- int64_t shardNum;
+ int64_t shardNum;
/* *
The realm number (nonnegative) */
- int64_t realmNum;
- /* *
- A non-negative account number unique within its realm */
+ int64_t realmNum;
pb_size_t which_account;
union {
+ /* *
+ A non-negative account number unique within its realm */
int64_t accountNum;
+ /* *
+ The public key bytes to be used as the account's alias. The public key
+ bytes are the result of serializing a protobuf Key message for any
+ primitive key type. Currently only primitive key bytes are supported as
+ an alias (ThresholdKey, KeyList, ContractID, and delegatable_contract_id
+ are not supported)
+
+ At most one account can ever have a given alias and it is used for
+ account creation if it was automatically created using a crypto
+ transfer. It will be null if an account is created normally. It is
+ immutable once it is set for an account.
+
+ If a transaction auto-creates the account, any further transfers to that
+ alias will simply be deposited in that account, without creating
+ anything, and with no creation fee being charged. */
Hedera_AccountID_alias_t alias;
- } account;
+ } account;
} Hedera_AccountID;
typedef PB_BYTES_ARRAY_T(20) Hedera_ContractID_evm_address_t;
@@ -37,17 +52,36 @@ typedef PB_BYTES_ARRAY_T(20) Hedera_ContractID_evm_address_t;
typedef struct _Hedera_ContractID {
/* *
The shard number (nonnegative) */
- int64_t shardNum;
+ int64_t shardNum;
/* *
The realm number (nonnegative) */
- int64_t realmNum;
- /* *
- A nonnegative number unique within a given shard and realm */
+ int64_t realmNum;
pb_size_t which_contract;
union {
+ /* *
+ A nonnegative number unique within a given shard and realm */
int64_t contractNum;
+ /* *
+ The 20-byte EVM address of the contract to call.
+
+ Every contract has an EVM address determined by its
+ shard.realm.num id. This address is as follows:
- The
+ first 4 bytes are the big-endian representation of the shard.
+ - The next 8 bytes are the big-endian representation of the
+ realm.
- The final 8 bytes are the big-endian representation of
+ the number.
+
+
+ Contracts created via CREATE2 have an additional, primary address
+ that is derived from the EIP-1014
+ specification, and does not have a simple relation to a
+ shard.realm.num id.
+
+ (Please do note that CREATE2 contracts can also be referenced by the
+ three-part EVM address described above.) */
Hedera_ContractID_evm_address_t evm_address;
- } contract;
+ } contract;
} Hedera_ContractID;
/* *
@@ -55,13 +89,13 @@ typedef struct _Hedera_ContractID {
typedef struct _Hedera_FileID {
/* *
The shard number (nonnegative) */
- int64_t shardNum;
+ int64_t shardNum;
/* *
The realm number (nonnegative) */
- int64_t realmNum;
+ int64_t realmNum;
/* *
A nonnegative File number unique within its realm */
- int64_t fileNum;
+ int64_t fileNum;
} Hedera_FileID;
/* *
@@ -70,11 +104,11 @@ typedef struct _Hedera_FileID {
typedef struct _Hedera_Fraction {
/* *
The rational's numerator */
- int64_t numerator;
+ int64_t numerator;
/* *
The rational's denominator; a zero value will result in
FRACTION_DIVIDES_BY_ZERO */
- int64_t denominator;
+ int64_t denominator;
} Hedera_Fraction;
/* *
@@ -83,10 +117,10 @@ typedef struct _Hedera_Fraction {
typedef struct _Hedera_RealmID {
/* *
The shard number (nonnegative) */
- int64_t shardNum;
+ int64_t shardNum;
/* *
The realm number (nonnegative) */
- int64_t realmNum;
+ int64_t realmNum;
} Hedera_RealmID;
/* *
@@ -108,7 +142,7 @@ typedef struct _Hedera_RealmID {
typedef struct _Hedera_ShardID {
/* *
the shard number (nonnegative) */
- int64_t shardNum;
+ int64_t shardNum;
} Hedera_ShardID;
/* *
@@ -116,13 +150,13 @@ typedef struct _Hedera_ShardID {
typedef struct _Hedera_TokenID {
/* *
A nonnegative shard number */
- int64_t shardNum;
+ int64_t shardNum;
/* *
A nonnegative realm number */
- int64_t realmNum;
+ int64_t realmNum;
/* *
A nonnegative token number */
- int64_t tokenNum;
+ int64_t tokenNum;
} Hedera_TokenID;
/* *
@@ -132,16 +166,16 @@ typedef struct _Hedera_AccountAmount {
/* *
The Account ID that sends/receives cryptocurrency or tokens */
bool has_accountID;
- Hedera_AccountID accountID;
+ Hedera_AccountID accountID;
/* *
The amount of tinybars (for Crypto transfers) or in the lowest
denomination (for Token transfers) that the account sends(negative) or
receives(positive) */
- int64_t amount;
+ int64_t amount;
/* *
If true then the transfer is expected to be an approved allowance and the
accountID is expected to be the owner. The default is false (omitted). */
- bool is_approval;
+ bool is_approval;
} Hedera_AccountAmount;
typedef PB_BYTES_ARRAY_T(32) Hedera_Key_ed25519_t;
@@ -197,18 +231,34 @@ typedef PB_BYTES_ARRAY_T(32) Hedera_Key_ECDSA_secp256k1_t;
Each Key should not have more than 46 levels, which implies 15 levels of
nested ThresholdKeys. */
typedef struct _Hedera_Key {
- /* *
- smart contract instance that is authorized as if it had signed with a
- key */
pb_size_t which_key;
union {
+ /* *
+ smart contract instance that is authorized as if it had signed with a
+ key */
Hedera_ContractID contractID;
+ /* *
+ Ed25519 public key bytes */
Hedera_Key_ed25519_t ed25519;
+ /* *
+ (NOT SUPPORTED) RSA-3072 public key bytes */
Hedera_Key_RSA_3072_t RSA_3072;
+ /* *
+ (NOT SUPPORTED) ECDSA with the p-384 curve public key bytes */
Hedera_Key_ECDSA_384_t ECDSA_384;
+ /* *
+ Compressed ECDSA(secp256k1) public key bytes */
Hedera_Key_ECDSA_secp256k1_t ECDSA_secp256k1;
+ /* *
+ A smart contract that, if the recipient of the active message frame,
+ should be treated as having signed. (Note this does not mean the code
+ being executed in the frame will belong to the given contract, since
+ it could be running another contract's code via delegatecall.
+ So setting this key is a more permissive version of setting the
+ contractID key, which also requires the code in the active message frame
+ belong to the the contract with the given id.) */
Hedera_ContractID delegatable_contract_id;
- } key;
+ } key;
} Hedera_Key;
/* *
@@ -220,19 +270,19 @@ typedef struct _Hedera_NftTransfer {
/* *
The accountID of the sender */
bool has_senderAccountID;
- Hedera_AccountID senderAccountID;
+ Hedera_AccountID senderAccountID;
/* *
The accountID of the receiver */
bool has_receiverAccountID;
- Hedera_AccountID receiverAccountID;
+ Hedera_AccountID receiverAccountID;
/* *
The serial number of the NFT */
- int64_t serialNumber;
+ int64_t serialNumber;
/* *
If true then the transfer is expected to be an approved allowance and the
senderAccountID is expected to be the owner. The default is false
(omitted). */
- bool is_approval;
+ bool is_approval;
} Hedera_NftTransfer;
/* *
@@ -241,7 +291,7 @@ typedef struct _Hedera_NftTransfer {
typedef struct _Hedera_StakingInfo {
/* *
If true, this account or contract declined to receive a staking reward. */
- bool decline_reward;
+ bool decline_reward;
/* *
The staking period during which either the staking settings for this
account or contract changed (such as starting staking or changing
@@ -249,20 +299,22 @@ typedef struct _Hedera_StakingInfo {
If this account or contract is not currently staked to a node, then this
field is not set. */
bool has_stake_period_start;
- Hedera_Timestamp stake_period_start;
+ Hedera_Timestamp stake_period_start;
/* *
The amount in tinybars that will be received in the next reward situation. */
- int64_t pending_reward;
+ int64_t pending_reward;
/* *
The total of balance of all accounts staked to this account or contract. */
- int64_t staked_to_me;
- /* *
- The account to which this account or contract is staking. */
+ int64_t staked_to_me;
pb_size_t which_staked_id;
union {
+ /* *
+ The account to which this account or contract is staking. */
Hedera_AccountID staked_account_id;
+ /* *
+ The ID of the node this account or contract is staked to. */
int64_t staked_node_id;
- } staked_id;
+ } staked_id;
} Hedera_StakingInfo;
/* A token - account association */
@@ -288,15 +340,15 @@ typedef struct _Hedera_TokenBalance {
/* *
A unique token id */
bool has_tokenId;
- Hedera_TokenID tokenId;
+ Hedera_TokenID tokenId;
/* *
Number of transferable units of the identified token. For token of type
FUNGIBLE_COMMON - balance in the smallest denomination. For token of type
NON_FUNGIBLE_UNIQUE - the number of NFTs held by the account */
- uint64_t balance;
+ uint64_t balance;
/* *
Tokens divide into 10decimals pieces */
- uint32_t decimals;
+ uint32_t decimals;
} Hedera_TokenBalance;
/* *
@@ -325,14 +377,14 @@ typedef struct _Hedera_TransactionID {
The transaction is invalid if consensusTimestamp <
transactionID.transactionStartValid */
bool has_transactionValidStart;
- Hedera_Timestamp transactionValidStart;
+ Hedera_Timestamp transactionValidStart;
/* *
The Account ID that paid for this transaction */
bool has_accountID;
- Hedera_AccountID accountID;
+ Hedera_AccountID accountID;
/* *
Whether the Transaction is of type Scheduled or no */
- bool scheduled;
+ bool scheduled;
/* *
The identifier for an internal transaction that was spawned as part
of handling a user transaction. (These internal transactions share the
@@ -342,7 +394,7 @@ typedef struct _Hedera_TransactionID {
An example is when a "parent" ContractCreate or ContractCall transaction
calls one or more HTS precompiled contracts; each of the "child"
transactions spawned for a precompile has a id with a different nonce. */
- int32_t nonce;
+ int32_t nonce;
} Hedera_TransactionID;
/* *
@@ -354,7 +406,7 @@ typedef struct _Hedera_KeyList {
list of keys
Limited to 1 here (because we don't have malloc!) */
pb_size_t keys_count;
- Hedera_Key keys[1];
+ Hedera_Key keys[1];
} Hedera_KeyList;
/* *
@@ -362,7 +414,7 @@ typedef struct _Hedera_KeyList {
Limited to 1 here */
typedef struct _Hedera_TokenBalances {
pb_size_t tokenBalances_count;
- Hedera_TokenBalance tokenBalances[1];
+ Hedera_TokenBalance tokenBalances[1];
} Hedera_TokenBalances;
/* *
@@ -373,27 +425,27 @@ typedef struct _Hedera_TokenTransferList {
/* *
The ID of the token */
bool has_token;
- Hedera_TokenID token;
+ Hedera_TokenID token;
/* *
Applicable to tokens of type FUNGIBLE_COMMON. Multiple list of
AccountAmounts, each of which has an account and amount
Limited to 2 for 1 allowed transfer (reciprocal subtraction of balance +
actual transfer) */
pb_size_t transfers_count;
- Hedera_AccountAmount transfers[2];
+ Hedera_AccountAmount transfers[2];
/* *
Applicable to tokens of type NON_FUNGIBLE_UNIQUE. Multiple list of
NftTransfers, each of which has a sender and receiver account, including
the serial number of the NFT
Limited to 1 here */
pb_size_t nftTransfers_count;
- Hedera_NftTransfer nftTransfers[1];
+ Hedera_NftTransfer nftTransfers[1];
/* *
If present, the number of decimals this fungible token type is expected to
have. The transfer will fail with UNEXPECTED_TOKEN_DECIMALS if the actual
decimals differ. */
bool has_expected_decimals;
- Hedera_UInt32Value expected_decimals;
+ Hedera_UInt32Value expected_decimals;
} Hedera_TokenTransferList;
/* *
@@ -405,7 +457,7 @@ typedef struct _Hedera_TransferList {
an amount to transfer into it (positive) or out of it (negative)
Limited to 2 for a transfer between two accounts */
pb_size_t accountAmounts_count;
- Hedera_AccountAmount accountAmounts[2];
+ Hedera_AccountAmount accountAmounts[2];
} Hedera_TransferList;
/* *
@@ -419,11 +471,11 @@ typedef struct _Hedera_TransferList {
typedef struct _Hedera_ThresholdKey {
/* *
A valid signature set must have at least this many signatures */
- uint32_t threshold;
+ uint32_t threshold;
/* *
List of all the keys that can sign */
bool has_keys;
- Hedera_KeyList keys;
+ Hedera_KeyList keys;
} Hedera_ThresholdKey;
diff --git a/proto/basic_types_pb2.py b/proto/basic_types_pb2.py
index 1861ee2f..a518ac9a 100644
--- a/proto/basic_types_pb2.py
+++ b/proto/basic_types_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/basic_types.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/basic_types.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -18,69 +29,69 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17proto/basic_types.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x15proto/timestamp.proto\x1a\x14proto/wrappers.proto\"\x1b\n\x07ShardID\x12\x10\n\x08shardNum\x18\x01 \x01(\x03\"-\n\x07RealmID\x12\x10\n\x08shardNum\x18\x01 \x01(\x03\x12\x10\n\x08realmNum\x18\x02 \x01(\x03\"h\n\tAccountID\x12\x10\n\x08shardNum\x18\x01 \x01(\x03\x12\x10\n\x08realmNum\x18\x02 \x01(\x03\x12\x14\n\naccountNum\x18\x03 \x01(\x03H\x00\x12\x16\n\x05\x61lias\x18\x04 \x01(\x0c\x42\x05\x92?\x02\x08 H\x00\x42\t\n\x07\x61\x63\x63ount\"=\n\x06\x46ileID\x12\x10\n\x08shardNum\x18\x01 \x01(\x03\x12\x10\n\x08realmNum\x18\x02 \x01(\x03\x12\x0f\n\x07\x66ileNum\x18\x03 \x01(\x03\"q\n\nContractID\x12\x10\n\x08shardNum\x18\x01 \x01(\x03\x12\x10\n\x08realmNum\x18\x02 \x01(\x03\x12\x15\n\x0b\x63ontractNum\x18\x03 \x01(\x03H\x00\x12\x1c\n\x0b\x65vm_address\x18\x04 \x01(\x0c\x42\x05\x92?\x02\x08\x14H\x00\x42\n\n\x08\x63ontract\"\x89\x01\n\rTransactionID\x12\x30\n\x15transactionValidStart\x18\x01 \x01(\x0b\x32\x11.Hedera.Timestamp\x12$\n\taccountID\x18\x02 \x01(\x0b\x32\x11.Hedera.AccountID\x12\x11\n\tscheduled\x18\x03 \x01(\x08\x12\r\n\x05nonce\x18\x04 \x01(\x05\"Z\n\rAccountAmount\x12$\n\taccountID\x18\x01 \x01(\x0b\x32\x11.Hedera.AccountID\x12\x0e\n\x06\x61mount\x18\x02 \x01(\x12\x12\x13\n\x0bis_approval\x18\x03 \x01(\x08\"D\n\x0cTransferList\x12\x34\n\x0e\x61\x63\x63ountAmounts\x18\x01 \x03(\x0b\x32\x15.Hedera.AccountAmountB\x05\x92?\x02\x10\x02\"\x92\x01\n\x0bNftTransfer\x12*\n\x0fsenderAccountID\x18\x01 \x01(\x0b\x32\x11.Hedera.AccountID\x12,\n\x11receiverAccountID\x18\x02 \x01(\x0b\x32\x11.Hedera.AccountID\x12\x14\n\x0cserialNumber\x18\x03 \x01(\x03\x12\x13\n\x0bis_approval\x18\x04 \x01(\x08\"\xc6\x01\n\x11TokenTransferList\x12\x1e\n\x05token\x18\x01 \x01(\x0b\x32\x0f.Hedera.TokenID\x12/\n\ttransfers\x18\x02 \x03(\x0b\x32\x15.Hedera.AccountAmountB\x05\x92?\x02\x10\x02\x12\x30\n\x0cnftTransfers\x18\x03 \x03(\x0b\x32\x13.Hedera.NftTransferB\x05\x92?\x02\x10\x01\x12.\n\x11\x65xpected_decimals\x18\x04 \x01(\x0b\x32\x13.Hedera.UInt32Value\"2\n\x08\x46raction\x12\x11\n\tnumerator\x18\x01 \x01(\x03\x12\x13\n\x0b\x64\x65nominator\x18\x02 \x01(\x03\"?\n\x07TokenID\x12\x10\n\x08shardNum\x18\x01 \x01(\x03\x12\x10\n\x08realmNum\x18\x02 \x01(\x03\x12\x10\n\x08tokenNum\x18\x03 \x01(\x03\"\xe0\x01\n\x03Key\x12(\n\ncontractID\x18\x01 \x01(\x0b\x32\x12.Hedera.ContractIDH\x00\x12\x18\n\x07\x65\x64\x32\x35\x35\x31\x39\x18\x02 \x01(\x0c\x42\x05\x92?\x02\x08 H\x00\x12\x19\n\x08RSA_3072\x18\x03 \x01(\x0c\x42\x05\x92?\x02\x08 H\x00\x12\x1a\n\tECDSA_384\x18\x04 \x01(\x0c\x42\x05\x92?\x02\x08 H\x00\x12 \n\x0f\x45\x43\x44SA_secp256k1\x18\x07 \x01(\x0c\x42\x05\x92?\x02\x08 H\x00\x12\x35\n\x17\x64\x65legatable_contract_id\x18\x08 \x01(\x0b\x32\x12.Hedera.ContractIDH\x00\x42\x05\n\x03key\"@\n\x0cThresholdKey\x12\x11\n\tthreshold\x18\x01 \x01(\r\x12\x1d\n\x04keys\x18\x02 \x01(\x0b\x32\x0f.Hedera.KeyList\"+\n\x07KeyList\x12 \n\x04keys\x18\x01 \x03(\x0b\x32\x0b.Hedera.KeyB\x05\x92?\x02\x10\x01\"S\n\x0cTokenBalance\x12 \n\x07tokenId\x18\x01 \x01(\x0b\x32\x0f.Hedera.TokenID\x12\x0f\n\x07\x62\x61lance\x18\x02 \x01(\x04\x12\x10\n\x08\x64\x65\x63imals\x18\x03 \x01(\r\"C\n\rTokenBalances\x12\x32\n\rtokenBalances\x18\x01 \x03(\x0b\x32\x14.Hedera.TokenBalanceB\x05\x92?\x02\x10\x01\"\\\n\x10TokenAssociation\x12!\n\x08token_id\x18\x01 \x01(\x0b\x32\x0f.Hedera.TokenID\x12%\n\naccount_id\x18\x02 \x01(\x0b\x32\x11.Hedera.AccountID\"\xd9\x01\n\x0bStakingInfo\x12\x16\n\x0e\x64\x65\x63line_reward\x18\x01 \x01(\x08\x12-\n\x12stake_period_start\x18\x02 \x01(\x0b\x32\x11.Hedera.Timestamp\x12\x16\n\x0epending_reward\x18\x03 \x01(\x03\x12\x14\n\x0cstaked_to_me\x18\x04 \x01(\x03\x12.\n\x11staked_account_id\x18\x05 \x01(\x0b\x32\x11.Hedera.AccountIDH\x00\x12\x18\n\x0estaked_node_id\x18\x06 \x01(\x03H\x00\x42\x0b\n\tstaked_idb\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.basic_types_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _ACCOUNTID.fields_by_name['alias']._options = None
- _ACCOUNTID.fields_by_name['alias']._serialized_options = b'\222?\002\010 '
- _CONTRACTID.fields_by_name['evm_address']._options = None
- _CONTRACTID.fields_by_name['evm_address']._serialized_options = b'\222?\002\010\024'
- _TRANSFERLIST.fields_by_name['accountAmounts']._options = None
- _TRANSFERLIST.fields_by_name['accountAmounts']._serialized_options = b'\222?\002\020\002'
- _TOKENTRANSFERLIST.fields_by_name['transfers']._options = None
- _TOKENTRANSFERLIST.fields_by_name['transfers']._serialized_options = b'\222?\002\020\002'
- _TOKENTRANSFERLIST.fields_by_name['nftTransfers']._options = None
- _TOKENTRANSFERLIST.fields_by_name['nftTransfers']._serialized_options = b'\222?\002\020\001'
- _KEY.fields_by_name['ed25519']._options = None
- _KEY.fields_by_name['ed25519']._serialized_options = b'\222?\002\010 '
- _KEY.fields_by_name['RSA_3072']._options = None
- _KEY.fields_by_name['RSA_3072']._serialized_options = b'\222?\002\010 '
- _KEY.fields_by_name['ECDSA_384']._options = None
- _KEY.fields_by_name['ECDSA_384']._serialized_options = b'\222?\002\010 '
- _KEY.fields_by_name['ECDSA_secp256k1']._options = None
- _KEY.fields_by_name['ECDSA_secp256k1']._serialized_options = b'\222?\002\010 '
- _KEYLIST.fields_by_name['keys']._options = None
- _KEYLIST.fields_by_name['keys']._serialized_options = b'\222?\002\020\001'
- _TOKENBALANCES.fields_by_name['tokenBalances']._options = None
- _TOKENBALANCES.fields_by_name['tokenBalances']._serialized_options = b'\222?\002\020\001'
- _SHARDID._serialized_start=94
- _SHARDID._serialized_end=121
- _REALMID._serialized_start=123
- _REALMID._serialized_end=168
- _ACCOUNTID._serialized_start=170
- _ACCOUNTID._serialized_end=274
- _FILEID._serialized_start=276
- _FILEID._serialized_end=337
- _CONTRACTID._serialized_start=339
- _CONTRACTID._serialized_end=452
- _TRANSACTIONID._serialized_start=455
- _TRANSACTIONID._serialized_end=592
- _ACCOUNTAMOUNT._serialized_start=594
- _ACCOUNTAMOUNT._serialized_end=684
- _TRANSFERLIST._serialized_start=686
- _TRANSFERLIST._serialized_end=754
- _NFTTRANSFER._serialized_start=757
- _NFTTRANSFER._serialized_end=903
- _TOKENTRANSFERLIST._serialized_start=906
- _TOKENTRANSFERLIST._serialized_end=1104
- _FRACTION._serialized_start=1106
- _FRACTION._serialized_end=1156
- _TOKENID._serialized_start=1158
- _TOKENID._serialized_end=1221
- _KEY._serialized_start=1224
- _KEY._serialized_end=1448
- _THRESHOLDKEY._serialized_start=1450
- _THRESHOLDKEY._serialized_end=1514
- _KEYLIST._serialized_start=1516
- _KEYLIST._serialized_end=1559
- _TOKENBALANCE._serialized_start=1561
- _TOKENBALANCE._serialized_end=1644
- _TOKENBALANCES._serialized_start=1646
- _TOKENBALANCES._serialized_end=1713
- _TOKENASSOCIATION._serialized_start=1715
- _TOKENASSOCIATION._serialized_end=1807
- _STAKINGINFO._serialized_start=1810
- _STAKINGINFO._serialized_end=2027
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.basic_types_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_ACCOUNTID'].fields_by_name['alias']._loaded_options = None
+ _globals['_ACCOUNTID'].fields_by_name['alias']._serialized_options = b'\222?\002\010 '
+ _globals['_CONTRACTID'].fields_by_name['evm_address']._loaded_options = None
+ _globals['_CONTRACTID'].fields_by_name['evm_address']._serialized_options = b'\222?\002\010\024'
+ _globals['_TRANSFERLIST'].fields_by_name['accountAmounts']._loaded_options = None
+ _globals['_TRANSFERLIST'].fields_by_name['accountAmounts']._serialized_options = b'\222?\002\020\002'
+ _globals['_TOKENTRANSFERLIST'].fields_by_name['transfers']._loaded_options = None
+ _globals['_TOKENTRANSFERLIST'].fields_by_name['transfers']._serialized_options = b'\222?\002\020\002'
+ _globals['_TOKENTRANSFERLIST'].fields_by_name['nftTransfers']._loaded_options = None
+ _globals['_TOKENTRANSFERLIST'].fields_by_name['nftTransfers']._serialized_options = b'\222?\002\020\001'
+ _globals['_KEY'].fields_by_name['ed25519']._loaded_options = None
+ _globals['_KEY'].fields_by_name['ed25519']._serialized_options = b'\222?\002\010 '
+ _globals['_KEY'].fields_by_name['RSA_3072']._loaded_options = None
+ _globals['_KEY'].fields_by_name['RSA_3072']._serialized_options = b'\222?\002\010 '
+ _globals['_KEY'].fields_by_name['ECDSA_384']._loaded_options = None
+ _globals['_KEY'].fields_by_name['ECDSA_384']._serialized_options = b'\222?\002\010 '
+ _globals['_KEY'].fields_by_name['ECDSA_secp256k1']._loaded_options = None
+ _globals['_KEY'].fields_by_name['ECDSA_secp256k1']._serialized_options = b'\222?\002\010 '
+ _globals['_KEYLIST'].fields_by_name['keys']._loaded_options = None
+ _globals['_KEYLIST'].fields_by_name['keys']._serialized_options = b'\222?\002\020\001'
+ _globals['_TOKENBALANCES'].fields_by_name['tokenBalances']._loaded_options = None
+ _globals['_TOKENBALANCES'].fields_by_name['tokenBalances']._serialized_options = b'\222?\002\020\001'
+ _globals['_SHARDID']._serialized_start=94
+ _globals['_SHARDID']._serialized_end=121
+ _globals['_REALMID']._serialized_start=123
+ _globals['_REALMID']._serialized_end=168
+ _globals['_ACCOUNTID']._serialized_start=170
+ _globals['_ACCOUNTID']._serialized_end=274
+ _globals['_FILEID']._serialized_start=276
+ _globals['_FILEID']._serialized_end=337
+ _globals['_CONTRACTID']._serialized_start=339
+ _globals['_CONTRACTID']._serialized_end=452
+ _globals['_TRANSACTIONID']._serialized_start=455
+ _globals['_TRANSACTIONID']._serialized_end=592
+ _globals['_ACCOUNTAMOUNT']._serialized_start=594
+ _globals['_ACCOUNTAMOUNT']._serialized_end=684
+ _globals['_TRANSFERLIST']._serialized_start=686
+ _globals['_TRANSFERLIST']._serialized_end=754
+ _globals['_NFTTRANSFER']._serialized_start=757
+ _globals['_NFTTRANSFER']._serialized_end=903
+ _globals['_TOKENTRANSFERLIST']._serialized_start=906
+ _globals['_TOKENTRANSFERLIST']._serialized_end=1104
+ _globals['_FRACTION']._serialized_start=1106
+ _globals['_FRACTION']._serialized_end=1156
+ _globals['_TOKENID']._serialized_start=1158
+ _globals['_TOKENID']._serialized_end=1221
+ _globals['_KEY']._serialized_start=1224
+ _globals['_KEY']._serialized_end=1448
+ _globals['_THRESHOLDKEY']._serialized_start=1450
+ _globals['_THRESHOLDKEY']._serialized_end=1514
+ _globals['_KEYLIST']._serialized_start=1516
+ _globals['_KEYLIST']._serialized_end=1559
+ _globals['_TOKENBALANCE']._serialized_start=1561
+ _globals['_TOKENBALANCE']._serialized_end=1644
+ _globals['_TOKENBALANCES']._serialized_start=1646
+ _globals['_TOKENBALANCES']._serialized_end=1713
+ _globals['_TOKENASSOCIATION']._serialized_start=1715
+ _globals['_TOKENASSOCIATION']._serialized_end=1807
+ _globals['_STAKINGINFO']._serialized_start=1810
+ _globals['_STAKINGINFO']._serialized_end=2027
# @@protoc_insertion_point(module_scope)
diff --git a/proto/contract_call.pb.c b/proto/contract_call.pb.c
index 07168a52..bd178f4f 100644
--- a/proto/contract_call.pb.c
+++ b/proto/contract_call.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/contract_call.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/contract_call.pb.h b/proto/contract_call.pb.h
index 0b5e8e97..772256ca 100644
--- a/proto/contract_call.pb.h
+++ b/proto/contract_call.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_CONTRACT_CALL_PB_H_INCLUDED
#define PB_HEDERA_PROTO_CONTRACT_CALL_PB_H_INCLUDED
@@ -29,16 +29,16 @@ typedef struct _Hedera_ContractCallTransactionBody {
/* *
The ID of a smart contract to call. */
bool has_contractID;
- Hedera_ContractID contractID;
+ Hedera_ContractID contractID;
/* Gas is defined as int64 in upstream proto (we could have negative gas); the app rejects negative values
Reference: https://github.com/hashgraph/hedera-protobufs/blob/8c27786cec93abab974309074feaef9b48a695b7/services/contract_call.proto#L70 */
- int64_t gas;
+ int64_t gas;
/* *
An amount of tinybar sent via this contract call.
If this is non-zero, the function MUST be `payable`. */
- int64_t amount;
- Hedera_ContractCallTransactionBody_functionParameters_t functionParameters;
+ int64_t amount;
+ Hedera_ContractCallTransactionBody_functionParameters_t functionParameters;
} Hedera_ContractCallTransactionBody;
diff --git a/proto/contract_call_pb2.py b/proto/contract_call_pb2.py
index c432100a..aab3bfe1 100644
--- a/proto/contract_call_pb2.py
+++ b/proto/contract_call_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/contract_call.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/contract_call.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -17,14 +28,14 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19proto/contract_call.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x17proto/basic_types.proto\"\x86\x01\n\x1b\x43ontractCallTransactionBody\x12&\n\ncontractID\x18\x01 \x01(\x0b\x32\x12.Hedera.ContractID\x12\x0b\n\x03gas\x18\x02 \x01(\x03\x12\x0e\n\x06\x61mount\x18\x03 \x01(\x03\x12\"\n\x12\x66unctionParameters\x18\x04 \x01(\x0c\x42\x06\x92?\x03\x08\x80\x04\x42&\n\"com.hederahashgraph.api.proto.javaP\x01\x62\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.contract_call_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- DESCRIPTOR._serialized_options = b'\n\"com.hederahashgraph.api.proto.javaP\001'
- _CONTRACTCALLTRANSACTIONBODY.fields_by_name['functionParameters']._options = None
- _CONTRACTCALLTRANSACTIONBODY.fields_by_name['functionParameters']._serialized_options = b'\222?\003\010\200\004'
- _CONTRACTCALLTRANSACTIONBODY._serialized_start=77
- _CONTRACTCALLTRANSACTIONBODY._serialized_end=211
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.contract_call_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ _globals['DESCRIPTOR']._loaded_options = None
+ _globals['DESCRIPTOR']._serialized_options = b'\n\"com.hederahashgraph.api.proto.javaP\001'
+ _globals['_CONTRACTCALLTRANSACTIONBODY'].fields_by_name['functionParameters']._loaded_options = None
+ _globals['_CONTRACTCALLTRANSACTIONBODY'].fields_by_name['functionParameters']._serialized_options = b'\222?\003\010\200\004'
+ _globals['_CONTRACTCALLTRANSACTIONBODY']._serialized_start=77
+ _globals['_CONTRACTCALLTRANSACTIONBODY']._serialized_end=211
# @@protoc_insertion_point(module_scope)
diff --git a/proto/crypto_create.pb.c b/proto/crypto_create.pb.c
index 83ac15ef..73f97d70 100644
--- a/proto/crypto_create.pb.c
+++ b/proto/crypto_create.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/crypto_create.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/crypto_create.pb.h b/proto/crypto_create.pb.h
index a5798bbe..2dc25314 100644
--- a/proto/crypto_create.pb.h
+++ b/proto/crypto_create.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_CRYPTO_CREATE_PB_H_INCLUDED
#define PB_HEDERA_PROTO_CRYPTO_CREATE_PB_H_INCLUDED
@@ -52,10 +52,10 @@ typedef struct _Hedera_CryptoCreateTransactionBody {
receiverSigRequired is true, then it must also sign any transfer into the
account. */
bool has_key;
- Hedera_Key key;
+ Hedera_Key key;
/* *
The initial number of tinybars to put into the account */
- uint64_t initialBalance;
+ uint64_t initialBalance;
/* *
[Deprecated] ID of the account to which this account is proxy staked. If
proxyAccountID is null, or is an invalid account, or is an account that
@@ -64,56 +64,59 @@ typedef struct _Hedera_CryptoCreateTransactionBody {
account refuses to accept proxy staking , or if it is not currently
running a node, then it will behave as if proxyAccountID was null. */
bool has_proxyAccountID;
- Hedera_AccountID proxyAccountID;
+ Hedera_AccountID proxyAccountID;
/* *
[Deprecated]. The threshold amount (in tinybars) for which an account
record is created for any send/withdraw transaction */
- uint64_t sendRecordThreshold;
+ uint64_t sendRecordThreshold;
/* *
[Deprecated]. The threshold amount (in tinybars) for which an account
record is created for any receive/deposit transaction */
- uint64_t receiveRecordThreshold;
+ uint64_t receiveRecordThreshold;
/* *
If true, this account's key must sign any transaction depositing into this
account (in addition to all withdrawals) */
- bool receiverSigRequired;
+ bool receiverSigRequired;
/* *
The account is charged to extend its expiration date every this many
seconds. If it doesn't have enough balance, it extends as long as
possible. If it is empty when it expires, then it is deleted. */
bool has_autoRenewPeriod;
- Hedera_Duration autoRenewPeriod;
+ Hedera_Duration autoRenewPeriod;
/* *
The shard in which this account is created */
bool has_shardID;
- Hedera_ShardID shardID;
+ Hedera_ShardID shardID;
/* *
The realm in which this account is created (leave this null to create a
new realm) */
bool has_realmID;
- Hedera_RealmID realmID;
+ Hedera_RealmID realmID;
/* *
If realmID is null, then this the admin key for the new realm that will be
created */
bool has_newRealmAdminKey;
- Hedera_Key newRealmAdminKey;
+ Hedera_Key newRealmAdminKey;
/* *
The memo associated with the account (UTF-8 encoding max 100 bytes) */
- char memo[100];
+ char memo[100];
/* *
The maximum number of tokens that an Account can be implicitly associated
with. Defaults to 0 and up to a maximum value of 1000. */
- int32_t max_automatic_token_associations;
- /* *
- ID of the account to which this account is staking. */
+ int32_t max_automatic_token_associations;
pb_size_t which_staked_id;
union {
+ /* *
+ ID of the account to which this account is staking. */
Hedera_AccountID staked_account_id;
+ /* *
+ ID of the node this account is staked to. */
int64_t staked_node_id;
- } staked_id;
+ } staked_id;
/* *
- ID of the node this account is staked to. */
- bool decline_reward;
+ If true, the account declines receiving a staking reward. The default
+ value is false. */
+ bool decline_reward;
} Hedera_CryptoCreateTransactionBody;
diff --git a/proto/crypto_create_pb2.py b/proto/crypto_create_pb2.py
index 6f2009d0..b858fbc1 100644
--- a/proto/crypto_create_pb2.py
+++ b/proto/crypto_create_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/crypto_create.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/crypto_create.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -18,19 +29,19 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19proto/crypto_create.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x17proto/basic_types.proto\x1a\x14proto/duration.proto\"\xa4\x04\n\x1b\x43ryptoCreateTransactionBody\x12\x18\n\x03key\x18\x01 \x01(\x0b\x32\x0b.Hedera.Key\x12\x16\n\x0einitialBalance\x18\x02 \x01(\x04\x12-\n\x0eproxyAccountID\x18\x03 \x01(\x0b\x32\x11.Hedera.AccountIDB\x02\x18\x01\x12\x1f\n\x13sendRecordThreshold\x18\x06 \x01(\x04\x42\x02\x18\x01\x12\"\n\x16receiveRecordThreshold\x18\x07 \x01(\x04\x42\x02\x18\x01\x12\x1b\n\x13receiverSigRequired\x18\x08 \x01(\x08\x12)\n\x0f\x61utoRenewPeriod\x18\t \x01(\x0b\x32\x10.Hedera.Duration\x12 \n\x07shardID\x18\n \x01(\x0b\x32\x0f.Hedera.ShardID\x12 \n\x07realmID\x18\x0b \x01(\x0b\x32\x0f.Hedera.RealmID\x12%\n\x10newRealmAdminKey\x18\x0c \x01(\x0b\x32\x0b.Hedera.Key\x12\x13\n\x04memo\x18\r \x01(\tB\x05\x92?\x02\x08\x64\x12(\n max_automatic_token_associations\x18\x0e \x01(\x05\x12.\n\x11staked_account_id\x18\x0f \x01(\x0b\x32\x11.Hedera.AccountIDH\x00\x12\x18\n\x0estaked_node_id\x18\x10 \x01(\x03H\x00\x12\x16\n\x0e\x64\x65\x63line_reward\x18\x11 \x01(\x08\x42\x0b\n\tstaked_idb\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.crypto_create_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _CRYPTOCREATETRANSACTIONBODY.fields_by_name['proxyAccountID']._options = None
- _CRYPTOCREATETRANSACTIONBODY.fields_by_name['proxyAccountID']._serialized_options = b'\030\001'
- _CRYPTOCREATETRANSACTIONBODY.fields_by_name['sendRecordThreshold']._options = None
- _CRYPTOCREATETRANSACTIONBODY.fields_by_name['sendRecordThreshold']._serialized_options = b'\030\001'
- _CRYPTOCREATETRANSACTIONBODY.fields_by_name['receiveRecordThreshold']._options = None
- _CRYPTOCREATETRANSACTIONBODY.fields_by_name['receiveRecordThreshold']._serialized_options = b'\030\001'
- _CRYPTOCREATETRANSACTIONBODY.fields_by_name['memo']._options = None
- _CRYPTOCREATETRANSACTIONBODY.fields_by_name['memo']._serialized_options = b'\222?\002\010d'
- _CRYPTOCREATETRANSACTIONBODY._serialized_start=99
- _CRYPTOCREATETRANSACTIONBODY._serialized_end=647
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.crypto_create_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_CRYPTOCREATETRANSACTIONBODY'].fields_by_name['proxyAccountID']._loaded_options = None
+ _globals['_CRYPTOCREATETRANSACTIONBODY'].fields_by_name['proxyAccountID']._serialized_options = b'\030\001'
+ _globals['_CRYPTOCREATETRANSACTIONBODY'].fields_by_name['sendRecordThreshold']._loaded_options = None
+ _globals['_CRYPTOCREATETRANSACTIONBODY'].fields_by_name['sendRecordThreshold']._serialized_options = b'\030\001'
+ _globals['_CRYPTOCREATETRANSACTIONBODY'].fields_by_name['receiveRecordThreshold']._loaded_options = None
+ _globals['_CRYPTOCREATETRANSACTIONBODY'].fields_by_name['receiveRecordThreshold']._serialized_options = b'\030\001'
+ _globals['_CRYPTOCREATETRANSACTIONBODY'].fields_by_name['memo']._loaded_options = None
+ _globals['_CRYPTOCREATETRANSACTIONBODY'].fields_by_name['memo']._serialized_options = b'\222?\002\010d'
+ _globals['_CRYPTOCREATETRANSACTIONBODY']._serialized_start=99
+ _globals['_CRYPTOCREATETRANSACTIONBODY']._serialized_end=647
# @@protoc_insertion_point(module_scope)
diff --git a/proto/crypto_transfer.pb.c b/proto/crypto_transfer.pb.c
index 4dc1ac7c..6881ac99 100644
--- a/proto/crypto_transfer.pb.c
+++ b/proto/crypto_transfer.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/crypto_transfer.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/crypto_transfer.pb.h b/proto/crypto_transfer.pb.h
index 20469e7c..6d0b821a 100644
--- a/proto/crypto_transfer.pb.h
+++ b/proto/crypto_transfer.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_CRYPTO_TRANSFER_PB_H_INCLUDED
#define PB_HEDERA_PROTO_CRYPTO_TRANSFER_PB_H_INCLUDED
@@ -28,7 +28,7 @@ typedef struct _Hedera_CryptoTransferTransactionBody {
/* *
The desired hbar balance adjustments */
bool has_transfers;
- Hedera_TransferList transfers;
+ Hedera_TransferList transfers;
/* *
The desired token unit balance adjustments; if any custom fees are
assessed, the ledger will try to deduct them from the payer of this
@@ -36,7 +36,7 @@ typedef struct _Hedera_CryptoTransferTransactionBody {
INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE if this is not possible
Limited to 1 here */
pb_size_t tokenTransfers_count;
- Hedera_TokenTransferList tokenTransfers[1];
+ Hedera_TokenTransferList tokenTransfers[1];
} Hedera_CryptoTransferTransactionBody;
diff --git a/proto/crypto_transfer_pb2.py b/proto/crypto_transfer_pb2.py
index 9c40c036..1797c876 100644
--- a/proto/crypto_transfer_pb2.py
+++ b/proto/crypto_transfer_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/crypto_transfer.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/crypto_transfer.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -17,13 +28,13 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bproto/crypto_transfer.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x17proto/basic_types.proto\"\x82\x01\n\x1d\x43ryptoTransferTransactionBody\x12\'\n\ttransfers\x18\x01 \x01(\x0b\x32\x14.Hedera.TransferList\x12\x38\n\x0etokenTransfers\x18\x02 \x03(\x0b\x32\x19.Hedera.TokenTransferListB\x05\x92?\x02\x10\x01\x62\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.crypto_transfer_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _CRYPTOTRANSFERTRANSACTIONBODY.fields_by_name['tokenTransfers']._options = None
- _CRYPTOTRANSFERTRANSACTIONBODY.fields_by_name['tokenTransfers']._serialized_options = b'\222?\002\020\001'
- _CRYPTOTRANSFERTRANSACTIONBODY._serialized_start=79
- _CRYPTOTRANSFERTRANSACTIONBODY._serialized_end=209
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.crypto_transfer_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_CRYPTOTRANSFERTRANSACTIONBODY'].fields_by_name['tokenTransfers']._loaded_options = None
+ _globals['_CRYPTOTRANSFERTRANSACTIONBODY'].fields_by_name['tokenTransfers']._serialized_options = b'\222?\002\020\001'
+ _globals['_CRYPTOTRANSFERTRANSACTIONBODY']._serialized_start=79
+ _globals['_CRYPTOTRANSFERTRANSACTIONBODY']._serialized_end=209
# @@protoc_insertion_point(module_scope)
diff --git a/proto/crypto_update.pb.c b/proto/crypto_update.pb.c
index 22fed33a..394cd5f7 100644
--- a/proto/crypto_update.pb.c
+++ b/proto/crypto_update.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/crypto_update.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/crypto_update.pb.h b/proto/crypto_update.pb.h
index 3b8719d6..8bafd5a2 100644
--- a/proto/crypto_update.pb.h
+++ b/proto/crypto_update.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_CRYPTO_UPDATE_PB_H_INCLUDED
#define PB_HEDERA_PROTO_CRYPTO_UPDATE_PB_H_INCLUDED
@@ -26,11 +26,11 @@ typedef struct _Hedera_CryptoUpdateTransactionBody {
/* *
The account ID which is being updated in this transaction */
bool has_accountIDToUpdate;
- Hedera_AccountID accountIDToUpdate;
+ Hedera_AccountID accountIDToUpdate;
/* *
The new key */
bool has_key;
- Hedera_Key key;
+ Hedera_Key key;
/* *
[Deprecated] ID of the account to which this account is proxy staked. If
proxyAccountID is null, or is an invalid account, or is an account that
@@ -39,70 +39,83 @@ typedef struct _Hedera_CryptoUpdateTransactionBody {
account refuses to accept proxy staking , or if it is not currently running
a node, then it will behave as if proxyAccountID was null. */
bool has_proxyAccountID;
- Hedera_AccountID proxyAccountID;
+ Hedera_AccountID proxyAccountID;
/* *
[Deprecated]. Payments earned from proxy staking are shared between the
node and this account, with proxyFraction / 10000 going to this account */
- int32_t proxyFraction;
- /* *
- [Deprecated]. The new threshold amount (in tinybars) for which an account
- record is created for any send/withdraw transaction */
+ int32_t proxyFraction;
pb_size_t which_sendRecordThresholdField;
union {
+ /* *
+ [Deprecated]. The new threshold amount (in tinybars) for which an account
+ record is created for any send/withdraw transaction */
uint64_t sendRecordThreshold;
+ /* *
+ [Deprecated]. The new threshold amount (in tinybars) for which an account
+ record is created for any send/withdraw transaction */
Hedera_UInt64Value sendRecordThresholdWrapper;
- } sendRecordThresholdField;
- /* *
- [Deprecated]. The new threshold amount (in tinybars) for which an account
- record is created for any send/withdraw transaction */
+ } sendRecordThresholdField;
pb_size_t which_receiveRecordThresholdField;
union {
+ /* *
+ [Deprecated]. The new threshold amount (in tinybars) for which an account
+ record is created for any receive/deposit transaction. */
uint64_t receiveRecordThreshold;
+ /* *
+ [Deprecated]. The new threshold amount (in tinybars) for which an account
+ record is created for any receive/deposit transaction. */
Hedera_UInt64Value receiveRecordThresholdWrapper;
- } receiveRecordThresholdField;
- /* *
- [Deprecated]. The new threshold amount (in tinybars) for which an account
- record is created for any receive/deposit transaction. */
- bool has_autoRenewPeriod;
- Hedera_Duration autoRenewPeriod;
- /* *
- [Deprecated]. The new threshold amount (in tinybars) for which an account
- record is created for any receive/deposit transaction. */
- bool has_expirationTime;
- Hedera_Timestamp expirationTime;
+ } receiveRecordThresholdField;
/* *
The duration in which it will automatically extend the expiration period.
If it doesn't have enough balance, it extends as long as possible. If it is
empty when it expires, then it is deleted. */
+ bool has_autoRenewPeriod;
+ Hedera_Duration autoRenewPeriod;
+ /* *
+ The new expiration time to extend to (ignored if equal to or before the
+ current one) */
+ bool has_expirationTime;
+ Hedera_Timestamp expirationTime;
pb_size_t which_receiverSigRequiredField;
union {
+ /* *
+ [Deprecated] Do NOT use this field to set a false value because the
+ server cannot distinguish from the default value. Use
+ receiverSigRequiredWrapper field for this purpose. */
bool receiverSigRequired;
+ /* *
+ If true, this account's key must sign any transaction depositing into
+ this account (in addition to all withdrawals) */
Hedera_BoolValue receiverSigRequiredWrapper;
- } receiverSigRequiredField;
+ } receiverSigRequiredField;
/* *
- The new expiration time to extend to (ignored if equal to or before the
- current one) */
+ If set, the new memo to be associated with the account (UTF-8 encoding max
+ 100 bytes) */
bool has_memo;
- Hedera_StringValue memo;
+ Hedera_StringValue memo;
/* *
- [Deprecated] Do NOT use this field to set a false value because the
- server cannot distinguish from the default value. Use
- receiverSigRequiredWrapper field for this purpose. */
+ The maximum number of tokens that an Account can be implicitly associated
+ with. Up to a 1000 including implicit and explicit associations. */
bool has_max_automatic_token_associations;
- Hedera_Int32Value max_automatic_token_associations;
- /* *
- If true, this account's key must sign any transaction depositing into
- this account (in addition to all withdrawals) */
+ Hedera_Int32Value max_automatic_token_associations;
pb_size_t which_staked_id;
union {
+ /* *
+ ID of the new account to which this account is staking. If set to the
+ sentinel 0.0.0 AccountID, this field removes this account's
+ staked account ID. */
Hedera_AccountID staked_account_id;
+ /* *
+ ID of the new node this account is staked to. If set to the sentinel
+ -1, this field removes this account's staked node ID. */
int64_t staked_node_id;
- } staked_id;
+ } staked_id;
/* *
- If set, the new memo to be associated with the account (UTF-8 encoding max
- 100 bytes) */
+ If true, the account declines receiving a staking reward. The default value
+ is false. */
bool has_decline_reward;
- Hedera_BoolValue decline_reward;
+ Hedera_BoolValue decline_reward;
} Hedera_CryptoUpdateTransactionBody;
diff --git a/proto/crypto_update_pb2.py b/proto/crypto_update_pb2.py
index 1936fb2f..6aac9171 100644
--- a/proto/crypto_update_pb2.py
+++ b/proto/crypto_update_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/crypto_update.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/crypto_update.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -20,25 +31,25 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19proto/crypto_update.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x17proto/basic_types.proto\x1a\x14proto/duration.proto\x1a\x15proto/timestamp.proto\x1a\x14proto/wrappers.proto\"\xe5\x06\n\x1b\x43ryptoUpdateTransactionBody\x12,\n\x11\x61\x63\x63ountIDToUpdate\x18\x02 \x01(\x0b\x32\x11.Hedera.AccountID\x12\x18\n\x03key\x18\x03 \x01(\x0b\x32\x0b.Hedera.Key\x12-\n\x0eproxyAccountID\x18\x04 \x01(\x0b\x32\x11.Hedera.AccountIDB\x02\x18\x01\x12\x19\n\rproxyFraction\x18\x05 \x01(\x05\x42\x02\x18\x01\x12!\n\x13sendRecordThreshold\x18\x06 \x01(\x04\x42\x02\x18\x01H\x00\x12=\n\x1asendRecordThresholdWrapper\x18\x0b \x01(\x0b\x32\x13.Hedera.UInt64ValueB\x02\x18\x01H\x00\x12$\n\x16receiveRecordThreshold\x18\x07 \x01(\x04\x42\x02\x18\x01H\x01\x12@\n\x1dreceiveRecordThresholdWrapper\x18\x0c \x01(\x0b\x32\x13.Hedera.UInt64ValueB\x02\x18\x01H\x01\x12)\n\x0f\x61utoRenewPeriod\x18\x08 \x01(\x0b\x32\x10.Hedera.Duration\x12)\n\x0e\x65xpirationTime\x18\t \x01(\x0b\x32\x11.Hedera.Timestamp\x12!\n\x13receiverSigRequired\x18\n \x01(\x08\x42\x02\x18\x01H\x02\x12\x37\n\x1areceiverSigRequiredWrapper\x18\r \x01(\x0b\x32\x11.Hedera.BoolValueH\x02\x12!\n\x04memo\x18\x0e \x01(\x0b\x32\x13.Hedera.StringValue\x12<\n max_automatic_token_associations\x18\x0f \x01(\x0b\x32\x12.Hedera.Int32Value\x12.\n\x11staked_account_id\x18\x10 \x01(\x0b\x32\x11.Hedera.AccountIDH\x03\x12\x18\n\x0estaked_node_id\x18\x11 \x01(\x03H\x03\x12)\n\x0e\x64\x65\x63line_reward\x18\x12 \x01(\x0b\x32\x11.Hedera.BoolValueB\x1a\n\x18sendRecordThresholdFieldB\x1d\n\x1breceiveRecordThresholdFieldB\x1a\n\x18receiverSigRequiredFieldB\x0b\n\tstaked_idb\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.crypto_update_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['proxyAccountID']._options = None
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['proxyAccountID']._serialized_options = b'\030\001'
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['proxyFraction']._options = None
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['proxyFraction']._serialized_options = b'\030\001'
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['sendRecordThreshold']._options = None
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['sendRecordThreshold']._serialized_options = b'\030\001'
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['sendRecordThresholdWrapper']._options = None
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['sendRecordThresholdWrapper']._serialized_options = b'\030\001'
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['receiveRecordThreshold']._options = None
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['receiveRecordThreshold']._serialized_options = b'\030\001'
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['receiveRecordThresholdWrapper']._options = None
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['receiveRecordThresholdWrapper']._serialized_options = b'\030\001'
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['receiverSigRequired']._options = None
- _CRYPTOUPDATETRANSACTIONBODY.fields_by_name['receiverSigRequired']._serialized_options = b'\030\001'
- _CRYPTOUPDATETRANSACTIONBODY._serialized_start=144
- _CRYPTOUPDATETRANSACTIONBODY._serialized_end=1013
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.crypto_update_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['proxyAccountID']._loaded_options = None
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['proxyAccountID']._serialized_options = b'\030\001'
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['proxyFraction']._loaded_options = None
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['proxyFraction']._serialized_options = b'\030\001'
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['sendRecordThreshold']._loaded_options = None
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['sendRecordThreshold']._serialized_options = b'\030\001'
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['sendRecordThresholdWrapper']._loaded_options = None
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['sendRecordThresholdWrapper']._serialized_options = b'\030\001'
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['receiveRecordThreshold']._loaded_options = None
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['receiveRecordThreshold']._serialized_options = b'\030\001'
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['receiveRecordThresholdWrapper']._loaded_options = None
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['receiveRecordThresholdWrapper']._serialized_options = b'\030\001'
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['receiverSigRequired']._loaded_options = None
+ _globals['_CRYPTOUPDATETRANSACTIONBODY'].fields_by_name['receiverSigRequired']._serialized_options = b'\030\001'
+ _globals['_CRYPTOUPDATETRANSACTIONBODY']._serialized_start=144
+ _globals['_CRYPTOUPDATETRANSACTIONBODY']._serialized_end=1013
# @@protoc_insertion_point(module_scope)
diff --git a/proto/duration.pb.c b/proto/duration.pb.c
index 40cc71e0..7fe526fe 100644
--- a/proto/duration.pb.c
+++ b/proto/duration.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/duration.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/duration.pb.h b/proto/duration.pb.h
index e0a1a459..4808169a 100644
--- a/proto/duration.pb.h
+++ b/proto/duration.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_DURATION_PB_H_INCLUDED
#define PB_HEDERA_PROTO_DURATION_PB_H_INCLUDED
@@ -15,7 +15,7 @@
typedef struct _Hedera_Duration {
/* *
The number of seconds */
- int64_t seconds;
+ int64_t seconds;
} Hedera_Duration;
diff --git a/proto/duration_pb2.py b/proto/duration_pb2.py
index 7dae9331..6b2d18ca 100644
--- a/proto/duration_pb2.py
+++ b/proto/duration_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/duration.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/duration.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -16,11 +27,11 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14proto/duration.proto\x12\x06Hedera\x1a\x0cnanopb.proto\"\x1b\n\x08\x44uration\x12\x0f\n\x07seconds\x18\x01 \x01(\x03\x62\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.duration_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _DURATION._serialized_start=46
- _DURATION._serialized_end=73
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.duration_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_DURATION']._serialized_start=46
+ _globals['_DURATION']._serialized_end=73
# @@protoc_insertion_point(module_scope)
diff --git a/proto/timestamp.pb.c b/proto/timestamp.pb.c
index 764dbc10..0d61ab2f 100644
--- a/proto/timestamp.pb.c
+++ b/proto/timestamp.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/timestamp.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/timestamp.pb.h b/proto/timestamp.pb.h
index b0e4ccd1..a0ea56e8 100644
--- a/proto/timestamp.pb.h
+++ b/proto/timestamp.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_TIMESTAMP_PB_H_INCLUDED
#define PB_HEDERA_PROTO_TIMESTAMP_PB_H_INCLUDED
@@ -18,10 +18,10 @@
typedef struct _Hedera_Timestamp {
/* *
Number of complete seconds since the start of the epoch */
- int64_t seconds;
+ int64_t seconds;
/* *
Number of nanoseconds since the start of the last second */
- int32_t nanos;
+ int32_t nanos;
} Hedera_Timestamp;
/* *
@@ -29,7 +29,7 @@ typedef struct _Hedera_Timestamp {
typedef struct _Hedera_TimestampSeconds {
/* *
Number of complete seconds since the start of the epoch */
- int64_t seconds;
+ int64_t seconds;
} Hedera_TimestampSeconds;
diff --git a/proto/timestamp_pb2.py b/proto/timestamp_pb2.py
index ee8d3d1e..b115b2c9 100644
--- a/proto/timestamp_pb2.py
+++ b/proto/timestamp_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/timestamp.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/timestamp.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -16,13 +27,13 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15proto/timestamp.proto\x12\x06Hedera\x1a\x0cnanopb.proto\"+\n\tTimestamp\x12\x0f\n\x07seconds\x18\x01 \x01(\x03\x12\r\n\x05nanos\x18\x02 \x01(\x05\"#\n\x10TimestampSeconds\x12\x0f\n\x07seconds\x18\x01 \x01(\x03\x62\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.timestamp_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _TIMESTAMP._serialized_start=47
- _TIMESTAMP._serialized_end=90
- _TIMESTAMPSECONDS._serialized_start=92
- _TIMESTAMPSECONDS._serialized_end=127
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.timestamp_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_TIMESTAMP']._serialized_start=47
+ _globals['_TIMESTAMP']._serialized_end=90
+ _globals['_TIMESTAMPSECONDS']._serialized_start=92
+ _globals['_TIMESTAMPSECONDS']._serialized_end=127
# @@protoc_insertion_point(module_scope)
diff --git a/proto/token_associate.pb.c b/proto/token_associate.pb.c
index eacbb599..b846049e 100644
--- a/proto/token_associate.pb.c
+++ b/proto/token_associate.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/token_associate.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/token_associate.pb.h b/proto/token_associate.pb.h
index 0ce4ea21..468103a5 100644
--- a/proto/token_associate.pb.h
+++ b/proto/token_associate.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_TOKEN_ASSOCIATE_PB_H_INCLUDED
#define PB_HEDERA_PROTO_TOKEN_ASSOCIATE_PB_H_INCLUDED
@@ -29,14 +29,14 @@ typedef struct _Hedera_TokenAssociateTransactionBody {
/* *
The account to be associated with the provided tokens */
bool has_account;
- Hedera_AccountID account;
+ Hedera_AccountID account;
/* *
The tokens to be associated with the provided account. In the case of
NON_FUNGIBLE_UNIQUE Type, once an account is associated, it can hold any
number of NFTs (serial numbers) of that token type
Limited to 1 here (no access to malloc for dynamic decode!) */
pb_size_t tokens_count;
- Hedera_TokenID tokens[1];
+ Hedera_TokenID tokens[1];
} Hedera_TokenAssociateTransactionBody;
diff --git a/proto/token_associate_pb2.py b/proto/token_associate_pb2.py
index 21ee64af..0991a957 100644
--- a/proto/token_associate_pb2.py
+++ b/proto/token_associate_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/token_associate.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/token_associate.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -17,13 +28,13 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bproto/token_associate.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x17proto/basic_types.proto\"k\n\x1dTokenAssociateTransactionBody\x12\"\n\x07\x61\x63\x63ount\x18\x01 \x01(\x0b\x32\x11.Hedera.AccountID\x12&\n\x06tokens\x18\x02 \x03(\x0b\x32\x0f.Hedera.TokenIDB\x05\x92?\x02\x10\x01\x62\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.token_associate_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _TOKENASSOCIATETRANSACTIONBODY.fields_by_name['tokens']._options = None
- _TOKENASSOCIATETRANSACTIONBODY.fields_by_name['tokens']._serialized_options = b'\222?\002\020\001'
- _TOKENASSOCIATETRANSACTIONBODY._serialized_start=78
- _TOKENASSOCIATETRANSACTIONBODY._serialized_end=185
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.token_associate_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_TOKENASSOCIATETRANSACTIONBODY'].fields_by_name['tokens']._loaded_options = None
+ _globals['_TOKENASSOCIATETRANSACTIONBODY'].fields_by_name['tokens']._serialized_options = b'\222?\002\020\001'
+ _globals['_TOKENASSOCIATETRANSACTIONBODY']._serialized_start=78
+ _globals['_TOKENASSOCIATETRANSACTIONBODY']._serialized_end=185
# @@protoc_insertion_point(module_scope)
diff --git a/proto/token_burn.pb.c b/proto/token_burn.pb.c
index 7bc9314b..96082f5f 100644
--- a/proto/token_burn.pb.c
+++ b/proto/token_burn.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/token_burn.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/token_burn.pb.h b/proto/token_burn.pb.h
index bddcacf5..5d36e3ad 100644
--- a/proto/token_burn.pb.h
+++ b/proto/token_burn.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_TOKEN_BURN_PB_H_INCLUDED
#define PB_HEDERA_PROTO_TOKEN_BURN_PB_H_INCLUDED
@@ -34,19 +34,19 @@ typedef struct _Hedera_TokenBurnTransactionBody {
The token for which to burn tokens. If token does not exist, transaction
results in INVALID_TOKEN_ID */
bool has_token;
- Hedera_TokenID token;
+ Hedera_TokenID token;
/* *
Applicable to tokens of type FUNGIBLE_COMMON. The amount to burn from the
Treasury Account. Amount must be a positive non-zero number, not bigger
than the token balance of the treasury account (0; balance], represented in
the lowest denomination. */
- uint64_t amount;
+ uint64_t amount;
/* *
Applicable to tokens of type NON_FUNGIBLE_UNIQUE. The list of serial
numbers to be burned.
Limited to 1 here */
pb_size_t serialNumbers_count;
- int64_t serialNumbers[1];
+ int64_t serialNumbers[1];
} Hedera_TokenBurnTransactionBody;
diff --git a/proto/token_burn_pb2.py b/proto/token_burn_pb2.py
index 05efdf3f..dde2a589 100644
--- a/proto/token_burn_pb2.py
+++ b/proto/token_burn_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/token_burn.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/token_burn.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -17,13 +28,13 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16proto/token_burn.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x17proto/basic_types.proto\"h\n\x18TokenBurnTransactionBody\x12\x1e\n\x05token\x18\x01 \x01(\x0b\x32\x0f.Hedera.TokenID\x12\x0e\n\x06\x61mount\x18\x02 \x01(\x04\x12\x1c\n\rserialNumbers\x18\x03 \x03(\x03\x42\x05\x92?\x02\x10\x01\x62\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.token_burn_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _TOKENBURNTRANSACTIONBODY.fields_by_name['serialNumbers']._options = None
- _TOKENBURNTRANSACTIONBODY.fields_by_name['serialNumbers']._serialized_options = b'\222?\002\020\001'
- _TOKENBURNTRANSACTIONBODY._serialized_start=73
- _TOKENBURNTRANSACTIONBODY._serialized_end=177
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.token_burn_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_TOKENBURNTRANSACTIONBODY'].fields_by_name['serialNumbers']._loaded_options = None
+ _globals['_TOKENBURNTRANSACTIONBODY'].fields_by_name['serialNumbers']._serialized_options = b'\222?\002\020\001'
+ _globals['_TOKENBURNTRANSACTIONBODY']._serialized_start=73
+ _globals['_TOKENBURNTRANSACTIONBODY']._serialized_end=177
# @@protoc_insertion_point(module_scope)
diff --git a/proto/token_dissociate.pb.c b/proto/token_dissociate.pb.c
index a231ea03..0aa59c93 100644
--- a/proto/token_dissociate.pb.c
+++ b/proto/token_dissociate.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/token_dissociate.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/token_dissociate.pb.h b/proto/token_dissociate.pb.h
index 0466e158..ed155668 100644
--- a/proto/token_dissociate.pb.h
+++ b/proto/token_dissociate.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_TOKEN_DISSOCIATE_PB_H_INCLUDED
#define PB_HEDERA_PROTO_TOKEN_DISSOCIATE_PB_H_INCLUDED
@@ -32,12 +32,12 @@ typedef struct _Hedera_TokenDissociateTransactionBody {
/* *
The account to be dissociated with the provided tokens */
bool has_account;
- Hedera_AccountID account;
+ Hedera_AccountID account;
/* *
The tokens to be dissociated with the provided account
Limited to 1 here */
pb_size_t tokens_count;
- Hedera_TokenID tokens[1];
+ Hedera_TokenID tokens[1];
} Hedera_TokenDissociateTransactionBody;
diff --git a/proto/token_dissociate_pb2.py b/proto/token_dissociate_pb2.py
index b5809df2..f4d3f6c2 100644
--- a/proto/token_dissociate_pb2.py
+++ b/proto/token_dissociate_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/token_dissociate.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/token_dissociate.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -17,13 +28,13 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cproto/token_dissociate.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x17proto/basic_types.proto\"l\n\x1eTokenDissociateTransactionBody\x12\"\n\x07\x61\x63\x63ount\x18\x01 \x01(\x0b\x32\x11.Hedera.AccountID\x12&\n\x06tokens\x18\x02 \x03(\x0b\x32\x0f.Hedera.TokenIDB\x05\x92?\x02\x10\x01\x62\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.token_dissociate_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _TOKENDISSOCIATETRANSACTIONBODY.fields_by_name['tokens']._options = None
- _TOKENDISSOCIATETRANSACTIONBODY.fields_by_name['tokens']._serialized_options = b'\222?\002\020\001'
- _TOKENDISSOCIATETRANSACTIONBODY._serialized_start=79
- _TOKENDISSOCIATETRANSACTIONBODY._serialized_end=187
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.token_dissociate_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_TOKENDISSOCIATETRANSACTIONBODY'].fields_by_name['tokens']._loaded_options = None
+ _globals['_TOKENDISSOCIATETRANSACTIONBODY'].fields_by_name['tokens']._serialized_options = b'\222?\002\020\001'
+ _globals['_TOKENDISSOCIATETRANSACTIONBODY']._serialized_start=79
+ _globals['_TOKENDISSOCIATETRANSACTIONBODY']._serialized_end=187
# @@protoc_insertion_point(module_scope)
diff --git a/proto/token_mint.pb.c b/proto/token_mint.pb.c
index d729ec09..b1750aa1 100644
--- a/proto/token_mint.pb.c
+++ b/proto/token_mint.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/token_mint.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/token_mint.pb.h b/proto/token_mint.pb.h
index a0bb6e9a..133b7fea 100644
--- a/proto/token_mint.pb.h
+++ b/proto/token_mint.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_TOKEN_MINT_PB_H_INCLUDED
#define PB_HEDERA_PROTO_TOKEN_MINT_PB_H_INCLUDED
@@ -32,19 +32,19 @@ typedef struct _Hedera_TokenMintTransactionBody {
The token for which to mint tokens. If token does not exist, transaction
results in INVALID_TOKEN_ID */
bool has_token;
- Hedera_TokenID token;
+ Hedera_TokenID token;
/* *
Applicable to tokens of type FUNGIBLE_COMMON. The amount to mint to the
Treasury Account. Amount must be a positive non-zero number represented in
the lowest denomination of the token. The new supply must be lower than
2^63. */
- uint64_t amount;
+ uint64_t amount;
/* *
Applicable to tokens of type NON_FUNGIBLE_UNIQUE. A list of metadata that
are being created. Maximum allowed size of each metadata is 100 bytes
Limited to 1 metadata chunk (no access to malloc) */
pb_size_t metadata_count;
- Hedera_TokenMintTransactionBody_metadata_t metadata[1];
+ Hedera_TokenMintTransactionBody_metadata_t metadata[1];
} Hedera_TokenMintTransactionBody;
diff --git a/proto/token_mint_pb2.py b/proto/token_mint_pb2.py
index 0ea6629c..aa9539f5 100644
--- a/proto/token_mint_pb2.py
+++ b/proto/token_mint_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/token_mint.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/token_mint.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -15,15 +26,15 @@
from proto import basic_types_pb2 as proto_dot_basic__types__pb2
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16proto/token_mint.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x17proto/basic_types.proto\"h\n\x18TokenMintTransactionBody\x12\x1e\n\x05token\x18\x01 \x01(\x0b\x32\x0f.Hedera.TokenID\x12\x0e\n\x06\x61mount\x18\x02 \x01(\x04\x12\x1c\n\x08metadata\x18\x03 \x03(\x0c\x42\n\x92?\x02\x08\x64\x92?\x02\x10\x01\x62\x06proto3')
-
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.token_mint_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16proto/token_mint.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x17proto/basic_types.proto\"e\n\x18TokenMintTransactionBody\x12\x1e\n\x05token\x18\x01 \x01(\x0b\x32\x0f.Hedera.TokenID\x12\x0e\n\x06\x61mount\x18\x02 \x01(\x04\x12\x19\n\x08metadata\x18\x03 \x03(\x0c\x42\x07\x92?\x04\x08\x64\x10\x01\x62\x06proto3')
- DESCRIPTOR._options = None
- _TOKENMINTTRANSACTIONBODY.fields_by_name['metadata']._options = None
- _TOKENMINTTRANSACTIONBODY.fields_by_name['metadata']._serialized_options = b'\222?\002\010d\222?\002\020\001'
- _TOKENMINTTRANSACTIONBODY._serialized_start=73
- _TOKENMINTTRANSACTIONBODY._serialized_end=177
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.token_mint_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_TOKENMINTTRANSACTIONBODY'].fields_by_name['metadata']._loaded_options = None
+ _globals['_TOKENMINTTRANSACTIONBODY'].fields_by_name['metadata']._serialized_options = b'\222?\004\010d\020\001'
+ _globals['_TOKENMINTTRANSACTIONBODY']._serialized_start=73
+ _globals['_TOKENMINTTRANSACTIONBODY']._serialized_end=174
# @@protoc_insertion_point(module_scope)
diff --git a/proto/transaction_body.pb.c b/proto/transaction_body.pb.c
index 0774cbeb..1046dfef 100644
--- a/proto/transaction_body.pb.c
+++ b/proto/transaction_body.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/transaction_body.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/transaction_body.pb.h b/proto/transaction_body.pb.h
index 52ce431f..d7d8b50d 100644
--- a/proto/transaction_body.pb.h
+++ b/proto/transaction_body.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_TRANSACTION_BODY_PB_H_INCLUDED
#define PB_HEDERA_PROTO_TRANSACTION_BODY_PB_H_INCLUDED
@@ -28,41 +28,55 @@ typedef struct _Hedera_TransactionBody {
account paying the transaction fee). If two transactions have the same
transactionID, they won't both have an effect */
bool has_transactionID;
- Hedera_TransactionID transactionID;
+ Hedera_TransactionID transactionID;
/* *
The account of the node that submits the client's transaction to the
network */
bool has_nodeAccountID;
- Hedera_AccountID nodeAccountID;
+ Hedera_AccountID nodeAccountID;
/* *
The maximum transaction fee the client is willing to pay */
- uint64_t transactionFee;
+ uint64_t transactionFee;
/* *
The transaction is invalid if consensusTimestamp >
transactionID.transactionValidStart + transactionValidDuration */
bool has_transactionValidDuration;
- Hedera_Duration transactionValidDuration;
+ Hedera_Duration transactionValidDuration;
/* *
Should a record of this transaction be generated? (A receipt is always
generated, but the record is optional) */
- bool generateRecord;
+ bool generateRecord;
/* *
Any notes or descriptions that should be put into the record (max length
100) */
- char memo[100];
- /* *
- Call a contract */
+ char memo[100];
pb_size_t which_data;
union {
+ /* *
+ Call a contract */
Hedera_ContractCallTransactionBody contractCall;
+ /* *
+ Create a new cryptocurrency account */
Hedera_CryptoCreateTransactionBody cryptoCreateAccount;
+ /* *
+ Transfer amount between accounts */
Hedera_CryptoTransferTransactionBody cryptoTransfer;
+ /* *
+ Modify information such as the expiration date for an account */
Hedera_CryptoUpdateTransactionBody cryptoUpdateAccount;
+ /* *
+ Mints new tokens to a token's treasury account */
Hedera_TokenMintTransactionBody tokenMint;
+ /* *
+ Burns tokens from a token's treasury account */
Hedera_TokenBurnTransactionBody tokenBurn;
+ /* *
+ Associate tokens to an account */
Hedera_TokenAssociateTransactionBody tokenAssociate;
+ /* *
+ Dissociate tokens from an account */
Hedera_TokenDissociateTransactionBody tokenDissociate;
- } data;
+ } data;
} Hedera_TransactionBody;
@@ -127,9 +141,11 @@ extern const pb_msgdesc_t Hedera_TransactionBody_msg;
/* Maximum encoded size of messages (where known) */
#if defined(Hedera_CryptoUpdateTransactionBody_size)
-#define Hedera_TransactionBody_size (282 + sizeof(union Hedera_TransactionBody_data_size_union))
union Hedera_TransactionBody_data_size_union {char f15[(6 + Hedera_CryptoUpdateTransactionBody_size)]; char f0[586];};
#endif
+#if defined(Hedera_CryptoUpdateTransactionBody_size)
+#define Hedera_TransactionBody_size (282 + sizeof(union Hedera_TransactionBody_data_size_union))
+#endif
#ifdef __cplusplus
} /* extern "C" */
diff --git a/proto/transaction_body_pb2.py b/proto/transaction_body_pb2.py
index f852f30f..7c8114dc 100644
--- a/proto/transaction_body_pb2.py
+++ b/proto/transaction_body_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/transaction_body.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/transaction_body.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -26,15 +37,15 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cproto/transaction_body.proto\x12\x06Hedera\x1a\x0cnanopb.proto\x1a\x17proto/basic_types.proto\x1a\x19proto/crypto_create.proto\x1a\x1bproto/crypto_transfer.proto\x1a\x19proto/crypto_update.proto\x1a\x14proto/duration.proto\x1a\x1bproto/token_associate.proto\x1a\x16proto/token_burn.proto\x1a\x1cproto/token_dissociate.proto\x1a\x16proto/token_mint.proto\x1a\x19proto/contract_call.proto\"\xe6\x05\n\x0fTransactionBody\x12,\n\rtransactionID\x18\x01 \x01(\x0b\x32\x15.Hedera.TransactionID\x12(\n\rnodeAccountID\x18\x02 \x01(\x0b\x32\x11.Hedera.AccountID\x12\x16\n\x0etransactionFee\x18\x03 \x01(\x04\x12\x32\n\x18transactionValidDuration\x18\x04 \x01(\x0b\x32\x10.Hedera.Duration\x12\x1a\n\x0egenerateRecord\x18\x05 \x01(\x08\x42\x02\x18\x01\x12\x13\n\x04memo\x18\x06 \x01(\tB\x05\x92?\x02\x08\x64\x12;\n\x0c\x63ontractCall\x18\x07 \x01(\x0b\x32#.Hedera.ContractCallTransactionBodyH\x00\x12\x42\n\x13\x63ryptoCreateAccount\x18\x0b \x01(\x0b\x32#.Hedera.CryptoCreateTransactionBodyH\x00\x12?\n\x0e\x63ryptoTransfer\x18\x0e \x01(\x0b\x32%.Hedera.CryptoTransferTransactionBodyH\x00\x12\x42\n\x13\x63ryptoUpdateAccount\x18\x0f \x01(\x0b\x32#.Hedera.CryptoUpdateTransactionBodyH\x00\x12\x35\n\ttokenMint\x18% \x01(\x0b\x32 .Hedera.TokenMintTransactionBodyH\x00\x12\x35\n\ttokenBurn\x18& \x01(\x0b\x32 .Hedera.TokenBurnTransactionBodyH\x00\x12?\n\x0etokenAssociate\x18( \x01(\x0b\x32%.Hedera.TokenAssociateTransactionBodyH\x00\x12\x41\n\x0ftokenDissociate\x18) \x01(\x0b\x32&.Hedera.TokenDissociateTransactionBodyH\x00\x42\x06\n\x04\x64\x61tab\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.transaction_body_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _TRANSACTIONBODY.fields_by_name['generateRecord']._options = None
- _TRANSACTIONBODY.fields_by_name['generateRecord']._serialized_options = b'\030\001'
- _TRANSACTIONBODY.fields_by_name['memo']._options = None
- _TRANSACTIONBODY.fields_by_name['memo']._serialized_options = b'\222?\002\010d'
- _TRANSACTIONBODY._serialized_start=319
- _TRANSACTIONBODY._serialized_end=1061
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.transaction_body_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_TRANSACTIONBODY'].fields_by_name['generateRecord']._loaded_options = None
+ _globals['_TRANSACTIONBODY'].fields_by_name['generateRecord']._serialized_options = b'\030\001'
+ _globals['_TRANSACTIONBODY'].fields_by_name['memo']._loaded_options = None
+ _globals['_TRANSACTIONBODY'].fields_by_name['memo']._serialized_options = b'\222?\002\010d'
+ _globals['_TRANSACTIONBODY']._serialized_start=319
+ _globals['_TRANSACTIONBODY']._serialized_end=1061
# @@protoc_insertion_point(module_scope)
diff --git a/proto/wrappers.pb.c b/proto/wrappers.pb.c
index 9843989e..748a4233 100644
--- a/proto/wrappers.pb.c
+++ b/proto/wrappers.pb.c
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#include "proto/wrappers.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
diff --git a/proto/wrappers.pb.h b/proto/wrappers.pb.h
index 562a4441..b3a2e39f 100644
--- a/proto/wrappers.pb.h
+++ b/proto/wrappers.pb.h
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
-/* Generated by nanopb-0.4.5 */
+/* Generated by nanopb-0.4.6 */
#ifndef PB_HEDERA_PROTO_WRAPPERS_PB_H_INCLUDED
#define PB_HEDERA_PROTO_WRAPPERS_PB_H_INCLUDED
@@ -15,7 +15,7 @@
The JSON representation for `StringValue` is JSON string. */
typedef struct _Hedera_StringValue {
/* The string value. */
- pb_callback_t value;
+ pb_callback_t value;
} Hedera_StringValue;
/* Wrapper message for `bool`.
@@ -23,7 +23,7 @@ typedef struct _Hedera_StringValue {
The JSON representation for `BoolValue` is JSON `true` and `false`. */
typedef struct _Hedera_BoolValue {
/* The bool value. */
- bool value;
+ bool value;
} Hedera_BoolValue;
/* Wrapper message for `double`.
@@ -31,7 +31,7 @@ typedef struct _Hedera_BoolValue {
The JSON representation for `DoubleValue` is JSON number. */
typedef struct _Hedera_DoubleValue {
/* The double value. */
- double value;
+ double value;
} Hedera_DoubleValue;
/* Wrapper message for `float`.
@@ -39,7 +39,7 @@ typedef struct _Hedera_DoubleValue {
The JSON representation for `FloatValue` is JSON number. */
typedef struct _Hedera_FloatValue {
/* The float value. */
- float value;
+ float value;
} Hedera_FloatValue;
/* Wrapper message for `int32`.
@@ -47,7 +47,7 @@ typedef struct _Hedera_FloatValue {
The JSON representation for `Int32Value` is JSON number. */
typedef struct _Hedera_Int32Value {
/* The int32 value. */
- int32_t value;
+ int32_t value;
} Hedera_Int32Value;
/* Wrapper message for `int64`.
@@ -55,7 +55,7 @@ typedef struct _Hedera_Int32Value {
The JSON representation for `Int64Value` is JSON string. */
typedef struct _Hedera_Int64Value {
/* The int64 value. */
- int64_t value;
+ int64_t value;
} Hedera_Int64Value;
/* Wrapper message for `uint32`.
@@ -63,7 +63,7 @@ typedef struct _Hedera_Int64Value {
The JSON representation for `UInt32Value` is JSON number. */
typedef struct _Hedera_UInt32Value {
/* The uint32 value. */
- uint32_t value;
+ uint32_t value;
} Hedera_UInt32Value;
/* Wrapper message for `uint64`.
@@ -71,7 +71,7 @@ typedef struct _Hedera_UInt32Value {
The JSON representation for `UInt64Value` is JSON string. */
typedef struct _Hedera_UInt64Value {
/* The uint64 value. */
- uint64_t value;
+ uint64_t value;
} Hedera_UInt64Value;
diff --git a/proto/wrappers_pb2.py b/proto/wrappers_pb2.py
index 7961d1ed..43a3dabe 100644
--- a/proto/wrappers_pb2.py
+++ b/proto/wrappers_pb2.py
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
+# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/wrappers.proto
+# Protobuf Python Version: 6.31.1
"""Generated protocol buffer code."""
-from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
+from google.protobuf.internal import builder as _builder
+_runtime_version.ValidateProtobufRuntimeVersion(
+ _runtime_version.Domain.PUBLIC,
+ 6,
+ 31,
+ 1,
+ '',
+ 'proto/wrappers.proto'
+)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -16,25 +27,25 @@
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14proto/wrappers.proto\x12\x06Hedera\x1a\x0cnanopb.proto\"\x1c\n\x0b\x44oubleValue\x12\r\n\x05value\x18\x01 \x01(\x01\"\x1b\n\nFloatValue\x12\r\n\x05value\x18\x01 \x01(\x02\"\x1b\n\nInt64Value\x12\r\n\x05value\x18\x01 \x01(\x03\"\x1c\n\x0bUInt64Value\x12\r\n\x05value\x18\x01 \x01(\x04\"\x1b\n\nInt32Value\x12\r\n\x05value\x18\x01 \x01(\x05\"\x1c\n\x0bUInt32Value\x12\r\n\x05value\x18\x01 \x01(\r\"\x1a\n\tBoolValue\x12\r\n\x05value\x18\x01 \x01(\x08\"\x1c\n\x0bStringValue\x12\r\n\x05value\x18\x01 \x01(\tb\x06proto3')
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.wrappers_pb2', globals())
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _DOUBLEVALUE._serialized_start=46
- _DOUBLEVALUE._serialized_end=74
- _FLOATVALUE._serialized_start=76
- _FLOATVALUE._serialized_end=103
- _INT64VALUE._serialized_start=105
- _INT64VALUE._serialized_end=132
- _UINT64VALUE._serialized_start=134
- _UINT64VALUE._serialized_end=162
- _INT32VALUE._serialized_start=164
- _INT32VALUE._serialized_end=191
- _UINT32VALUE._serialized_start=193
- _UINT32VALUE._serialized_end=221
- _BOOLVALUE._serialized_start=223
- _BOOLVALUE._serialized_end=249
- _STRINGVALUE._serialized_start=251
- _STRINGVALUE._serialized_end=279
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.wrappers_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ DESCRIPTOR._loaded_options = None
+ _globals['_DOUBLEVALUE']._serialized_start=46
+ _globals['_DOUBLEVALUE']._serialized_end=74
+ _globals['_FLOATVALUE']._serialized_start=76
+ _globals['_FLOATVALUE']._serialized_end=103
+ _globals['_INT64VALUE']._serialized_start=105
+ _globals['_INT64VALUE']._serialized_end=132
+ _globals['_UINT64VALUE']._serialized_start=134
+ _globals['_UINT64VALUE']._serialized_end=162
+ _globals['_INT32VALUE']._serialized_start=164
+ _globals['_INT32VALUE']._serialized_end=191
+ _globals['_UINT32VALUE']._serialized_start=193
+ _globals['_UINT32VALUE']._serialized_end=221
+ _globals['_BOOLVALUE']._serialized_start=223
+ _globals['_BOOLVALUE']._serialized_end=249
+ _globals['_STRINGVALUE']._serialized_start=251
+ _globals['_STRINGVALUE']._serialized_end=279
# @@protoc_insertion_point(module_scope)
diff --git a/src/sign_transaction.c b/src/sign_transaction.c
index 139566df..cde4778b 100644
--- a/src/sign_transaction.c
+++ b/src/sign_transaction.c
@@ -426,7 +426,12 @@ void handle_sign_transaction(uint8_t p1, uint8_t p2, uint8_t* buffer,
pb_istream_t stream =
pb_istream_from_buffer(raw_transaction, raw_transaction_length);
+ PRINTF("%s: Before pb_decode, len=%u\n", __func__, raw_transaction_length);
+ PRINTF("%s: Stream bytes_left=%u\n", __func__, stream.bytes_left);
+ PRINTF("%s: Stream state=%p\n", __func__, stream.state);
+
// Decode the Transaction
+ PRINTF("%s: Calling pb_decode...\n", __func__);
if (!pb_decode(&stream, Hedera_TransactionBody_fields,
&st_ctx.transaction)) {
// Oh no couldn't ...
@@ -435,6 +440,8 @@ void handle_sign_transaction(uint8_t p1, uint8_t p2, uint8_t* buffer,
MEMCLEAR(raw_transaction);
THROW(EXCEPTION_MALFORMED_APDU);
}
+
+ PRINTF("%s: pb_decode succeeded, which_data=%u\n", __func__, st_ctx.transaction.which_data);
// Extract account memo from cryptoUpdateAccount using second-stage protobuf
// decoding This handles the nested StringValue structure that nanopb
diff --git a/tests/swap/.test_dependencies/libraries/app-ethereum/ethereum-plugin-sdk b/tests/swap/.test_dependencies/libraries/app-ethereum/ethereum-plugin-sdk
new file mode 160000
index 00000000..676219f7
--- /dev/null
+++ b/tests/swap/.test_dependencies/libraries/app-ethereum/ethereum-plugin-sdk
@@ -0,0 +1 @@
+Subproject commit 676219f749cbfd6afba530e36738f81fb247624b
diff --git a/tests/swap/.test_dependencies/main/app-exchange/ledger-nanopb b/tests/swap/.test_dependencies/main/app-exchange/ledger-nanopb
new file mode 160000
index 00000000..7b8ae830
--- /dev/null
+++ b/tests/swap/.test_dependencies/main/app-exchange/ledger-nanopb
@@ -0,0 +1 @@
+Subproject commit 7b8ae830ebf01e95f0b55c15054c8fa46c94bdca
diff --git a/vendor/nanopb/.github/workflows/binary_packages.yml b/vendor/nanopb/.github/workflows/binary_packages.yml
new file mode 100644
index 00000000..34d8e322
--- /dev/null
+++ b/vendor/nanopb/.github/workflows/binary_packages.yml
@@ -0,0 +1,143 @@
+name: Build binary packages
+
+on:
+ workflow_dispatch:
+ workflow_call:
+ push:
+ branches:
+ - 'master'
+ tags:
+ - '*'
+
+jobs:
+ build_linux:
+ name: Build binary on Ubuntu 20.04
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+ fetch-depth: "0"
+
+ - name: Install dependencies
+ run: |
+ python3 -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller
+ python3 -c 'import google.protobuf; print(google.protobuf.__file__)'
+
+ - name: Build binary package
+ run: |
+ cd nanopb
+ git clean -dxf
+ tools/make_linux_package.sh
+
+ - name: Fingerprint binary
+ run: |
+ openssl sha256 nanopb/dist/*.tar.gz
+
+ - name: Upload binary
+ uses: actions/upload-artifact@v2
+ with:
+ path: nanopb/dist/*.tar.gz
+ name: nanopb-binary-linux
+
+ - name: Test binary package
+ run: |
+ tar xzf nanopb/dist/*.tar.gz
+ cd nanopb-*/tests
+ python3 -m SCons
+
+ - name: Test examples
+ run: |
+ cd nanopb-*/examples
+ (cd simple; make; ./simple)
+ (cd network_server; make)
+ (cd using_union_messages; make)
+ (cd cmake_simple; mkdir build; cd build; cmake ..; make)
+ (cd cmake_relpath; mkdir build; cd build; cmake ..; make)
+
+ build_windows:
+ name: Build binary on Windows 2019
+ runs-on: windows-2019
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+ fetch-depth: "0"
+
+ - name: Install dependencies
+ shell: bash
+ run: |
+ python3 -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller
+ python3 -c 'import google.protobuf; print(google.protobuf.__file__)'
+
+ - name: Build binary package
+ shell: bash
+ run: |
+ cd nanopb
+ git clean -dxf
+ tools/make_windows_package.sh
+
+ - name: Fingerprint binary
+ run: |
+ openssl sha256 nanopb/dist/*.zip
+
+ - name: Upload binary
+ uses: actions/upload-artifact@v2
+ with:
+ path: nanopb/dist/*.zip
+ name: nanopb-binary-windows
+
+ - name: Test binary package
+ shell: bash
+ run: |
+ powershell "Expand-Archive nanopb/dist/*.zip"
+ ls
+ cd nanopb-*/nanopb-*/tests
+ python3 -m SCons
+
+ build_macos:
+ name: Build binary on Mac OS X Big Sur 11
+ runs-on: macos-11
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+ fetch-depth: "0"
+
+ - name: Install dependencies
+ run: |
+ python3 -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller
+ python3 -c 'import google.protobuf; print(google.protobuf.__file__)'
+
+ - name: Build binary package
+ run: |
+ cd nanopb
+ git clean -dxf
+ tools/make_mac_package.sh
+
+ - name: Fingerprint binary
+ run: |
+ openssl sha256 nanopb/dist/*.tar.gz
+
+ - name: Upload binary
+ uses: actions/upload-artifact@v2
+ with:
+ path: nanopb/dist/*.tar.gz
+ name: nanopb-binary-macos
+
+ - name: Test binary package
+ run: |
+ tar xzf nanopb/dist/*.tar.gz
+ cd nanopb-*/tests
+ python3 -m SCons
+ cd ../examples/simple
+ make
+ ./simple
+
+
diff --git a/vendor/nanopb/.github/workflows/cifuzz.yml b/vendor/nanopb/.github/workflows/cifuzz.yml
index e67e68fc..b4f6c483 100644
--- a/vendor/nanopb/.github/workflows/cifuzz.yml
+++ b/vendor/nanopb/.github/workflows/cifuzz.yml
@@ -1,17 +1,7 @@
-name: CIFuzz
+name: Run CIFuzz fuzz test for 10 minutes
on:
- push:
- branches:
- - master
- paths:
- - '**.c'
- - '**.h'
- pull_request:
- branches:
- - master
- paths:
- - '**.c'
- - '**.h'
+ workflow_dispatch:
+ workflow_call:
jobs:
Fuzzing:
diff --git a/vendor/nanopb/.github/workflows/compiler_tests.yml b/vendor/nanopb/.github/workflows/compiler_tests.yml
new file mode 100644
index 00000000..cfdc63b4
--- /dev/null
+++ b/vendor/nanopb/.github/workflows/compiler_tests.yml
@@ -0,0 +1,62 @@
+name: Run tests with various compilers
+
+on:
+ workflow_dispatch:
+ workflow_call:
+
+jobs:
+ test_linux:
+ name: Test with gcc & clang on Ubuntu
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+ fetch-depth: "0"
+
+ - name: Install dependencies
+ run: |
+ sudo dpkg --add-architecture i386
+ sudo apt-get update
+ sudo apt-get install python3-protobuf protobuf-compiler scons
+ sudo apt-get install clang valgrind splint cmake
+ sudo apt-get install libstdc++6:i386 libgcc-s1:i386 lib32gcc-9-dev lib32stdc++-9-dev libncurses5:i386 libc6-dbg:i386 libc6-dev:i386 binutils-multiarch
+
+ - name: Test with 64-bit GCC
+ run: |
+ cd nanopb/tests
+ rm -rf build
+ scons CC=gcc CXX=g++ CCFLAGS="-O3"
+ rm -rf build
+ scons CC=gcc CXX=g++ CCFLAGS="-Os -flto"
+ rm -rf build
+ scons CC=gcc CXX=g++ CCFLAGS="-O1 -DPB_FIELD_32BIT=1"
+
+ - name: Test with 32-bit GCC
+ run: |
+ cd nanopb/tests
+ rm -rf build
+ scons CC=gcc CXX=g++ CCFLAGS="-O3 -m32" LINKFLAGS="-m32"
+ rm -rf build
+ scons CC=gcc CXX=g++ CCFLAGS="-Os -flto -m32" LINKFLAGS="-m32"
+ rm -rf build
+ scons CC=gcc CXX=g++ CCFLAGS="-O1 -DPB_FIELD_32BIT=1 -m32" LINKFLAGS="-m32"
+
+ - name: Test with 64-bit clang
+ run: |
+ cd nanopb/tests
+ rm -rf build
+ scons CC=clang CXX=clang++ CCFLAGS="-O3"
+ rm -rf build
+ scons CC=clang CXX=clang++ CCFLAGS="-Os -DPB_FIELD_32BIT=1"
+
+ - name: Test with 32-bit clang
+ run: |
+ cd nanopb/tests
+ rm -rf build
+ scons CC=clang CXX=clang++ CCFLAGS="-O3 -m32" LINKFLAGS="-m32"
+ rm -rf build
+ scons CC=clang CXX=clang++ CCFLAGS="-Os -DPB_FIELD_32BIT=1 -m32" LINKFLAGS="-m32"
+
diff --git a/vendor/nanopb/.github/workflows/spm.yml b/vendor/nanopb/.github/workflows/ios_swift_tests.yml
similarity index 69%
rename from vendor/nanopb/.github/workflows/spm.yml
rename to vendor/nanopb/.github/workflows/ios_swift_tests.yml
index 999851a0..42c022af 100644
--- a/vendor/nanopb/.github/workflows/spm.yml
+++ b/vendor/nanopb/.github/workflows/ios_swift_tests.yml
@@ -1,8 +1,8 @@
-name: spm
+name: Build and test for Apple iOS swift
on:
- push:
- pull_request:
+ workflow_dispatch:
+ workflow_call:
jobs:
swift-build-run:
diff --git a/vendor/nanopb/.github/workflows/platformio_tests.yml b/vendor/nanopb/.github/workflows/platformio_tests.yml
new file mode 100644
index 00000000..6c52ccd2
--- /dev/null
+++ b/vendor/nanopb/.github/workflows/platformio_tests.yml
@@ -0,0 +1,63 @@
+name: Build and test using platformio
+
+on:
+ workflow_dispatch:
+ workflow_call:
+
+jobs:
+ platformio:
+ name: Build and run PlatformIO example
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+
+ - name: Installing dependencies for local act
+ if: ${{ env.ACT }}
+ run: |
+ sudo apt update
+
+ - name: Installing common dependencies
+ run: |
+ sudo apt install -y python3-pip
+
+ - name: Install and setup PlatformIO
+ run: |
+ pip3 install -U platformio
+ export PATH=~/.local/bin:$PATH
+
+ - name: Build PlatformIO package
+ run: |
+ cd nanopb
+ pio package pack
+
+ - name: Example - Extract PlatformIO package to example dir
+ run: |
+ cp -R nanopb/examples/platformio example
+ mkdir -p example/lib/nanopb
+ tar -xzf nanopb/Nanopb-*.tar.gz -C example/lib/nanopb
+
+ - name: Example - Build
+ run: |
+ cd example
+ pio run
+
+ - name: Example - Run test without options
+ run: example/.pio/build/pio_without_options/program
+
+ - name: Example - Run test with options
+ run: example/.pio/build/pio_with_options/program
+
+ - name: Build with default platformio.ini
+ run: |
+ mkdir -p test_default_pio_conf
+ cd test_default_pio_conf
+ pio project init
+ ln -s ../nanopb lib/nanopb
+ echo "[env:native]" >> platformio.ini
+ echo "platform = native" >> platformio.ini
+ echo "lib_deps = Nanopb" >> platformio.ini
+ echo "int main(int argc, char *argv[]){}" > src/main.cpp
+ pio run
diff --git a/vendor/nanopb/.github/workflows/pypi_publish.yml b/vendor/nanopb/.github/workflows/pypi_publish.yml
new file mode 100644
index 00000000..b2243a78
--- /dev/null
+++ b/vendor/nanopb/.github/workflows/pypi_publish.yml
@@ -0,0 +1,78 @@
+name: Publish generator package to PyPI / pip
+
+on:
+ workflow_dispatch:
+ workflow_call:
+ secrets:
+ PYPI_API_KEY:
+ required: true
+
+jobs:
+ publish_pypi:
+ name: Build and publish pypi package on Ubuntu 20.04
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+ fetch-depth: "0"
+
+ - name: Install dependencies
+ run: |
+ python3 -m pip install --user --upgrade pyinstaller poetry protobuf grpcio-tools
+
+ - name: Build PyPI package
+ run: |
+ cd nanopb/extra/poetry
+ ./poetry_build.sh
+
+ - name: Fingerprint package
+ run: |
+ openssl sha256 nanopb/extra/poetry/dist/*.whl
+
+ - name: Check for existence of PyPI package
+ run: |
+ VERSION=$(grep "^version =" nanopb/extra/poetry/build/pyproject.toml | cut -d '"' -f 2)
+ if curl --head --silent --fail https://pypi.org/project/nanopb/$VERSION/; then
+ echo "pypi_exists=true" >> $GITHUB_ENV
+ else
+ echo "pypi_exists=false" >> $GITHUB_ENV
+ fi
+
+ - name: Publish PyPI package
+ if: env.pypi_exists == 'false'
+ env:
+ POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_KEY }}
+ POETRY_HTTP_BASIC_PYPI_USERNAME: __token__
+ POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_API_KEY }}
+ run: |
+ cd nanopb/extra/poetry/build
+ poetry publish -n -v -u __token__ -p "$POETRY_PYPI_TOKEN_PYPI"
+
+ test_pypi:
+ name: Test pypi package
+ runs-on: ubuntu-20.04
+ needs: publish_pypi
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+
+ - name: Wait for package to become visible
+ run: |
+ sleep 60
+
+ - name: Install PyPI package
+ run: |
+ python3 -m pip install --user --upgrade protobuf grpcio-tools scons
+ python3 -m pip install --user --upgrade --pre nanopb
+
+ - name: Test PyPI package
+ run: |
+ cd nanopb/tests/alltypes/
+ nanopb_generator alltypes.proto
+ gcc -Wall -I ../../ -c alltypes.pb.c
diff --git a/vendor/nanopb/.github/workflows/python2_tests.yml b/vendor/nanopb/.github/workflows/python2_tests.yml
new file mode 100644
index 00000000..fdd39fd0
--- /dev/null
+++ b/vendor/nanopb/.github/workflows/python2_tests.yml
@@ -0,0 +1,30 @@
+name: Run tests on Python 2
+
+on:
+ workflow_dispatch:
+ workflow_call:
+
+jobs:
+ test_python2:
+ name: Test with Python 2 on Ubuntu 18.04
+ runs-on: ubuntu-18.04
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+ fetch-depth: "0"
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install python-protobuf protobuf-compiler scons
+
+ - name: Run tests with Python 2
+ run: |
+ cd nanopb
+ export GENPATH=$(bash -c 'printf %q "$(pwd)/generator/protoc-gen-nanopb-py2"')
+ cd tests
+ scons PYTHON="/usr/bin/python2" PROTOC="/usr/bin/protoc" PROTOCFLAGS="--plugin=protoc-gen-nanopb=$GENPATH"
+
diff --git a/vendor/nanopb/.github/workflows/simulator_tests.yml b/vendor/nanopb/.github/workflows/simulator_tests.yml
new file mode 100644
index 00000000..67b1ffbd
--- /dev/null
+++ b/vendor/nanopb/.github/workflows/simulator_tests.yml
@@ -0,0 +1,89 @@
+name: Run tests in simulator
+
+on:
+ workflow_dispatch:
+ workflow_call:
+
+jobs:
+ test_avr:
+ name: Test in simavr for ATMega1284
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+ fetch-depth: "0"
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install python3-protobuf protobuf-compiler scons
+ sudo apt-get install libelf-dev gcc-avr gdb-avr avr-libc
+
+ - name: Install simavr
+ run: |
+ git clone https://github.com/buserror/simavr.git
+ cd simavr
+ make build-simavr
+ sudo make install-simavr
+ sudo ldconfig
+
+ - name: Run tests in AVR simulator
+ run: |
+ cd nanopb/tests
+ scons PLATFORM=AVR
+
+ test_mips:
+ name: Test in qemu for MIPS
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+ fetch-depth: "0"
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install python3-protobuf protobuf-compiler scons
+ sudo apt-get install gcc-mipsel-linux-gnu g++-mipsel-linux-gnu gcc-mips-linux-gnu g++-mips-linux-gnu qemu-user
+
+ - name: Run tests for big-endian MIPS
+ run: |
+ cd nanopb/tests
+ rm -rf build
+ scons PLATFORM=MIPS
+
+ - name: Run tests for little-endian MIPS
+ run: |
+ cd nanopb/tests
+ rm -rf build
+ scons PLATFORM=MIPSEL
+
+ test_riscv:
+ name: Test in qemu for RISCV64
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+ fetch-depth: "0"
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install python3-protobuf protobuf-compiler scons
+ sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu qemu-user
+
+ - name: Run tests for RISCV64
+ run: |
+ cd nanopb/tests
+ rm -rf build
+ scons PLATFORM=RISCV64
+
diff --git a/vendor/nanopb/.github/workflows/trigger_on_code_change.yml b/vendor/nanopb/.github/workflows/trigger_on_code_change.yml
new file mode 100644
index 00000000..e8bf944b
--- /dev/null
+++ b/vendor/nanopb/.github/workflows/trigger_on_code_change.yml
@@ -0,0 +1,53 @@
+name: Test after code changes
+on:
+ workflow_dispatch:
+ push:
+ paths:
+ - '**.c'
+ - '**.h'
+ - '**.py'
+ - '**.sh'
+ - '**.yml'
+ - '**.proto'
+ - '**.mk'
+ - '**.cmake'
+ pull_request:
+ paths:
+ - '**.c'
+ - '**.h'
+ - '**.py'
+ - '**.sh'
+ - '**.yml'
+ - '**.proto'
+ - '**.mk'
+ - '**.cmake'
+
+jobs:
+ smoke_test:
+ name: Run test suite on Ubuntu 20.04
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v2
+ with:
+ path: nanopb
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install python3-protobuf protobuf-compiler scons splint valgrind
+
+ - name: Run tests
+ run: |
+ cd nanopb/tests
+ scons
+
+ fuzz_tests:
+ needs: smoke_test
+ uses: ./.github/workflows/cifuzz.yml
+
+ binary_builds:
+ needs: smoke_test
+ uses: ./.github/workflows/binary_packages.yml
+
diff --git a/vendor/nanopb/.github/workflows/trigger_on_schedule.yml b/vendor/nanopb/.github/workflows/trigger_on_schedule.yml
new file mode 100644
index 00000000..1980b339
--- /dev/null
+++ b/vendor/nanopb/.github/workflows/trigger_on_schedule.yml
@@ -0,0 +1,35 @@
+name: Test, build and pre-release weekly
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: '32 1 * * 1'
+
+jobs:
+ compiler_tests:
+ uses: ./.github/workflows/compiler_tests.yml
+
+ simulator_tests:
+ uses: ./.github/workflows/simulator_tests.yml
+
+ python2_tests:
+ uses: ./.github/workflows/python2_tests.yml
+
+ ios_swift_tests:
+ uses: ./.github/workflows/ios_swift_tests.yml
+
+ platformio_tests:
+ uses: ./.github/workflows/platformio_tests.yml
+
+ cifuzz:
+ uses: ./.github/workflows/cifuzz.yml
+
+ binary_packages:
+ needs: [compiler_tests, simulator_tests, python2_tests, ios_swift_tests, platformio_tests, cifuzz]
+ uses: ./.github/workflows/binary_packages.yml
+
+ pypi_publish:
+ needs: binary_packages
+ uses: ./.github/workflows/pypi_publish.yml
+ secrets:
+ PYPI_API_KEY: ${{ secrets.PYPI_API_KEY }}
+
diff --git a/vendor/nanopb/.travis.yml b/vendor/nanopb/.travis.yml
deleted file mode 100644
index 0f9775c2..00000000
--- a/vendor/nanopb/.travis.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-language: c
-dist: focal
-
-# Test using both gcc and clang
-env:
- - CC=gcc CXX=g++
- - CC=clang CXX=clang++
-
-addons:
- apt:
- packages:
- - scons
- - python3
- - python3-protobuf
- - protobuf-compiler
-
-
-before_install:
- - export PATH=$HOME/.local/bin:$HOME/protobuf/bin:$PATH
- - export MAKEFLAGS=-j$(nproc)
- - $CC --version
- - $CXX --version
- - python --version
- - lsb_release -a
-
-script:
- - pushd tests && scons CC=$CC CXX=$CXX && popd
-
-notifications:
- email:
- recipients:
- - jpa@travis.mail.kapsi.fi
diff --git a/vendor/nanopb/AUTHORS.txt b/vendor/nanopb/AUTHORS.txt
index 465f1071..d966e4c1 100644
--- a/vendor/nanopb/AUTHORS.txt
+++ b/vendor/nanopb/AUTHORS.txt
@@ -98,3 +98,19 @@ leabut
Angel ILIEV
Jakub Tymejczyk
Matthew Simmons
+Anthony Pesch
+Avik De
+ConradWood
+David Sabatie
+Sebastian Stockhammer
+Gil Shapira
+Ian Frosst
+Ingo Kresse
+Ivan Zrno
+Jonathan Seilkopf
+Karl Ljungkvist
+Mathis Logemann
+Oleg Dolgy <60554929+odolgy@users.noreply.github.com>
+Pavel Sokolov
+Slavey Karadzhov
+Tobias Nießen
diff --git a/vendor/nanopb/CHANGELOG.txt b/vendor/nanopb/CHANGELOG.txt
index 05596461..4ecdc47a 100644
--- a/vendor/nanopb/CHANGELOG.txt
+++ b/vendor/nanopb/CHANGELOG.txt
@@ -1,3 +1,44 @@
+nanopb-0.4.6 (2022-05-30)
+ Fix passing of error message from substream callback (#703)
+ Fix comments going to wrong member variables (#701)
+ Fix regression in 0.4.3 where generator did not find all dependencies (#720)
+ Fix FindNanopb.cmake not finding options file (#659)
+ Fix double-definition errors with size_union (#692)
+ Fix generator error with same inner message name (#746)
+ Fix infinite recursion in generator/protoc script (#762)
+ Fix unicode comment handling for Python 2 (#740)
+ Fix compiler warnings with PB_BUFFER_ONLY (#717)
+ Fix options dependency in nanopb.mk (#666)
+ Fix handling of filenames with dot in them in FindNanopb.cmake (#756)
+ Add fallback_type option (#772, #773)
+ Use C11 static assert mechanism by default (#761, #766)
+ Use 'static_assert' keyword for iar (#679)
+ Explicitly check for pItem == NULL to satisfy Xcode analyzer (#667, #674)
+ Support --proto-path as alias to -I (#749)
+ Refactor name mangling to separate class, improve error messages (#735)
+ Move PB_WT_PACKED definition to the header to fix compiler warnings (#671)
+ FindNanopb.cmake: use --nanopb_opt for option passing by default (#752)
+ FindNanopb.cmake: Add option NANOPB_GENERATE_CPP_STANDALONE (#741)
+ FindNanopb.cmake: Add PROTOC_OPTIONS variable (#768, #771)
+ CMakeLists: add build interface for using as a submodule (#669)
+ CMakeLists: fix error with nanopb_BUILD_GENERATOR=OFF (#764)
+ CMakeLists: make more uniform (#676)
+ CMakeLists: Fix uninitialized PYTHON_INSTDIR (#652)
+ Clean up CMake examples (#741)
+ Rebuild nanopb_pb2.py and print version numbers on import failure (#733, #742)
+ Use memcpy instead of iterating on buf_read/write (#751)
+ Add generator support for PlatformIO (#718)
+ Add clean target to generator/proto/Makefile (#681)
+ Windows .bats: use standard python invocation instead of py.exe launcher (#657)
+ Fix problems running tests with newer SCons version
+ Improve handling of varint overflows
+ Improve optimization for little-endian platforms
+
+NOTE: During development, prereleases were published on platform.io registry
+as versions 0.4.6 - 0.4.6.3. The version 0.4.6.4 on platform.io corresponds
+to the real final 0.4.6 release.
+
+
nanopb-0.4.5 (2021-03-22)
Fix invalid free() with oneof (#647, GHSA-7mv5-5mxh-qg88)
Fix unordered field numbers inside oneof causing fields to be ignored (#617)
@@ -241,7 +282,7 @@ nanopb-0.3.8 (2017-03-05)
Allow overriding proto3 mode (#228)
Add optional enum->string mapping function (#223)
Add transitional options.proto file (#241)
- Add better error message on Python library version imcompatibility (#240)
+ Add better error message on Python library version incompatibility (#240)
Include version number in PlatformIO library.json (#222)
CMake build script changes (#236, #237)
Change download links to https
diff --git a/vendor/nanopb/CMakeLists.txt b/vendor/nanopb/CMakeLists.txt
index d9c5e5e1..f509a919 100644
--- a/vendor/nanopb/CMakeLists.txt
+++ b/vendor/nanopb/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.12)
project(nanopb C)
-set(nanopb_VERSION_STRING nanopb-0.4.5)
+set(nanopb_VERSION_STRING nanopb-0.4.6)
set(nanopb_SOVERSION 0)
string(REPLACE "nanopb-" "" nanopb_VERSION ${nanopb_VERSION_STRING})
@@ -14,8 +14,9 @@ option(nanopb_BUILD_RUNTIME "Build the headers and libraries needed at runtime"
option(nanopb_BUILD_GENERATOR "Build the protoc plugin for code generation" ON)
option(nanopb_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON)
-if(NOT DEFINED nanopb_PROTOC_PATH)
- set(nanopb_PROTOC_PATH "protoc")
+find_program(nanopb_PROTOC_PATH protoc)
+if(NOT EXISTS ${nanopb_PROTOC_PATH})
+ message(FATAL_ERROR "protoc compiler not found")
endif()
if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
@@ -38,17 +39,17 @@ if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR)
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/nanopb")
endif()
+find_package(Python REQUIRED COMPONENTS Interpreter)
+execute_process(
+ COMMAND ${Python_EXECUTABLE} -c
+ "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))"
+ OUTPUT_VARIABLE PYTHON_INSTDIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
if(nanopb_BUILD_GENERATOR)
set(generator_protos nanopb)
- find_package(Python REQUIRED)
- execute_process(
- COMMAND ${Python_EXECUTABLE} -c
- "from distutils import sysconfig; print(sysconfig.get_python_lib(prefix=''))"
- OUTPUT_VARIABLE PYTHON_INSTDIR
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
foreach(generator_proto IN LISTS generator_protos)
string(REGEX REPLACE "([^;]+)" "${PROJECT_SOURCE_DIR}/generator/proto/\\1.proto" generator_proto_file "${generator_proto}")
string(REGEX REPLACE "([^;]+)" "\\1_pb2.py" generator_proto_py_file "${generator_proto}")
@@ -64,23 +65,25 @@ if(nanopb_BUILD_GENERATOR)
DESTINATION ${PYTHON_INSTDIR}/proto/
)
endforeach()
-endif()
-install( FILES generator/proto/_utils.py
- DESTINATION ${PYTHON_INSTDIR}/proto/ )
+ install( FILES generator/proto/_utils.py
+ DESTINATION ${PYTHON_INSTDIR}/proto/ )
+endif()
-if( WIN32 )
- install(
- PROGRAMS generator/nanopb_generator.py
- generator/protoc-gen-nanopb.bat
- DESTINATION ${CMAKE_INSTALL_BINDIR}
- )
+if(WIN32)
+ install(
+ PROGRAMS
+ generator/nanopb_generator.py
+ generator/protoc-gen-nanopb.bat
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ )
else()
- install(
- PROGRAMS generator/nanopb_generator.py
- generator/protoc-gen-nanopb
- DESTINATION ${CMAKE_INSTALL_BINDIR}
- )
+ install(
+ PROGRAMS
+ generator/nanopb_generator.py
+ generator/protoc-gen-nanopb
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ )
endif()
if(nanopb_BUILD_RUNTIME)
@@ -97,10 +100,11 @@ if(nanopb_BUILD_RUNTIME)
SOVERSION ${nanopb_SOVERSION})
install(TARGETS protobuf-nanopb EXPORT nanopb-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
target_include_directories(protobuf-nanopb INTERFACE
- $
+ $
+ $
)
endif()
@@ -118,7 +122,8 @@ if(nanopb_BUILD_RUNTIME)
install(TARGETS protobuf-nanopb-static EXPORT nanopb-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
target_include_directories(protobuf-nanopb-static INTERFACE
- $
+ $
+ $
)
endif()
diff --git a/vendor/nanopb/README.md b/vendor/nanopb/README.md
index 44aa3e41..33f5ccf0 100644
--- a/vendor/nanopb/README.md
+++ b/vendor/nanopb/README.md
@@ -1,17 +1,19 @@
Nanopb - Protocol Buffers for Embedded Systems
==============================================
-[](https://travis-ci.com/nanopb/nanopb)
+
+
Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is
especially suitable for use in microcontrollers, but fits any memory
restricted system.
* **Homepage:** https://jpa.kapsi.fi/nanopb/
+* **Git repository:** https://github.com/nanopb/nanopb/
* **Documentation:** https://jpa.kapsi.fi/nanopb/docs/
-* **Downloads:** https://jpa.kapsi.fi/nanopb/download/
* **Forum:** https://groups.google.com/forum/#!forum/nanopb
-* **Nightly builds:** https://jpa.kapsi.fi/jenkins/job/nanopb/
+* **Stable version downloads:** https://jpa.kapsi.fi/nanopb/download/
+* **Pre-release binary packages:** https://github.com/nanopb/nanopb/actions/workflows/binary_packages.yml
Using the nanopb library
@@ -43,7 +45,7 @@ The binary packages for Windows, Linux and Mac OS X should contain all necessary
dependencies, including Python, python-protobuf library and protoc. If you are
using a git checkout or a plain source distribution, you will need to install
Python separately. Once you have Python, you can install the other dependencies
-with `pip install protobuf grpcio-tools`.
+with `pip install --upgrade protobuf grpcio-tools`.
You can further customize the header generation by creating an `.options` file.
See [documentation](https://jpa.kapsi.fi/nanopb/docs/concepts.html#modifying-generator-behaviour) for details.
@@ -89,20 +91,9 @@ There exist build rules for several systems:
* **Conan**: `conanfile.py` in source root
* **PlatformIO**: https://platformio.org/lib/show/431/Nanopb
* **PyPI/pip**: https://pypi.org/project/nanopb/
+* **vcpkg**: https://vcpkg.info/port/nanopb
And also integration to platform interfaces:
* **Arduino**: http://platformio.org/lib/show/1385/nanopb-arduino
-Building nanopb - Using vcpkg
------------------------------
-
-You can download and install nanopb using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
-
- git clone https://github.com/Microsoft/vcpkg.git
- cd vcpkg
- ./bootstrap-vcpkg.sh
- ./vcpkg integrate install
- ./vcpkg install nanopb
-
-The nanopb port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
diff --git a/vendor/nanopb/conanfile.py b/vendor/nanopb/conanfile.py
index fb57883b..93211f29 100644
--- a/vendor/nanopb/conanfile.py
+++ b/vendor/nanopb/conanfile.py
@@ -3,7 +3,7 @@
class NanoPbConan(ConanFile):
name = "nanopb"
- version = "0.4.5"
+ version = "0.4.6"
license = "zlib"
url = "https://jpa.kapsi.fi/nanopb/"
description = "Protocol Buffers with small code size"
diff --git a/vendor/nanopb/docs/concepts.md b/vendor/nanopb/docs/concepts.md
index 74e1ca32..814ed11e 100644
--- a/vendor/nanopb/docs/concepts.md
+++ b/vendor/nanopb/docs/concepts.md
@@ -544,7 +544,7 @@ framing format are to:
3. Perform any synchronization and error checking that may be needed
depending on application.
-For example UDP packets already fullfill all the requirements, and TCP
+For example UDP packets already fulfill all the requirements, and TCP
streams typically only need a way to identify the message length and
type. Lower level interfaces such as serial ports may need a more robust
frame format, such as HDLC (high-level data link control).
@@ -577,3 +577,45 @@ error. The most common error conditions are:
7) Errors that happen in your callback functions.
8) Running out of memory, i.e. stack overflow.
9) Invalid field descriptors (would usually mean a bug in the generator).
+
+## Static assertions
+
+Nanopb code uses static assertions to check size of structures at the compile
+time. The `PB_STATIC_ASSERT` macro is defined in `pb.h`. If ISO C11 standard
+is available, the C standard `_Static_assert` keyword is used, otherwise a
+negative sized array definition trick is used.
+
+Common reasons for static assertion errors are:
+
+1. `FIELDINFO_DOES_NOT_FIT_width2` with `width1` or `width2`:
+ Message that is larger than 256 bytes, but nanopb generator does not detect
+ it for some reason. Often resolved by giving all `.proto` files as argument
+ to `nanopb_generator.py` at the same time, to ensure submessage definitions
+ are found. Alternatively `(nanopb).descriptorsize = DS_4` option can be
+ given manually.
+
+2. `FIELDINFO_DOES_NOT_FIT_width4` with `width4`:
+ Message that is larger than 64 kilobytes. There will be a better error
+ message for this in a future nanopb version, but currently it asserts here.
+ The compile time option `PB_FIELD_32BIT` should be specified either on
+ C compiler command line or by editing `pb.h`. This will increase the sizes
+ of integer types used internally in nanopb code.
+
+3. `DOUBLE_MUST_BE_8_BYTES`:
+ Some platforms, most notably AVR, do not support the 64-bit `double` type,
+ only 32-bit `float`. The compile time option `PB_CONVERT_DOUBLE_FLOAT` can
+ be defined to convert between the types automatically. The conversion
+ results in small rounding errors and takes unnecessary space in transmission,
+ so changing the `.proto` to use `float` type is often better.
+
+4. `INT64_T_WRONG_SIZE`:
+ The `stdint.h` system header is incorrect for the C compiler being used.
+ This can result from erroneous compiler include path.
+ If the compiler actually does not support 64-bit types, the compile time
+ option `PB_WITHOUT_64BIT` can be used.
+
+5. `variably modified array size`:
+ The compiler used has problems resolving the array-based static assert at
+ compile time. Try setting the compiler to C11 standard mode if possible.
+ If static assertions cannot be made to work on the compiler used, the
+ compile-time option `PB_NO_STATIC_ASSERT` can be specified to turn them off.
diff --git a/vendor/nanopb/docs/migration.md b/vendor/nanopb/docs/migration.md
index 5a0a9842..0fde1db6 100644
--- a/vendor/nanopb/docs/migration.md
+++ b/vendor/nanopb/docs/migration.md
@@ -6,6 +6,48 @@ required modifications of user applications are explained. Also any
error indications are included, in order to make it easier to find this
document.
+Nanopb-0.4.6 (2022-05-30)
+-------------------------
+
+### NANOPB_VERSION define is now a string
+
+**Changes:** To ease `NANOPB_VERSION` macro usage, the value is directly a string.
+
+**Required actions:** Most nanopb users probably never used that macro. If so,
+you certainly use the `#` preprocessor to convert it as string. You, now,
+only have to call it directly, like this for example:
+`strcpy(myvar, NANOPB_VERSION);`
+
+### FindNanopb.cmake now requires protoc 3.6.0 or newer by default
+
+**Changes:** The default options passing method now uses `--plugin-opt` which
+is supported by protoc 3.6.0 and newer (released in 2018).
+
+**Required actions:** Update `protoc` if needed, or alternatively install
+`grpcio-tools` package from `pip`. If neither is possible, the
+`NANOPB_PROTOC_OLDER_THAN_3_6_0` cmake option can be used to restore the old
+style option passing. Note that it has problems with special characters such
+as `:`.
+
+**Error indications:** "`protoc: Unknown flag: --nanopb_opt`"
+
+### pb.h uses C11 _Static_assert keyword by default
+
+**Rationale:** The nanopb generated headers use static assertions to catch
+errors at compile time. There are several mechanisms to implement this.
+The most widely supported is C11 `_Static_assert` keyword.
+Previously the code used negative size array definition trick, which is
+supported already in C99 but does not work with every compiler and can
+produce confusing error messages.
+
+**Changes:** Now `_Static_assert` is used by default.
+
+**Required actions:** If the keyword is not recognized, set the compiler to
+C11 standard mode if available. If it is not available, define either `PB_C99_STATIC_ASSERT`
+or `PB_NO_STATIC_ASSERT` in `pb.h` or on compiler command line.
+
+**Error indications:** `Undefined identifier _Static_assert`
+
Nanopb-0.4.4 (2020-11-25)
-------------------------
@@ -511,7 +553,7 @@ Nanopb-0.2.1 (2013-04-14)
### Callback function signature
-**Rationale:** Previously the auxilary data to field callbacks was
+**Rationale:** Previously the auxiliary data to field callbacks was
passed as `void*`. This allowed passing of any data, but made it
unnecessarily complex to return a pointer from callback.
diff --git a/vendor/nanopb/docs/reference.md b/vendor/nanopb/docs/reference.md
index 84e90247..2d591ae9 100644
--- a/vendor/nanopb/docs/reference.md
+++ b/vendor/nanopb/docs/reference.md
@@ -18,8 +18,10 @@ includes nanopb headers.
* `PB_SYSTEM_HEADER`: Replace the standards header files with a single system-specific header file. Value must include quotes, for example `#define PB_SYSTEM_HEADER "foo.h"`. See [extra/pb_syshdr.h](https://github.com/nanopb/nanopb/blob/master/extra/pb_syshdr.h) for an example.
* `PB_WITHOUT_64BIT`: Disable support of 64-bit integer fields, for old compilers or for a slight speedup on 8-bit platforms.
* `PB_ENCODE_ARRAYS_UNPACKED`: Encode scalar arrays in the unpacked format, which takes up more space. Only to be used when the decoder on the receiving side cannot process packed arrays, such as [protobuf.js versions before 2020](https://github.com/protocolbuffers/protobuf/issues/1701).
-* `PB_CONVERT_DOBULE_FLOAT`: Convert doubles to floats for platforms that do not support 64-bit `double` datatype. Mainly `AVR` processors.
+* `PB_CONVERT_DOUBLE_FLOAT`: Convert doubles to floats for platforms that do not support 64-bit `double` datatype. Mainly `AVR` processors.
* `PB_VALIDATE_UTF8`: Check whether incoming strings are valid UTF-8 sequences. Adds a small performance and code size penalty.
+* `PB_C99_STATIC_ASSERT`: Use C99 style negative array trick for static assertions. For compilers that do not support C11 standard.
+* `PB_NO_STATIC_ASSERT`: Disable static assertions at compile time. Only for compilers with limited support of C standards.
The `PB_MAX_REQUIRED_FIELDS` and `PB_FIELD_32BIT` settings allow
raising some datatype limits to suit larger messages. Their need is
diff --git a/vendor/nanopb/examples/cmake_relpath/CMakeLists.txt b/vendor/nanopb/examples/cmake_relpath/CMakeLists.txt
index e7727d85..a8abeb4f 100644
--- a/vendor/nanopb/examples/cmake_relpath/CMakeLists.txt
+++ b/vendor/nanopb/examples/cmake_relpath/CMakeLists.txt
@@ -9,9 +9,6 @@ nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS RELPATH proto
proto/simple.proto proto/sub/unlucky.proto)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
-#add_custom_target(generate_proto_sources DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
-set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS}
- PROPERTIES GENERATED TRUE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -g -O0")
diff --git a/vendor/nanopb/examples/cmake_simple/CMakeLists.txt b/vendor/nanopb/examples/cmake_simple/CMakeLists.txt
index e5f33a02..d9b96be0 100644
--- a/vendor/nanopb/examples/cmake_simple/CMakeLists.txt
+++ b/vendor/nanopb/examples/cmake_simple/CMakeLists.txt
@@ -7,9 +7,6 @@ include_directories(${NANOPB_INCLUDE_DIRS})
nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS simple.proto)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
-#add_custom_target(generate_proto_sources DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
-set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS}
- PROPERTIES GENERATED TRUE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -g -O0")
diff --git a/vendor/nanopb/examples/platformio/.gitignore b/vendor/nanopb/examples/platformio/.gitignore
new file mode 100644
index 00000000..6093aef6
--- /dev/null
+++ b/vendor/nanopb/examples/platformio/.gitignore
@@ -0,0 +1,5 @@
+.pio/
+.idea/
+cmake-build-*/
+/CMakeLists.txt
+CMakeListsPrivate.txt
diff --git a/vendor/nanopb/examples/platformio/platformio.ini b/vendor/nanopb/examples/platformio/platformio.ini
new file mode 100644
index 00000000..7e119b84
--- /dev/null
+++ b/vendor/nanopb/examples/platformio/platformio.ini
@@ -0,0 +1,48 @@
+;
+; You can setup `custom_nanopb_protos` `nanopb_options` vars to generate code from proto files
+;
+; Generator will use next folders:
+;
+; `$BUILD_DIR/nanopb/generated-src` - `*.pb.h` and `*.pb.c` files
+; `$BUILD_DIR/nanopb/md5` - MD5 files to track changes in source .proto/.options
+;
+; Compiled `.pb.o` files will be located under `$BUILD_DIR/nanopb/generated-build`
+;
+; Example:
+
+[env:pio_with_options]
+platform = native
+lib_deps = Nanopb
+
+src_filter =
+ +
+
+; All path are relative to the `$PROJECT_DIR`
+custom_nanopb_protos =
+ +
+custom_nanopb_options =
+ --error-on-unmatched
+
+[env:pio_without_options]
+platform = native
+lib_deps = Nanopb
+
+src_filter =
+ +
+
+; All path are relative to the `$PROJECT_DIR`
+custom_nanopb_protos =
+ +
+
+
+[env:pio_esp32_idf]
+platform = espressif32
+board = firebeetle32
+framework = espidf
+lib_deps = Nanopb
+
+; Warning: the 'src_filter' option cannot be used with ESP-IDF. Select source files to build in the project CMakeLists.txt file.
+; So, we specified source files in src/CMakeLists.txt
+
+custom_nanopb_protos =
+ +
diff --git a/vendor/nanopb/examples/platformio/proto/pio_with_options.options b/vendor/nanopb/examples/platformio/proto/pio_with_options.options
new file mode 100644
index 00000000..fe2dbee6
--- /dev/null
+++ b/vendor/nanopb/examples/platformio/proto/pio_with_options.options
@@ -0,0 +1 @@
+TestMessageWithOptions.str max_size:16
diff --git a/vendor/nanopb/examples/platformio/proto/pio_with_options.proto b/vendor/nanopb/examples/platformio/proto/pio_with_options.proto
new file mode 100644
index 00000000..58e00ed3
--- /dev/null
+++ b/vendor/nanopb/examples/platformio/proto/pio_with_options.proto
@@ -0,0 +1,5 @@
+syntax = "proto3";
+
+message TestMessageWithOptions {
+ string str = 1;
+}
diff --git a/vendor/nanopb/examples/platformio/proto/pio_without_options.proto b/vendor/nanopb/examples/platformio/proto/pio_without_options.proto
new file mode 100644
index 00000000..2284488b
--- /dev/null
+++ b/vendor/nanopb/examples/platformio/proto/pio_without_options.proto
@@ -0,0 +1,5 @@
+syntax = "proto3";
+
+message TestMessageWithoutOptions {
+ int32 number = 1;
+}
diff --git a/vendor/nanopb/examples/platformio/src/CMakeLists.txt b/vendor/nanopb/examples/platformio/src/CMakeLists.txt
new file mode 100644
index 00000000..40ab4b7e
--- /dev/null
+++ b/vendor/nanopb/examples/platformio/src/CMakeLists.txt
@@ -0,0 +1,3 @@
+idf_component_register(
+ SRCS
+ pio_esp32_idf.c)
diff --git a/vendor/nanopb/examples/platformio/src/pio_esp32_idf.c b/vendor/nanopb/examples/platformio/src/pio_esp32_idf.c
new file mode 100644
index 00000000..5e12ea5b
--- /dev/null
+++ b/vendor/nanopb/examples/platformio/src/pio_esp32_idf.c
@@ -0,0 +1,34 @@
+#include "pb_encode.h"
+#include "pb_decode.h"
+
+#include "test.h"
+
+#include "pio_without_options.pb.h"
+
+void app_main() {
+ int status = 0;
+
+ uint8_t buffer[256];
+ pb_ostream_t ostream;
+ pb_istream_t istream;
+ size_t written;
+
+ TestMessageWithoutOptions original = TestMessageWithoutOptions_init_zero;
+ original.number = 45;
+
+ ostream = pb_ostream_from_buffer(buffer, sizeof(buffer));
+
+ TEST(pb_encode(&ostream, &TestMessageWithoutOptions_msg, &original));
+
+ written = ostream.bytes_written;
+
+ istream = pb_istream_from_buffer(buffer, written);
+
+ TestMessageWithoutOptions decoded = TestMessageWithoutOptions_init_zero;
+
+ TEST(pb_decode(&istream, &TestMessageWithoutOptions_msg, &decoded));
+
+ TEST(decoded.number == 45);
+
+ return status;
+}
diff --git a/vendor/nanopb/examples/platformio/src/pio_with_options.c b/vendor/nanopb/examples/platformio/src/pio_with_options.c
new file mode 100644
index 00000000..f558c61d
--- /dev/null
+++ b/vendor/nanopb/examples/platformio/src/pio_with_options.c
@@ -0,0 +1,35 @@
+#include "pb_encode.h"
+#include "pb_decode.h"
+
+#include "test.h"
+
+#include "pio_with_options.pb.h"
+
+int main(int argc, char *argv[]) {
+
+ int status = 0;
+
+ uint8_t buffer[256];
+ pb_ostream_t ostream;
+ pb_istream_t istream;
+ size_t written;
+
+ TestMessageWithOptions original = TestMessageWithOptions_init_zero;
+ strcpy(original.str,"Hello");
+
+ ostream = pb_ostream_from_buffer(buffer, sizeof(buffer));
+
+ TEST(pb_encode(&ostream, &TestMessageWithOptions_msg, &original));
+
+ written = ostream.bytes_written;
+
+ istream = pb_istream_from_buffer(buffer, written);
+
+ TestMessageWithOptions decoded = TestMessageWithOptions_init_zero;
+
+ TEST(pb_decode(&istream, &TestMessageWithOptions_msg, &decoded));
+
+ TEST(strcmp(decoded.str,"Hello") == 0);
+
+ return status;
+}
diff --git a/vendor/nanopb/examples/platformio/src/pio_without_options.c b/vendor/nanopb/examples/platformio/src/pio_without_options.c
new file mode 100644
index 00000000..1ab59f94
--- /dev/null
+++ b/vendor/nanopb/examples/platformio/src/pio_without_options.c
@@ -0,0 +1,35 @@
+#include "pb_encode.h"
+#include "pb_decode.h"
+
+#include "test.h"
+
+#include "pio_without_options.pb.h"
+
+int main(int argc, char *argv[]) {
+
+ int status = 0;
+
+ uint8_t buffer[256];
+ pb_ostream_t ostream;
+ pb_istream_t istream;
+ size_t written;
+
+ TestMessageWithoutOptions original = TestMessageWithoutOptions_init_zero;
+ original.number = 45;
+
+ ostream = pb_ostream_from_buffer(buffer, sizeof(buffer));
+
+ TEST(pb_encode(&ostream, &TestMessageWithoutOptions_msg, &original));
+
+ written = ostream.bytes_written;
+
+ istream = pb_istream_from_buffer(buffer, written);
+
+ TestMessageWithoutOptions decoded = TestMessageWithoutOptions_init_zero;
+
+ TEST(pb_decode(&istream, &TestMessageWithoutOptions_msg, &decoded));
+
+ TEST(decoded.number == 45);
+
+ return status;
+}
diff --git a/vendor/nanopb/examples/platformio/src/test.h b/vendor/nanopb/examples/platformio/src/test.h
new file mode 100644
index 00000000..63895dac
--- /dev/null
+++ b/vendor/nanopb/examples/platformio/src/test.h
@@ -0,0 +1,9 @@
+#include
+
+#define TEST(x) \
+ if (!(x)) { \
+ fprintf(stderr, "\033[31;1mFAILED:\033[22;39m %s:%d %s\n", __FILE__, __LINE__, #x); \
+ status = 1; \
+ } else { \
+ printf("\033[32;1mOK:\033[22;39m %s\n", #x); \
+ }
diff --git a/vendor/nanopb/extra/FindNanopb.cmake b/vendor/nanopb/extra/FindNanopb.cmake
index a6c34fa9..f2ecd267 100644
--- a/vendor/nanopb/extra/FindNanopb.cmake
+++ b/vendor/nanopb/extra/FindNanopb.cmake
@@ -25,6 +25,7 @@
# under build directory, instead of mirroring
# relative paths of source directories.
# Set to FALSE if you want to disable this behaviour.
+# PROTOC_OPTIONS - Pass options to protoc executable
#
# Defines the following variables:
#
@@ -162,7 +163,7 @@ function(NANOPB_GENERATE_CPP SRCS HDRS)
set(GENERATOR_CORE_SRC
${GENERATOR_CORE_DIR}/nanopb.proto)
- # Treat the source diretory as immutable.
+ # Treat the source directory as immutable.
#
# Copy the generator directory to the build directory before
# compiling python and proto files. Fixes issues when using the
@@ -196,8 +197,8 @@ function(NANOPB_GENERATE_CPP SRCS HDRS)
endif()
foreach(FIL ${NANOPB_GENERATE_CPP_UNPARSED_ARGUMENTS})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
- get_filename_component(FIL_WE ${FIL} NAME_WE)
- get_filename_component(FIL_DIR ${FIL} PATH)
+ get_filename_component(FIL_WE ${FIL} NAME_WLE)
+ get_filename_component(FIL_DIR ${ABS_FIL} PATH)
set(FIL_PATH_REL)
if(ABS_ROOT)
# Check that the file is under the given "RELPATH"
@@ -258,17 +259,9 @@ function(NANOPB_GENERATE_CPP SRCS HDRS)
# We need to pass the path to the option files to the nanopb plugin. There are two ways to do it.
# - An older hacky one using ':' as option separator in protoc args preventing the ':' to be used in path.
# - Or a newer one, using --nanopb_opt which requires a version of protoc >= 3.6
- # So we will determine which version of protoc we have available and choose accordingly.
- execute_process(COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --version OUTPUT_VARIABLE PROTOC_VERSION_STRING OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX MATCH "[(0-9)].*.[(0-9)].*.[(0-9)].*" PROTOC_VERSION ${PROTOC_VERSION_STRING})
-
- if(PROTOC_VERSION VERSION_LESS "3.6.0")
- #try to use the older way
- string(REGEX MATCH ":" HAS_COLON_IN_PATH ${NANOPB_PLUGIN_OPTIONS} ${NANOPB_OUT})
- if(HAS_COLON_IN_PATH)
- message(FATAL_ERROR "Your path includes a ':' character used as an option separator for nanopb. Upgrade to protoc version >= 3.6.0 or use a different path.")
- endif()
- set(NANOPB_OPT_STRING "--nanopb_out=${NANOPB_PLUGIN_OPTIONS}:${NANOPB_OUT}")
+ # Since nanopb 0.4.6, --nanopb_opt is the default.
+ if(DEFINED NANOPB_PROTOC_OLDER_THAN_3_6_0)
+ set(NANOPB_OPT_STRING "--nanopb_out=${NANOPB_PLUGIN_OPTIONS}:${NANOPB_OUT}")
else()
set(NANOPB_OPT_STRING "--nanopb_opt=${NANOPB_PLUGIN_OPTIONS}" "--nanopb_out=${NANOPB_OUT}")
endif()
@@ -281,6 +274,7 @@ function(NANOPB_GENERATE_CPP SRCS HDRS)
-I${CMAKE_CURRENT_BINARY_DIR} ${_nanopb_include_path}
--plugin=protoc-gen-nanopb=${NANOPB_GENERATOR_PLUGIN}
${NANOPB_OPT_STRING}
+ ${PROTOC_OPTIONS}
${ABS_FIL}
DEPENDS ${ABS_FIL} ${GENERATOR_CORE_PYTHON_SRC}
${ABS_OPT_FIL} ${NANOPB_DEPENDS}
@@ -290,9 +284,18 @@ function(NANOPB_GENERATE_CPP SRCS HDRS)
endforeach()
set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
- set(${SRCS} ${${SRCS}} ${NANOPB_SRCS} PARENT_SCOPE)
- set(${HDRS} ${${HDRS}} ${NANOPB_HDRS} PARENT_SCOPE)
+ if(NOT DEFINED NANOPB_GENERATE_CPP_STANDALONE)
+ set(NANOPB_GENERATE_CPP_STANDALONE TRUE)
+ endif()
+
+ if (NANOPB_GENERATE_CPP_STANDALONE)
+ set(${SRCS} ${${SRCS}} ${NANOPB_SRCS} PARENT_SCOPE)
+ set(${HDRS} ${${HDRS}} ${NANOPB_HDRS} PARENT_SCOPE)
+ else()
+ set(${SRCS} ${${SRCS}} PARENT_SCOPE)
+ set(${HDRS} ${${HDRS}} PARENT_SCOPE)
+ endif()
endfunction()
diff --git a/vendor/nanopb/extra/nanopb.mk b/vendor/nanopb/extra/nanopb.mk
index fc085f45..d60b37d0 100644
--- a/vendor/nanopb/extra/nanopb.mk
+++ b/vendor/nanopb/extra/nanopb.mk
@@ -31,15 +31,10 @@ else
endif
endif
-########################################
-# Protobuf files regeneration #
-########################################
-.PHONY: proto
-proto:
- @echo "Generating protobuf files..."
- @for proto_file in $(PB_FILES) ; do \
- echo "Processing $$proto_file..." ; \
- $(PROTOC) $(PROTOC_OPTS) --nanopb_out=. $$proto_file ; \
- $(PROTOC) $(PROTOC_OPTS) --python_out=. $$proto_file ; \
- done
- @echo "Protobuf generation complete."
+# Rule for building .pb.c and .pb.h
+%.pb.c %.pb.h: %.proto %.options
+ $(PROTOC) $(PROTOC_OPTS) --nanopb_out=. $<
+
+%.pb.c %.pb.h: %.proto
+ $(PROTOC) $(PROTOC_OPTS) --nanopb_out=. $<
+
diff --git a/vendor/nanopb/extra/poetry/pyproject.toml b/vendor/nanopb/extra/poetry/pyproject.toml
index b03b482d..4ef1903d 100644
--- a/vendor/nanopb/extra/poetry/pyproject.toml
+++ b/vendor/nanopb/extra/poetry/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nanopb"
-version = "0.4.5"
+version = "0.4.6"
description = "Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is especially suitable for use in microcontrollers, but fits any memory restricted system."
authors = ["Petteri Aimonen "]
license = "Zlib"
@@ -18,8 +18,8 @@ protoc-gen-nanopb = "nanopb.generator.nanopb_generator:main_plugin"
[tool.poetry.dependencies]
python = ">=2.7"
-protobuf = ">=3.6"
-grpcio-tools = {version = ">=1.26.0rc1", allow-prereleases = true, optional=true}
+protobuf = ">=3.19"
+grpcio-tools = ">=1.46.0"
[tool.poetry.dev-dependencies]
diff --git a/vendor/nanopb/generator/nanopb_generator.py b/vendor/nanopb/generator/nanopb_generator.py
index 48792ef5..819b993b 100755
--- a/vendor/nanopb/generator/nanopb_generator.py
+++ b/vendor/nanopb/generator/nanopb_generator.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
'''Generate header file for nanopb from a ProtoBuf FileDescriptorSet.'''
-nanopb_version = "nanopb-0.4.5"
+nanopb_version = "nanopb-0.4.6"
import sys
import re
@@ -18,7 +18,7 @@
try:
# Add some dummy imports to keep packaging tools happy.
- import google, distutils.util # bbfreeze seems to need these
+ import google # bbfreeze seems to need these
import pkg_resources # pyinstaller / protobuf 2.5 seem to need these
import proto.nanopb_pb2 as nanopb_pb2 # pyinstaller seems to need this
import pkg_resources.py2_warn
@@ -150,13 +150,19 @@ class Globals:
matched_namemasks = set()
protoc_insertion_points = False
-# String types (for python 2 / python 3 compatibility)
-try:
+# String types and file encoding for Python2 UTF-8 support
+if sys.version_info.major == 2:
+ import codecs
+ open = codecs.open
strtypes = (unicode, str)
- openmode_unicode = 'rU'
-except NameError:
+
+ def str(x):
+ try:
+ return strtypes[1](x)
+ except UnicodeEncodeError:
+ return strtypes[0](x)
+else:
strtypes = (str, )
- openmode_unicode = 'r'
class Names:
@@ -272,56 +278,42 @@ def upperlimit(self):
else:
return 2**32 - 1
-
-'''
-Constants regarding path of proto elements in file descriptor.
-They are used to connect proto elements with source code information (comments)
-These values come from:
- https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto
-'''
-MESSAGE_PATH = 4
-ENUM_PATH = 5
-FIELD_PATH = 2
-
-
class ProtoElement(object):
- def __init__(self, path, index, comments):
+ # Constants regarding path of proto elements in file descriptor.
+ # They are used to connect proto elements with source code information (comments)
+ # These values come from:
+ # https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto
+ FIELD = 2
+ MESSAGE = 4
+ ENUM = 5
+
+ def __init__(self, element_type, index, comments = None, parent = ()):
'''
- path is a predefined value for each element type in proto file.
+ element_type is a predefined value for each element type in proto file.
For example, message == 4, enum == 5, service == 6
- index is the N-th occurance of the `path` in the proto file.
+ index is the N-th occurrence of the `path` in the proto file.
For example, 4-th message in the proto file or 2-nd enum etc ...
comments is a dictionary mapping between element path & SourceCodeInfo.Location
(contains information about source comments).
'''
- self.path = path
- self.index = index
- self.comments = comments
-
- def element_path(self):
- '''Get path to proto element.'''
- return [self.path, self.index]
-
- def member_path(self, member_index):
- '''Get path to member of proto element.
- Example paths:
- [4, m] - message comments, m: msgIdx in proto from 0
- [4, m, 2, f] - field comments in message, f: fieldIdx in message from 0
- [6, s] - service comments, s: svcIdx in proto from 0
- [6, s, 2, r] - rpc comments in service, r: rpc method def in service from 0
- '''
- return self.element_path() + [FIELD_PATH, member_index]
+ self.element_path = parent + (element_type, index)
+ self.comments = comments or {}
+
+ def get_member_comments(self, index):
+ '''Get comments for a member of enum or message.'''
+ return self.get_comments((ProtoElement.FIELD, index), leading_indent = True)
- def get_comments(self, path, leading_indent=True):
- '''Get leading & trailing comments for enum member based on path.
+ def get_comments(self, member_path = (), leading_indent = False):
+ '''Get leading & trailing comments for a protobuf element.
- path is the proto path of an element or member (ex. [5 0] or [4 1 2 0])
+ member_path is the proto path of an element or member (ex. [5 0] or [4 1 2 0])
leading_indent is a flag that indicates if leading comments should be indented
'''
# Obtain SourceCodeInfo.Location object containing comment
# information (based on the member path)
- comment = self.comments.get(str(path))
+ path = self.element_path + member_path
+ comment = self.comments.get(path)
leading_comment = ""
trailing_comment = ""
@@ -347,7 +339,7 @@ def __init__(self, names, desc, enum_options, index, comments):
comments is a dictionary mapping between element path & SourceCodeInfo.Location
(contains information about source comments)
'''
- super(Enum, self).__init__(ENUM_PATH, index, comments)
+ super(Enum, self).__init__(ProtoElement.ENUM, index, comments)
self.options = enum_options
self.names = names
@@ -373,8 +365,7 @@ def encoded_size(self):
return max([varint_max_size(v) for n,v in self.values])
def __str__(self):
- enum_path = self.element_path()
- leading_comment, trailing_comment = self.get_comments(enum_path, leading_indent=False)
+ leading_comment, trailing_comment = self.get_comments()
result = ''
if leading_comment:
@@ -385,8 +376,7 @@ def __str__(self):
enum_length = len(self.values)
enum_values = []
for index, (name, value) in enumerate(self.values):
- member_path = self.member_path(index)
- leading_comment, trailing_comment = self.get_comments(member_path)
+ leading_comment, trailing_comment = self.get_member_comments(index)
if leading_comment:
enum_values.append(leading_comment)
@@ -461,12 +451,13 @@ def extend(self, extend, field_name = None):
self.checks.extend(extend.checks)
-class Field:
+class Field(ProtoElement):
macro_x_param = 'X'
macro_a_param = 'a'
- def __init__(self, struct_name, desc, field_options):
+ def __init__(self, struct_name, desc, field_options, parent_path = (), index = None, comments = None):
'''desc is FieldDescriptorProto'''
+ ProtoElement.__init__(self, ProtoElement.FIELD, index, comments, parent_path)
self.tag = desc.number
self.struct_name = struct_name
self.union_name = None
@@ -479,10 +470,11 @@ def __init__(self, struct_name, desc, field_options):
self.data_item_size = None
self.ctype = None
self.fixed_count = False
+ self.index = index
self.callback_datatype = field_options.callback_datatype
self.math_include_required = False
self.sort_by_tag = field_options.sort_by_tag
-
+
if field_options.type == nanopb_pb2.FT_INLINE:
# Before nanopb-0.3.8, fixed length bytes arrays were specified
# by setting type to FT_INLINE. But to handle pointer typed fields,
@@ -548,7 +540,7 @@ def __init__(self, struct_name, desc, field_options):
if can_be_static:
field_options.type = nanopb_pb2.FT_STATIC
else:
- field_options.type = nanopb_pb2.FT_CALLBACK
+ field_options.type = field_options.fallback_type
if field_options.type == nanopb_pb2.FT_STATIC and not can_be_static:
raise Exception("Field '%s' is defined as static, but max_size or "
@@ -656,6 +648,11 @@ def __str__(self):
elif self.rules == 'REPEATED':
result += ' pb_size_t ' + self.name + '_count;\n'
result += ' %s %s%s;' % (self.ctype, self.name, self.array_decl)
+
+ leading_comment, trailing_comment = self.get_comments(leading_indent = True)
+ if leading_comment: result = leading_comment + "\n" + result
+ if trailing_comment: result = result + " " + trailing_comment
+
return result
def types(self):
@@ -1023,6 +1020,7 @@ def __init__(self, struct_name, oneof_desc, oneof_options):
self.allocation = 'ONEOF'
self.default = None
self.rules = 'ONEOF'
+ self.index = None
self.anonymous = oneof_options.anonymous_oneof
self.sort_by_tag = oneof_options.sort_by_tag
self.has_msg_cb = False
@@ -1126,7 +1124,7 @@ def requires_custom_field_callback(self):
class Message(ProtoElement):
def __init__(self, names, desc, message_options, index, comments):
- super(Message, self).__init__(MESSAGE_PATH, index, comments)
+ super(Message, self).__init__(ProtoElement.MESSAGE, index, comments)
self.name = names
self.fields = []
self.oneofs = {}
@@ -1168,7 +1166,7 @@ def load_fields(self, desc, message_options):
else:
sys.stderr.write('Note: This Python protobuf library has no OneOf support\n')
- for f in desc.field:
+ for index, f in enumerate(desc.field):
field_options = get_nanopb_suboptions(f, message_options, self.name + f.name)
if field_options.type == nanopb_pb2.FT_IGNORE:
continue
@@ -1176,7 +1174,7 @@ def load_fields(self, desc, message_options):
if field_options.descriptorsize > self.descriptorsize:
self.descriptorsize = field_options.descriptorsize
- field = Field(self.name, f, field_options)
+ field = Field(self.name, f, field_options, self.element_path, index, self.comments)
if hasattr(f, 'oneof_index') and f.HasField('oneof_index'):
if hasattr(f, 'proto3_optional') and f.proto3_optional:
no_unions.append(f.oneof_index)
@@ -1211,8 +1209,7 @@ def get_dependencies(self):
return deps
def __str__(self):
- message_path = self.element_path()
- leading_comment, trailing_comment = self.get_comments(message_path, leading_indent=False)
+ leading_comment, trailing_comment = self.get_comments()
result = ''
if leading_comment:
@@ -1225,17 +1222,7 @@ def __str__(self):
# Therefore add a dummy field if an empty message occurs.
result += ' char dummy_field;'
- msg_fields = []
- for index, field in enumerate(self.fields):
- member_path = self.member_path(index)
- leading_comment, trailing_comment = self.get_comments(member_path)
-
- if leading_comment:
- msg_fields.append(leading_comment)
-
- msg_fields.append("%s %s" % (str(field), trailing_comment))
-
- result += '\n'.join(msg_fields)
+ result += '\n'.join([str(f) for f in self.fields])
if Globals.protoc_insertion_points:
result += '\n/* @@protoc_insertion_point(struct:%s) */' % self.name
@@ -1441,6 +1428,9 @@ def default_value(self, dependencies):
raise Exception("Could not find enum type %s while generating default values for %s.\n" % (enumname, self.name)
+ "Try passing all source files to generator at once, or use -I option.")
+ if not isinstance(enumtype, Enum):
+ raise Exception("Expected enum type as %s, got %s" % (enumname, repr(enumtype)))
+
if field.HasField('default_value'):
defvals = [v for n,v in enumtype.values if n.parts[-1] == field.default_value]
else:
@@ -1462,6 +1452,8 @@ def default_value(self, dependencies):
optional_only.ClearField(str('nested_type'))
optional_only.ClearField(str('extension'))
optional_only.ClearField(str('enum_type'))
+ optional_only.name += str(id(self))
+
desc = google.protobuf.descriptor.MakeDescriptor(optional_only)
msg = reflection.MakeClass(desc)()
@@ -1553,6 +1545,81 @@ def make_identifier(headername):
result += '_'
return result
+class MangleNames:
+ '''Handles conversion of type names according to mangle_names option:
+ M_NONE = 0; // Default, no typename mangling
+ M_STRIP_PACKAGE = 1; // Strip current package name
+ M_FLATTEN = 2; // Only use last path component
+ M_PACKAGE_INITIALS = 3; // Replace the package name by the initials
+ '''
+ def __init__(self, fdesc, file_options):
+ self.file_options = file_options
+ self.mangle_names = file_options.mangle_names
+ self.flatten = (self.mangle_names == nanopb_pb2.M_FLATTEN)
+ self.strip_prefix = None
+ self.replacement_prefix = None
+ self.name_mapping = {}
+ self.reverse_name_mapping = {}
+
+ if self.mangle_names == nanopb_pb2.M_STRIP_PACKAGE:
+ self.strip_prefix = "." + fdesc.package
+ elif self.mangle_names == nanopb_pb2.M_PACKAGE_INITIALS:
+ self.strip_prefix = "." + fdesc.package
+ self.replacement_prefix = ""
+ for part in fdesc.package.split("."):
+ self.replacement_prefix += part[0]
+ elif file_options.package:
+ self.strip_prefix = "." + fdesc.package
+ self.replacement_prefix = file_options.package
+
+ if self.replacement_prefix is not None:
+ self.base_name = Names(self.replacement_prefix.split('.'))
+ elif fdesc.package:
+ self.base_name = Names(fdesc.package.split('.'))
+ else:
+ self.base_name = Names()
+
+ def create_name(self, names):
+ '''Create name for a new message / enum.
+ Argument can be either string or Names instance.
+ '''
+ if str(names) not in self.name_mapping:
+ if self.mangle_names in (nanopb_pb2.M_NONE, nanopb_pb2.M_PACKAGE_INITIALS):
+ new_name = self.base_name + names
+ elif self.mangle_names == nanopb_pb2.M_STRIP_PACKAGE:
+ new_name = Names(names)
+ elif isinstance(names, Names):
+ new_name = Names(names.parts[-1])
+ else:
+ new_name = Names(names)
+
+ if str(new_name) in self.reverse_name_mapping:
+ sys.stderr.write("Warning: Duplicate name with mangle_names=%s: %s and %s map to %s\n" %
+ (self.mangle_names, self.reverse_name_mapping[str(new_name)], names, new_name))
+
+ self.name_mapping[str(names)] = new_name
+ self.reverse_name_mapping[str(new_name)] = names
+
+ return self.name_mapping[str(names)]
+
+ def mangle_field_typename(self, typename):
+ '''Mangle type name for a submessage / enum crossreference.
+ Argument is a string.
+ '''
+ if self.mangle_names == nanopb_pb2.M_FLATTEN:
+ return "." + typename.split(".")[-1]
+
+ if self.strip_prefix is not None and typename.startswith(self.strip_prefix):
+ if self.replacement_prefix is not None:
+ return "." + self.replacement_prefix + typename[len(self.strip_prefix):]
+ else:
+ return typename[len(self.strip_prefix):]
+
+ if self.file_options.package:
+ return "." + self.replacement_prefix + typename
+
+ return typename
+
class ProtoFile:
def __init__(self, fdesc, file_options):
'''Takes a FileDescriptorProto and parses it.'''
@@ -1574,67 +1641,23 @@ def parse(self):
self.enums = []
self.messages = []
self.extensions = []
-
- mangle_names = self.file_options.mangle_names
- flatten = mangle_names == nanopb_pb2.M_FLATTEN
- strip_prefix = None
- replacement_prefix = None
- if mangle_names == nanopb_pb2.M_STRIP_PACKAGE:
- strip_prefix = "." + self.fdesc.package
- elif mangle_names == nanopb_pb2.M_PACKAGE_INITIALS:
- strip_prefix = "." + self.fdesc.package
- replacement_prefix = ""
- for part in self.fdesc.package.split("."):
- replacement_prefix += part[0]
- elif self.file_options.package:
- strip_prefix = "." + self.fdesc.package
- replacement_prefix = self.file_options.package
-
-
- def create_name(names):
- if mangle_names in (nanopb_pb2.M_NONE, nanopb_pb2.M_PACKAGE_INITIALS):
- return base_name + names
- if mangle_names == nanopb_pb2.M_STRIP_PACKAGE:
- return Names(names)
- single_name = names
- if isinstance(names, Names):
- single_name = names.parts[-1]
- return Names(single_name)
-
- def mangle_field_typename(typename):
- if mangle_names == nanopb_pb2.M_FLATTEN:
- return "." + typename.split(".")[-1]
- if strip_prefix is not None and typename.startswith(strip_prefix):
- if replacement_prefix is not None:
- return "." + replacement_prefix + typename[len(strip_prefix):]
- else:
- return typename[len(strip_prefix):]
- if self.file_options.package:
- return "." + replacement_prefix + typename
- return typename
-
- if replacement_prefix is not None:
- base_name = Names(replacement_prefix.split('.'))
- elif self.fdesc.package:
- base_name = Names(self.fdesc.package.split('.'))
- else:
- base_name = Names()
+ self.manglenames = MangleNames(self.fdesc, self.file_options)
# process source code comment locations
# ignores any locations that do not contain any comment information
self.comment_locations = {
- str(list(location.path)): location
+ tuple(location.path): location
for location in self.fdesc.source_code_info.location
if location.leading_comments or location.leading_detached_comments or location.trailing_comments
}
for index, enum in enumerate(self.fdesc.enum_type):
- name = create_name(enum.name)
+ name = self.manglenames.create_name(enum.name)
enum_options = get_nanopb_suboptions(enum, self.file_options, name)
self.enums.append(Enum(name, enum, enum_options, index, self.comment_locations))
- for index, (names, message) in enumerate(iterate_messages(self.fdesc, flatten)):
- name = create_name(names)
+ for index, (names, message) in enumerate(iterate_messages(self.fdesc, self.manglenames.flatten)):
+ name = self.manglenames.create_name(names)
message_options = get_nanopb_suboptions(message, self.file_options, name)
if message_options.skip_message:
@@ -1643,21 +1666,21 @@ def mangle_field_typename(typename):
message = copy.deepcopy(message)
for field in message.field:
if field.type in (FieldD.TYPE_MESSAGE, FieldD.TYPE_ENUM):
- field.type_name = mangle_field_typename(field.type_name)
+ field.type_name = self.manglenames.mangle_field_typename(field.type_name)
self.messages.append(Message(name, message, message_options, index, self.comment_locations))
for index, enum in enumerate(message.enum_type):
- name = create_name(names + enum.name)
+ name = self.manglenames.create_name(names + enum.name)
enum_options = get_nanopb_suboptions(enum, message_options, name)
self.enums.append(Enum(name, enum, enum_options, index, self.comment_locations))
- for names, extension in iterate_extensions(self.fdesc, flatten):
- name = create_name(names + extension.name)
+ for names, extension in iterate_extensions(self.fdesc, self.manglenames.flatten):
+ name = self.manglenames.create_name(names + extension.name)
field_options = get_nanopb_suboptions(extension, self.file_options, name)
extension = copy.deepcopy(extension)
if extension.type in (FieldD.TYPE_MESSAGE, FieldD.TYPE_ENUM):
- extension.type_name = mangle_field_typename(extension.type_name)
+ extension.type_name = self.manglenames.mangle_field_typename(extension.type_name)
if field_options.type != nanopb_pb2.FT_IGNORE:
self.extensions.append(ExtensionField(name, extension, field_options))
@@ -1804,14 +1827,29 @@ def generate_header(self, includes, headername, options):
# If we require a symbol from another file, put a preprocessor if statement
# around it to prevent compilation errors if the symbol is not actually available.
local_defines = [identifier for identifier, msize in messagesizes if msize is not None]
+
+ # emit size_unions, if any
+ oneof_sizes = []
+ for msg in self.messages:
+ for f in msg.fields:
+ if isinstance(f, OneOf):
+ msize = f.encoded_size(self.dependencies)
+ if msize is not None:
+ oneof_sizes.append(msize)
+ for msize in oneof_sizes:
+ guard = msize.get_cpp_guard(local_defines)
+ if guard:
+ yield guard
+ yield msize.get_declarations()
+ if guard:
+ yield '#endif\n'
+
guards = {}
for identifier, msize in messagesizes:
if msize is not None:
cpp_guard = msize.get_cpp_guard(local_defines)
if cpp_guard not in guards:
guards[cpp_guard] = set()
- for decl in msize.get_declarations().splitlines():
- guards[cpp_guard].add(decl)
guards[cpp_guard].add('#define %-40s %s' % (identifier, msize))
else:
yield '/* %s depends on runtime parameters */\n' % identifier
@@ -1966,7 +2004,7 @@ def read_options_file(infile):
text_format.Merge(parts[1], opts)
except Exception as e:
sys.stderr.write("%s:%d: " % (infile.name, i + 1) +
- "Unparseable option line: '%s'. " % line +
+ "Unparsable option line: '%s'. " % line +
"Error: %s\n" % str(e))
sys.exit(1)
results.append((parts[0], opts))
@@ -2035,9 +2073,9 @@ def get_nanopb_suboptions(subdesc, options, name):
help="Set extension to use for generated source files. [default: %default]")
optparser.add_option("-f", "--options-file", dest="options_file", metavar="FILE", default="%s.options",
help="Set name of a separate generator options file.")
-optparser.add_option("-I", "--options-path", dest="options_path", metavar="DIR",
+optparser.add_option("-I", "--options-path", "--proto-path", dest="options_path", metavar="DIR",
action="append", default = [],
- help="Search for .options files additionally in this path")
+ help="Search path for .options and .proto files. Also determines relative paths for output directory structure.")
optparser.add_option("--error-on-unmatched", dest="error_on_unmatched", action="store_true", default=False,
help ="Stop generation if there are unmatched fields in options file")
optparser.add_option("--no-error-on-unmatched", dest="error_on_unmatched", action="store_false", default=False,
@@ -2095,7 +2133,7 @@ def parse_file(filename, fdesc, options):
optfilename = os.path.join(p, optfilename)
if options.verbose:
sys.stderr.write('Reading options from ' + optfilename + '\n')
- Globals.separate_options = read_options_file(open(optfilename, openmode_unicode))
+ Globals.separate_options = read_options_file(open(optfilename, 'r', encoding = 'utf-8'))
break
else:
# If we are given a full filename and it does not exist, give an error.
@@ -2201,8 +2239,9 @@ def main_cli():
% (google.protobuf.__file__, google.protobuf.__version__))
# Load .pb files into memory and compile any .proto files.
- fdescs = {}
include_path = ['-I%s' % p for p in options.options_path]
+ all_fdescs = {}
+ out_fdescs = {}
for filename in filenames:
if filename.endswith(".proto"):
with TemporaryDirectory() as tmpdir:
@@ -2213,18 +2252,23 @@ def main_cli():
else:
data = open(filename, 'rb').read()
- fdesc = descriptor.FileDescriptorSet.FromString(data).file[-1]
- fdescs[fdesc.name] = fdesc
+ fdescs = descriptor.FileDescriptorSet.FromString(data).file
+ last_fdesc = fdescs[-1]
+
+ for fdesc in fdescs:
+ all_fdescs[fdesc.name] = fdesc
+
+ out_fdescs[last_fdesc.name] = last_fdesc
# Process any include files first, in order to have them
# available as dependencies
other_files = {}
- for fdesc in fdescs.values():
+ for fdesc in all_fdescs.values():
other_files[fdesc.name] = parse_file(fdesc.name, fdesc, options)
# Then generate the headers / sources
Globals.verbose_options = options.verbose
- for fdesc in fdescs.values():
+ for fdesc in out_fdescs.values():
results = process_file(fdesc.name, fdesc, options, other_files)
base_dir = options.output_dir or ''
diff --git a/vendor/nanopb/generator/platformio_generator.py b/vendor/nanopb/generator/platformio_generator.py
new file mode 100644
index 00000000..9fbbbbf4
--- /dev/null
+++ b/vendor/nanopb/generator/platformio_generator.py
@@ -0,0 +1,154 @@
+import os
+import hashlib
+import pathlib
+from platformio import fs
+
+Import("env")
+
+try:
+ import protobuf
+except ImportError:
+ env.Execute(
+ env.VerboseAction(
+ # We need to speicify protobuf version. In other case got next (on Ubuntu 20.04):
+ # Requirement already satisfied: protobuf in /usr/lib/python3/dist-packages (3.6.1)
+ '$PYTHONEXE -m pip install "protobuf>=3.19.1"',
+ "Installing Protocol Buffers dependencies",
+ )
+ )
+
+try:
+ import grpc_tools.protoc
+except ImportError:
+ env.Execute(
+ env.VerboseAction(
+ '$PYTHONEXE -m pip install "grpcio-tools>=1.43.0"',
+ "Installing GRPC dependencies",
+ )
+ )
+
+nanopb_root = os.path.join(os.getcwd(), '..')
+
+project_dir = env.subst("$PROJECT_DIR")
+build_dir = env.subst("$BUILD_DIR")
+
+generated_src_dir = os.path.join(build_dir, 'nanopb', 'generated-src')
+generated_build_dir = os.path.join(build_dir, 'nanopb', 'generated-build')
+md5_dir = os.path.join(build_dir, 'nanopb', 'md5')
+
+nanopb_protos = env.GetProjectOption("custom_nanopb_protos", "")
+nanopb_plugin_options = env.GetProjectOption("custom_nanopb_options", "")
+
+if not nanopb_protos:
+ print("[nanopb] No generation needed.")
+else:
+ if isinstance(nanopb_plugin_options, (list, tuple)):
+ nanopb_plugin_options = " ".join(nanopb_plugin_options)
+
+ nanopb_plugin_options = nanopb_plugin_options.split()
+
+ protos_files = fs.match_src_files(project_dir, nanopb_protos)
+ if not len(protos_files):
+ print("[nanopb] ERROR: No files matched pattern:")
+ print(f"custom_nanopb_protos: {nanopb_protos}")
+ exit(1)
+
+ protoc_generator = os.path.join(nanopb_root, 'generator', 'protoc')
+
+ nanopb_options = ""
+ nanopb_options += f" --nanopb_out={generated_src_dir}"
+ for opt in nanopb_plugin_options:
+ nanopb_options += (" --nanopb_opt=" + opt)
+
+ try:
+ os.makedirs(generated_src_dir)
+ except FileExistsError:
+ pass
+
+ try:
+ os.makedirs(md5_dir)
+ except FileExistsError:
+ pass
+
+ # Collect include dirs based on
+ proto_include_dirs = set()
+ for proto_file in protos_files:
+ proto_file_abs = os.path.join(project_dir, proto_file)
+ proto_dir = os.path.dirname(proto_file_abs)
+ proto_include_dirs.add(proto_dir)
+
+ for proto_include_dir in proto_include_dirs:
+ nanopb_options += (" --proto_path=" + proto_include_dir)
+ nanopb_options += (" --nanopb_opt=-I" + proto_include_dir)
+
+ for proto_file in protos_files:
+ proto_file_abs = os.path.join(project_dir, proto_file)
+
+ proto_file_path_abs = os.path.dirname(proto_file_abs)
+ proto_file_basename = os.path.basename(proto_file_abs)
+ proto_file_without_ext = os.path.splitext(proto_file_basename)[0]
+
+ proto_file_md5_abs = os.path.join(md5_dir, proto_file_basename + '.md5')
+ proto_file_current_md5 = hashlib.md5(pathlib.Path(proto_file_abs).read_bytes()).hexdigest()
+
+ options_file = proto_file_without_ext + ".options"
+ options_file_abs = os.path.join(proto_file_path_abs, options_file)
+ options_file_md5_abs = None
+ options_file_current_md5 = None
+ if pathlib.Path(options_file_abs).exists():
+ options_file_md5_abs = os.path.join(md5_dir, options_file + '.md5')
+ options_file_current_md5 = hashlib.md5(pathlib.Path(options_file_abs).read_bytes()).hexdigest()
+ else:
+ options_file = None
+
+ header_file = proto_file_without_ext + ".pb.h"
+ source_file = proto_file_without_ext + ".pb.c"
+
+ header_file_abs = os.path.join(generated_src_dir, source_file)
+ source_file_abs = os.path.join(generated_src_dir, header_file)
+
+ need_generate = False
+
+ # Check proto file md5
+ try:
+ last_md5 = pathlib.Path(proto_file_md5_abs).read_text()
+ if last_md5 != proto_file_current_md5:
+ need_generate = True
+ except FileNotFoundError:
+ need_generate = True
+
+ if options_file:
+ # Check options file md5
+ try:
+ last_md5 = pathlib.Path(options_file_md5_abs).read_text()
+ if last_md5 != options_file_current_md5:
+ need_generate = True
+ except FileNotFoundError:
+ need_generate = True
+
+ options_info = f"{options_file}" if options_file else "no options"
+
+ if not need_generate:
+ print(f"[nanopb] Skipping '{proto_file}' ({options_info})")
+ else:
+ print(f"[nanopb] Processing '{proto_file}' ({options_info})")
+ cmd = protoc_generator + " " + nanopb_options + " " + proto_file_basename
+ result = env.Execute(cmd)
+ if result != 0:
+ print(f"[nanopb] ERROR: ({result}) processing cmd: '{cmd}'")
+ exit(1)
+ pathlib.Path(proto_file_md5_abs).write_text(proto_file_current_md5)
+ if options_file:
+ pathlib.Path(options_file_md5_abs).write_text(options_file_current_md5)
+
+ #
+ # Add generated includes and sources to build environment
+ #
+ env.Append(CPPPATH=[generated_src_dir])
+
+ # Fix for ESP32 ESP-IDF https://github.com/nanopb/nanopb/issues/734#issuecomment-1001544447
+ global_env = DefaultEnvironment()
+ already_called_env_name = "_PROTOBUF_GENERATOR_ALREADY_CALLED_" + env['PIOENV'].replace("-", "_")
+ if not global_env.get(already_called_env_name, False):
+ env.BuildSources(generated_build_dir, generated_src_dir)
+ global_env[already_called_env_name] = True
diff --git a/vendor/nanopb/generator/proto/Makefile b/vendor/nanopb/generator/proto/Makefile
index c17fb9c7..a93d88ff 100644
--- a/vendor/nanopb/generator/proto/Makefile
+++ b/vendor/nanopb/generator/proto/Makefile
@@ -1,6 +1,10 @@
-PROTOC?=protoc
+PROTOC?=../protoc
all: nanopb_pb2.py
%_pb2.py: %.proto
$(PROTOC) --python_out=. $<
+
+.PHONY: clean
+clean:
+ rm nanopb_pb2.py
diff --git a/vendor/nanopb/generator/proto/__init__.py b/vendor/nanopb/generator/proto/__init__.py
index 29153d40..e2e8000e 100644
--- a/vendor/nanopb/generator/proto/__init__.py
+++ b/vendor/nanopb/generator/proto/__init__.py
@@ -6,31 +6,45 @@
import pkg_resources
-from ._utils import has_grpcio_protoc, invoke_protoc
+from ._utils import has_grpcio_protoc, invoke_protoc, print_versions
dirname = os.path.dirname(__file__)
protosrc = os.path.join(dirname, "nanopb.proto")
protodst = os.path.join(dirname, "nanopb_pb2.py")
+rebuild = False
if os.path.isfile(protosrc):
src_date = os.path.getmtime(protosrc)
if not os.path.isfile(protodst) or os.path.getmtime(protodst) < src_date:
+ rebuild = True
+
+if not rebuild:
+ try:
+ from . import nanopb_pb2
+ except AttributeError as e:
+ rebuild = True
+ sys.stderr.write("Failed to import nanopb_pb2.py: " + str(e) + "\n"
+ "Will automatically attempt to rebuild this.\n"
+ "Verify that python-protobuf and protoc versions match.\n")
+ print_versions()
+
+if rebuild:
+ cmd = [
+ "protoc",
+ "--python_out={}".format(dirname),
+ protosrc,
+ "-I={}".format(dirname),
+ ]
+
+ if has_grpcio_protoc():
+ # grpcio-tools has an extra CLI argument
+ # from grpc.tools.protoc __main__ invocation.
+ _builtin_proto_include = pkg_resources.resource_filename('grpc_tools', '_proto')
+
+ cmd.append("-I={}".format(_builtin_proto_include))
+ try:
+ invoke_protoc(argv=cmd)
+ except:
+ sys.stderr.write("Failed to build nanopb_pb2.py: " + ' '.join(cmd) + "\n")
+ raise
- cmd = [
- "protoc",
- "--python_out={}".format(dirname),
- protosrc,
- "-I={}".format(dirname),
- ]
-
- if has_grpcio_protoc():
- # grpcio-tools has an extra CLI argument
- # from grpc.tools.protoc __main__ invocation.
- _builtin_proto_include = pkg_resources.resource_filename('grpc_tools', '_proto')
-
- cmd.append("-I={}".format(_builtin_proto_include))
- try:
- invoke_protoc(argv=cmd)
- except:
- sys.stderr.write("Failed to build nanopb_pb2.py: " + ' '.join(cmd) + "\n")
- raise
diff --git a/vendor/nanopb/generator/proto/_utils.py b/vendor/nanopb/generator/proto/_utils.py
index 7076e9d3..bd495374 100644
--- a/vendor/nanopb/generator/proto/_utils.py
+++ b/vendor/nanopb/generator/proto/_utils.py
@@ -1,3 +1,4 @@
+import sys
import subprocess
import os.path
@@ -41,3 +42,25 @@ def invoke_protoc(argv):
return protoc.main(argv)
else:
return subprocess.call(argv)
+
+def print_versions():
+ try:
+ if has_grpcio_protoc():
+ import grpc_tools.protoc
+ sys.stderr.write("Using grpcio-tools protoc from " + grpc_tools.protoc.__file__ + "\n")
+ else:
+ sys.stderr.write("Using protoc from system path\n")
+
+ invoke_protoc(['protoc', '--version'])
+ except Exception as e:
+ sys.stderr.write("Failed to determine protoc version: " + str(e) + "\n")
+
+ try:
+ import google.protobuf
+ sys.stderr.write("Using python-protobuf from " + google.protobuf.__file__ + "\n")
+ sys.stderr.write("Python-protobuf version: " + google.protobuf.__version__ + "\n")
+ except Exception as e:
+ sys.stderr.write("Failed to determine python-protobuf version: " + str(e) + "\n")
+
+if __name__ == '__main__':
+ print_versions()
diff --git a/vendor/nanopb/generator/proto/nanopb.proto b/vendor/nanopb/generator/proto/nanopb.proto
index c8067e3a..5e36eaa8 100644
--- a/vendor/nanopb/generator/proto/nanopb.proto
+++ b/vendor/nanopb/generator/proto/nanopb.proto
@@ -133,7 +133,7 @@ message NanoPBOptions {
// Extra files to include in generated `.pb.h`
repeated string include = 24;
- // Automatic includes to exlude from generated `.pb.h`
+ // Automatic includes to exclude from generated `.pb.h`
// Same as nanopb_generator.py command line flag -x.
repeated string exclude = 26;
@@ -147,6 +147,12 @@ message NanoPBOptions {
// instead of the order in .proto. Set this to false to keep the .proto order.
// The default value will probably change to false in nanopb-0.5.0.
optional bool sort_by_tag = 28 [default = true];
+
+ // Set the FT_DEFAULT field conversion strategy.
+ // A field that can become a static member of a c struct (e.g. int, bool, etc)
+ // will be a a static field.
+ // Fields with dynamic length are converted to either a pointer or a callback.
+ optional FieldType fallback_type = 29 [default = FT_CALLBACK];
}
// Extensions to protoc 'Descriptor' type in order to define options
diff --git a/vendor/nanopb/generator/protoc b/vendor/nanopb/generator/protoc
index 4b1512d0..0d952a31 100755
--- a/vendor/nanopb/generator/protoc
+++ b/vendor/nanopb/generator/protoc
@@ -1,4 +1,7 @@
#!/usr/bin/env python3
+# This file acts as a drop-in replacement of binary protoc.exe.
+# It will use either Python-based protoc from grpcio-tools package,
+# or if it is not available, protoc.exe from path if found.
import sys
import os
@@ -6,12 +9,20 @@ import os.path
from nanopb_generator import invoke_protoc
if __name__ == '__main__':
- # Add argument so that protoc-gen-nanopb gets found
+ # Get path of the directory where this script is stored.
if getattr(sys, 'frozen', False):
mypath = os.path.dirname(sys.executable) # For pyInstaller
else:
mypath = os.path.dirname(__file__)
+ # Avoid recursive calls to self
+ env_paths = os.environ["PATH"].split(os.pathsep)
+ if mypath in env_paths:
+ env_paths.remove(mypath)
+ os.environ["PATH"] = os.pathsep.join(env_paths)
+
+ # Add argument for finding the nanopb generator when using --nanopb_out=
+ # argument to protoc.
if os.path.isfile(os.path.join(mypath, "protoc-gen-nanopb.exe")):
protoc_gen_nanopb = os.path.join(mypath, "protoc-gen-nanopb.exe")
elif os.name == 'nt':
diff --git a/vendor/nanopb/generator/protoc-gen-nanopb.bat b/vendor/nanopb/generator/protoc-gen-nanopb.bat
index 48a4aa92..fa5bdd2b 100644
--- a/vendor/nanopb/generator/protoc-gen-nanopb.bat
+++ b/vendor/nanopb/generator/protoc-gen-nanopb.bat
@@ -9,4 +9,4 @@
:: --plugin= on the command line.
set mydir=%~dp0
-py -3 "%mydir%\nanopb_generator.py" --protoc-plugin
+python "%mydir%\nanopb_generator.py" --protoc-plugin %*
diff --git a/vendor/nanopb/generator/protoc.bat b/vendor/nanopb/generator/protoc.bat
index cfd9e437..2538c94a 100644
--- a/vendor/nanopb/generator/protoc.bat
+++ b/vendor/nanopb/generator/protoc.bat
@@ -5,5 +5,5 @@
setLocal enableDelayedExpansion
set mydir=%~dp0
-py -3 "%mydir%\protoc" %*
+python "%mydir%\protoc" %*
exit /b %ERRORLEVEL%
diff --git a/vendor/nanopb/library.json b/vendor/nanopb/library.json
index 93364587..abcb4f96 100644
--- a/vendor/nanopb/library.json
+++ b/vendor/nanopb/library.json
@@ -1,6 +1,6 @@
{
"name": "Nanopb",
- "version": "0.4.5",
+ "version": "0.4.6.4",
"keywords": "protocol buffers, protobuf, google",
"description": "Nanopb is a plain-C implementation of Google's Protocol Buffers data format. It is targeted at 32 bit microcontrollers, but is also fit for other embedded systems with tight (<10 kB ROM, <1 kB RAM) memory constraints.",
"repository": {
@@ -17,10 +17,26 @@
"*.c",
"*.cpp",
"*.h",
- "examples"
+ "examples",
+ "generator"
+ ],
+ "exclude": [
+ "generator/**/__pycache__",
+ "examples/platformio/.gitignore"
]
},
- "examples": "examples/*/*.c",
+ "build": {
+ "extraScript": "generator/platformio_generator.py",
+ "srcDir": "",
+ "srcFilter": [
+ "+<*.c>"
+ ]
+ },
+ "examples": [
+ "examples/platformio/platformio.ini",
+ "examples/platformio/src/*.c",
+ "examples/*/*.c"
+ ],
"frameworks": "*",
"platforms": "*"
}
diff --git a/vendor/nanopb/pb.h b/vendor/nanopb/pb.h
index fbb9f1d1..765f04b9 100644
--- a/vendor/nanopb/pb.h
+++ b/vendor/nanopb/pb.h
@@ -14,7 +14,8 @@
/* #define PB_ENABLE_MALLOC 1 */
/* Define this if your CPU / compiler combination does not support
- * unaligned memory access to packed structures. */
+ * unaligned memory access to packed structures. Note that packed
+ * structures are only used when requested in .proto options. */
/* #define PB_NO_PACKED_STRUCTS 1 */
/* Increase the number of required fields that are tracked.
@@ -47,6 +48,15 @@
* the string processing slightly and slightly increases code size. */
/* #define PB_VALIDATE_UTF8 1 */
+/* This can be defined if the platform is little-endian and has 8-bit bytes.
+ * Normally it is automatically detected based on __BYTE_ORDER__ macro. */
+/* #define PB_LITTLE_ENDIAN_8BIT 1 */
+
+/* Configure static assert mechanism. Instead of changing these, set your
+ * compiler to C11 standard mode if possible. */
+#define PB_C99_STATIC_ASSERT 1
+#define PB_NO_STATIC_ASSERT 1
+
/******************************************************************
* You usually don't need to change anything below this line. *
* Feel free to look around and use the defined macros, though. *
@@ -55,7 +65,7 @@
/* Version of the nanopb library. Just in case you want to check it in
* your own program. */
-#define NANOPB_VERSION nanopb-0.4.5
+#define NANOPB_VERSION "nanopb-0.4.6"
/* Include all the system headers needed by nanopb. You will need the
* definitions of the following:
@@ -76,7 +86,6 @@
#include
#include
#include
-#include "os.h"
#ifdef PB_ENABLE_MALLOC
#include
@@ -117,6 +126,18 @@ extern "C" {
# define pb_packed
#endif
+/* Detect endianness */
+#ifndef PB_LITTLE_ENDIAN_8BIT
+#if ((defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || \
+ (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
+ defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || \
+ defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || \
+ defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM)) \
+ && CHAR_BIT == 8
+#define PB_LITTLE_ENDIAN_8BIT 1
+#endif
+#endif
+
/* Handly macro for suppressing unreferenced-parameter compiler warnings. */
#ifndef PB_UNUSED
#define PB_UNUSED(x) (void)(x)
@@ -146,14 +167,20 @@ extern "C" {
*/
#ifndef PB_NO_STATIC_ASSERT
# ifndef PB_STATIC_ASSERT
-# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
- /* C11 standard _Static_assert mechanism */
-# define PB_STATIC_ASSERT(COND,MSG) _Static_assert(COND,#MSG);
-# else
+# if defined(__ICCARM__)
+ /* IAR has static_assert keyword but no _Static_assert */
+# define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG);
+# elif defined(PB_C99_STATIC_ASSERT)
/* Classic negative-size-array static assert mechanism */
# define PB_STATIC_ASSERT(COND,MSG) typedef char PB_STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1];
# define PB_STATIC_ASSERT_MSG(MSG, LINE, COUNTER) PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER)
# define PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) pb_static_assertion_##MSG##_##LINE##_##COUNTER
+# elif defined(__cplusplus)
+ /* C++11 standard static_assert mechanism */
+# define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG);
+# else
+ /* C11 standard _Static_assert mechanism */
+# define PB_STATIC_ASSERT(COND,MSG) _Static_assert(COND,#MSG);
# endif
# endif
#else
@@ -161,6 +188,14 @@ extern "C" {
# define PB_STATIC_ASSERT(COND,MSG)
#endif
+/* Test that PB_STATIC_ASSERT works
+ * If you get errors here, you may need to do one of these:
+ * - Enable C11 standard support in your compiler
+ * - Define PB_C99_STATIC_ASSERT to enable C99 standard support
+ * - Define PB_NO_STATIC_ASSERT to disable static asserts altogether
+ */
+PB_STATIC_ASSERT(1, STATIC_ASSERT_IS_NOT_WORKING)
+
/* Number of required fields to keep track of. */
#ifndef PB_MAX_REQUIRED_FIELDS
#define PB_MAX_REQUIRED_FIELDS 64
@@ -239,7 +274,7 @@ typedef uint_least8_t pb_type_t;
#define PB_HTYPE_MASK 0x30U
/**** Field allocation types ****/
-
+
#define PB_ATYPE_STATIC 0x00U
#define PB_ATYPE_POINTER 0x80U
#define PB_ATYPE_CALLBACK 0x40U
@@ -366,7 +401,7 @@ struct pb_callback_s {
bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void **arg);
bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, void * const *arg);
} funcs;
-
+
/* Free arg for use by callback */
void *arg;
};
@@ -378,7 +413,8 @@ typedef enum {
PB_WT_VARINT = 0,
PB_WT_64BIT = 1,
PB_WT_STRING = 2,
- PB_WT_32BIT = 5
+ PB_WT_32BIT = 5,
+ PB_WT_PACKED = 255 /* PB_WT_PACKED is internal marker for packed arrays. */
} pb_wire_type_t;
/* Structure for defining the handling of unknown/extension fields.
@@ -398,7 +434,7 @@ struct pb_extension_type_s {
*/
bool (*decode)(pb_istream_t *stream, pb_extension_t *extension,
uint32_t tag, pb_wire_type_t wire_type);
-
+
/* Called once after all regular fields have been encoded.
* If you have something to write, do so and return true.
* If you do not have anything to write, just return true.
@@ -406,7 +442,7 @@ struct pb_extension_type_s {
* Set to NULL for default handler.
*/
bool (*encode)(pb_ostream_t *stream, const pb_extension_t *extension);
-
+
/* Free field for use by the callback. */
const void *arg;
};
@@ -415,11 +451,11 @@ struct pb_extension_s {
/* Type describing the extension field. Usually you'll initialize
* this to a pointer to the automatically generated structure. */
const pb_extension_type_t *type;
-
+
/* Destination for the decoded data. This must match the datatype
* of the extension field. */
void *dest;
-
+
/* Pointer to the next extension handler, or NULL.
* If this extension does not match a field, the next handler is
* automatically called. */
@@ -873,4 +909,3 @@ template struct MessageDescriptor;
#endif /* __cplusplus */
#endif
-
diff --git a/vendor/nanopb/pb_common.c b/vendor/nanopb/pb_common.c
index af6583d0..1f471874 100644
--- a/vendor/nanopb/pb_common.c
+++ b/vendor/nanopb/pb_common.c
@@ -4,6 +4,15 @@
*/
#include "pb_common.h"
+#include
+/* Debug logging support - only if PRINTF is available */
+#ifdef PRINTF
+/* Forward declaration for mcu_usb_printf - function is provided by Ledger SDK */
+/* This declaration is needed when PRINTF is defined as mcu_usb_printf */
+#define PB_DEBUG_PRINTF PRINTF
+#else
+#define PB_DEBUG_PRINTF(...) ((void)0)
+#endif
static bool load_descriptor_values(pb_field_iter_t *iter)
{
@@ -11,74 +20,98 @@ static bool load_descriptor_values(pb_field_iter_t *iter)
uint32_t data_offset;
int_least8_t size_offset;
+ PB_DEBUG_PRINTF("load_descriptor_values: index=%u, field_count=%u\n",
+ iter->index, iter->descriptor->field_count);
+
if (iter->index >= iter->descriptor->field_count)
return false;
word0 = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index]);
iter->type = (pb_type_t)((word0 >> 8) & 0xFF);
+
+ // W pliku app-hedera/vendor/nanopb/pb_common.c, w funkcji load_descriptor_values:
+
+ PB_DEBUG_PRINTF("load_descriptor_values: type=0x%02x\n", iter->type);
+
+ PB_DEBUG_PRINTF("load_descriptor_values: word0 & 3 = %u (format type)\n", word0 & 3);
switch(word0 & 3)
{
case 0: {
+ PB_DEBUG_PRINTF("load_descriptor_values: case 0 (1-word format)\n");
/* 1-word format */
iter->array_size = 1;
iter->tag = (pb_size_t)((word0 >> 2) & 0x3F);
size_offset = (int_least8_t)((word0 >> 24) & 0x0F);
data_offset = (word0 >> 16) & 0xFF;
iter->data_size = (pb_size_t)((word0 >> 28) & 0x0F);
+ PB_DEBUG_PRINTF("load_descriptor_values: case 0 done, tag=%u, data_offset=%u\n", iter->tag, data_offset);
break;
}
case 1: {
+ PB_DEBUG_PRINTF("load_descriptor_values: case 1 (2-word format)\n");
/* 2-word format */
uint32_t word1 = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index + 1]);
+ PB_DEBUG_PRINTF("load_descriptor_values: word1=0x%08x\n", word1);
iter->array_size = (pb_size_t)((word0 >> 16) & 0x0FFF);
iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 28) << 6));
size_offset = (int_least8_t)((word0 >> 28) & 0x0F);
data_offset = word1 & 0xFFFF;
iter->data_size = (pb_size_t)((word1 >> 16) & 0x0FFF);
+ PB_DEBUG_PRINTF("load_descriptor_values: case 1 done\n");
break;
}
case 2: {
+ PB_DEBUG_PRINTF("load_descriptor_values: case 2 (4-word format)\n");
/* 4-word format */
uint32_t word1 = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index + 1]);
uint32_t word2 = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index + 2]);
uint32_t word3 = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index + 3]);
+ PB_DEBUG_PRINTF("load_descriptor_values: word1=0x%08x, word2=0x%08x, word3=0x%08x\n", word1, word2, word3);
iter->array_size = (pb_size_t)(word0 >> 16);
iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 8) << 6));
size_offset = (int_least8_t)(word1 & 0xFF);
data_offset = word2;
iter->data_size = (pb_size_t)word3;
+ PB_DEBUG_PRINTF("load_descriptor_values: case 2 done\n");
break;
}
default: {
+ PB_DEBUG_PRINTF("load_descriptor_values: default case (8-word format)\n");
/* 8-word format */
uint32_t word1 = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index + 1]);
uint32_t word2 = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index + 2]);
uint32_t word3 = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index + 3]);
- uint32_t word4 = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index + 4]);
+ uint32_t word4 = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index + 4]);
+ PB_DEBUG_PRINTF("load_descriptor_values: word1=0x%08x, word2=0x%08x, word3=0x%08x, word4=0x%08x\n", word1, word2, word3, word4);
iter->array_size = (pb_size_t)word4;
iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 8) << 6));
size_offset = (int_least8_t)(word1 & 0xFF);
data_offset = word2;
iter->data_size = (pb_size_t)word3;
+ PB_DEBUG_PRINTF("load_descriptor_values: default case done\n");
break;
}
}
+
+ PB_DEBUG_PRINTF("load_descriptor_values: after switch, message=%p\n", iter->message);
if (!iter->message)
{
+ PB_DEBUG_PRINTF("load_descriptor_values: message is NULL\n");
/* Avoid doing arithmetic on null pointers, it is undefined */
iter->pField = NULL;
iter->pSize = NULL;
}
else
{
+ PB_DEBUG_PRINTF("load_descriptor_values: setting pField, data_offset=%u\n", data_offset);
iter->pField = (char*)iter->message + data_offset;
if (size_offset)
@@ -115,16 +148,23 @@ static bool load_descriptor_values(pb_field_iter_t *iter)
{
iter->submsg_desc = NULL;
}
-
+
+ PB_DEBUG_PRINTF("load_descriptor_values: returning true\n");
return true;
}
+// W pliku app-hedera/vendor/nanopb/pb_common.c, w funkcji advance_iterator (około linii 156):
+
static void advance_iterator(pb_field_iter_t *iter)
{
+ PB_DEBUG_PRINTF("advance_iterator: start, index=%u, field_count=%u\n",
+ iter->index, iter->descriptor ? iter->descriptor->field_count : 0);
+
iter->index++;
if (iter->index >= iter->descriptor->field_count)
{
+ PB_DEBUG_PRINTF("advance_iterator: restarting\n");
/* Restart */
iter->index = 0;
iter->field_info_index = 0;
@@ -133,6 +173,7 @@ static void advance_iterator(pb_field_iter_t *iter)
}
else
{
+ PB_DEBUG_PRINTF("advance_iterator: incrementing, field_info_index=%u\n", iter->field_info_index);
/* Increment indexes based on previous field type.
* All field info formats have the following fields:
* - lowest 2 bits tell the amount of words in the descriptor (2^n words)
@@ -143,6 +184,9 @@ static void advance_iterator(pb_field_iter_t *iter)
pb_type_t prev_type = (prev_descriptor >> 8) & 0xFF;
pb_size_t descriptor_len = (pb_size_t)(1 << (prev_descriptor & 3));
+ PB_DEBUG_PRINTF("advance_iterator: prev_descriptor=0x%08x, prev_type=0x%02x, descriptor_len=%u\n",
+ prev_descriptor, prev_type, descriptor_len);
+
/* Add to fields.
* The cast to pb_size_t is needed to avoid -Wconversion warning.
* Because the data is is constants from generator, there is no danger of overflow.
@@ -150,16 +194,31 @@ static void advance_iterator(pb_field_iter_t *iter)
iter->field_info_index = (pb_size_t)(iter->field_info_index + descriptor_len);
iter->required_field_index = (pb_size_t)(iter->required_field_index + (PB_HTYPE(prev_type) == PB_HTYPE_REQUIRED));
iter->submessage_index = (pb_size_t)(iter->submessage_index + PB_LTYPE_IS_SUBMSG(prev_type));
+
+ PB_DEBUG_PRINTF("advance_iterator: new field_info_index=%u, submessage_index=%u\n",
+ iter->field_info_index, iter->submessage_index);
}
}
bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message)
{
+ PB_DEBUG_PRINTF("pb_field_iter_begin: desc=%p, message=%p\n", desc, message);
+
+ if (desc == NULL || desc->field_count == 0)
+ {
+ PB_DEBUG_PRINTF("pb_field_iter_begin: empty descriptor\n");
+ return false;
+ }
+
+ PB_DEBUG_PRINTF("pb_field_iter_begin: field_count=%u, field_info=%p\n",
+ desc->field_count, desc->field_info);
+
memset(iter, 0, sizeof(*iter));
iter->descriptor = PIC(desc);
iter->message = message;
+ PB_DEBUG_PRINTF("pb_field_iter_begin: calling load_descriptor_values\n");
return load_descriptor_values(iter);
}
@@ -192,14 +251,26 @@ bool pb_field_iter_next(pb_field_iter_t *iter)
return iter->index != 0;
}
+// W pliku app-hedera/vendor/nanopb/pb_common.c, w funkcji pb_field_iter_find (około linii 254):
+
bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag)
{
+ PB_DEBUG_PRINTF("pb_field_iter_find: start, tag=%u, iter->tag=%u\n", tag, iter->tag);
+ PB_DEBUG_PRINTF("pb_field_iter_find: descriptor=%p, field_info=%p\n",
+ iter->descriptor, iter->descriptor ? iter->descriptor->field_info : NULL);
+ PB_DEBUG_PRINTF("pb_field_iter_find: index=%u, field_info_index=%u, field_count=%u\n",
+ iter->index, iter->field_info_index,
+ iter->descriptor ? iter->descriptor->field_count : 0);
+
if (iter->tag == tag)
{
+ PB_DEBUG_PRINTF("pb_field_iter_find: tag matches, returning true\n");
return true; /* Nothing to do, correct field already. */
}
else if (tag > iter->descriptor->largest_tag)
{
+ PB_DEBUG_PRINTF("pb_field_iter_find: tag %u > largest_tag %u, returning false\n",
+ tag, iter->descriptor->largest_tag);
return false;
}
else
@@ -207,8 +278,11 @@ bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag)
pb_size_t start = iter->index;
uint32_t fieldinfo;
+ PB_DEBUG_PRINTF("pb_field_iter_find: searching, start=%u\n", start);
+
if (tag < iter->tag)
{
+ PB_DEBUG_PRINTF("pb_field_iter_find: tag < iter->tag, resetting index\n");
/* Fields are in tag number order, so we know that tag is between
* 0 and our start position. Setting index to end forces
* advance_iterator() call below to restart from beginning. */
@@ -217,26 +291,35 @@ bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag)
do
{
+ PB_DEBUG_PRINTF("pb_field_iter_find: loop, index=%u, field_info_index=%u\n",
+ iter->index, iter->field_info_index);
+
/* Advance iterator but don't load values yet */
advance_iterator(iter);
+ PB_DEBUG_PRINTF("pb_field_iter_find: after advance, field_info_index=%u\n",
+ iter->field_info_index);
+
/* Do fast check for tag number match */
fieldinfo = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index]);
if (((fieldinfo >> 2) & 0x3F) == (tag & 0x3F))
{
+ PB_DEBUG_PRINTF("pb_field_iter_find: candidate match, loading values\n");
/* Good candidate, check further */
(void)load_descriptor_values(iter);
if (iter->tag == tag &&
PB_LTYPE(iter->type) != PB_LTYPE_EXTENSION)
{
+ PB_DEBUG_PRINTF("pb_field_iter_find: found match, returning true\n");
/* Found it */
return true;
}
}
} while (iter->index != start);
+ PB_DEBUG_PRINTF("pb_field_iter_find: not found, restoring values\n");
/* Searched all the way back to start, and found nothing. */
(void)load_descriptor_values(iter);
return false;
@@ -260,7 +343,8 @@ bool pb_field_iter_find_extension(pb_field_iter_t *iter)
advance_iterator(iter);
/* Do fast check for field type */
- fieldinfo = PB_PROGMEM_READU32(((uint32_t *)PIC(((pb_msgdesc_t *)PIC(iter->descriptor))->field_info))[iter->field_info_index]);
+ fieldinfo = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]);
+
if (PB_LTYPE((fieldinfo >> 8) & 0xFF) == PB_LTYPE_EXTENSION)
{
return load_descriptor_values(iter);
diff --git a/vendor/nanopb/pb_decode.c b/vendor/nanopb/pb_decode.c
index d9fcc2dd..d9ee0dd0 100644
--- a/vendor/nanopb/pb_decode.c
+++ b/vendor/nanopb/pb_decode.c
@@ -12,11 +12,20 @@
#else
#define checkreturn __attribute__((warn_unused_result))
#endif
-
+#include
#include "pb.h"
#include "pb_decode.h"
#include "pb_common.h"
+/* Debug logging support - only if PRINTF is available */
+#ifdef PRINTF
+/* Forward declaration for mcu_usb_printf - function is provided by Ledger SDK */
+/* This declaration is needed when PRINTF is defined as mcu_usb_printf */
+#define PB_DEBUG_PRINTF PRINTF
+#else
+#define PB_DEBUG_PRINTF(...) ((void)0)
+#endif
+
/**************************************
* Declarations internal to this file *
**************************************/
@@ -57,8 +66,6 @@ static void pb_release_single_field(pb_field_iter_t *field);
#define pb_uint64_t uint64_t
#endif
-#define PB_WT_PACKED ((pb_wire_type_t)0xFF)
-
typedef struct {
uint32_t bitfield[(PB_MAX_REQUIRED_FIELDS + 31) / 32];
} pb_fields_seen_t;
@@ -71,12 +78,17 @@ static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t co
{
size_t i;
const pb_byte_t *source = (const pb_byte_t*)stream->state;
+
+ PB_DEBUG_PRINTF("buf_read: count=%u, bytes_left=%u, source=%p, buf=%p\n",
+ (unsigned)count, stream->bytes_left, source, buf);
+
stream->state = (pb_byte_t*)stream->state + count;
if (buf != NULL)
{
for (i = 0; i < count; i++)
buf[i] = source[i];
+ PB_DEBUG_PRINTF("buf_read: copied %u bytes\n", (unsigned)count);
}
return true;
@@ -213,18 +225,22 @@ static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *d
PB_RETURN_ERROR(stream, "varint overflow");
}
}
+ else if (bitpos == 28)
+ {
+ PB_DEBUG_PRINTF("pb_decode_varint32: bitpos=28, byte=0x%02x\n", byte);
+ if ((byte & 0x70) != 0 && (byte & 0x78) != 0x78)
+ {
+ PB_DEBUG_PRINTF("pb_decode_varint32: varint overflow detected\n");
+ PB_RETURN_ERROR(stream, "varint overflow");
+ }
+ result |= (uint32_t)(byte & 0x0F) << bitpos;
+ }
else
{
result |= (uint32_t)(byte & 0x7F) << bitpos;
}
bitpos = (uint_fast8_t)(bitpos + 7);
} while (byte & 0x80);
-
- if (bitpos == 35 && (byte & 0x70) != 0)
- {
- /* The last byte was at bitpos=28, so only bottom 4 bits fit. */
- PB_RETURN_ERROR(stream, "varint overflow");
- }
}
*dest = result;
@@ -245,12 +261,12 @@ bool checkreturn pb_decode_varint(pb_istream_t *stream, uint64_t *dest)
do
{
- if (bitpos >= 64)
- PB_RETURN_ERROR(stream, "varint overflow");
-
if (!pb_readbyte(stream, &byte))
return false;
+ if (bitpos >= 63 && (byte & 0xFE) != 0)
+ PB_RETURN_ERROR(stream, "varint overflow");
+
result |= (uint64_t)(byte & 0x7F) << bitpos;
bitpos = (uint_fast8_t)(bitpos + 7);
} while (byte & 0x80);
@@ -517,9 +533,12 @@ static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t
}
case PB_HTYPE_ONEOF:
+ PB_DEBUG_PRINTF("decode_static_field: ONEOF, tag=%u, LTYPE=%u\n",
+ field->tag, PB_LTYPE(field->type));
if (PB_LTYPE_IS_SUBMSG(field->type) &&
*(pb_size_t*)field->pSize != field->tag)
{
+ PB_DEBUG_PRINTF("decode_static_field: ONEOF submsg, clearing data\n");
/* We memset to zero so that any callbacks are set to NULL.
* This is because the callbacks might otherwise have values
* from some other union field.
@@ -532,7 +551,7 @@ static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t
/* Set default values for the submessage fields. */
if (field->submsg_desc->default_value != NULL ||
field->submsg_desc->field_callback != NULL ||
- ((const pb_msgdesc_t * const *)PIC(field->submsg_desc->submsg_info))[0] != NULL)
+ field->submsg_desc->submsg_info[0] != NULL)
{
pb_field_iter_t submsg_iter;
if (pb_field_iter_begin(&submsg_iter, field->submsg_desc, field->pData))
@@ -703,6 +722,12 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
/* Decode the array entry */
field->pData = *(char**)field->pField + field->data_size * (*size);
+ if (field->pData == NULL)
+ {
+ /* Shouldn't happen, but satisfies static analyzers */
+ status = false;
+ break;
+ }
initialize_pointer_field(field->pData, field);
if (!decode_basic_field(&substream, PB_WT_PACKED, field))
{
@@ -756,8 +781,11 @@ static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type
do
{
prev_bytes_left = substream.bytes_left;
- if (!((bool (*)(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_iter_t *field))(PIC(field->descriptor->field_callback)))(&substream, NULL, field))
- PB_RETURN_ERROR(stream, "callback failed");
+ if (!field->descriptor->field_callback(&substream, NULL, field))
+ {
+ PB_SET_ERROR(stream, substream.errmsg ? substream.errmsg : "callback failed");
+ return false;
+ }
} while (substream.bytes_left > 0 && substream.bytes_left < prev_bytes_left);
if (!pb_close_string_substream(stream, &substream))
@@ -785,11 +813,14 @@ static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type
static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field)
{
+ PB_DEBUG_PRINTF("decode_field: tag=%u, wire_type=%u, HTYPE=%u, LTYPE=%u\n",
+ field->tag, wire_type, PB_HTYPE(field->type), PB_LTYPE(field->type));
#ifdef PB_ENABLE_MALLOC
/* When decoding an oneof field, check if there is old data that must be
* released first. */
if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)
{
+ PB_DEBUG_PRINTF("decode_field: ONEOF field, tag=%u\n", field->tag);
if (!pb_release_union_field(stream, field))
return false;
}
@@ -854,13 +885,21 @@ static bool checkreturn decode_extension(pb_istream_t *stream,
}
/* Initialize message fields to default values, recursively */
+// W pliku app-hedera/vendor/nanopb/pb_decode.c, w funkcji pb_field_set_to_default (około linii 888):
+
static bool pb_field_set_to_default(pb_field_iter_t *field)
{
pb_type_t type;
type = field->type;
+ PB_DEBUG_PRINTF("pb_field_set_to_default: start, tag=%u, type=0x%02x\n",
+ field->tag, type);
+ PB_DEBUG_PRINTF("pb_field_set_to_default: pField=%p, pSize=%p, pData=%p\n",
+ field->pField, field->pSize, field->pData);
+
if (PB_LTYPE(type) == PB_LTYPE_EXTENSION)
{
+ PB_DEBUG_PRINTF("pb_field_set_to_default: EXTENSION type\n");
pb_extension_t *ext = *(pb_extension_t* const *)field->pData;
while (ext != NULL)
{
@@ -876,9 +915,11 @@ static bool pb_field_set_to_default(pb_field_iter_t *field)
}
else if (PB_ATYPE(type) == PB_ATYPE_STATIC)
{
+ PB_DEBUG_PRINTF("pb_field_set_to_default: STATIC type\n");
bool init_data = true;
if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL && field->pSize != NULL)
{
+ PB_DEBUG_PRINTF("pb_field_set_to_default: OPTIONAL, setting has_field=false\n");
/* Set has_field to false. Still initialize the optional field
* itself also. */
*(bool*)field->pSize = false;
@@ -886,6 +927,7 @@ static bool pb_field_set_to_default(pb_field_iter_t *field)
else if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
PB_HTYPE(type) == PB_HTYPE_ONEOF)
{
+ PB_DEBUG_PRINTF("pb_field_set_to_default: REPEATED/ONEOF, setting count/which=0\n");
/* REPEATED: Set array count to 0, no need to initialize contents.
ONEOF: Set which_field to 0. */
*(pb_size_t*)field->pSize = 0;
@@ -899,6 +941,7 @@ static bool pb_field_set_to_default(pb_field_iter_t *field)
field->submsg_desc->field_callback != NULL ||
((const pb_msgdesc_t * const *)PIC(field->submsg_desc->submsg_info))[0] != NULL))
{
+ PB_DEBUG_PRINTF("pb_field_set_to_default: SUBMSG with defaults\n");
/* Initialize submessage to defaults.
* Only needed if it has default values
* or callback/submessage fields. */
@@ -911,6 +954,7 @@ static bool pb_field_set_to_default(pb_field_iter_t *field)
}
else
{
+ PB_DEBUG_PRINTF("pb_field_set_to_default: memset to zero, data_size=%u\n", field->data_size);
/* Initialize to zeros */
memset(field->pData, 0, (size_t)field->data_size);
}
@@ -918,6 +962,7 @@ static bool pb_field_set_to_default(pb_field_iter_t *field)
}
else if (PB_ATYPE(type) == PB_ATYPE_POINTER)
{
+ PB_DEBUG_PRINTF("pb_field_set_to_default: POINTER type\n");
/* Initialize the pointer to NULL. */
*(void**)field->pField = NULL;
@@ -930,9 +975,11 @@ static bool pb_field_set_to_default(pb_field_iter_t *field)
}
else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK)
{
+ PB_DEBUG_PRINTF("pb_field_set_to_default: CALLBACK type\n");
/* Don't overwrite callback */
}
+ PB_DEBUG_PRINTF("pb_field_set_to_default: done\n");
return true;
}
@@ -943,21 +990,40 @@ static bool pb_message_set_to_defaults(pb_field_iter_t *iter)
pb_wire_type_t wire_type = PB_WT_VARINT;
bool eof;
+ PB_DEBUG_PRINTF("pb_message_set_to_defaults: start, descriptor=%p, message=%p\n",
+ iter->descriptor, iter->message);
+ PB_DEBUG_PRINTF("pb_message_set_to_defaults: field_count=%u, index=%u\n",
+ iter->descriptor ? iter->descriptor->field_count : 0, iter->index);
+
if (iter->descriptor->default_value)
{
+ PB_DEBUG_PRINTF("pb_message_set_to_defaults: has default_value\n");
defstream = pb_istream_from_buffer(iter->descriptor->default_value, (size_t)-1);
if (!pb_decode_tag(&defstream, &wire_type, &tag, &eof))
return false;
}
+ else
+ {
+ PB_DEBUG_PRINTF("pb_message_set_to_defaults: no default_value\n");
+ }
do
{
+ PB_DEBUG_PRINTF("pb_message_set_to_defaults: iterating, tag=%u, index=%u\n",
+ iter->tag, iter->index);
+ PB_DEBUG_PRINTF("pb_message_set_to_defaults: pField=%p, pSize=%p, pData=%p\n",
+ iter->pField, iter->pSize, iter->pData);
+
if (!pb_field_set_to_default(iter))
+ {
+ PB_DEBUG_PRINTF("pb_message_set_to_defaults: pb_field_set_to_default failed\n");
return false;
+ }
if (tag != 0 && iter->tag == tag)
{
/* We have a default value for this field in the defstream */
+ PB_DEBUG_PRINTF("pb_message_set_to_defaults: applying default value for tag %u\n", tag);
if (!decode_field(&defstream, wire_type, iter))
return false;
if (!pb_decode_tag(&defstream, &wire_type, &tag, &eof))
@@ -968,6 +1034,7 @@ static bool pb_message_set_to_defaults(pb_field_iter_t *iter)
}
} while (pb_field_iter_next(iter));
+ PB_DEBUG_PRINTF("pb_message_set_to_defaults: done\n");
return true;
}
@@ -992,14 +1059,23 @@ static bool checkreturn pb_decode_inner(pb_istream_t *stream, const pb_msgdesc_t
const uint32_t allbits = ~(uint32_t)0;
pb_field_iter_t iter;
+ PB_DEBUG_PRINTF("pb_decode_inner: start, bytes_left=%u, field_count=%u\n",
+ stream->bytes_left, fields->field_count);
+
if (pb_field_iter_begin(&iter, fields, dest_struct))
{
+ PB_DEBUG_PRINTF("pb_decode_inner: pb_field_iter_begin succeeded\n");
if ((flags & PB_DECODE_NOINIT) == 0)
{
+ PB_DEBUG_PRINTF("pb_decode_inner: setting defaults\n");
if (!pb_message_set_to_defaults(&iter))
PB_RETURN_ERROR(stream, "failed to set defaults");
}
}
+ else
+ {
+ PB_DEBUG_PRINTF("pb_decode_inner: pb_field_iter_begin failed\n");
+ }
while (stream->bytes_left)
{
@@ -1015,6 +1091,9 @@ static bool checkreturn pb_decode_inner(pb_istream_t *stream, const pb_msgdesc_t
return false;
}
+ PB_DEBUG_PRINTF("pb_decode_inner: tag=%u, wire_type=%u, bytes_left=%u\n",
+ tag, wire_type, stream->bytes_left);
+
if (tag == 0)
{
if (flags & PB_DECODE_NULLTERMINATED)
@@ -1029,6 +1108,7 @@ static bool checkreturn pb_decode_inner(pb_istream_t *stream, const pb_msgdesc_t
if (!pb_field_iter_find(&iter, tag) || PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION)
{
+ PB_DEBUG_PRINTF("pb_decode_inner: tag %u not found or extension\n", tag);
/* No match found, check if it matches an extension. */
if (extension_range_start == 0)
{
@@ -1095,9 +1175,16 @@ static bool checkreturn pb_decode_inner(pb_istream_t *stream, const pb_msgdesc_t
fields_seen.bitfield[iter.required_field_index >> 5] |= tmp;
}
+ PB_DEBUG_PRINTF("pb_decode_inner: decoding field, tag=%u, HTYPE=%u, LTYPE=%u\n",
+ iter.tag, PB_HTYPE(iter.type), PB_LTYPE(iter.type));
if (!decode_field(stream, wire_type, &iter))
+ {
+ PB_DEBUG_PRINTF("pb_decode_inner: decode_field failed for tag=%u\n", iter.tag);
return false;
+ }
}
+
+ PB_DEBUG_PRINTF("pb_decode_inner: completed successfully\n");
/* Check that all elements of the last decoded fixed count field were present. */
if (fixed_count_field != PB_SIZE_MAX &&
@@ -1358,7 +1445,7 @@ bool pb_decode_fixed32(pb_istream_t *stream, void *dest)
if (!pb_read(stream, u.bytes, 4))
return false;
-#if defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN && CHAR_BIT == 8
+#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1
/* fast path - if we know that we're on little endian, assign directly */
*(uint32_t*)dest = u.fixed32;
#else
@@ -1381,7 +1468,7 @@ bool pb_decode_fixed64(pb_istream_t *stream, void *dest)
if (!pb_read(stream, u.bytes, 8))
return false;
-#if defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN && CHAR_BIT == 8
+#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1
/* fast path - if we know that we're on little endian, assign directly */
*(uint64_t*)dest = u.fixed64;
#else
diff --git a/vendor/nanopb/pb_encode.c b/vendor/nanopb/pb_encode.c
index de716f7a..7f562012 100644
--- a/vendor/nanopb/pb_encode.c
+++ b/vendor/nanopb/pb_encode.c
@@ -51,12 +51,10 @@ static bool checkreturn pb_enc_fixed_length_bytes(pb_ostream_t *stream, const pb
static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count)
{
- size_t i;
pb_byte_t *dest = (pb_byte_t*)stream->state;
stream->state = dest + count;
- for (i = 0; i < count; i++)
- dest[i] = buf[i];
+ memcpy(dest, buf, count * sizeof(pb_byte_t));
return true;
}
@@ -65,7 +63,11 @@ pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize)
{
pb_ostream_t stream;
#ifdef PB_BUFFER_ONLY
- stream.callback = (void*)1; /* Just a marker value */
+ /* In PB_BUFFER_ONLY configuration the callback pointer is just int*.
+ * NULL pointer marks a sizing field, so put a non-NULL value to mark a buffer stream.
+ */
+ static const int marker = 0;
+ stream.callback = ▮
#else
stream.callback = &buf_write;
#endif
@@ -622,8 +624,9 @@ bool checkreturn pb_encode_varint(pb_ostream_t *stream, pb_uint64_t value)
bool checkreturn pb_encode_svarint(pb_ostream_t *stream, pb_int64_t value)
{
pb_uint64_t zigzagged;
+ pb_uint64_t mask = ((pb_uint64_t)-1) >> 1; /* Satisfy clang -fsanitize=integer */
if (value < 0)
- zigzagged = ~((pb_uint64_t)value << 1);
+ zigzagged = ~(((pb_uint64_t)value & mask) << 1);
else
zigzagged = (pb_uint64_t)value << 1;
@@ -632,6 +635,10 @@ bool checkreturn pb_encode_svarint(pb_ostream_t *stream, pb_int64_t value)
bool checkreturn pb_encode_fixed32(pb_ostream_t *stream, const void *value)
{
+#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1
+ /* Fast path if we know that we're on little endian */
+ return pb_write(stream, (const pb_byte_t*)value, 4);
+#else
uint32_t val = *(const uint32_t*)value;
pb_byte_t bytes[4];
bytes[0] = (pb_byte_t)(val & 0xFF);
@@ -639,11 +646,16 @@ bool checkreturn pb_encode_fixed32(pb_ostream_t *stream, const void *value)
bytes[2] = (pb_byte_t)((val >> 16) & 0xFF);
bytes[3] = (pb_byte_t)((val >> 24) & 0xFF);
return pb_write(stream, bytes, 4);
+#endif
}
#ifndef PB_WITHOUT_64BIT
bool checkreturn pb_encode_fixed64(pb_ostream_t *stream, const void *value)
{
+#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1
+ /* Fast path if we know that we're on little endian */
+ return pb_write(stream, (const pb_byte_t*)value, 8);
+#else
uint64_t val = *(const uint64_t*)value;
pb_byte_t bytes[8];
bytes[0] = (pb_byte_t)(val & 0xFF);
@@ -655,6 +667,7 @@ bool checkreturn pb_encode_fixed64(pb_ostream_t *stream, const void *value)
bytes[6] = (pb_byte_t)((val >> 48) & 0xFF);
bytes[7] = (pb_byte_t)((val >> 56) & 0xFF);
return pb_write(stream, bytes, 8);
+#endif
}
#endif
diff --git a/vendor/nanopb/pb_encode.h b/vendor/nanopb/pb_encode.h
index 9cff22a4..89136832 100644
--- a/vendor/nanopb/pb_encode.h
+++ b/vendor/nanopb/pb_encode.h
@@ -33,7 +33,7 @@ struct pb_ostream_s
* Also, NULL pointer marks a 'sizing stream' that does not
* write anything.
*/
- int *callback;
+ const int *callback;
#else
bool (*callback)(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
#endif
diff --git a/vendor/nanopb/spm_headers/nanopb/pb.h b/vendor/nanopb/spm_headers/nanopb/pb.h
index e2be14d9..f5c9c6f3 100644
--- a/vendor/nanopb/spm_headers/nanopb/pb.h
+++ b/vendor/nanopb/spm_headers/nanopb/pb.h
@@ -1 +1,911 @@
-../../pb.h
\ No newline at end of file
+/* Common parts of the nanopb library. Most of these are quite low-level
+ * stuff. For the high-level interface, see pb_encode.h and pb_decode.h.
+ */
+
+#ifndef PB_H_INCLUDED
+#define PB_H_INCLUDED
+
+/*****************************************************************
+ * Nanopb compilation time options. You can change these here by *
+ * uncommenting the lines, or on the compiler command line. *
+ *****************************************************************/
+
+/* Enable support for dynamically allocated fields */
+/* #define PB_ENABLE_MALLOC 1 */
+
+/* Define this if your CPU / compiler combination does not support
+ * unaligned memory access to packed structures. Note that packed
+ * structures are only used when requested in .proto options. */
+/* #define PB_NO_PACKED_STRUCTS 1 */
+
+/* Increase the number of required fields that are tracked.
+ * A compiler warning will tell if you need this. */
+/* #define PB_MAX_REQUIRED_FIELDS 256 */
+
+/* Add support for tag numbers > 65536 and fields larger than 65536 bytes. */
+/* #define PB_FIELD_32BIT 1 */
+
+/* Disable support for error messages in order to save some code space. */
+/* #define PB_NO_ERRMSG 1 */
+
+/* Disable support for custom streams (support only memory buffers). */
+/* #define PB_BUFFER_ONLY 1 */
+
+/* Disable support for 64-bit datatypes, for compilers without int64_t
+ or to save some code space. */
+/* #define PB_WITHOUT_64BIT 1 */
+
+/* Don't encode scalar arrays as packed. This is only to be used when
+ * the decoder on the receiving side cannot process packed scalar arrays.
+ * Such example is older protobuf.js. */
+/* #define PB_ENCODE_ARRAYS_UNPACKED 1 */
+
+/* Enable conversion of doubles to floats for platforms that do not
+ * support 64-bit doubles. Most commonly AVR. */
+/* #define PB_CONVERT_DOUBLE_FLOAT 1 */
+
+/* Check whether incoming strings are valid UTF-8 sequences. Slows down
+ * the string processing slightly and slightly increases code size. */
+/* #define PB_VALIDATE_UTF8 1 */
+
+/* This can be defined if the platform is little-endian and has 8-bit bytes.
+ * Normally it is automatically detected based on __BYTE_ORDER__ macro. */
+/* #define PB_LITTLE_ENDIAN_8BIT 1 */
+
+/* Configure static assert mechanism. Instead of changing these, set your
+ * compiler to C11 standard mode if possible. */
+/* #define PB_C99_STATIC_ASSERT 1 */
+/* #define PB_NO_STATIC_ASSERT 1 */
+
+/******************************************************************
+ * You usually don't need to change anything below this line. *
+ * Feel free to look around and use the defined macros, though. *
+ ******************************************************************/
+
+
+/* Version of the nanopb library. Just in case you want to check it in
+ * your own program. */
+#define NANOPB_VERSION "nanopb-0.4.6"
+
+/* Include all the system headers needed by nanopb. You will need the
+ * definitions of the following:
+ * - strlen, memcpy, memset functions
+ * - [u]int_least8_t, uint_fast8_t, [u]int_least16_t, [u]int32_t, [u]int64_t
+ * - size_t
+ * - bool
+ *
+ * If you don't have the standard header files, you can instead provide
+ * a custom header that defines or includes all this. In that case,
+ * define PB_SYSTEM_HEADER to the path of this file.
+ */
+#ifdef PB_SYSTEM_HEADER
+#include PB_SYSTEM_HEADER
+#else
+#include
+#include
+#include
+#include
+#include
+
+#ifdef PB_ENABLE_MALLOC
+#include
+#endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Macro for defining packed structures (compiler dependent).
+ * This just reduces memory requirements, but is not required.
+ */
+#if defined(PB_NO_PACKED_STRUCTS)
+ /* Disable struct packing */
+# define PB_PACKED_STRUCT_START
+# define PB_PACKED_STRUCT_END
+# define pb_packed
+#elif defined(__GNUC__) || defined(__clang__)
+ /* For GCC and clang */
+# define PB_PACKED_STRUCT_START
+# define PB_PACKED_STRUCT_END
+# define pb_packed __attribute__((packed))
+#elif defined(__ICCARM__) || defined(__CC_ARM)
+ /* For IAR ARM and Keil MDK-ARM compilers */
+# define PB_PACKED_STRUCT_START _Pragma("pack(push, 1)")
+# define PB_PACKED_STRUCT_END _Pragma("pack(pop)")
+# define pb_packed
+#elif defined(_MSC_VER) && (_MSC_VER >= 1500)
+ /* For Microsoft Visual C++ */
+# define PB_PACKED_STRUCT_START __pragma(pack(push, 1))
+# define PB_PACKED_STRUCT_END __pragma(pack(pop))
+# define pb_packed
+#else
+ /* Unknown compiler */
+# define PB_PACKED_STRUCT_START
+# define PB_PACKED_STRUCT_END
+# define pb_packed
+#endif
+
+/* Detect endianness */
+#ifndef PB_LITTLE_ENDIAN_8BIT
+#if ((defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || \
+ (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
+ defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || \
+ defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || \
+ defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM)) \
+ && CHAR_BIT == 8
+#define PB_LITTLE_ENDIAN_8BIT 1
+#endif
+#endif
+
+/* Handly macro for suppressing unreferenced-parameter compiler warnings. */
+#ifndef PB_UNUSED
+#define PB_UNUSED(x) (void)(x)
+#endif
+
+/* Harvard-architecture processors may need special attributes for storing
+ * field information in program memory. */
+#ifndef PB_PROGMEM
+#ifdef __AVR__
+#include
+#define PB_PROGMEM PROGMEM
+#define PB_PROGMEM_READU32(x) pgm_read_dword(&x)
+#else
+#define PB_PROGMEM
+#define PB_PROGMEM_READU32(x) (x)
+#endif
+#endif
+
+/* Compile-time assertion, used for checking compatible compilation options.
+ * If this does not work properly on your compiler, use
+ * #define PB_NO_STATIC_ASSERT to disable it.
+ *
+ * But before doing that, check carefully the error message / place where it
+ * comes from to see if the error has a real cause. Unfortunately the error
+ * message is not always very clear to read, but you can see the reason better
+ * in the place where the PB_STATIC_ASSERT macro was called.
+ */
+#ifndef PB_NO_STATIC_ASSERT
+# ifndef PB_STATIC_ASSERT
+# if defined(__ICCARM__)
+ /* IAR has static_assert keyword but no _Static_assert */
+# define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG);
+# elif defined(PB_C99_STATIC_ASSERT)
+ /* Classic negative-size-array static assert mechanism */
+# define PB_STATIC_ASSERT(COND,MSG) typedef char PB_STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1];
+# define PB_STATIC_ASSERT_MSG(MSG, LINE, COUNTER) PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER)
+# define PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) pb_static_assertion_##MSG##_##LINE##_##COUNTER
+# elif defined(__cplusplus)
+ /* C++11 standard static_assert mechanism */
+# define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG);
+# else
+ /* C11 standard _Static_assert mechanism */
+# define PB_STATIC_ASSERT(COND,MSG) _Static_assert(COND,#MSG);
+# endif
+# endif
+#else
+ /* Static asserts disabled by PB_NO_STATIC_ASSERT */
+# define PB_STATIC_ASSERT(COND,MSG)
+#endif
+
+/* Test that PB_STATIC_ASSERT works
+ * If you get errors here, you may need to do one of these:
+ * - Enable C11 standard support in your compiler
+ * - Define PB_C99_STATIC_ASSERT to enable C99 standard support
+ * - Define PB_NO_STATIC_ASSERT to disable static asserts altogether
+ */
+PB_STATIC_ASSERT(1, STATIC_ASSERT_IS_NOT_WORKING)
+
+/* Number of required fields to keep track of. */
+#ifndef PB_MAX_REQUIRED_FIELDS
+#define PB_MAX_REQUIRED_FIELDS 64
+#endif
+
+#if PB_MAX_REQUIRED_FIELDS < 64
+#error You should not lower PB_MAX_REQUIRED_FIELDS from the default value (64).
+#endif
+
+#ifdef PB_WITHOUT_64BIT
+#ifdef PB_CONVERT_DOUBLE_FLOAT
+/* Cannot use doubles without 64-bit types */
+#undef PB_CONVERT_DOUBLE_FLOAT
+#endif
+#endif
+
+/* List of possible field types. These are used in the autogenerated code.
+ * Least-significant 4 bits tell the scalar type
+ * Most-significant 4 bits specify repeated/required/packed etc.
+ */
+
+typedef uint_least8_t pb_type_t;
+
+/**** Field data types ****/
+
+/* Numeric types */
+#define PB_LTYPE_BOOL 0x00U /* bool */
+#define PB_LTYPE_VARINT 0x01U /* int32, int64, enum, bool */
+#define PB_LTYPE_UVARINT 0x02U /* uint32, uint64 */
+#define PB_LTYPE_SVARINT 0x03U /* sint32, sint64 */
+#define PB_LTYPE_FIXED32 0x04U /* fixed32, sfixed32, float */
+#define PB_LTYPE_FIXED64 0x05U /* fixed64, sfixed64, double */
+
+/* Marker for last packable field type. */
+#define PB_LTYPE_LAST_PACKABLE 0x05U
+
+/* Byte array with pre-allocated buffer.
+ * data_size is the length of the allocated PB_BYTES_ARRAY structure. */
+#define PB_LTYPE_BYTES 0x06U
+
+/* String with pre-allocated buffer.
+ * data_size is the maximum length. */
+#define PB_LTYPE_STRING 0x07U
+
+/* Submessage
+ * submsg_fields is pointer to field descriptions */
+#define PB_LTYPE_SUBMESSAGE 0x08U
+
+/* Submessage with pre-decoding callback
+ * The pre-decoding callback is stored as pb_callback_t right before pSize.
+ * submsg_fields is pointer to field descriptions */
+#define PB_LTYPE_SUBMSG_W_CB 0x09U
+
+/* Extension pseudo-field
+ * The field contains a pointer to pb_extension_t */
+#define PB_LTYPE_EXTENSION 0x0AU
+
+/* Byte array with inline, pre-allocated byffer.
+ * data_size is the length of the inline, allocated buffer.
+ * This differs from PB_LTYPE_BYTES by defining the element as
+ * pb_byte_t[data_size] rather than pb_bytes_array_t. */
+#define PB_LTYPE_FIXED_LENGTH_BYTES 0x0BU
+
+/* Number of declared LTYPES */
+#define PB_LTYPES_COUNT 0x0CU
+#define PB_LTYPE_MASK 0x0FU
+
+/**** Field repetition rules ****/
+
+#define PB_HTYPE_REQUIRED 0x00U
+#define PB_HTYPE_OPTIONAL 0x10U
+#define PB_HTYPE_SINGULAR 0x10U
+#define PB_HTYPE_REPEATED 0x20U
+#define PB_HTYPE_FIXARRAY 0x20U
+#define PB_HTYPE_ONEOF 0x30U
+#define PB_HTYPE_MASK 0x30U
+
+/**** Field allocation types ****/
+
+#define PB_ATYPE_STATIC 0x00U
+#define PB_ATYPE_POINTER 0x80U
+#define PB_ATYPE_CALLBACK 0x40U
+#define PB_ATYPE_MASK 0xC0U
+
+#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
+#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
+#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
+#define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
+ PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
+
+/* Data type used for storing sizes of struct fields
+ * and array counts.
+ */
+#if defined(PB_FIELD_32BIT)
+ typedef uint32_t pb_size_t;
+ typedef int32_t pb_ssize_t;
+#else
+ typedef uint_least16_t pb_size_t;
+ typedef int_least16_t pb_ssize_t;
+#endif
+#define PB_SIZE_MAX ((pb_size_t)-1)
+
+/* Data type for storing encoded data and other byte streams.
+ * This typedef exists to support platforms where uint8_t does not exist.
+ * You can regard it as equivalent on uint8_t on other platforms.
+ */
+typedef uint_least8_t pb_byte_t;
+
+/* Forward declaration of struct types */
+typedef struct pb_istream_s pb_istream_t;
+typedef struct pb_ostream_s pb_ostream_t;
+typedef struct pb_field_iter_s pb_field_iter_t;
+
+/* This structure is used in auto-generated constants
+ * to specify struct fields.
+ */
+typedef struct pb_msgdesc_s pb_msgdesc_t;
+struct pb_msgdesc_s {
+ const uint32_t *field_info;
+ const pb_msgdesc_t * const * submsg_info;
+ const pb_byte_t *default_value;
+
+ bool (*field_callback)(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_iter_t *field);
+
+ pb_size_t field_count;
+ pb_size_t required_field_count;
+ pb_size_t largest_tag;
+};
+
+/* Iterator for message descriptor */
+struct pb_field_iter_s {
+ const pb_msgdesc_t *descriptor; /* Pointer to message descriptor constant */
+ void *message; /* Pointer to start of the structure */
+
+ pb_size_t index; /* Index of the field */
+ pb_size_t field_info_index; /* Index to descriptor->field_info array */
+ pb_size_t required_field_index; /* Index that counts only the required fields */
+ pb_size_t submessage_index; /* Index that counts only submessages */
+
+ pb_size_t tag; /* Tag of current field */
+ pb_size_t data_size; /* sizeof() of a single item */
+ pb_size_t array_size; /* Number of array entries */
+ pb_type_t type; /* Type of current field */
+
+ void *pField; /* Pointer to current field in struct */
+ void *pData; /* Pointer to current data contents. Different than pField for arrays and pointers. */
+ void *pSize; /* Pointer to count/has field */
+
+ const pb_msgdesc_t *submsg_desc; /* For submessage fields, pointer to field descriptor for the submessage. */
+};
+
+/* For compatibility with legacy code */
+typedef pb_field_iter_t pb_field_t;
+
+/* Make sure that the standard integer types are of the expected sizes.
+ * Otherwise fixed32/fixed64 fields can break.
+ *
+ * If you get errors here, it probably means that your stdint.h is not
+ * correct for your platform.
+ */
+#ifndef PB_WITHOUT_64BIT
+PB_STATIC_ASSERT(sizeof(int64_t) == 2 * sizeof(int32_t), INT64_T_WRONG_SIZE)
+PB_STATIC_ASSERT(sizeof(uint64_t) == 2 * sizeof(uint32_t), UINT64_T_WRONG_SIZE)
+#endif
+
+/* This structure is used for 'bytes' arrays.
+ * It has the number of bytes in the beginning, and after that an array.
+ * Note that actual structs used will have a different length of bytes array.
+ */
+#define PB_BYTES_ARRAY_T(n) struct { pb_size_t size; pb_byte_t bytes[n]; }
+#define PB_BYTES_ARRAY_T_ALLOCSIZE(n) ((size_t)n + offsetof(pb_bytes_array_t, bytes))
+
+struct pb_bytes_array_s {
+ pb_size_t size;
+ pb_byte_t bytes[1];
+};
+typedef struct pb_bytes_array_s pb_bytes_array_t;
+
+/* This structure is used for giving the callback function.
+ * It is stored in the message structure and filled in by the method that
+ * calls pb_decode.
+ *
+ * The decoding callback will be given a limited-length stream
+ * If the wire type was string, the length is the length of the string.
+ * If the wire type was a varint/fixed32/fixed64, the length is the length
+ * of the actual value.
+ * The function may be called multiple times (especially for repeated types,
+ * but also otherwise if the message happens to contain the field multiple
+ * times.)
+ *
+ * The encoding callback will receive the actual output stream.
+ * It should write all the data in one call, including the field tag and
+ * wire type. It can write multiple fields.
+ *
+ * The callback can be null if you want to skip a field.
+ */
+typedef struct pb_callback_s pb_callback_t;
+struct pb_callback_s {
+ /* Callback functions receive a pointer to the arg field.
+ * You can access the value of the field as *arg, and modify it if needed.
+ */
+ union {
+ bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void **arg);
+ bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, void * const *arg);
+ } funcs;
+
+ /* Free arg for use by callback */
+ void *arg;
+};
+
+extern bool pb_default_field_callback(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_t *field);
+
+/* Wire types. Library user needs these only in encoder callbacks. */
+typedef enum {
+ PB_WT_VARINT = 0,
+ PB_WT_64BIT = 1,
+ PB_WT_STRING = 2,
+ PB_WT_32BIT = 5,
+ PB_WT_PACKED = 255 /* PB_WT_PACKED is internal marker for packed arrays. */
+} pb_wire_type_t;
+
+/* Structure for defining the handling of unknown/extension fields.
+ * Usually the pb_extension_type_t structure is automatically generated,
+ * while the pb_extension_t structure is created by the user. However,
+ * if you want to catch all unknown fields, you can also create a custom
+ * pb_extension_type_t with your own callback.
+ */
+typedef struct pb_extension_type_s pb_extension_type_t;
+typedef struct pb_extension_s pb_extension_t;
+struct pb_extension_type_s {
+ /* Called for each unknown field in the message.
+ * If you handle the field, read off all of its data and return true.
+ * If you do not handle the field, do not read anything and return true.
+ * If you run into an error, return false.
+ * Set to NULL for default handler.
+ */
+ bool (*decode)(pb_istream_t *stream, pb_extension_t *extension,
+ uint32_t tag, pb_wire_type_t wire_type);
+
+ /* Called once after all regular fields have been encoded.
+ * If you have something to write, do so and return true.
+ * If you do not have anything to write, just return true.
+ * If you run into an error, return false.
+ * Set to NULL for default handler.
+ */
+ bool (*encode)(pb_ostream_t *stream, const pb_extension_t *extension);
+
+ /* Free field for use by the callback. */
+ const void *arg;
+};
+
+struct pb_extension_s {
+ /* Type describing the extension field. Usually you'll initialize
+ * this to a pointer to the automatically generated structure. */
+ const pb_extension_type_t *type;
+
+ /* Destination for the decoded data. This must match the datatype
+ * of the extension field. */
+ void *dest;
+
+ /* Pointer to the next extension handler, or NULL.
+ * If this extension does not match a field, the next handler is
+ * automatically called. */
+ pb_extension_t *next;
+
+ /* The decoder sets this to true if the extension was found.
+ * Ignored for encoding. */
+ bool found;
+};
+
+#define pb_extension_init_zero {NULL,NULL,NULL,false}
+
+/* Memory allocation functions to use. You can define pb_realloc and
+ * pb_free to custom functions if you want. */
+#ifdef PB_ENABLE_MALLOC
+# ifndef pb_realloc
+# define pb_realloc(ptr, size) realloc(ptr, size)
+# endif
+# ifndef pb_free
+# define pb_free(ptr) free(ptr)
+# endif
+#endif
+
+/* This is used to inform about need to regenerate .pb.h/.pb.c files. */
+#define PB_PROTO_HEADER_VERSION 40
+
+/* These macros are used to declare pb_field_t's in the constant array. */
+/* Size of a structure member, in bytes. */
+#define pb_membersize(st, m) (sizeof ((st*)0)->m)
+/* Number of entries in an array. */
+#define pb_arraysize(st, m) (pb_membersize(st, m) / pb_membersize(st, m[0]))
+/* Delta from start of one member to the start of another member. */
+#define pb_delta(st, m1, m2) ((int)offsetof(st, m1) - (int)offsetof(st, m2))
+
+/* Force expansion of macro value */
+#define PB_EXPAND(x) x
+
+/* Binding of a message field set into a specific structure */
+#define PB_BIND(msgname, structname, width) \
+ const uint32_t structname ## _field_info[] PB_PROGMEM = \
+ { \
+ msgname ## _FIELDLIST(PB_GEN_FIELD_INFO_ ## width, structname) \
+ 0 \
+ }; \
+ const pb_msgdesc_t* const structname ## _submsg_info[] = \
+ { \
+ msgname ## _FIELDLIST(PB_GEN_SUBMSG_INFO, structname) \
+ NULL \
+ }; \
+ const pb_msgdesc_t structname ## _msg = \
+ { \
+ structname ## _field_info, \
+ structname ## _submsg_info, \
+ msgname ## _DEFAULT, \
+ msgname ## _CALLBACK, \
+ 0 msgname ## _FIELDLIST(PB_GEN_FIELD_COUNT, structname), \
+ 0 msgname ## _FIELDLIST(PB_GEN_REQ_FIELD_COUNT, structname), \
+ 0 msgname ## _FIELDLIST(PB_GEN_LARGEST_TAG, structname), \
+ }; \
+ msgname ## _FIELDLIST(PB_GEN_FIELD_INFO_ASSERT_ ## width, structname)
+
+#define PB_GEN_FIELD_COUNT(structname, atype, htype, ltype, fieldname, tag) +1
+#define PB_GEN_REQ_FIELD_COUNT(structname, atype, htype, ltype, fieldname, tag) \
+ + (PB_HTYPE_ ## htype == PB_HTYPE_REQUIRED)
+#define PB_GEN_LARGEST_TAG(structname, atype, htype, ltype, fieldname, tag) \
+ * 0 + tag
+
+/* X-macro for generating the entries in struct_field_info[] array. */
+#define PB_GEN_FIELD_INFO_1(structname, atype, htype, ltype, fieldname, tag) \
+ PB_FIELDINFO_1(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
+ PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
+
+#define PB_GEN_FIELD_INFO_2(structname, atype, htype, ltype, fieldname, tag) \
+ PB_FIELDINFO_2(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
+ PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
+
+#define PB_GEN_FIELD_INFO_4(structname, atype, htype, ltype, fieldname, tag) \
+ PB_FIELDINFO_4(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
+ PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
+
+#define PB_GEN_FIELD_INFO_8(structname, atype, htype, ltype, fieldname, tag) \
+ PB_FIELDINFO_8(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
+ PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
+
+#define PB_GEN_FIELD_INFO_AUTO(structname, atype, htype, ltype, fieldname, tag) \
+ PB_FIELDINFO_AUTO2(PB_FIELDINFO_WIDTH_AUTO(_PB_ATYPE_ ## atype, _PB_HTYPE_ ## htype, _PB_LTYPE_ ## ltype), \
+ tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
+ PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
+
+#define PB_FIELDINFO_AUTO2(width, tag, type, data_offset, data_size, size_offset, array_size) \
+ PB_FIELDINFO_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size)
+
+#define PB_FIELDINFO_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size) \
+ PB_FIELDINFO_ ## width(tag, type, data_offset, data_size, size_offset, array_size)
+
+/* X-macro for generating asserts that entries fit in struct_field_info[] array.
+ * The structure of macros here must match the structure above in PB_GEN_FIELD_INFO_x(),
+ * but it is not easily reused because of how macro substitutions work. */
+#define PB_GEN_FIELD_INFO_ASSERT_1(structname, atype, htype, ltype, fieldname, tag) \
+ PB_FIELDINFO_ASSERT_1(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
+ PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
+
+#define PB_GEN_FIELD_INFO_ASSERT_2(structname, atype, htype, ltype, fieldname, tag) \
+ PB_FIELDINFO_ASSERT_2(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
+ PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
+
+#define PB_GEN_FIELD_INFO_ASSERT_4(structname, atype, htype, ltype, fieldname, tag) \
+ PB_FIELDINFO_ASSERT_4(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
+ PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
+
+#define PB_GEN_FIELD_INFO_ASSERT_8(structname, atype, htype, ltype, fieldname, tag) \
+ PB_FIELDINFO_ASSERT_8(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
+ PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
+
+#define PB_GEN_FIELD_INFO_ASSERT_AUTO(structname, atype, htype, ltype, fieldname, tag) \
+ PB_FIELDINFO_ASSERT_AUTO2(PB_FIELDINFO_WIDTH_AUTO(_PB_ATYPE_ ## atype, _PB_HTYPE_ ## htype, _PB_LTYPE_ ## ltype), \
+ tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
+ PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
+ PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
+
+#define PB_FIELDINFO_ASSERT_AUTO2(width, tag, type, data_offset, data_size, size_offset, array_size) \
+ PB_FIELDINFO_ASSERT_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size)
+
+#define PB_FIELDINFO_ASSERT_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size) \
+ PB_FIELDINFO_ASSERT_ ## width(tag, type, data_offset, data_size, size_offset, array_size)
+
+#define PB_DATA_OFFSET_STATIC(htype, structname, fieldname) PB_DO ## htype(structname, fieldname)
+#define PB_DATA_OFFSET_POINTER(htype, structname, fieldname) PB_DO ## htype(structname, fieldname)
+#define PB_DATA_OFFSET_CALLBACK(htype, structname, fieldname) PB_DO ## htype(structname, fieldname)
+#define PB_DO_PB_HTYPE_REQUIRED(structname, fieldname) offsetof(structname, fieldname)
+#define PB_DO_PB_HTYPE_SINGULAR(structname, fieldname) offsetof(structname, fieldname)
+#define PB_DO_PB_HTYPE_ONEOF(structname, fieldname) offsetof(structname, PB_ONEOF_NAME(FULL, fieldname))
+#define PB_DO_PB_HTYPE_OPTIONAL(structname, fieldname) offsetof(structname, fieldname)
+#define PB_DO_PB_HTYPE_REPEATED(structname, fieldname) offsetof(structname, fieldname)
+#define PB_DO_PB_HTYPE_FIXARRAY(structname, fieldname) offsetof(structname, fieldname)
+
+#define PB_SIZE_OFFSET_STATIC(htype, structname, fieldname) PB_SO ## htype(structname, fieldname)
+#define PB_SIZE_OFFSET_POINTER(htype, structname, fieldname) PB_SO_PTR ## htype(structname, fieldname)
+#define PB_SIZE_OFFSET_CALLBACK(htype, structname, fieldname) PB_SO_CB ## htype(structname, fieldname)
+#define PB_SO_PB_HTYPE_REQUIRED(structname, fieldname) 0
+#define PB_SO_PB_HTYPE_SINGULAR(structname, fieldname) 0
+#define PB_SO_PB_HTYPE_ONEOF(structname, fieldname) PB_SO_PB_HTYPE_ONEOF2(structname, PB_ONEOF_NAME(FULL, fieldname), PB_ONEOF_NAME(UNION, fieldname))
+#define PB_SO_PB_HTYPE_ONEOF2(structname, fullname, unionname) PB_SO_PB_HTYPE_ONEOF3(structname, fullname, unionname)
+#define PB_SO_PB_HTYPE_ONEOF3(structname, fullname, unionname) pb_delta(structname, fullname, which_ ## unionname)
+#define PB_SO_PB_HTYPE_OPTIONAL(structname, fieldname) pb_delta(structname, fieldname, has_ ## fieldname)
+#define PB_SO_PB_HTYPE_REPEATED(structname, fieldname) pb_delta(structname, fieldname, fieldname ## _count)
+#define PB_SO_PB_HTYPE_FIXARRAY(structname, fieldname) 0
+#define PB_SO_PTR_PB_HTYPE_REQUIRED(structname, fieldname) 0
+#define PB_SO_PTR_PB_HTYPE_SINGULAR(structname, fieldname) 0
+#define PB_SO_PTR_PB_HTYPE_ONEOF(structname, fieldname) PB_SO_PB_HTYPE_ONEOF(structname, fieldname)
+#define PB_SO_PTR_PB_HTYPE_OPTIONAL(structname, fieldname) 0
+#define PB_SO_PTR_PB_HTYPE_REPEATED(structname, fieldname) PB_SO_PB_HTYPE_REPEATED(structname, fieldname)
+#define PB_SO_PTR_PB_HTYPE_FIXARRAY(structname, fieldname) 0
+#define PB_SO_CB_PB_HTYPE_REQUIRED(structname, fieldname) 0
+#define PB_SO_CB_PB_HTYPE_SINGULAR(structname, fieldname) 0
+#define PB_SO_CB_PB_HTYPE_ONEOF(structname, fieldname) PB_SO_PB_HTYPE_ONEOF(structname, fieldname)
+#define PB_SO_CB_PB_HTYPE_OPTIONAL(structname, fieldname) 0
+#define PB_SO_CB_PB_HTYPE_REPEATED(structname, fieldname) 0
+#define PB_SO_CB_PB_HTYPE_FIXARRAY(structname, fieldname) 0
+
+#define PB_ARRAY_SIZE_STATIC(htype, structname, fieldname) PB_AS ## htype(structname, fieldname)
+#define PB_ARRAY_SIZE_POINTER(htype, structname, fieldname) PB_AS_PTR ## htype(structname, fieldname)
+#define PB_ARRAY_SIZE_CALLBACK(htype, structname, fieldname) 1
+#define PB_AS_PB_HTYPE_REQUIRED(structname, fieldname) 1
+#define PB_AS_PB_HTYPE_SINGULAR(structname, fieldname) 1
+#define PB_AS_PB_HTYPE_OPTIONAL(structname, fieldname) 1
+#define PB_AS_PB_HTYPE_ONEOF(structname, fieldname) 1
+#define PB_AS_PB_HTYPE_REPEATED(structname, fieldname) pb_arraysize(structname, fieldname)
+#define PB_AS_PB_HTYPE_FIXARRAY(structname, fieldname) pb_arraysize(structname, fieldname)
+#define PB_AS_PTR_PB_HTYPE_REQUIRED(structname, fieldname) 1
+#define PB_AS_PTR_PB_HTYPE_SINGULAR(structname, fieldname) 1
+#define PB_AS_PTR_PB_HTYPE_OPTIONAL(structname, fieldname) 1
+#define PB_AS_PTR_PB_HTYPE_ONEOF(structname, fieldname) 1
+#define PB_AS_PTR_PB_HTYPE_REPEATED(structname, fieldname) 1
+#define PB_AS_PTR_PB_HTYPE_FIXARRAY(structname, fieldname) pb_arraysize(structname, fieldname[0])
+
+#define PB_DATA_SIZE_STATIC(htype, structname, fieldname) PB_DS ## htype(structname, fieldname)
+#define PB_DATA_SIZE_POINTER(htype, structname, fieldname) PB_DS_PTR ## htype(structname, fieldname)
+#define PB_DATA_SIZE_CALLBACK(htype, structname, fieldname) PB_DS_CB ## htype(structname, fieldname)
+#define PB_DS_PB_HTYPE_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname)
+#define PB_DS_PB_HTYPE_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname)
+#define PB_DS_PB_HTYPE_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname)
+#define PB_DS_PB_HTYPE_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname))
+#define PB_DS_PB_HTYPE_REPEATED(structname, fieldname) pb_membersize(structname, fieldname[0])
+#define PB_DS_PB_HTYPE_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname[0])
+#define PB_DS_PTR_PB_HTYPE_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname[0])
+#define PB_DS_PTR_PB_HTYPE_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname[0])
+#define PB_DS_PTR_PB_HTYPE_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname[0])
+#define PB_DS_PTR_PB_HTYPE_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname)[0])
+#define PB_DS_PTR_PB_HTYPE_REPEATED(structname, fieldname) pb_membersize(structname, fieldname[0])
+#define PB_DS_PTR_PB_HTYPE_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname[0][0])
+#define PB_DS_CB_PB_HTYPE_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname)
+#define PB_DS_CB_PB_HTYPE_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname)
+#define PB_DS_CB_PB_HTYPE_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname)
+#define PB_DS_CB_PB_HTYPE_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname))
+#define PB_DS_CB_PB_HTYPE_REPEATED(structname, fieldname) pb_membersize(structname, fieldname)
+#define PB_DS_CB_PB_HTYPE_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname)
+
+#define PB_ONEOF_NAME(type, tuple) PB_EXPAND(PB_ONEOF_NAME_ ## type tuple)
+#define PB_ONEOF_NAME_UNION(unionname,membername,fullname) unionname
+#define PB_ONEOF_NAME_MEMBER(unionname,membername,fullname) membername
+#define PB_ONEOF_NAME_FULL(unionname,membername,fullname) fullname
+
+#define PB_GEN_SUBMSG_INFO(structname, atype, htype, ltype, fieldname, tag) \
+ PB_SUBMSG_INFO_ ## htype(_PB_LTYPE_ ## ltype, structname, fieldname)
+
+#define PB_SUBMSG_INFO_REQUIRED(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
+#define PB_SUBMSG_INFO_SINGULAR(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
+#define PB_SUBMSG_INFO_OPTIONAL(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
+#define PB_SUBMSG_INFO_ONEOF(ltype, structname, fieldname) PB_SUBMSG_INFO_ONEOF2(ltype, structname, PB_ONEOF_NAME(UNION, fieldname), PB_ONEOF_NAME(MEMBER, fieldname))
+#define PB_SUBMSG_INFO_ONEOF2(ltype, structname, unionname, membername) PB_SUBMSG_INFO_ONEOF3(ltype, structname, unionname, membername)
+#define PB_SUBMSG_INFO_ONEOF3(ltype, structname, unionname, membername) PB_SI ## ltype(structname ## _ ## unionname ## _ ## membername ## _MSGTYPE)
+#define PB_SUBMSG_INFO_REPEATED(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
+#define PB_SUBMSG_INFO_FIXARRAY(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
+#define PB_SI_PB_LTYPE_BOOL(t)
+#define PB_SI_PB_LTYPE_BYTES(t)
+#define PB_SI_PB_LTYPE_DOUBLE(t)
+#define PB_SI_PB_LTYPE_ENUM(t)
+#define PB_SI_PB_LTYPE_UENUM(t)
+#define PB_SI_PB_LTYPE_FIXED32(t)
+#define PB_SI_PB_LTYPE_FIXED64(t)
+#define PB_SI_PB_LTYPE_FLOAT(t)
+#define PB_SI_PB_LTYPE_INT32(t)
+#define PB_SI_PB_LTYPE_INT64(t)
+#define PB_SI_PB_LTYPE_MESSAGE(t) PB_SUBMSG_DESCRIPTOR(t)
+#define PB_SI_PB_LTYPE_MSG_W_CB(t) PB_SUBMSG_DESCRIPTOR(t)
+#define PB_SI_PB_LTYPE_SFIXED32(t)
+#define PB_SI_PB_LTYPE_SFIXED64(t)
+#define PB_SI_PB_LTYPE_SINT32(t)
+#define PB_SI_PB_LTYPE_SINT64(t)
+#define PB_SI_PB_LTYPE_STRING(t)
+#define PB_SI_PB_LTYPE_UINT32(t)
+#define PB_SI_PB_LTYPE_UINT64(t)
+#define PB_SI_PB_LTYPE_EXTENSION(t)
+#define PB_SI_PB_LTYPE_FIXED_LENGTH_BYTES(t)
+#define PB_SUBMSG_DESCRIPTOR(t) &(t ## _msg),
+
+/* The field descriptors use a variable width format, with width of either
+ * 1, 2, 4 or 8 of 32-bit words. The two lowest bytes of the first byte always
+ * encode the descriptor size, 6 lowest bits of field tag number, and 8 bits
+ * of the field type.
+ *
+ * Descriptor size is encoded as 0 = 1 word, 1 = 2 words, 2 = 4 words, 3 = 8 words.
+ *
+ * Formats, listed starting with the least significant bit of the first word.
+ * 1 word: [2-bit len] [6-bit tag] [8-bit type] [8-bit data_offset] [4-bit size_offset] [4-bit data_size]
+ *
+ * 2 words: [2-bit len] [6-bit tag] [8-bit type] [12-bit array_size] [4-bit size_offset]
+ * [16-bit data_offset] [12-bit data_size] [4-bit tag>>6]
+ *
+ * 4 words: [2-bit len] [6-bit tag] [8-bit type] [16-bit array_size]
+ * [8-bit size_offset] [24-bit tag>>6]
+ * [32-bit data_offset]
+ * [32-bit data_size]
+ *
+ * 8 words: [2-bit len] [6-bit tag] [8-bit type] [16-bit reserved]
+ * [8-bit size_offset] [24-bit tag>>6]
+ * [32-bit data_offset]
+ * [32-bit data_size]
+ * [32-bit array_size]
+ * [32-bit reserved]
+ * [32-bit reserved]
+ * [32-bit reserved]
+ */
+
+#define PB_FIELDINFO_1(tag, type, data_offset, data_size, size_offset, array_size) \
+ (0 | (((tag) << 2) & 0xFF) | ((type) << 8) | (((uint32_t)(data_offset) & 0xFF) << 16) | \
+ (((uint32_t)(size_offset) & 0x0F) << 24) | (((uint32_t)(data_size) & 0x0F) << 28)),
+
+#define PB_FIELDINFO_2(tag, type, data_offset, data_size, size_offset, array_size) \
+ (1 | (((tag) << 2) & 0xFF) | ((type) << 8) | (((uint32_t)(array_size) & 0xFFF) << 16) | (((uint32_t)(size_offset) & 0x0F) << 28)), \
+ (((uint32_t)(data_offset) & 0xFFFF) | (((uint32_t)(data_size) & 0xFFF) << 16) | (((uint32_t)(tag) & 0x3c0) << 22)),
+
+#define PB_FIELDINFO_4(tag, type, data_offset, data_size, size_offset, array_size) \
+ (2 | (((tag) << 2) & 0xFF) | ((type) << 8) | (((uint32_t)(array_size) & 0xFFFF) << 16)), \
+ ((uint32_t)(int_least8_t)(size_offset) | (((uint32_t)(tag) << 2) & 0xFFFFFF00)), \
+ (data_offset), (data_size),
+
+#define PB_FIELDINFO_8(tag, type, data_offset, data_size, size_offset, array_size) \
+ (3 | (((tag) << 2) & 0xFF) | ((type) << 8)), \
+ ((uint32_t)(int_least8_t)(size_offset) | (((uint32_t)(tag) << 2) & 0xFFFFFF00)), \
+ (data_offset), (data_size), (array_size), 0, 0, 0,
+
+/* These assertions verify that the field information fits in the allocated space.
+ * The generator tries to automatically determine the correct width that can fit all
+ * data associated with a message. These asserts will fail only if there has been a
+ * problem in the automatic logic - this may be worth reporting as a bug. As a workaround,
+ * you can increase the descriptor width by defining PB_FIELDINFO_WIDTH or by setting
+ * descriptorsize option in .options file.
+ */
+#define PB_FITS(value,bits) ((uint32_t)(value) < ((uint32_t)1<2GB messages with nanopb anyway.
+ */
+#define PB_FIELDINFO_ASSERT_4(tag, type, data_offset, data_size, size_offset, array_size) \
+ PB_STATIC_ASSERT(PB_FITS(tag,30) && PB_FITS(data_offset,31) && PB_FITS(size_offset,8) && PB_FITS(data_size,31) && PB_FITS(array_size,16), FIELDINFO_DOES_NOT_FIT_width4_field ## tag)
+
+#define PB_FIELDINFO_ASSERT_8(tag, type, data_offset, data_size, size_offset, array_size) \
+ PB_STATIC_ASSERT(PB_FITS(tag,30) && PB_FITS(data_offset,31) && PB_FITS(size_offset,8) && PB_FITS(data_size,31) && PB_FITS(array_size,31), FIELDINFO_DOES_NOT_FIT_width8_field ## tag)
+#endif
+
+
+/* Automatic picking of FIELDINFO width:
+ * Uses width 1 when possible, otherwise resorts to width 2.
+ * This is used when PB_BIND() is called with "AUTO" as the argument.
+ * The generator will give explicit size argument when it knows that a message
+ * structure grows beyond 1-word format limits.
+ */
+#define PB_FIELDINFO_WIDTH_AUTO(atype, htype, ltype) PB_FI_WIDTH ## atype(htype, ltype)
+#define PB_FI_WIDTH_PB_ATYPE_STATIC(htype, ltype) PB_FI_WIDTH ## htype(ltype)
+#define PB_FI_WIDTH_PB_ATYPE_POINTER(htype, ltype) PB_FI_WIDTH ## htype(ltype)
+#define PB_FI_WIDTH_PB_ATYPE_CALLBACK(htype, ltype) 2
+#define PB_FI_WIDTH_PB_HTYPE_REQUIRED(ltype) PB_FI_WIDTH ## ltype
+#define PB_FI_WIDTH_PB_HTYPE_SINGULAR(ltype) PB_FI_WIDTH ## ltype
+#define PB_FI_WIDTH_PB_HTYPE_OPTIONAL(ltype) PB_FI_WIDTH ## ltype
+#define PB_FI_WIDTH_PB_HTYPE_ONEOF(ltype) PB_FI_WIDTH ## ltype
+#define PB_FI_WIDTH_PB_HTYPE_REPEATED(ltype) 2
+#define PB_FI_WIDTH_PB_HTYPE_FIXARRAY(ltype) 2
+#define PB_FI_WIDTH_PB_LTYPE_BOOL 1
+#define PB_FI_WIDTH_PB_LTYPE_BYTES 2
+#define PB_FI_WIDTH_PB_LTYPE_DOUBLE 1
+#define PB_FI_WIDTH_PB_LTYPE_ENUM 1
+#define PB_FI_WIDTH_PB_LTYPE_UENUM 1
+#define PB_FI_WIDTH_PB_LTYPE_FIXED32 1
+#define PB_FI_WIDTH_PB_LTYPE_FIXED64 1
+#define PB_FI_WIDTH_PB_LTYPE_FLOAT 1
+#define PB_FI_WIDTH_PB_LTYPE_INT32 1
+#define PB_FI_WIDTH_PB_LTYPE_INT64 1
+#define PB_FI_WIDTH_PB_LTYPE_MESSAGE 2
+#define PB_FI_WIDTH_PB_LTYPE_MSG_W_CB 2
+#define PB_FI_WIDTH_PB_LTYPE_SFIXED32 1
+#define PB_FI_WIDTH_PB_LTYPE_SFIXED64 1
+#define PB_FI_WIDTH_PB_LTYPE_SINT32 1
+#define PB_FI_WIDTH_PB_LTYPE_SINT64 1
+#define PB_FI_WIDTH_PB_LTYPE_STRING 2
+#define PB_FI_WIDTH_PB_LTYPE_UINT32 1
+#define PB_FI_WIDTH_PB_LTYPE_UINT64 1
+#define PB_FI_WIDTH_PB_LTYPE_EXTENSION 1
+#define PB_FI_WIDTH_PB_LTYPE_FIXED_LENGTH_BYTES 2
+
+/* The mapping from protobuf types to LTYPEs is done using these macros. */
+#define PB_LTYPE_MAP_BOOL PB_LTYPE_BOOL
+#define PB_LTYPE_MAP_BYTES PB_LTYPE_BYTES
+#define PB_LTYPE_MAP_DOUBLE PB_LTYPE_FIXED64
+#define PB_LTYPE_MAP_ENUM PB_LTYPE_VARINT
+#define PB_LTYPE_MAP_UENUM PB_LTYPE_UVARINT
+#define PB_LTYPE_MAP_FIXED32 PB_LTYPE_FIXED32
+#define PB_LTYPE_MAP_FIXED64 PB_LTYPE_FIXED64
+#define PB_LTYPE_MAP_FLOAT PB_LTYPE_FIXED32
+#define PB_LTYPE_MAP_INT32 PB_LTYPE_VARINT
+#define PB_LTYPE_MAP_INT64 PB_LTYPE_VARINT
+#define PB_LTYPE_MAP_MESSAGE PB_LTYPE_SUBMESSAGE
+#define PB_LTYPE_MAP_MSG_W_CB PB_LTYPE_SUBMSG_W_CB
+#define PB_LTYPE_MAP_SFIXED32 PB_LTYPE_FIXED32
+#define PB_LTYPE_MAP_SFIXED64 PB_LTYPE_FIXED64
+#define PB_LTYPE_MAP_SINT32 PB_LTYPE_SVARINT
+#define PB_LTYPE_MAP_SINT64 PB_LTYPE_SVARINT
+#define PB_LTYPE_MAP_STRING PB_LTYPE_STRING
+#define PB_LTYPE_MAP_UINT32 PB_LTYPE_UVARINT
+#define PB_LTYPE_MAP_UINT64 PB_LTYPE_UVARINT
+#define PB_LTYPE_MAP_EXTENSION PB_LTYPE_EXTENSION
+#define PB_LTYPE_MAP_FIXED_LENGTH_BYTES PB_LTYPE_FIXED_LENGTH_BYTES
+
+/* These macros are used for giving out error messages.
+ * They are mostly a debugging aid; the main error information
+ * is the true/false return value from functions.
+ * Some code space can be saved by disabling the error
+ * messages if not used.
+ *
+ * PB_SET_ERROR() sets the error message if none has been set yet.
+ * msg must be a constant string literal.
+ * PB_GET_ERROR() always returns a pointer to a string.
+ * PB_RETURN_ERROR() sets the error and returns false from current
+ * function.
+ */
+#ifdef PB_NO_ERRMSG
+#define PB_SET_ERROR(stream, msg) PB_UNUSED(stream)
+#define PB_GET_ERROR(stream) "(errmsg disabled)"
+#else
+#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
+#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
+#endif
+
+#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#ifdef __cplusplus
+#if __cplusplus >= 201103L
+#define PB_CONSTEXPR constexpr
+#else // __cplusplus >= 201103L
+#define PB_CONSTEXPR
+#endif // __cplusplus >= 201103L
+
+#if __cplusplus >= 201703L
+#define PB_INLINE_CONSTEXPR inline constexpr
+#else // __cplusplus >= 201703L
+#define PB_INLINE_CONSTEXPR PB_CONSTEXPR
+#endif // __cplusplus >= 201703L
+
+namespace nanopb {
+// Each type will be partially specialized by the generator.
+template struct MessageDescriptor;
+} // namespace nanopb
+#endif /* __cplusplus */
+
+#endif
diff --git a/vendor/nanopb/spm_headers/nanopb/pb_common.h b/vendor/nanopb/spm_headers/nanopb/pb_common.h
index 9449ad84..58aa90f7 100644
--- a/vendor/nanopb/spm_headers/nanopb/pb_common.h
+++ b/vendor/nanopb/spm_headers/nanopb/pb_common.h
@@ -1 +1,49 @@
-../../pb_common.h
\ No newline at end of file
+/* pb_common.h: Common support functions for pb_encode.c and pb_decode.c.
+ * These functions are rarely needed by applications directly.
+ */
+
+#ifndef PB_COMMON_H_INCLUDED
+#define PB_COMMON_H_INCLUDED
+
+#include "pb.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Initialize the field iterator structure to beginning.
+ * Returns false if the message type is empty. */
+bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message);
+
+/* Get a field iterator for extension field. */
+bool pb_field_iter_begin_extension(pb_field_iter_t *iter, pb_extension_t *extension);
+
+/* Same as pb_field_iter_begin(), but for const message pointer.
+ * Note that the pointers in pb_field_iter_t will be non-const but shouldn't
+ * be written to when using these functions. */
+bool pb_field_iter_begin_const(pb_field_iter_t *iter, const pb_msgdesc_t *desc, const void *message);
+bool pb_field_iter_begin_extension_const(pb_field_iter_t *iter, const pb_extension_t *extension);
+
+/* Advance the iterator to the next field.
+ * Returns false when the iterator wraps back to the first field. */
+bool pb_field_iter_next(pb_field_iter_t *iter);
+
+/* Advance the iterator until it points at a field with the given tag.
+ * Returns false if no such field exists. */
+bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag);
+
+/* Find a field with type PB_LTYPE_EXTENSION, or return false if not found.
+ * There can be only one extension range field per message. */
+bool pb_field_iter_find_extension(pb_field_iter_t *iter);
+
+#ifdef PB_VALIDATE_UTF8
+/* Validate UTF-8 text string */
+bool pb_validate_utf8(const char *s);
+#endif
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
+
diff --git a/vendor/nanopb/spm_headers/nanopb/pb_decode.h b/vendor/nanopb/spm_headers/nanopb/pb_decode.h
index d8288c70..824acd4e 100644
--- a/vendor/nanopb/spm_headers/nanopb/pb_decode.h
+++ b/vendor/nanopb/spm_headers/nanopb/pb_decode.h
@@ -1 +1,199 @@
-../../pb_decode.h
\ No newline at end of file
+/* pb_decode.h: Functions to decode protocol buffers. Depends on pb_decode.c.
+ * The main function is pb_decode. You also need an input stream, and the
+ * field descriptions created by nanopb_generator.py.
+ */
+
+#ifndef PB_DECODE_H_INCLUDED
+#define PB_DECODE_H_INCLUDED
+
+#include "pb.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Structure for defining custom input streams. You will need to provide
+ * a callback function to read the bytes from your storage, which can be
+ * for example a file or a network socket.
+ *
+ * The callback must conform to these rules:
+ *
+ * 1) Return false on IO errors. This will cause decoding to abort.
+ * 2) You can use state to store your own data (e.g. buffer pointer),
+ * and rely on pb_read to verify that no-body reads past bytes_left.
+ * 3) Your callback may be used with substreams, in which case bytes_left
+ * is different than from the main stream. Don't use bytes_left to compute
+ * any pointers.
+ */
+struct pb_istream_s
+{
+#ifdef PB_BUFFER_ONLY
+ /* Callback pointer is not used in buffer-only configuration.
+ * Having an int pointer here allows binary compatibility but
+ * gives an error if someone tries to assign callback function.
+ */
+ int *callback;
+#else
+ bool (*callback)(pb_istream_t *stream, pb_byte_t *buf, size_t count);
+#endif
+
+ void *state; /* Free field for use by callback implementation */
+ size_t bytes_left;
+
+#ifndef PB_NO_ERRMSG
+ const char *errmsg;
+#endif
+};
+
+#ifndef PB_NO_ERRMSG
+#define PB_ISTREAM_EMPTY {0,0,0,0}
+#else
+#define PB_ISTREAM_EMPTY {0,0,0}
+#endif
+
+/***************************
+ * Main decoding functions *
+ ***************************/
+
+/* Decode a single protocol buffers message from input stream into a C structure.
+ * Returns true on success, false on any failure.
+ * The actual struct pointed to by dest must match the description in fields.
+ * Callback fields of the destination structure must be initialized by caller.
+ * All other fields will be initialized by this function.
+ *
+ * Example usage:
+ * MyMessage msg = {};
+ * uint8_t buffer[64];
+ * pb_istream_t stream;
+ *
+ * // ... read some data into buffer ...
+ *
+ * stream = pb_istream_from_buffer(buffer, count);
+ * pb_decode(&stream, MyMessage_fields, &msg);
+ */
+bool pb_decode(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct);
+
+/* Extended version of pb_decode, with several options to control
+ * the decoding process:
+ *
+ * PB_DECODE_NOINIT: Do not initialize the fields to default values.
+ * This is slightly faster if you do not need the default
+ * values and instead initialize the structure to 0 using
+ * e.g. memset(). This can also be used for merging two
+ * messages, i.e. combine already existing data with new
+ * values.
+ *
+ * PB_DECODE_DELIMITED: Input message starts with the message size as varint.
+ * Corresponds to parseDelimitedFrom() in Google's
+ * protobuf API.
+ *
+ * PB_DECODE_NULLTERMINATED: Stop reading when field tag is read as 0. This allows
+ * reading null terminated messages.
+ * NOTE: Until nanopb-0.4.0, pb_decode() also allows
+ * null-termination. This behaviour is not supported in
+ * most other protobuf implementations, so PB_DECODE_DELIMITED
+ * is a better option for compatibility.
+ *
+ * Multiple flags can be combined with bitwise or (| operator)
+ */
+#define PB_DECODE_NOINIT 0x01U
+#define PB_DECODE_DELIMITED 0x02U
+#define PB_DECODE_NULLTERMINATED 0x04U
+bool pb_decode_ex(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct, unsigned int flags);
+
+/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
+#define pb_decode_noinit(s,f,d) pb_decode_ex(s,f,d, PB_DECODE_NOINIT)
+#define pb_decode_delimited(s,f,d) pb_decode_ex(s,f,d, PB_DECODE_DELIMITED)
+#define pb_decode_delimited_noinit(s,f,d) pb_decode_ex(s,f,d, PB_DECODE_DELIMITED | PB_DECODE_NOINIT)
+#define pb_decode_nullterminated(s,f,d) pb_decode_ex(s,f,d, PB_DECODE_NULLTERMINATED)
+
+#ifdef PB_ENABLE_MALLOC
+/* Release any allocated pointer fields. If you use dynamic allocation, you should
+ * call this for any successfully decoded message when you are done with it. If
+ * pb_decode() returns with an error, the message is already released.
+ */
+void pb_release(const pb_msgdesc_t *fields, void *dest_struct);
+#else
+/* Allocation is not supported, so release is no-op */
+#define pb_release(fields, dest_struct) PB_UNUSED(fields); PB_UNUSED(dest_struct);
+#endif
+
+
+/**************************************
+ * Functions for manipulating streams *
+ **************************************/
+
+/* Create an input stream for reading from a memory buffer.
+ *
+ * msglen should be the actual length of the message, not the full size of
+ * allocated buffer.
+ *
+ * Alternatively, you can use a custom stream that reads directly from e.g.
+ * a file or a network socket.
+ */
+pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t msglen);
+
+/* Function to read from a pb_istream_t. You can use this if you need to
+ * read some custom header data, or to read data in field callbacks.
+ */
+bool pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count);
+
+
+/************************************************
+ * Helper functions for writing field callbacks *
+ ************************************************/
+
+/* Decode the tag for the next field in the stream. Gives the wire type and
+ * field tag. At end of the message, returns false and sets eof to true. */
+bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof);
+
+/* Skip the field payload data, given the wire type. */
+bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type);
+
+/* Decode an integer in the varint format. This works for enum, int32,
+ * int64, uint32 and uint64 field types. */
+#ifndef PB_WITHOUT_64BIT
+bool pb_decode_varint(pb_istream_t *stream, uint64_t *dest);
+#else
+#define pb_decode_varint pb_decode_varint32
+#endif
+
+/* Decode an integer in the varint format. This works for enum, int32,
+ * and uint32 field types. */
+bool pb_decode_varint32(pb_istream_t *stream, uint32_t *dest);
+
+/* Decode a bool value in varint format. */
+bool pb_decode_bool(pb_istream_t *stream, bool *dest);
+
+/* Decode an integer in the zig-zagged svarint format. This works for sint32
+ * and sint64. */
+#ifndef PB_WITHOUT_64BIT
+bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest);
+#else
+bool pb_decode_svarint(pb_istream_t *stream, int32_t *dest);
+#endif
+
+/* Decode a fixed32, sfixed32 or float value. You need to pass a pointer to
+ * a 4-byte wide C variable. */
+bool pb_decode_fixed32(pb_istream_t *stream, void *dest);
+
+#ifndef PB_WITHOUT_64BIT
+/* Decode a fixed64, sfixed64 or double value. You need to pass a pointer to
+ * a 8-byte wide C variable. */
+bool pb_decode_fixed64(pb_istream_t *stream, void *dest);
+#endif
+
+#ifdef PB_CONVERT_DOUBLE_FLOAT
+/* Decode a double value into float variable. */
+bool pb_decode_double_as_float(pb_istream_t *stream, float *dest);
+#endif
+
+/* Make a limited-length substream for reading a PB_WT_STRING field. */
+bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream);
+bool pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/vendor/nanopb/spm_headers/nanopb/pb_encode.h b/vendor/nanopb/spm_headers/nanopb/pb_encode.h
index 3236a5f5..89136832 100644
--- a/vendor/nanopb/spm_headers/nanopb/pb_encode.h
+++ b/vendor/nanopb/spm_headers/nanopb/pb_encode.h
@@ -1 +1,185 @@
-../../pb_encode.h
\ No newline at end of file
+/* pb_encode.h: Functions to encode protocol buffers. Depends on pb_encode.c.
+ * The main function is pb_encode. You also need an output stream, and the
+ * field descriptions created by nanopb_generator.py.
+ */
+
+#ifndef PB_ENCODE_H_INCLUDED
+#define PB_ENCODE_H_INCLUDED
+
+#include "pb.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Structure for defining custom output streams. You will need to provide
+ * a callback function to write the bytes to your storage, which can be
+ * for example a file or a network socket.
+ *
+ * The callback must conform to these rules:
+ *
+ * 1) Return false on IO errors. This will cause encoding to abort.
+ * 2) You can use state to store your own data (e.g. buffer pointer).
+ * 3) pb_write will update bytes_written after your callback runs.
+ * 4) Substreams will modify max_size and bytes_written. Don't use them
+ * to calculate any pointers.
+ */
+struct pb_ostream_s
+{
+#ifdef PB_BUFFER_ONLY
+ /* Callback pointer is not used in buffer-only configuration.
+ * Having an int pointer here allows binary compatibility but
+ * gives an error if someone tries to assign callback function.
+ * Also, NULL pointer marks a 'sizing stream' that does not
+ * write anything.
+ */
+ const int *callback;
+#else
+ bool (*callback)(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
+#endif
+ void *state; /* Free field for use by callback implementation. */
+ size_t max_size; /* Limit number of output bytes written (or use SIZE_MAX). */
+ size_t bytes_written; /* Number of bytes written so far. */
+
+#ifndef PB_NO_ERRMSG
+ const char *errmsg;
+#endif
+};
+
+/***************************
+ * Main encoding functions *
+ ***************************/
+
+/* Encode a single protocol buffers message from C structure into a stream.
+ * Returns true on success, false on any failure.
+ * The actual struct pointed to by src_struct must match the description in fields.
+ * All required fields in the struct are assumed to have been filled in.
+ *
+ * Example usage:
+ * MyMessage msg = {};
+ * uint8_t buffer[64];
+ * pb_ostream_t stream;
+ *
+ * msg.field1 = 42;
+ * stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
+ * pb_encode(&stream, MyMessage_fields, &msg);
+ */
+bool pb_encode(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct);
+
+/* Extended version of pb_encode, with several options to control the
+ * encoding process:
+ *
+ * PB_ENCODE_DELIMITED: Prepend the length of message as a varint.
+ * Corresponds to writeDelimitedTo() in Google's
+ * protobuf API.
+ *
+ * PB_ENCODE_NULLTERMINATED: Append a null byte to the message for termination.
+ * NOTE: This behaviour is not supported in most other
+ * protobuf implementations, so PB_ENCODE_DELIMITED
+ * is a better option for compatibility.
+ */
+#define PB_ENCODE_DELIMITED 0x02U
+#define PB_ENCODE_NULLTERMINATED 0x04U
+bool pb_encode_ex(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct, unsigned int flags);
+
+/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
+#define pb_encode_delimited(s,f,d) pb_encode_ex(s,f,d, PB_ENCODE_DELIMITED)
+#define pb_encode_nullterminated(s,f,d) pb_encode_ex(s,f,d, PB_ENCODE_NULLTERMINATED)
+
+/* Encode the message to get the size of the encoded data, but do not store
+ * the data. */
+bool pb_get_encoded_size(size_t *size, const pb_msgdesc_t *fields, const void *src_struct);
+
+/**************************************
+ * Functions for manipulating streams *
+ **************************************/
+
+/* Create an output stream for writing into a memory buffer.
+ * The number of bytes written can be found in stream.bytes_written after
+ * encoding the message.
+ *
+ * Alternatively, you can use a custom stream that writes directly to e.g.
+ * a file or a network socket.
+ */
+pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize);
+
+/* Pseudo-stream for measuring the size of a message without actually storing
+ * the encoded data.
+ *
+ * Example usage:
+ * MyMessage msg = {};
+ * pb_ostream_t stream = PB_OSTREAM_SIZING;
+ * pb_encode(&stream, MyMessage_fields, &msg);
+ * printf("Message size is %d\n", stream.bytes_written);
+ */
+#ifndef PB_NO_ERRMSG
+#define PB_OSTREAM_SIZING {0,0,0,0,0}
+#else
+#define PB_OSTREAM_SIZING {0,0,0,0}
+#endif
+
+/* Function to write into a pb_ostream_t stream. You can use this if you need
+ * to append or prepend some custom headers to the message.
+ */
+bool pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
+
+
+/************************************************
+ * Helper functions for writing field callbacks *
+ ************************************************/
+
+/* Encode field header based on type and field number defined in the field
+ * structure. Call this from the callback before writing out field contents. */
+bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_iter_t *field);
+
+/* Encode field header by manually specifying wire type. You need to use this
+ * if you want to write out packed arrays from a callback field. */
+bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number);
+
+/* Encode an integer in the varint format.
+ * This works for bool, enum, int32, int64, uint32 and uint64 field types. */
+#ifndef PB_WITHOUT_64BIT
+bool pb_encode_varint(pb_ostream_t *stream, uint64_t value);
+#else
+bool pb_encode_varint(pb_ostream_t *stream, uint32_t value);
+#endif
+
+/* Encode an integer in the zig-zagged svarint format.
+ * This works for sint32 and sint64. */
+#ifndef PB_WITHOUT_64BIT
+bool pb_encode_svarint(pb_ostream_t *stream, int64_t value);
+#else
+bool pb_encode_svarint(pb_ostream_t *stream, int32_t value);
+#endif
+
+/* Encode a string or bytes type field. For strings, pass strlen(s) as size. */
+bool pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size);
+
+/* Encode a fixed32, sfixed32 or float value.
+ * You need to pass a pointer to a 4-byte wide C variable. */
+bool pb_encode_fixed32(pb_ostream_t *stream, const void *value);
+
+#ifndef PB_WITHOUT_64BIT
+/* Encode a fixed64, sfixed64 or double value.
+ * You need to pass a pointer to a 8-byte wide C variable. */
+bool pb_encode_fixed64(pb_ostream_t *stream, const void *value);
+#endif
+
+#ifdef PB_CONVERT_DOUBLE_FLOAT
+/* Encode a float value so that it appears like a double in the encoded
+ * message. */
+bool pb_encode_float_as_double(pb_ostream_t *stream, float value);
+#endif
+
+/* Encode a submessage field.
+ * You need to pass the pb_field_t array and pointer to struct, just like
+ * with pb_encode(). This internally encodes the submessage twice, first to
+ * calculate message size and then to actually write it out.
+ */
+bool pb_encode_submessage(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/vendor/nanopb/tests/SConstruct b/vendor/nanopb/tests/SConstruct
index 17550125..d2af0d70 100644
--- a/vendor/nanopb/tests/SConstruct
+++ b/vendor/nanopb/tests/SConstruct
@@ -3,7 +3,7 @@ Type 'scons' to build and run all the available test cases.
It will automatically detect your platform and C compiler and
build appropriately.
-You can modify the behavious using following options:
+You can modify the behaviour using following options:
BUILDDIR Directory to build into (default "build")
CC Name of C compiler
CXX Name of C++ compiler
@@ -162,12 +162,13 @@ if not env.get('NODEFARGS'):
# Debug info, warnings as errors
env.Append(CFLAGS = '-g -Wall -Werror ')
- env.Append(CORECFLAGS = '-Wextra')
+ env.Append(CORECFLAGS = '-Wextra ')
# Pedantic ANSI C. On AVR this doesn't work because we use large
# enums in some of the tests.
if env.get("EMBEDDED") != "AVR":
- env.Append(CFLAGS = '-ansi -pedantic')
+ env.Append(CFLAGS = '-ansi ')
+ env.Append(CORECFLAGS = '-pedantic ')
# Profiling and coverage
if not env.get("EMBEDDED"):
@@ -191,6 +192,9 @@ if not env.get('NODEFARGS'):
# More strict checks on the nanopb core
env.Append(CORECFLAGS = '/W4')
+ # Enable C11 standard
+ env.Append(CFLAGS = ' /std:c11 ')
+
# Disable warning about sizeof(union{}) construct that is used in
# message size macros, in e.g. multiple_files testcase. The C construct
# itself is valid, but quite rare, which causes Visual C++ to give a warning
@@ -203,7 +207,7 @@ if not env.get('NODEFARGS'):
if 'clang' in env['CXX']:
env.Append(CXXFLAGS = '-g -Wall -Werror -Wextra -Wno-missing-field-initializers')
elif 'g++' in env['CXX'] or 'gcc' in env['CXX']:
- env.Append(CXXFLAGS = '-g -Wall -Werror -Wextra -Wno-missing-field-initializers')
+ env.Append(CXXFLAGS = '-g -Wall -Werror -Wextra -Wno-missing-field-initializers -std=gnu++11')
elif 'cl' in env['CXX']:
env.Append(CXXFLAGS = '/Zi /W2 /WX /wd4116 /wd4127')
diff --git a/vendor/nanopb/tests/any_type/anytest.proto b/vendor/nanopb/tests/any_type/anytest.proto
index 0b86957f..891bfaab 100644
--- a/vendor/nanopb/tests/any_type/anytest.proto
+++ b/vendor/nanopb/tests/any_type/anytest.proto
@@ -13,7 +13,7 @@
// the type_url and value fields, and then call pb_decode() again on the value.
//
// This does result in unnecessarily copying the data around, so for larger
-// values it is preferrable to use callbacks on the fields instead.
+// values it is preferable to use callbacks on the fields instead.
syntax = "proto3";
import "google/protobuf/any.proto";
diff --git a/vendor/nanopb/tests/comments/comments.expected b/vendor/nanopb/tests/comments/comments.expected
index 0017cda1..0d96dc2a 100644
--- a/vendor/nanopb/tests/comments/comments.expected
+++ b/vendor/nanopb/tests/comments/comments.expected
@@ -3,4 +3,8 @@ LeadingEnumComment
ENUMVAL2.*TrailingEnumComment
Message1Comment
member2.*TrailingMemberComment
-
+m2member1.*m2comment1
+m2member50.*m2comment50
+m2member4.*m2comment4
+m2oneof10.*m2oneof10_comment
+m2oneof5.*m2oneof5_comment
diff --git a/vendor/nanopb/tests/comments/comments.proto b/vendor/nanopb/tests/comments/comments.proto
index e4825c62..0dba90f3 100644
--- a/vendor/nanopb/tests/comments/comments.proto
+++ b/vendor/nanopb/tests/comments/comments.proto
@@ -15,3 +15,15 @@ enum Enum1
ENUMVAL1 = 1;
ENUMVAL2 = 2; // TrailingEnumComment
}
+
+message Message2
+{
+ required string m2member1 = 1; // m2comment1
+ required string m2member50 = 50; // m2comment50
+ required string m2member4 = 4; // m2comment4
+
+ oneof m2oneof {
+ int32 m2oneof10 = 10; // m2oneof10_comment
+ int32 m2oneof5 = 5; // m2oneof5_comment
+ }
+}
diff --git a/vendor/nanopb/tests/cxx_descriptor/SConscript b/vendor/nanopb/tests/cxx_descriptor/SConscript
index a11aff03..1b609b70 100644
--- a/vendor/nanopb/tests/cxx_descriptor/SConscript
+++ b/vendor/nanopb/tests/cxx_descriptor/SConscript
@@ -19,6 +19,9 @@ for std in ["c++03", "c++11", "c++14", "c++17", "c++20"]:
print("Skipping {} test - compiler doesn't support it".format(std))
continue
+ if std == 'c++03':
+ e.Append(CPPDEFINES = {'PB_C99_STATIC_ASSERT': 1})
+
o1 = e.Object('message_descriptor_{}'.format(std), 'message_descriptor.cc')
o2 = e.Object('message.pb_{}'.format(std), 'message.pb.c')
p = e.Program([o1, o2])
diff --git a/vendor/nanopb/tests/fallback_type/SConscript b/vendor/nanopb/tests/fallback_type/SConscript
new file mode 100644
index 00000000..98dfd745
--- /dev/null
+++ b/vendor/nanopb/tests/fallback_type/SConscript
@@ -0,0 +1,7 @@
+# Test fallback_type option
+
+Import("env")
+
+env.NanopbProto(["fallback_type","fallback_type.options"])
+env.Object("fallback_type.pb.c")
+env.Match(['fallback_type.pb.h', 'fallback_type.expected'])
diff --git a/vendor/nanopb/tests/fallback_type/fallback_type.expected b/vendor/nanopb/tests/fallback_type/fallback_type.expected
new file mode 100644
index 00000000..05d72d09
--- /dev/null
+++ b/vendor/nanopb/tests/fallback_type/fallback_type.expected
@@ -0,0 +1,3 @@
+int32_t member1;
+char \*member2
+pb_callback_t member3
diff --git a/vendor/nanopb/tests/fallback_type/fallback_type.options b/vendor/nanopb/tests/fallback_type/fallback_type.options
new file mode 100644
index 00000000..8db3189f
--- /dev/null
+++ b/vendor/nanopb/tests/fallback_type/fallback_type.options
@@ -0,0 +1 @@
+Message1.member2 fallback_type:FT_POINTER
diff --git a/vendor/nanopb/tests/fallback_type/fallback_type.proto b/vendor/nanopb/tests/fallback_type/fallback_type.proto
new file mode 100644
index 00000000..2e1dc0a6
--- /dev/null
+++ b/vendor/nanopb/tests/fallback_type/fallback_type.proto
@@ -0,0 +1,9 @@
+syntax = "proto2";
+
+message Message1
+{
+ required int32 member1 = 1; // must remain as int
+ required string member2 = 2; // must become a pointer
+ required string member3 = 3; // must become pb_callback_t
+}
+
diff --git a/vendor/nanopb/tests/fuzztest/SConscript b/vendor/nanopb/tests/fuzztest/SConscript
index 7c0d6e27..a5df9050 100644
--- a/vendor/nanopb/tests/fuzztest/SConscript
+++ b/vendor/nanopb/tests/fuzztest/SConscript
@@ -80,12 +80,12 @@ def run_against_corpus(target, source, env):
count = 0
args = [str(source[0])]
- if env.has_key("TEST_RUNNER"):
+ if "TEST_RUNNER" in env:
args = [env["TEST_RUNNER"]] + args
- if env.has_key("FUZZTEST_CORPUS_SAMPLESIZE"):
+ if "FUZZTEST_CORPUS_SAMPLESIZE" in env:
samplesize = int(env["FUZZTEST_CORPUS_SAMPLESIZE"])
- elif env.has_key("EMBEDDED"):
+ elif env.get('EMBEDDED'):
samplesize = 100
else:
samplesize = 4096
diff --git a/vendor/nanopb/tests/fuzztest/random_data.c b/vendor/nanopb/tests/fuzztest/random_data.c
index 6fbc8128..46eeb448 100644
--- a/vendor/nanopb/tests/fuzztest/random_data.c
+++ b/vendor/nanopb/tests/fuzztest/random_data.c
@@ -55,7 +55,7 @@ uint8_t rand_byte()
}
/* Get a random length, with skewed distribution.
- * Favors the shorter lengths, but always atleast 1. */
+ * Favors the shorter lengths, but always at least 1. */
size_t rand_len(size_t max)
{
uint32_t w = rand_word();
diff --git a/vendor/nanopb/tests/fuzztest/random_data.h b/vendor/nanopb/tests/fuzztest/random_data.h
index 292b77c8..57923eab 100644
--- a/vendor/nanopb/tests/fuzztest/random_data.h
+++ b/vendor/nanopb/tests/fuzztest/random_data.h
@@ -23,7 +23,7 @@ bool rand_bool();
uint8_t rand_byte();
/* Get a random length, with skewed distribution.
- * Favors the shorter lengths, but always atleast 1. */
+ * Favors the shorter lengths, but always at least 1. */
size_t rand_len(size_t max);
/* Fills a buffer with random bytes with skewed distribution. */
diff --git a/vendor/nanopb/tests/options/options.proto b/vendor/nanopb/tests/options/options.proto
index 10acca6e..d5d3704a 100644
--- a/vendor/nanopb/tests/options/options.proto
+++ b/vendor/nanopb/tests/options/options.proto
@@ -119,9 +119,9 @@ message HasFieldMessage
optional int32 normal = 3;
}
-// Overriden type in generated C code
+// Overridden type in generated C code
message TypeOverrideMessage
{
required Enum1 normal = 1;
- required Enum1 overriden = 2 [(nanopb).type_override = TYPE_UINT32];
+ required Enum1 overridden = 2 [(nanopb).type_override = TYPE_UINT32];
}
diff --git a/vendor/nanopb/tests/options/options_h.expected b/vendor/nanopb/tests/options/options_h.expected
index 9e3be16a..9cad2272 100644
--- a/vendor/nanopb/tests/options/options_h.expected
+++ b/vendor/nanopb/tests/options/options_h.expected
@@ -18,7 +18,7 @@ Message5_EnumValue1
#define Message5_msgid 105
! has_proto3field
Enum1 normal
-uint32_t overriden
+uint32_t overridden
#define TypeOverrideMessage_init_default[ ]*\{_Enum1_MIN, 0\}
#define TypeOverrideMessage_init_zero[ ]*\{_Enum1_MIN, 0\}
diff --git a/vendor/nanopb/tests/regression/issue_692/SConscript b/vendor/nanopb/tests/regression/issue_692/SConscript
new file mode 100644
index 00000000..11f07ca2
--- /dev/null
+++ b/vendor/nanopb/tests/regression/issue_692/SConscript
@@ -0,0 +1,9 @@
+# Regression test for #693:
+# Duplicate declarations of size_unions with repeated fields inside a oneof
+
+Import("env")
+
+env.NanopbProto("other.proto")
+env.NanopbProto(["oneof.proto", "other.proto"])
+env.Object("oneof.pb.c")
+env.Object("test.c")
diff --git a/vendor/nanopb/tests/regression/issue_692/oneof.proto b/vendor/nanopb/tests/regression/issue_692/oneof.proto
new file mode 100644
index 00000000..7f7baafe
--- /dev/null
+++ b/vendor/nanopb/tests/regression/issue_692/oneof.proto
@@ -0,0 +1,19 @@
+syntax = "proto3";
+
+import "other.proto";
+
+message FirstOneof {}
+
+message Bar {
+ oneof content {
+ FirstOneof first = 1;
+ SecondOneof second = 2; // unknown size if no options are considered
+ }
+}
+
+message Foo {
+ AnotherList foo = 1; // again, unknown size
+ Bar bar = 2; // no duplicate size_union shall be generated anymore
+}
+
+
diff --git a/vendor/nanopb/tests/regression/issue_692/other.proto b/vendor/nanopb/tests/regression/issue_692/other.proto
new file mode 100644
index 00000000..733103cb
--- /dev/null
+++ b/vendor/nanopb/tests/regression/issue_692/other.proto
@@ -0,0 +1,9 @@
+syntax = "proto3";
+
+message SecondOneof {
+ repeated int32 foo = 1;
+}
+
+message AnotherList {
+ repeated int32 bar = 1;
+}
\ No newline at end of file
diff --git a/vendor/nanopb/tests/regression/issue_692/test.c b/vendor/nanopb/tests/regression/issue_692/test.c
new file mode 100644
index 00000000..95281b7d
--- /dev/null
+++ b/vendor/nanopb/tests/regression/issue_692/test.c
@@ -0,0 +1,7 @@
+/* This fakes the situation where other.proto was not found at generation time,
+ so size_union declarations are generated. */
+
+#define SecondOneof_size 88
+#define AnotherList_size 88
+
+#include "oneof.pb.h"
diff --git a/vendor/nanopb/tests/regression/issue_746/SConscript b/vendor/nanopb/tests/regression/issue_746/SConscript
new file mode 100644
index 00000000..5a59d8a3
--- /dev/null
+++ b/vendor/nanopb/tests/regression/issue_746/SConscript
@@ -0,0 +1,8 @@
+# Regression test for #746:
+# Name conflict when generating default values for message
+
+Import("env")
+
+env.NanopbProto("test.proto")
+env.Object("test.pb.c")
+
diff --git a/vendor/nanopb/tests/regression/issue_746/test.proto b/vendor/nanopb/tests/regression/issue_746/test.proto
new file mode 100644
index 00000000..fe768632
--- /dev/null
+++ b/vendor/nanopb/tests/regression/issue_746/test.proto
@@ -0,0 +1,25 @@
+syntax = "proto2"; // must be "proto2", proto3 requires enums starting with 0.
+
+enum Enum
+{
+ enumerand = 1; // must be non-zero
+}
+
+message Outer1
+{
+ message Inner
+ {
+ optional Enum enum1 = 1; // can also be "required"
+ }
+}
+
+message Outer2
+{
+ message Inner
+ {
+ // further trouble of this is also named "enum1"
+ optional Enum enum2 = 1; // can also be "required"
+
+ }
+}
+
diff --git a/vendor/nanopb/tests/site_scons/platforms/avr/run_test.c b/vendor/nanopb/tests/site_scons/platforms/avr/run_test.c
index 8e4679e5..eca0d328 100644
--- a/vendor/nanopb/tests/site_scons/platforms/avr/run_test.c
+++ b/vendor/nanopb/tests/site_scons/platforms/avr/run_test.c
@@ -146,7 +146,7 @@ int main(int argc, char *argv[])
filename = argv[2];
}
- elf_firmware_t firmware;
+ elf_firmware_t firmware = {};
elf_read_firmware(filename, &firmware);
avr_init(g_avr);
avr_load_firmware(g_avr, &firmware);
diff --git a/vendor/nanopb/tests/site_scons/site_init.py b/vendor/nanopb/tests/site_scons/site_init.py
index ce8f7e11..1f52b834 100644
--- a/vendor/nanopb/tests/site_scons/site_init.py
+++ b/vendor/nanopb/tests/site_scons/site_init.py
@@ -22,25 +22,30 @@
except ImportError:
pass
+# UTF-8 support on Python 2
+if sys.version_info.major == 2:
+ import codecs
+ open = codecs.open
+
def add_nanopb_builders(env):
'''Add the necessary builder commands for nanopb tests.'''
# Build command that runs a test program and saves the output
def run_test(target, source, env):
if len(source) > 1:
- infile = open(str(source[1]))
+ infile = open(str(source[1]), 'rb')
else:
infile = None
- if env.has_key("COMMAND"):
+ if "COMMAND" in env:
args = [env["COMMAND"]]
else:
args = [str(source[0])]
- if env.has_key('ARGS'):
+ if 'ARGS' in env:
args.extend(env['ARGS'])
- if env.has_key("TEST_RUNNER"):
+ if "TEST_RUNNER" in env:
args = [env["TEST_RUNNER"]] + args
print('Command line: ' + str(args))
@@ -98,8 +103,8 @@ def compare_files(target, source, env):
# Build command that checks that each pattern in source2 is found in source1.
def match_files(target, source, env):
- data = open(str(source[0]), 'rU').read()
- patterns = open(str(source[1]))
+ data = open(str(source[0]), 'r', encoding = 'utf-8').read()
+ patterns = open(str(source[1]), 'r', encoding = 'utf-8')
for pattern in patterns:
if pattern.strip():
invert = False
diff --git a/vendor/nanopb/tests/site_scons/site_tools/nanopb.py b/vendor/nanopb/tests/site_scons/site_tools/nanopb.py
index 1a258088..37b8e20c 100644
--- a/vendor/nanopb/tests/site_scons/site_tools/nanopb.py
+++ b/vendor/nanopb/tests/site_scons/site_tools/nanopb.py
@@ -46,7 +46,7 @@ class NanopbWarning(warningbase):
def _detect_nanopb(env):
'''Find the path to nanopb root directory.'''
- if env.has_key('NANOPB'):
+ if 'NANOPB' in env:
# Use nanopb dir given by user
return env['NANOPB']
@@ -60,7 +60,7 @@ def _detect_nanopb(env):
def _detect_python(env):
'''Find Python executable to use.'''
- if env.has_key('PYTHON'):
+ if 'PYTHON' in env:
return env['PYTHON']
p = env.WhereIs('python3')
@@ -85,7 +85,7 @@ def _detect_nanopb_generator(env):
def _detect_protoc(env):
'''Find the path to the protoc compiler.'''
- if env.has_key('PROTOC'):
+ if 'PROTOC' in env:
# Use protoc defined by user
return env['PROTOC']
@@ -113,7 +113,7 @@ def _detect_protoc(env):
def _detect_protocflags(env):
'''Find the options to use for protoc.'''
- if env.has_key('PROTOCFLAGS'):
+ if 'PROTOCFLAGS' in env:
return env['PROTOCFLAGS']
p = _detect_protoc(env)
diff --git a/vendor/nanopb/tests/special_characters/SConscript b/vendor/nanopb/tests/special_characters/SConscript
index 2309cf2e..d3bd33b3 100644
--- a/vendor/nanopb/tests/special_characters/SConscript
+++ b/vendor/nanopb/tests/special_characters/SConscript
@@ -2,5 +2,7 @@
Import('env')
-env.NanopbProto("funny-proto+name has.characters.proto")
+env.NanopbProto(["funny-proto+name has.characters.proto", "funny-proto+name has.characters.options"])
env.Object("funny-proto+name has.characters.pb.c")
+env.Match(['funny-proto+name has.characters.pb.h', 'specchars.expected'])
+
diff --git a/vendor/nanopb/tests/special_characters/funny-proto+name has.characters.options b/vendor/nanopb/tests/special_characters/funny-proto+name has.characters.options
new file mode 100644
index 00000000..b9e25751
--- /dev/null
+++ b/vendor/nanopb/tests/special_characters/funny-proto+name has.characters.options
@@ -0,0 +1,3 @@
+// Unicode comment эмйÅÄÖ
+* max_count:10
+
diff --git a/vendor/nanopb/tests/special_characters/funny-proto+name has.characters.proto b/vendor/nanopb/tests/special_characters/funny-proto+name has.characters.proto
index f5170c8a..879b7968 100644
--- a/vendor/nanopb/tests/special_characters/funny-proto+name has.characters.proto
+++ b/vendor/nanopb/tests/special_characters/funny-proto+name has.characters.proto
@@ -1,8 +1,10 @@
syntax="proto2";
+// Unicode comment эмйÅÄÖ
message WorkingMessage {
required int32 b = 1;
required int32 Z = 2;
+ repeated int32 x = 3;
}
message FailingMessageBecauseMembersAreMacroParameter {
@@ -19,3 +21,5 @@ message TestMacroParametersAndUnderscores {
required int32 X___ = 6;
required int32 X____ = 7;
}
+
+
diff --git a/vendor/nanopb/tests/special_characters/specchars.expected b/vendor/nanopb/tests/special_characters/specchars.expected
new file mode 100644
index 00000000..dc90cc4d
--- /dev/null
+++ b/vendor/nanopb/tests/special_characters/specchars.expected
@@ -0,0 +1,3 @@
+int32_t x\[10\];
+Unicode comment эмйÅÄÖ
+
diff --git a/vendor/nanopb/tests/splint/splint.rc b/vendor/nanopb/tests/splint/splint.rc
index 0cf43761..c01e2fca 100644
--- a/vendor/nanopb/tests/splint/splint.rc
+++ b/vendor/nanopb/tests/splint/splint.rc
@@ -36,3 +36,5 @@
-noeffect
-usedef
+# Splint doesn't support C11
+-DPB_C99_STATIC_ASSERT
diff --git a/vendor/nanopb/tools/make_linux_package.sh b/vendor/nanopb/tools/make_linux_package.sh
index 5509cbbd..dd22b0d6 100644
--- a/vendor/nanopb/tools/make_linux_package.sh
+++ b/vendor/nanopb/tools/make_linux_package.sh
@@ -37,7 +37,7 @@ rm -rf $DEST/generator/dist $DEST/generator/build $DEST/generator/nanopb_generat
cp $DEST/generator-bin/nanopb_generator $DEST/generator-bin/protoc-gen-nanopb
# Remove debugging symbols to reduce size of package
-( cd $DEST/generator-bin; strip *.so *.so.* )
+( cd $DEST/generator-bin; strip *.so* )
# Tar it all up
( cd dist; tar -czf $VERSION.tar.gz $VERSION )
diff --git a/vendor/nanopb/tools/make_windows_package.sh b/vendor/nanopb/tools/make_windows_package.sh
index 1d1acc12..c4577f26 100644
--- a/vendor/nanopb/tools/make_windows_package.sh
+++ b/vendor/nanopb/tools/make_windows_package.sh
@@ -17,16 +17,16 @@ mkdir -p $DEST
git archive HEAD | tar x -C $DEST
# Rebuild the Python .proto files and .pyc
-( cd $DEST/generator; py -3 nanopb_generator.py ||: )
+( cd $DEST/generator; python3 nanopb_generator.py ||: )
# Package the Python libraries
-( cd $DEST/generator; py -3 -m PyInstaller nanopb_generator.py )
-( cd $DEST/generator; py -3 -m PyInstaller protoc )
+( cd $DEST/generator; python3 -m PyInstaller nanopb_generator.py )
+( cd $DEST/generator; python3 -m PyInstaller protoc )
mv $DEST/generator/dist/nanopb_generator $DEST/generator-bin
cp $DEST/generator/dist/protoc/protoc.exe $DEST/generator-bin
# Include Google's descriptor.proto and nanopb.proto
-cp -pr $(py -3 -c 'import grpc_tools, os.path; print(os.path.dirname(grpc_tools.__file__))')/_proto $DEST/generator-bin/grpc_tools/
+cp -pr $(python3 -c 'import grpc_tools, os.path; print(os.path.dirname(grpc_tools.__file__))')/_proto $DEST/generator-bin/grpc_tools/
cp -pr $DEST/generator/proto $DEST/generator-bin/proto
# Remove temp files
diff --git a/vendor/nanopb/tools/set_version.sh b/vendor/nanopb/tools/set_version.sh
index 60006190..3dd0c1cd 100644
--- a/vendor/nanopb/tools/set_version.sh
+++ b/vendor/nanopb/tools/set_version.sh
@@ -5,7 +5,7 @@
# It sets the version number in pb.h and generator/nanopb_generator.py.
sed -i -e 's/nanopb_version\s*=\s*"[^"]*"/nanopb_version = "'$1'"/' generator/nanopb_generator.py
-sed -i -e 's/#define\s*NANOPB_VERSION\s*.*/#define NANOPB_VERSION '$1'/' pb.h
+sed -i -e 's/#define\s*NANOPB_VERSION\s*.*/#define NANOPB_VERSION "'$1'"/' pb.h
sed -i -e 's/set(\s*nanopb_VERSION_STRING\s*[^)]*)/set(nanopb_VERSION_STRING '$1')/' CMakeLists.txt
VERSION_ONLY=$(echo $1 | sed 's/nanopb-//')