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

A message containing an alert signed by one of the bitcoin developers. Inherits CBMessage. More...

#include "CBMessage.h"

Go to the source code of this file.

Data Structures

struct  CBAlert
 Structure for CBAlert objects. More...

Functions

CBAlertCBNewAlert (int32_t version, int64_t relayUntil, int64_t expiration, int32_t ID, int32_t cancel, int32_t minVer, int32_t maxVer, int32_t priority, CBByteArray *hiddenComment, CBByteArray *displayedComment, CBByteArray *reserved, CBByteArray *signature, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBAlert object.
CBAlertCBNewAlertFromData (CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBAlert object from serialised data.
CBAlertCBGetAlert (void *self)
 Gets a CBAlert from another object. Use this to avoid casts.
bool CBInitAlert (CBAlert *self, int32_t version, int64_t relayUntil, int64_t expiration, int32_t ID, int32_t cancel, int32_t minVer, int32_t maxVer, int32_t priority, CBByteArray *hiddenComment, CBByteArray *displayedComment, CBByteArray *reserved, CBByteArray *signature, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBAlert object.
bool CBInitAlertFromData (CBAlert *self, CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBAlert object from serialised data.
void CBFreeAlert (void *self)
 Frees a CBAlert object.
bool CBAlertAddCancelID (CBAlert *self, uint32_t ID)
 Adds a ID to the cancel set.
bool CBAlertAddUserAgent (CBAlert *self, CBByteArray *userAgent)
 Adds a user agent to the user agent set.
uint32_t CBAlertCalculateLength (CBAlert *self)
 Calculates the length needed to serialise the object.
uint32_t CBAlertDeserialise (CBAlert *self)
 Deserialises a CBAlert so that it can be used as an object.
CBByteArrayCBAlertGetPayload (CBAlert *self)
 Gets the payload from the data. Should be serialised beforehand.
CBByteArrayCBAlertSerialisePayload (CBAlert *self)
 Serialises the payload of a CBAlert and returns a CBByteArray to the specifc payload bytes to aid in creating a signature.
uint16_t CBAlertSerialiseSignature (CBAlert *self, uint16_t offset)
 Serialises the signature of a CBAlert.
bool CBAlertTakeUserAgent (CBAlert *self, CBByteArray *userAgent)
 Takes a user agent for the user agent set. This does not retain the CBByteArray so you can pass an CBByteArray into this while releasing control from the calling function.

Detailed Description

A message containing an alert signed by one of the bitcoin developers. Inherits CBMessage.


Function Documentation

bool CBAlertAddCancelID ( CBAlert self,
uint32_t  ID 
)

Adds a ID to the cancel set.

Parameters:
selfThe CBAlert object
IDThe id to add.
Returns:
true if the cancel ID was added successfully or false on error.
bool CBAlertAddUserAgent ( CBAlert self,
CBByteArray userAgent 
)

Adds a user agent to the user agent set.

Parameters:
selfThe CBAlert object
userAgentThe user agent to add.
Returns:
true if the user agent was added successfully or false on error.
uint32_t CBAlertCalculateLength ( CBAlert self)

Calculates the length needed to serialise the object.

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

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

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

Gets the payload from the data. Should be serialised beforehand.

Parameters:
selfThe CBAlert object
Returns:
A CBByteArray object for the payload. Can be used to check the signature. When checking the signature the payload should be hashed by SHA256 twice.

Serialises the payload of a CBAlert and returns a CBByteArray to the specifc payload bytes to aid in creating a signature.

Parameters:
selfThe CBAlert object
Returns:
The payload bytes on sucess. NULL on failure.
uint16_t CBAlertSerialiseSignature ( CBAlert self,
uint16_t  offset 
)

Serialises the signature of a CBAlert.

Parameters:
selfThe CBAlert object
offsetThe offset to the begining of the signature which should be exactly after the payload.
Returns:
The total length of the serialised CBAlert on sucess, else false.
bool CBAlertTakeUserAgent ( CBAlert self,
CBByteArray userAgent 
)

Takes a user agent for the user agent set. This does not retain the CBByteArray so you can pass an CBByteArray into this while releasing control from the calling function.

Parameters:
selfThe CBAlert object
userAgentThe user agent to take.
Returns:
true if the user agent was taken successfully or false on error.
void CBFreeAlert ( void *  self)

Frees a CBAlert object.

Parameters:
selfThe CBAlert object to free.
CBAlert* CBGetAlert ( void *  self)

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

Parameters:
selfThe object to obtain the CBAlert from.
Returns:
The CBAlert object.
bool CBInitAlert ( CBAlert self,
int32_t  version,
int64_t  relayUntil,
int64_t  expiration,
int32_t  ID,
int32_t  cancel,
int32_t  minVer,
int32_t  maxVer,
int32_t  priority,
CBByteArray hiddenComment,
CBByteArray displayedComment,
CBByteArray reserved,
CBByteArray signature,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Initialises a CBAlert object.

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

Initialises a CBAlert object from serialised data.

Parameters:
selfThe CBAlert object to initialise
dataThe serialised data.
Returns:
true on success, false on failure.
CBAlert* CBNewAlert ( int32_t  version,
int64_t  relayUntil,
int64_t  expiration,
int32_t  ID,
int32_t  cancel,
int32_t  minVer,
int32_t  maxVer,
int32_t  priority,
CBByteArray hiddenComment,
CBByteArray displayedComment,
CBByteArray reserved,
CBByteArray signature,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Creates a new CBAlert object.

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

Creates a new CBAlert object from serialised data.

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