46 #define PEERDIST_INFO_V1 0x0100 49 #define PEERDIST_INFO_V2 0x0200 97 #define PEERDIST_INFO_V1_HASH_SHA256 0x0000800cUL 100 #define PEERDIST_INFO_V1_HASH_SHA384 0x0000800dUL 103 #define PEERDIST_INFO_V1_HASH_SHA512 0x0000800eUL 146 #define peerdist_info_v1_segment_t( digestsize ) \ 148 struct peerdist_info_v1_segment segment; \ 149 uint8_t hash[digestsize]; \ 150 uint8_t secret[digestsize]; \ 151 } __attribute__ (( packed )) 179 #define peerdist_info_v1_block_t( digestsize, blocks ) \ 181 struct peerdist_info_v1_block block; \ 182 uint8_t hash[blocks][digestsize]; \ 183 } __attribute__ (( packed )) 225 #define PEERDIST_INFO_V2_HASH_SHA512_TRUNC 0x04 250 #define peerdist_info_v2_chunk_t( digestsize ) \ 252 struct peerdist_info_v2_chunk chunk; \ 253 peerdist_info_v2_segment_t ( digestsize ) segment[0]; \ 254 } __attribute__ (( packed )) 257 #define PEERDIST_INFO_V2_CHUNK_TYPE 0x00 280 #define peerdist_info_v2_segment_t( digestsize ) \ 282 struct peerdist_info_v2_segment segment; \ 283 uint8_t hash[digestsize]; \ 284 uint8_t secret[digestsize]; \ 285 } __attribute__ (( packed )) 298 #define PEERDIST_DIGEST_MAX_SIZE 64 391 #define PEERDIST_SEGMENT_ID_MAGIC L"MS_P2P_CACHING" 442 unsigned int index );
445 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.
userptr_t data
Data buffer.
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.
Access to external ("user") memory.
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.
uint32_t userptr_t
A pointer to a user 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.
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.
int peerdist_info(userptr_t data, size_t len, struct peerdist_info *info)
Populate content information.
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.
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.