Statistics
| Branch: | Revision:

grapes / include / trade_msg_ha.h @ d1de8494

History | View | Annotate | Download (1.43 KB)

1
/** @file trade_msg_ha.h
2
 *
3
 * Chunk Delivery API - Higher Abstraction
4
 *
5
 * The Chunk Delivery HA provides the primitives for effective chunks exchange with other peers. <br>
6
 * This is a part of the Data Exchange Protocol which provides high level abstraction for sending chunks to a target peers.
7
 *
8
 * @image html SOM_Internals.png "Data Exchange Protocol of the SOM module" width=50
9
 */
10
#include "chunk.h"
11
/**
12
  * Send a Chunk to a target Peer
13
  *
14
  * Send a single Chunk to a given Peer
15
  *
16
  * @param[in] to destination peer
17
  * @param[in] c Chunk to send
18
  * @return 0 on success, <0 on error
19
  */
20
int sendChunk(struct nodeID *to, const struct chunk *c);
21

    
22
/**
23
  * Init the Chunk trading stuff...
24
  *
25
  *
26
  * @param myID address of this peer
27
  * @return >= 0 on success, <0 on error
28
  */
29
int chunkInit(struct nodeID *myID);
30

    
31

    
32
#if 0
33
/** 
34
  * Notification function for a Chunk arrival
35
  */
36
typedef int (*ChunkNotification)(struct peer *from, struct chunk  *c);
37

38
/**
39
  * Register a notification for Chunk arrival
40
  * 
41
  * Register a notification function that should be called at every Chunk arrival
42
  *
43
  * @param[in] som Handle to the enclosing SOM instance
44
  * @param[in] p notify a send of chunk from Peer p, or from any peer if NULL
45
  * @param[in] fn pointer to the notification function.
46
  * @return a handle to the notification or NULL on error @see unregisterSendChunk
47
  */
48
void registerSendChunkNotifier(struct peer *p, ChunkNotification *fn);
49
#endif