API to serialize and deserialize delegation chains and abds. More...
#include "platform.h"#include "gnunet_util_lib.h"#include "gnunet_abd_service.h"#include "gnunet_signatures.h"#include "abd.h"#include "abd_serialization.h"Go to the source code of this file.
Functions | |
| size_t | GNUNET_ABD_delegation_set_get_size (unsigned int ds_count, const struct GNUNET_ABD_DelegationSet *dsr) |
| Calculate how many bytes we will need to serialize the given delegation chain. | |
| ssize_t | GNUNET_ABD_delegation_set_serialize (unsigned int d_count, const struct GNUNET_ABD_DelegationSet *dsr, size_t dest_size, char *dest) |
| Serizalize the given delegation chain entries and abd. | |
| int | GNUNET_ABD_delegation_set_deserialize (size_t len, const char *src, unsigned int d_count, struct GNUNET_ABD_DelegationSet *dsr) |
| Deserialize the given destination. | |
| size_t | GNUNET_ABD_delegates_get_size (unsigned int c_count, const struct GNUNET_ABD_Delegate *cd) |
| Calculate how many bytes we will need to serialize the abds. | |
| ssize_t | GNUNET_ABD_delegates_serialize (unsigned int c_count, const struct GNUNET_ABD_Delegate *cd, size_t dest_size, char *dest) |
| Serizalize the given abds. | |
| int | GNUNET_ABD_delegates_deserialize (size_t len, const char *src, unsigned int c_count, struct GNUNET_ABD_Delegate *cd) |
| Deserialize the given destination. | |
| size_t | GNUNET_ABD_delegation_chain_get_size (unsigned int d_count, const struct GNUNET_ABD_Delegation *dd, unsigned int c_count, const struct GNUNET_ABD_Delegate *cd) |
| Calculate how many bytes we will need to serialize the given delegation chain and abd. | |
| ssize_t | GNUNET_ABD_delegation_chain_serialize (unsigned int d_count, const struct GNUNET_ABD_Delegation *dd, unsigned int c_count, const struct GNUNET_ABD_Delegate *cd, size_t dest_size, char *dest) |
| Serizalize the given delegation chain entries and abd. | |
| int | GNUNET_ABD_delegation_chain_deserialize (size_t len, const char *src, unsigned int d_count, struct GNUNET_ABD_Delegation *dd, unsigned int c_count, struct GNUNET_ABD_Delegate *cd) |
| Deserialize the given destination. | |
| int | GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *dele, char **data) |
| struct GNUNET_ABD_Delegate * | GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size) |
API to serialize and deserialize delegation chains and abds.
Definition in file abd_serialization.c.
| size_t GNUNET_ABD_delegation_set_get_size | ( | unsigned int | ds_count, |
| const struct GNUNET_ABD_DelegationSet * | dsr | ||
| ) |
Calculate how many bytes we will need to serialize the given delegation chain.
Calculate how many bytes we will need to serialize the given delegation record.
| ds_count | number of delegation chain entries |
| dsr | array of GNUNET_ABD_DelegationSet |
Definition at line 44 of file abd_serialization.c.
References GNUNET_assert, ret, DelegationRecordData::subject_attribute_len, and GNUNET_ABD_DelegationSet::subject_attribute_len.
Referenced by abd_string_to_value().
| ssize_t GNUNET_ABD_delegation_set_serialize | ( | unsigned int | d_count, |
| const struct GNUNET_ABD_DelegationSet * | dsr, | ||
| size_t | dest_size, | ||
| char * | dest | ||
| ) |
Serizalize the given delegation chain entries and abd.
Serizalize the given delegation record entries.
| d_count | number of delegation chain entries |
| dsr | array of GNUNET_ABD_DelegationSet |
| dest_size | size of the destination |
| dest | where to store the result |
Definition at line 72 of file abd_serialization.c.
References GNUNET_memcpy, DelegationRecordData::subject_attribute_len, GNUNET_ABD_DelegationSet::subject_attribute_len, DelegationRecordData::subject_key, and GNUNET_ABD_DelegationSet::subject_key.
Referenced by abd_string_to_value().
| int GNUNET_ABD_delegation_set_deserialize | ( | size_t | len, |
| const char * | src, | ||
| unsigned int | d_count, | ||
| struct GNUNET_ABD_DelegationSet * | dsr | ||
| ) |
Deserialize the given destination.
| len | size of the serialized delegation chain and cred |
| src | the serialized data |
| d_count | the number of delegation chain entries |
| dsr | where to put the delegation chain entries |
Definition at line 114 of file abd_serialization.c.
References GNUNET_memcpy, GNUNET_OK, GNUNET_SYSERR, GNUNET_ABD_DelegationSet::subject_attribute, DelegationRecordData::subject_attribute_len, GNUNET_ABD_DelegationSet::subject_attribute_len, DelegationRecordData::subject_key, and GNUNET_ABD_DelegationSet::subject_key.
Referenced by abd_value_to_string(), and backward_resolution().
| size_t GNUNET_ABD_delegates_get_size | ( | unsigned int | c_count, |
| const struct GNUNET_ABD_Delegate * | cd | ||
| ) |
Calculate how many bytes we will need to serialize the abds.
| c_count | number of abd entries |
| cd | a #GNUNET_ABD_Credential |
Definition at line 151 of file abd_serialization.c.
References GNUNET_assert, DelegateEntry::issuer_attribute_len, GNUNET_ABD_Delegate::issuer_attribute_len, ret, DelegateEntry::subject_attribute_len, and GNUNET_ABD_Delegate::subject_attribute_len.
Referenced by GNUNET_ABD_delegation_chain_get_size(), and GNUNET_ABD_verify().
| ssize_t GNUNET_ABD_delegates_serialize | ( | unsigned int | c_count, |
| const struct GNUNET_ABD_Delegate * | cd, | ||
| size_t | dest_size, | ||
| char * | dest | ||
| ) |
Serizalize the given abds.
| c_count | number of abd entries |
| cd | a #GNUNET_ABD_Credential |
| dest_size | size of the destination |
| dest | where to store the result |
Definition at line 181 of file abd_serialization.c.
References expiration, DelegateEntry::expiration, GNUNET_htonll(), GNUNET_memcpy, GNUNET_SIGNATURE_PURPOSE_DELEGATE, DelegateEntry::issuer_attribute_len, GNUNET_ABD_Delegate::issuer_attribute_len, DelegateEntry::issuer_key, GNUNET_ABD_Delegate::issuer_key, DelegateEntry::purpose, GNUNET_CRYPTO_SignaturePurpose::purpose, DelegateEntry::signature, GNUNET_ABD_Delegate::signature, GNUNET_CRYPTO_SignaturePurpose::size, DelegateEntry::subject_attribute_len, DelegateEntry::subject_key, and GNUNET_ABD_Delegate::subject_key.
Referenced by GNUNET_ABD_delegation_chain_serialize(), and GNUNET_ABD_verify().
| int GNUNET_ABD_delegates_deserialize | ( | size_t | len, |
| const char * | src, | ||
| unsigned int | c_count, | ||
| struct GNUNET_ABD_Delegate * | cd | ||
| ) |
Deserialize the given destination.
| len | size of the serialized creds |
| src | the serialized data |
| c_count | the number of abd entries |
| cd | where to put the abd data |
Definition at line 230 of file abd_serialization.c.
References GNUNET_TIME_Absolute::abs_value_us, DelegateEntry::expiration, GNUNET_ABD_Delegate::expiration, GNUNET_memcpy, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, GNUNET_ABD_Delegate::issuer_attribute, DelegateEntry::issuer_attribute_len, GNUNET_ABD_Delegate::issuer_attribute_len, DelegateEntry::issuer_key, GNUNET_ABD_Delegate::issuer_key, DelegateEntry::signature, GNUNET_ABD_Delegate::signature, GNUNET_ABD_Delegate::subject_attribute_len, DelegateEntry::subject_key, and GNUNET_ABD_Delegate::subject_key.
Referenced by GNUNET_ABD_delegation_chain_deserialize(), and handle_verify().
| size_t GNUNET_ABD_delegation_chain_get_size | ( | unsigned int | d_count, |
| const struct GNUNET_ABD_Delegation * | dd, | ||
| unsigned int | c_count, | ||
| const struct GNUNET_ABD_Delegate * | cd | ||
| ) |
Calculate how many bytes we will need to serialize the given delegation chain and abd.
| d_count | number of delegation chain entries |
| dd | array of GNUNET_ABD_Delegation |
| c_count | number of abd entries |
| cd | a #GNUNET_ABD_Credential |
Definition at line 272 of file abd_serialization.c.
References GNUNET_ABD_delegates_get_size(), GNUNET_assert, ChainEntry::issuer_attribute_len, GNUNET_ABD_Delegation::issuer_attribute_len, ret, ChainEntry::subject_attribute_len, and GNUNET_ABD_Delegation::subject_attribute_len.
Referenced by send_intermediate_response(), and send_lookup_response().
| ssize_t GNUNET_ABD_delegation_chain_serialize | ( | unsigned int | d_count, |
| const struct GNUNET_ABD_Delegation * | dd, | ||
| unsigned int | c_count, | ||
| const struct GNUNET_ABD_Delegate * | cd, | ||
| size_t | dest_size, | ||
| char * | dest | ||
| ) |
Serizalize the given delegation chain entries and abd.
| d_count | number of delegation chain entries |
| dd | array of GNUNET_ABD_Delegation |
| c_count | number of abd entries |
| cd | a #GNUNET_ABD_Credential |
| dest_size | size of the destination |
| dest | where to store the result |
Definition at line 305 of file abd_serialization.c.
References GNUNET_ABD_delegates_serialize(), GNUNET_memcpy, ChainEntry::issuer_attribute_len, GNUNET_ABD_Delegation::issuer_attribute_len, ChainEntry::issuer_key, GNUNET_ABD_Delegation::issuer_key, ChainEntry::subject_attribute_len, GNUNET_ABD_Delegation::subject_attribute_len, ChainEntry::subject_key, and GNUNET_ABD_Delegation::subject_key.
Referenced by send_intermediate_response(), and send_lookup_response().
| int GNUNET_ABD_delegation_chain_deserialize | ( | size_t | len, |
| const char * | src, | ||
| unsigned int | d_count, | ||
| struct GNUNET_ABD_Delegation * | dd, | ||
| unsigned int | c_count, | ||
| struct GNUNET_ABD_Delegate * | cd | ||
| ) |
Deserialize the given destination.
| len | size of the serialized delegation chain and cred |
| src | the serialized data |
| d_count | the number of delegation chain entries |
| dd | where to put the delegation chain entries |
| c_count | the number of abd entries |
| cd | where to put the abd data |
Definition at line 362 of file abd_serialization.c.
References GNUNET_ABD_delegates_deserialize(), GNUNET_memcpy, GNUNET_SYSERR, GNUNET_ABD_Delegation::issuer_attribute, ChainEntry::issuer_attribute_len, GNUNET_ABD_Delegation::issuer_attribute_len, ChainEntry::issuer_key, GNUNET_ABD_Delegation::issuer_key, GNUNET_ABD_Delegation::subject_attribute, ChainEntry::subject_attribute_len, GNUNET_ABD_Delegation::subject_attribute_len, ChainEntry::subject_key, and GNUNET_ABD_Delegation::subject_key.
Referenced by handle_intermediate(), and handle_result().
| int GNUNET_ABD_delegate_serialize | ( | struct GNUNET_ABD_Delegate * | dele, |
| char ** | data | ||
| ) |
Definition at line 402 of file abd_serialization.c.
References GNUNET_TIME_Absolute::abs_value_us, data, DelegateEntry::expiration, GNUNET_ABD_Delegate::expiration, GNUNET_CRYPTO_blinded_key_signature_verify_(), GNUNET_ERROR_TYPE_WARNING, GNUNET_htonll(), GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, GNUNET_SIGNATURE_PURPOSE_DELEGATE, GNUNET_ABD_Delegate::issuer_attribute, DelegateEntry::issuer_attribute_len, GNUNET_ABD_Delegate::issuer_attribute_len, DelegateEntry::issuer_key, GNUNET_ABD_Delegate::issuer_key, DelegateEntry::purpose, GNUNET_CRYPTO_SignaturePurpose::purpose, DelegateEntry::signature, GNUNET_ABD_Delegate::signature, GNUNET_CRYPTO_SignaturePurpose::size, size, GNUNET_ABD_Delegate::subject_attribute, DelegateEntry::subject_attribute_len, GNUNET_ABD_Delegate::subject_attribute_len, DelegateEntry::subject_key, and GNUNET_ABD_Delegate::subject_key.
Referenced by abd_string_to_value(), and store_cb().
| struct GNUNET_ABD_Delegate * GNUNET_ABD_delegate_deserialize | ( | const char * | data, |
| size_t | data_size | ||
| ) |
Definition at line 468 of file abd_serialization.c.
References GNUNET_TIME_Absolute::abs_value_us, data, data_size, DelegateEntry::expiration, GNUNET_ABD_Delegate::expiration, GNUNET_CRYPTO_blinded_key_signature_verify_(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_ntohll(), GNUNET_OK, GNUNET_SIGNATURE_PURPOSE_DELEGATE, GNUNET_ABD_Delegate::issuer_attribute, DelegateEntry::issuer_attribute_len, GNUNET_ABD_Delegate::issuer_attribute_len, DelegateEntry::issuer_key, GNUNET_ABD_Delegate::issuer_key, DelegateEntry::purpose, DelegateEntry::signature, GNUNET_ABD_Delegate::signature, GNUNET_ABD_Delegate::subject_attribute, DelegateEntry::subject_attribute_len, GNUNET_ABD_Delegate::subject_attribute_len, DelegateEntry::subject_key, and GNUNET_ABD_Delegate::subject_key.
Referenced by abd_value_to_string(), forward_resolution(), and handle_delegate_collection_cb().