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

Message for broadcasting CBNetworkAddresses over the network. This is used to share socket information for peers that are accepting incomming connections. When making an object, get the addresses you want to add and then set the "addrNum" and "addresses" fields. When managing the addresses you want to share, it's best to keep one object and change the addresses when necessary by reorganising the pointers with the "addresses" field. Inherits CBMessage. More...

#include "CBNetworkAddress.h"

Go to the source code of this file.

Data Structures

struct  CBAddressBroadcast
 Structure for CBAddressBroadcast objects. More...

Functions

CBAddressBroadcastCBNewAddressBroadcast (bool timeStamps, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBAddressBroadcast object.
CBAddressBroadcastCBNewAddressBroadcastFromData (CBByteArray *data, bool timeStamps, void(*onErrorReceived)(CBError error, char *,...))
 Creates a new CBAddressBroadcast object from serialised data.
CBAddressBroadcastCBGetAddressBroadcast (void *self)
 Gets a CBAddressBroadcast from another object. Use this to avoid casts.
bool CBInitAddressBroadcast (CBAddressBroadcast *self, bool timeStamps, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBAddressBroadcast object.
bool CBInitAddressBroadcastFromData (CBAddressBroadcast *self, bool timeStamps, CBByteArray *data, void(*onErrorReceived)(CBError error, char *,...))
 Initialises a CBAddressBroadcast object from serialised data.
void CBFreeAddressBroadcast (void *self)
 Frees a CBAddressBroadcast object.
bool CBAddressBroadcastAddNetworkAddress (CBAddressBroadcast *self, CBNetworkAddress *address)
 Adds a CBNetworkAddress to the list for broadcasting.
uint32_t CBAddressBroadcastCalculateLength (CBAddressBroadcast *self)
 Calculates the length needed to serialise the object.
uint32_t CBAddressBroadcastDeserialise (CBAddressBroadcast *self)
 Deserialises a CBAddressBroadcast so that it can be used as an object.
uint32_t CBAddressBroadcastSerialise (CBAddressBroadcast *self)
 Serialises a CBAddressBroadcast to the byte data.
bool CBAddressBroadcastTakeNetworkAddress (CBAddressBroadcast *self, CBNetworkAddress *address)
 Takes a CBNetworkAddress to the list for broadcasting. This does not retain the CBNetworkAddress so you can pass an CBNetworkAddress into this while releasing control in the calling function.

Detailed Description

Message for broadcasting CBNetworkAddresses over the network. This is used to share socket information for peers that are accepting incomming connections. When making an object, get the addresses you want to add and then set the "addrNum" and "addresses" fields. When managing the addresses you want to share, it's best to keep one object and change the addresses when necessary by reorganising the pointers with the "addresses" field. Inherits CBMessage.


Function Documentation

Adds a CBNetworkAddress to the list for broadcasting.

Parameters:
selfThe CBAddressBroadcast object
addressThe CBNetworkAddress to add.
Returns:
true if the network address was added successfully, false if there was an error in doing so.

Calculates the length needed to serialise the object.

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

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

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

Serialises a CBAddressBroadcast to the byte data.

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

Takes a CBNetworkAddress to the list for broadcasting. This does not retain the CBNetworkAddress so you can pass an CBNetworkAddress into this while releasing control in the calling function.

Parameters:
selfThe CBAddressBroadcast object
addressThe CBNetworkAddress to take.
Returns:
true if the network address was taken successfully, false if there was an error in doing so.
void CBFreeAddressBroadcast ( void *  self)

Frees a CBAddressBroadcast object.

Parameters:
selfThe CBAddressBroadcast object to free.

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

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

Initialises a CBAddressBroadcast object.

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

Initialises a CBAddressBroadcast object from serialised data.

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

Creates a new CBAddressBroadcast object.

Returns:
A new CBAddressBroadcast object.
CBAddressBroadcast* CBNewAddressBroadcastFromData ( CBByteArray data,
bool  timeStamps,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Creates a new CBAddressBroadcast object from serialised data.

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