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

Represents a key, begining with a version byte and ending with a checksum. Inherits CBByteArray. More...

#include "CBByteArray.h"
#include "CBBase58.h"

Go to the source code of this file.

Data Structures

struct  CBVersionChecksumBytes
 Structure for CBVersionChecksumBytes objects. More...

Functions

CBVersionChecksumBytesCBNewVersionChecksumBytesFromString (CBByteArray *string, bool cacheString, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBVersionChecksumBytes object from a base-58 encoded string. The base-58 string will be validated by it's checksum. This returns NULL if the string is invalid. The CB_ERROR_BASE58_DECODE_CHECK_TOO_SHORT error is given if the decoded data is less than 4 bytes. CB_ERROR_BASE58_DECODE_CHECK_INVALID is given if the checksum does not match.
CBVersionChecksumBytesCBNewVersionChecksumBytesFromBytes (uint8_t *bytes, uint32_t size, bool cacheString, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBVersionChecksumBytes object from bytes.
CBVersionChecksumBytesCBGetVersionChecksumBytes (void *self)
 Gets a CBVersionChecksumBytes from another object. Use this to avoid casts.
bool CBInitVersionChecksumBytesFromString (CBVersionChecksumBytes *self, CBByteArray *string, bool cacheString, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBVersionChecksumBytes object from a string.
bool CBInitVersionChecksumBytesFromBytes (CBVersionChecksumBytes *self, uint8_t *bytes, uint32_t size, bool cacheString, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a new CBVersionChecksumBytes object from bytes.
void CBFreeVersionChecksumBytes (void *self)
 Frees a CBVersionChecksumBytes object.
uint8_t CBVersionChecksumBytesGetVersion (CBVersionChecksumBytes *self)
 Gets the version for a CBVersionChecksumBytes object.
CBByteArrayCBVersionChecksumBytesGetString (CBVersionChecksumBytes *self)
 Gets the string representation for a CBVersionChecksumBytes object as a base-58 encoded CBString.

Detailed Description

Represents a key, begining with a version byte and ending with a checksum. Inherits CBByteArray.


Function Documentation

void CBFreeVersionChecksumBytes ( void *  self)

Frees a CBVersionChecksumBytes object.

Parameters:
selfThe CBVersionChecksumBytes object to free.

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

Parameters:
selfThe object to obtain the CBVersionChecksumBytes from.
Returns:
The CBVersionChecksumBytes object.
bool CBInitVersionChecksumBytesFromBytes ( CBVersionChecksumBytes self,
uint8_t *  bytes,
uint32_t  size,
bool  cacheString,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Initialises a new CBVersionChecksumBytes object from bytes.

Parameters:
selfThe CBVersionChecksumBytes object to initialise.
bytesThe bytes for the CBVersionChecksumBytes object.
sizeThe size of the byte data.
cacheStringIf true, the bitcoin string for this object will be cached in memory.
onErrorReceivedA CBEngine for errors.
Returns:
true on success, false on failure.
bool CBInitVersionChecksumBytesFromString ( CBVersionChecksumBytes self,
CBByteArray string,
bool  cacheString,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Initialises a CBVersionChecksumBytes object from a string.

Parameters:
selfThe CBVersionChecksumBytes object to initialise.
stringA CBString to make a CBVersionChecksumBytes object with a termination character.
cacheStringIf true, the bitcoin string for this object will be cached in memory.
onErrorReceivedA CBEngine for errors.
Returns:
true on success, false on failure.
CBVersionChecksumBytes* CBNewVersionChecksumBytesFromBytes ( uint8_t *  bytes,
uint32_t  size,
bool  cacheString,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Creates a new CBVersionChecksumBytes object from bytes.

Parameters:
bytesThe bytes for the CBVersionChecksumBytes object.
sizeThe size of the byte data.
cacheStringIf true, the bitcoin string for this object will be cached in memory.
onErrorReceivedA CBEngine for errors.
Returns:
A new CBVersionChecksumBytes object.
CBVersionChecksumBytes* CBNewVersionChecksumBytesFromString ( CBByteArray string,
bool  cacheString,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Creates a new CBVersionChecksumBytes object from a base-58 encoded string. The base-58 string will be validated by it's checksum. This returns NULL if the string is invalid. The CB_ERROR_BASE58_DECODE_CHECK_TOO_SHORT error is given if the decoded data is less than 4 bytes. CB_ERROR_BASE58_DECODE_CHECK_INVALID is given if the checksum does not match.

Parameters:
stringA base-58 encoded CBString to make a CBVersionChecksumBytes object with a termination character.
cacheStringIf true, the bitcoin string for this object will be cached in memory.
onErrorReceivedA CBEngine for errors.
Returns:
A new CBVersionChecksumBytes object or NULL on failure.

Gets the string representation for a CBVersionChecksumBytes object as a base-58 encoded CBString.

Parameters:
selfThe CBVersionChecksumBytes object.
Returns:
The object represented as a base-58 encoded CBString. Do not modify this. Copy if modification is required.

Gets the version for a CBVersionChecksumBytes object.

Parameters:
selfThe CBVersionChecksumBytes object.
Returns:
The version code. The Macros CB_PRODUCTION_NETWORK and CB_TEST_NETWORK should correspond to this.