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

This message contains the ID used in ping and pong messages for protocol versions over 60000. A CBNetworkCommunicator will accept this message for compatible protocol numbers and use an empty message for pings otherwise. Inherits CBMessage. More...

#include "CBMessage.h"

Go to the source code of this file.

Data Structures

struct  CBPingPong
 Structure for CBPingPong objects. More...

Functions

CBPingPongCBNewPingPong (uint64_t ID, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBPingPong object.
CBPingPongCBNewPingPongFromData (CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBPingPong object from serialised data.
CBPingPongCBGetPingPong (void *self)
 Gets a CBPingPong from another object. Use this to avoid casts.
bool CBInitPingPong (CBPingPong *self, uint64_t ID, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBPingPong object.
bool CBInitPingPongFromData (CBPingPong *self, CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBPingPong object from serialised data.
void CBFreePingPong (void *self)
 Frees a CBPingPong object.
uint8_t CBPingPongDeserialise (CBPingPong *self)
 Deserialises a CBPingPong so that it can be used as an object.
uint8_t CBPingPongSerialise (CBPingPong *self)
 Serialises a CBPingPong to the byte data.

Detailed Description

This message contains the ID used in ping and pong messages for protocol versions over 60000. A CBNetworkCommunicator will accept this message for compatible protocol numbers and use an empty message for pings otherwise. Inherits CBMessage.


Function Documentation

void CBFreePingPong ( void *  self)

Frees a CBPingPong object.

Parameters:
selfThe CBPingPong object to free.
CBPingPong* CBGetPingPong ( void *  self)

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

Parameters:
selfThe object to obtain the CBPingPong from.
Returns:
The CBPingPong object.
bool CBInitPingPong ( CBPingPong self,
uint64_t  ID,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Initialises a CBPingPong object.

Parameters:
selfThe CBPingPong object to initialise
IDThe identifier used in a ping/pong communcation. Use zero for no identification.
Returns:
true on success, false on failure.
bool CBInitPingPongFromData ( CBPingPong self,
CBByteArray data,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Initialises a CBPingPong object from serialised data.

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

Creates a new CBPingPong object.

Parameters:
IDThe identifier used in a ping/pong communcation. Use zero for no identification.
Returns:
A new CBPingPong object.
CBPingPong* CBNewPingPongFromData ( CBByteArray data,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Creates a new CBPingPong object from serialised data.

Parameters:
dataSerialised CBPingPong data.
Returns:
A new CBPingPong object.
uint8_t CBPingPongDeserialise ( CBPingPong self)

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

Parameters:
selfThe CBPingPong object
Returns:
Length read if successful, zero otherwise.
uint8_t CBPingPongSerialise ( CBPingPong self)

Serialises a CBPingPong to the byte data.

Parameters:
selfThe CBPingPong object
Returns:
Length written if successful, zero otherwise.