cbitcoin
 All Data Structures Files Functions Variables Typedefs
src/structures/CBObject/CBMessage/CBGetBlocks/CBGetBlocks.h File Reference

A message to ask for an inventory of blocks or the block headers (getheaders message) up to the "stopAtHash", the last known block or 500 blocks, whichever comes first. The message comes with a block chain descriptor so the recipient can discover how the blockchain is different so they can send the necessary blocks (starting from a point of agreement). Inherits CBMessage. More...

Go to the source code of this file.

Data Structures

struct  CBGetBlocks
 Structure for CBGetBlocks objects. More...

Functions

CBGetBlocksCBNewGetBlocks (uint32_t version, CBChainDescriptor *chainDescriptor, CBByteArray *stopAtHash, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBGetBlocks object.
CBGetBlocksCBNewGetBlocksFromData (CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBGetBlocks object from serialised data.
CBGetBlocksCBGetGetBlocks (void *self)
 Gets a CBGetBlocks from another object. Use this to avoid casts.
bool CBInitGetBlocks (CBGetBlocks *self, uint32_t version, CBChainDescriptor *chainDescriptor, CBByteArray *stopAtHash, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBGetBlocks object.
bool CBInitGetBlocksFromData (CBGetBlocks *self, CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBGetBlocks object from serialised data.
void CBFreeGetBlocks (void *self)
 Frees a CBGetBlocks object.
uint32_t CBGetBlocksCalculateLength (CBGetBlocks *self)
 Calculates the length needed to serialise the object.
uint16_t CBGetBlocksDeserialise (CBGetBlocks *self)
 Deserialises a CBGetBlocks so that it can be used as an object.
uint16_t CBGetBlocksSerialise (CBGetBlocks *self)
 Serialises a CBGetBlocks to the byte data.

Detailed Description

A message to ask for an inventory of blocks or the block headers (getheaders message) up to the "stopAtHash", the last known block or 500 blocks, whichever comes first. The message comes with a block chain descriptor so the recipient can discover how the blockchain is different so they can send the necessary blocks (starting from a point of agreement). Inherits CBMessage.


Function Documentation

void CBFreeGetBlocks ( void *  self)

Frees a CBGetBlocks object.

Parameters:
selfThe CBGetBlocks object to free.

Calculates the length needed to serialise the object.

Parameters:
selfThe CBGetBlocks object.
Returns:
The length read on success, 0 on failure.
uint16_t CBGetBlocksDeserialise ( CBGetBlocks self)

Deserialises a CBGetBlocks so that it can be used as an object.

Parameters:
selfThe CBGetBlocks object
Returns:
The length read on success, 0 on failure.
uint16_t CBGetBlocksSerialise ( CBGetBlocks self)

Serialises a CBGetBlocks to the byte data.

Parameters:
selfThe CBGetBlocks object
Returns:
The length written on success, 0 on failure.
CBGetBlocks* CBGetGetBlocks ( void *  self)

Gets a CBGetBlocks from another object. Use this to avoid casts.

Parameters:
selfThe object to obtain the CBGetBlocks from.
Returns:
The CBGetBlocks object.
bool CBInitGetBlocks ( CBGetBlocks self,
uint32_t  version,
CBChainDescriptor chainDescriptor,
CBByteArray stopAtHash,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Initialises a CBGetBlocks object.

Parameters:
selfThe CBGetBlocks object to initialise
Returns:
true on success, false on failure.
bool CBInitGetBlocksFromData ( CBGetBlocks self,
CBByteArray data,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Initialises a CBGetBlocks object from serialised data.

Parameters:
selfThe CBGetBlocks object to initialise
dataThe serialised data.
Returns:
true on success, false on failure.
CBGetBlocks* CBNewGetBlocks ( uint32_t  version,
CBChainDescriptor chainDescriptor,
CBByteArray stopAtHash,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Creates a new CBGetBlocks object.

Returns:
A new CBGetBlocks object.
CBGetBlocks* CBNewGetBlocksFromData ( CBByteArray data,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Creates a new CBGetBlocks object from serialised data.

Parameters:
dataSerialised CBGetBlocks data.
Returns:
A new CBGetBlocks object.