trade_sig_ha.h File Reference

Chunk Signaling API - Higher Abstraction (HA). More...

#include "net_helper.h"

Go to the source code of this file.

Enumerations

enum  signaling_type {
  sig_offer, sig_accept, sig_request, sig_deliver,
  sig_send_buffermap, sig_request_buffermap
}

Functions

int chunkSignalingInit (struct nodeID *myID)
 Set current node identifier.
int parseSignaling (uint8_t *buff, int buff_len, struct nodeID **owner_id, struct chunkID_set **cset, int *max_deliver, int *trans_id, enum signaling_type *sig_type)
 Parse an incoming signaling message, providing the signal type and the information of the signaling message.
int requestChunks (struct nodeID *to, const struct chunkID_set *cset, int max_deliver, int trans_id)
 Request a set of chunks from a Peer.
int deliverChunks (struct nodeID *to, struct chunkID_set *cset, int trans_id)
 Deliver a set of Chunks to a Peer as a reply of its previous request of Chunks.
int offerChunks (struct nodeID *to, struct chunkID_set *cset, int max_deliver, int trans_id)
 Offer a (sub)set of chunks to a Peer.
int acceptChunks (struct nodeID *to, struct chunkID_set *cset, int trans_id)
 Accept a (sub)set of chunks from a Peer.
int sendBufferMap (struct nodeID *to, const struct nodeID *owner, struct chunkID_set *bmap, int trans_id)
 Send a BufferMap to a Peer.
int requestBufferMap (struct nodeID *to, const struct nodeID *owner, int trans_id)
 Request a BufferMap to a Peer.

Detailed Description

Chunk Signaling API - Higher Abstraction (HA).

The trade signaling HA provides a set of primitives for chunks signaling negotiation with other peers, in order to collect information for the effective chunk exchange with other peers. This is a part of the Data Exchange Protocol which provides high level abstraction for chunks' negotiations, like requesting and proposing chunks.


Function Documentation

int acceptChunks ( struct nodeID *  to,
struct chunkID_set *  cset,
int  trans_id 
)

Accept a (sub)set of chunks from a Peer.

Announce to accept a (sub)set of Chunks from a Peer which sent a offer before, and specify the maximum number of Chunks attempted to receive (attempted to receive: i.e., the receiver peer would like to receive at most this number of Chunks from the set offered before).

Parameters:
[in] to target peer to accept the ChunkIDs.
[in] cset array of ChunkIDs.
[in] trans_id transaction number associated with this request.
Returns:
1 on success, <0 on error.
int chunkSignalingInit ( struct nodeID *  myID  ) 

Set current node identifier.

Initialize the node identifier of the peer

Parameters:
[in] current node indentifier.
Returns:
1 on success, <0 on error.
int deliverChunks ( struct nodeID *  to,
struct chunkID_set *  cset,
int  trans_id 
)

Deliver a set of Chunks to a Peer as a reply of its previous request of Chunks.

Announce to the Peer which sent a request of a set of Chunks, that we have these chunks (sub)set available among all those requested and willing to deliver them.

Parameters:
[in] to target peer to which deliver the ChunkIDs.
[in] cset array of ChunkIDs.
[in] trans_id transaction number associated with this request.
Returns:
1 on success, <0 on error.
int offerChunks ( struct nodeID *  to,
struct chunkID_set *  cset,
int  max_deliver,
int  trans_id 
)

Offer a (sub)set of chunks to a Peer.

Initiate a offer for a set of Chunks towards a Peer, and specify the maximum number of Chunks attempted to deliver (attempted to deliver: i.e., the sender peer should try to send at most this number of Chunks from the set).

Parameters:
[in] to target peer to offer the ChunkIDs.
[in] cset array of ChunkIDs.
[in] max_deliver deliver at most this number of Chunks.
[in] trans_id transaction number associated with this request.
Returns:
1 on success, <0 on error.
int parseSignaling ( uint8_t *  buff,
int  buff_len,
struct nodeID **  owner_id,
struct chunkID_set **  cset,
int *  max_deliver,
int *  trans_id,
enum signaling_type *  sig_type 
)

Parse an incoming signaling message, providing the signal type and the information of the signaling message.

Parse an incoming signaling message provided in the buffer, giving the information of the message received.

Parameters:
[in] buffer containing the incoming message.
[in] buff_len length of the buffer.
[out] owner_id identifier of the node on which refer the message just received.
[out] cset array of chunkIDs.
[out] max_deliver deliver at most this number of Chunks.
[out] trans_id transaction number associated with this message.
[out] sig_type Type of signaling message.
Returns:
1 on success, <0 on error.
int requestBufferMap ( struct nodeID *  to,
const struct nodeID *  owner,
int  trans_id 
)

Request a BufferMap to a Peer.

Request (target peer or some other peer's) BufferMap to target Peer.

Parameters:
[in] to PeerID.
[in] owner Owner of the BufferMap to request.
[in] trans_id transaction number associated with this request.
Returns:
1 Success, <0 on error.
int requestChunks ( struct nodeID *  to,
const struct chunkID_set *  cset,
int  max_deliver,
int  trans_id 
)

Request a set of chunks from a Peer.

Request a set of Chunks towards a Peer, and specify the maximum number of Chunks attempted to receive (i.e., the number of chunks the destination peer would like to receive among those requested).

Parameters:
[in] to target peer to request the ChunkIDs from.
[in] cset array of ChunkIDs.
[in] max_deliver deliver at most this number of Chunks.
[in] trans_id transaction number associated with this request.
Returns:
1 on success, <0 on error.
int sendBufferMap ( struct nodeID *  to,
const struct nodeID *  owner,
struct chunkID_set *  bmap,
int  trans_id 
)

Send a BufferMap to a Peer.

Send (our own or some other peer's) BufferMap to a third Peer.

Parameters:
[in] to PeerID.
[in] owner Owner of the BufferMap to send.
[in] bmap the BufferMap to send.
[in] trans_id transaction number associated with this send.
Returns:
1 Success, <0 on error.
Generated on Mon Jul 12 16:16:52 2010 for GRAPES by  doxygen 1.6.3