45 #define PEERDIST_INFO_V1 0x0100 48 #define PEERDIST_INFO_V2 0x0200 96 #define PEERDIST_INFO_V1_HASH_SHA256 0x0000800cUL 99 #define PEERDIST_INFO_V1_HASH_SHA384 0x0000800dUL 102 #define PEERDIST_INFO_V1_HASH_SHA512 0x0000800eUL 145 #define peerdist_info_v1_segment_t( digestsize ) \ 147 struct peerdist_info_v1_segment segment; \ 148 uint8_t hash[digestsize]; \ 149 uint8_t secret[digestsize]; \ 150 } __attribute__ (( packed )) 178 #define peerdist_info_v1_block_t( digestsize, blocks ) \ 180 struct peerdist_info_v1_block block; \ 181 uint8_t hash[blocks][digestsize]; \ 182 } __attribute__ (( packed )) 224 #define PEERDIST_INFO_V2_HASH_SHA512_TRUNC 0x04 249 #define peerdist_info_v2_chunk_t( digestsize ) \ 251 struct peerdist_info_v2_chunk chunk; \ 252 peerdist_info_v2_segment_t ( digestsize ) segment[0]; \ 253 } __attribute__ (( packed )) 256 #define PEERDIST_INFO_V2_CHUNK_TYPE 0x00 279 #define peerdist_info_v2_segment_t( digestsize ) \ 281 struct peerdist_info_v2_segment segment; \ 282 uint8_t hash[digestsize]; \ 283 uint8_t secret[digestsize]; \ 284 } __attribute__ (( packed )) 297 #define PEERDIST_DIGEST_MAX_SIZE 64 390 #define PEERDIST_SEGMENT_ID_MAGIC L"MS_P2P_CACHING" 441 unsigned int index );
444 unsigned int index );
uint64_t len
Length of content range, or zero.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
size_t blksize
Block size.
uint16_t segment
Code segment.
union peerdist_info_version version
Version number.
A content information segment.
uint8_t hash
Hash algorithm.
Content Information version 1 data structure header.
uint8_t hash[PEERDIST_DIGEST_MAX_SIZE]
Segment hash of data.
const struct peerdist_info_segment * segment
Content information segment.
size_t start
Start offset.
uint32_t blksize
Block size for this segment.
uint64_t offset
Offset of the first segment within the content.
struct peerdist_info_operations * op
Content information operations.
uint32_t segments
Number of segments within the content information.
unsigned long long uint64_t
uint32_t len
Length of this segment.
unsigned int index
Segment index.
uint8_t secret[PEERDIST_DIGEST_MAX_SIZE]
Segment secret.
unsigned int index
Block index.
struct digest_algorithm * digest
Digest algorithm.
int(* segment)(struct peerdist_info_segment *segment)
Populate content information segment.
A content information block.
Content Information version 1 block description header.
size_t len
Length of data buffer.
struct peerdist_range range
Content range.
struct peerdist_range trim
Trimmed content range.
Content Information version 2 segment description header.
Content Information version 1 segment description header.
uint32_t len
Chunk data length.
uint32_t first
Length to skip in first segment.
uint32_t last
Length to read in last segment, or zero.
uint16_t raw
Raw version number.
struct peerdist_range trim
Trimmed content range.
unsigned int segments
Number of segments within the content information.
const void * data
Data buffer.
union peerdist_info_version version
Version number.
int peerdist_info_block(const struct peerdist_info_segment *segment, struct peerdist_info_block *block, unsigned int index)
Populate content information block.
#define PEERDIST_DIGEST_MAX_SIZE
Maximum digest size for any supported algorithm.
uint8_t major
Major version number.
struct peerdist_range range
Content range.
uint32_t hash
Hash algorithm.
uint32_t first
Length to skip in first segment.
uint32_t blocks
Number of blocks within the block description.
uint8_t block[3][8]
DES-encrypted blocks.
struct digest_algorithm sha512_trunc_algorithm
unsigned int blocks
Number of blocks within this segment.
const struct peerdist_info * info
Content information.
A message digest algorithm.
uint8_t data[48]
Additional event data.
size_t digestsize
Digest size.
struct peerdist_range range
Content range.
int peerdist_info(const void *data, size_t len, struct peerdist_info *info)
Populate content information.
uint32_t len
Segment length.
int peerdist_info_segment(const struct peerdist_info *info, struct peerdist_info_segment *segment, unsigned int index)
Populate content information segment.
int(* info)(struct peerdist_info *info)
Populate content information.
uint64_t index
Index of the first segment within the content.
struct peerdist_raw raw
Raw content information.
Content Information version 2 data structure header.
uint64_t offset
Offset of this segment within the content.
Content Information version 2 chunk description header.
int(* block)(struct peerdist_info_block *block)
Populate content information block.
Content information operations.
uint8_t minor
Minor version number.
Content Information version number.
uint8_t hash[PEERDIST_DIGEST_MAX_SIZE]
Block hash.