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

A message used to send and receive block headers. Inherits CBMessage. More...

#include "CBBlock.h"

Go to the source code of this file.

Data Structures

struct  CBBlockHeaders
 Structure for CBBlockHeaders objects. More...

Functions

CBBlockHeadersCBNewBlockHeaders (void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBBlockHeaders object.
CBBlockHeadersCBNewBlockHeadersFromData (CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBBlockHeaders object from serialised data.
CBBlockHeadersCBGetBlockHeaders (void *self)
 Gets a CBBlockHeaders from another object. Use this to avoid casts.
bool CBInitBlockHeaders (CBBlockHeaders *self, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBBlockHeaders object.
bool CBInitBlockHeadersFromData (CBBlockHeaders *self, CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBBlockHeaders object from serialised data.
void CBFreeBlockHeaders (void *self)
 Frees a CBBlockHeaders object.
bool CBBlockHeadersAddBlockHeader (CBBlockHeaders *self, CBBlock *header)
 Adds a CBBlock into the block header list.
uint32_t CBBlockHeadersCalculateLength (CBBlockHeaders *self)
 Calculates the length needed to serialise the object.
uint32_t CBBlockHeadersDeserialise (CBBlockHeaders *self)
 Deserialises a CBBlockHeaders so that it can be used as an object.
uint32_t CBBlockHeadersSerialise (CBBlockHeaders *self)
 Serialises a CBBlockHeaders to the byte data.
bool CBBlockHeadersTakeBlockHeader (CBBlockHeaders *self, CBBlock *header)
 Takes a CBBlock for the block header list. This does not retain the CBBlock so you can pass an CBBlock into this while releasing control from the calling function.

Detailed Description

A message used to send and receive block headers. Inherits CBMessage.


Function Documentation

bool CBBlockHeadersAddBlockHeader ( CBBlockHeaders self,
CBBlock header 
)

Adds a CBBlock into the block header list.

Parameters:
selfThe CBBlockHeaders object
addressThe CBBlock to add.
Returns:
true if the block header was added successfully or false on error.

Calculates the length needed to serialise the object.

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

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

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

Serialises a CBBlockHeaders to the byte data.

Parameters:
selfThe CBBlockHeaders object
Returns:
The length written on success, 0 on failure.
bool CBBlockHeadersTakeBlockHeader ( CBBlockHeaders self,
CBBlock header 
)

Takes a CBBlock for the block header list. This does not retain the CBBlock so you can pass an CBBlock into this while releasing control from the calling function.

Parameters:
selfThe CBBlockHeaders object
addressThe CBBlock to take.
Returns:
true if the block header was taken successfully or false on error.
void CBFreeBlockHeaders ( void *  self)

Frees a CBBlockHeaders object.

Parameters:
selfThe CBBlockHeaders object to free.
CBBlockHeaders* CBGetBlockHeaders ( void *  self)

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

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

Initialises a CBBlockHeaders object.

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

Initialises a CBBlockHeaders object from serialised data.

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

Creates a new CBBlockHeaders object.

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

Creates a new CBBlockHeaders object from serialised data.

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