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

Contains infromation relating to the version of a peer, the timestamp, features, IPs, user agent and last block recieveed. Inherits CBMessage. More...

#include "CBMessage.h"
#include "CBNetworkAddress.h"

Go to the source code of this file.

Data Structures

struct  CBVersion
 Structure for CBVersion objects. More...

Functions

CBVersionCBNewVersion (int32_t version, CBVersionServices services, int64_t time, CBNetworkAddress *addRecv, CBNetworkAddress *addSource, uint64_t nounce, CBByteArray *userAgent, int32_t blockHeight, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBVersion object.
CBVersionCBNewVersionFromData (CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBVersion object from serialised data.
CBVersionCBGetVersion (void *self)
 Gets a CBVersion from another object. Use this to avoid casts.
bool CBInitVersion (CBVersion *self, int32_t version, CBVersionServices services, int64_t time, CBNetworkAddress *addRecv, CBNetworkAddress *addSource, uint64_t nounce, CBByteArray *userAgent, int32_t blockHeight, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBVersion object.
bool CBInitVersionFromData (CBVersion *self, CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a new CBVersion object from serialised data.
void CBFreeVersion (void *self)
 Frees a CBVersion object.
uint32_t CBVersionDeserialise (CBVersion *self)
 Deserialises a CBVersion so that it can be used as an object.
uint32_t CBVersionCalculateLength (CBVersion *self)
 Calculates the length needed to serialise the object.
uint32_t CBVersionSerialise (CBVersion *self)
 Serialises a CBVersion to the byte data.

Detailed Description

Contains infromation relating to the version of a peer, the timestamp, features, IPs, user agent and last block recieveed. Inherits CBMessage.


Function Documentation

void CBFreeVersion ( void *  self)

Frees a CBVersion object.

Parameters:
selfThe CBVersion object to free.
CBVersion* CBGetVersion ( void *  self)

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

Parameters:
selfThe object to obtain the CBVersion from.
Returns:
The CBVersion object.
bool CBInitVersion ( CBVersion self,
int32_t  version,
CBVersionServices  services,
int64_t  time,
CBNetworkAddress addRecv,
CBNetworkAddress addSource,
uint64_t  nounce,
CBByteArray userAgent,
int32_t  blockHeight,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Initialises a CBVersion object.

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

Initialises a new CBVersion object from serialised data.

Parameters:
selfThe CBVersion object to initialise
dataA CBByteArray holding the serialised data.
Returns:
true on success, false on failure.
CBVersion* CBNewVersion ( int32_t  version,
CBVersionServices  services,
int64_t  time,
CBNetworkAddress addRecv,
CBNetworkAddress addSource,
uint64_t  nounce,
CBByteArray userAgent,
int32_t  blockHeight,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Creates a new CBVersion object.

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

Creates a new CBVersion object from serialised data.

Parameters:
dataA CBByteArray holding the serialised data.
Returns:
A new CBVersion object.
uint32_t CBVersionCalculateLength ( CBVersion self)

Calculates the length needed to serialise the object.

Parameters:
selfThe CBVersion object
Returns:
The length read on success, 0 on failure.
uint32_t CBVersionDeserialise ( CBVersion self)

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

Parameters:
selfThe CBVersion object
Returns:
The length read on success, 0 on failure.
uint32_t CBVersionSerialise ( CBVersion self)

Serialises a CBVersion to the byte data.

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