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

Stores up to 500 block hashes for a block chain to describe a block chain for a peer so that a peer can send relevent block data. Inherits CBMessage. More...

#include "CBMessage.h"

Go to the source code of this file.

Data Structures

struct  CBChainDescriptor
 Structure for CBChainDescriptor objects. More...

Functions

CBChainDescriptorCBNewChainDescriptor (void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBChainDescriptor object.
CBChainDescriptorCBNewChainDescriptorFromData (CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBChainDescriptor object from serialised data.
CBChainDescriptorCBGetChainDescriptor (void *self)
 Gets a CBChainDescriptor from another object. Use this to avoid casts.
bool CBInitChainDescriptor (CBChainDescriptor *self, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBChainDescriptor object.
bool CBInitChainDescriptorFromData (CBChainDescriptor *self, CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBChainDescriptor object from serialised data.
void CBFreeChainDescriptor (void *self)
 Frees a CBChainDescriptor object.
bool CBChainDescriptorAddHash (CBChainDescriptor *self, CBByteArray *hash)
 Adds a hash to the CBChainDescriptor onto the end.
uint16_t CBChainDescriptorDeserialise (CBChainDescriptor *self)
 Deserialises a CBChainDescriptor so that it can be used as an object.
uint16_t CBChainDescriptorSerialise (CBChainDescriptor *self)
 Serialises a CBChainDescriptor to the byte data.
bool CBChainDescriptorTakeHash (CBChainDescriptor *self, CBByteArray *hash)
 Takes a hash for the CBChainDescriptor and puts it on the end. The hash is not retained so the calling function is releasing control.

Detailed Description

Stores up to 500 block hashes for a block chain to describe a block chain for a peer so that a peer can send relevent block data. Inherits CBMessage.


Function Documentation

Adds a hash to the CBChainDescriptor onto the end.

Parameters:
selfThe CBChainDescriptor object
hashThe hash to add.
Returns:
true if the hash was added successfully, false on error.

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

Parameters:
selfThe CBChainDescriptor object
Returns:
The length read on success, 0 on failure.

Serialises a CBChainDescriptor to the byte data.

Parameters:
selfThe CBChainDescriptor object
Returns:
The length written on success, 0 on failure.

Takes a hash for the CBChainDescriptor and puts it on the end. The hash is not retained so the calling function is releasing control.

Parameters:
selfThe CBChainDescriptor object
hashThe hash to take.
Returns:
true if the hash was taken successfully, false on error.
void CBFreeChainDescriptor ( void *  self)

Frees a CBChainDescriptor object.

Parameters:
selfThe CBChainDescriptor object to free.

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

Parameters:
selfThe object to obtain the CBChainDescriptor from.
Returns:
The CBChainDescriptor object.
bool CBInitChainDescriptor ( CBChainDescriptor self,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Initialises a CBChainDescriptor object.

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

Initialises a CBChainDescriptor object from serialised data.

Parameters:
selfThe CBChainDescriptor object to initialise
dataThe serialised data.
Returns:
true on success, false on failure.
CBChainDescriptor* CBNewChainDescriptor ( void(*)(CBError error, char *,...)  onErrorReceived)

Creates a new CBChainDescriptor object.

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

Creates a new CBChainDescriptor object from serialised data.

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