1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef __DADA_NI_H
#define __DADA_NI_H
/* ************************************************************************
dada_ni_t - a struct and associated routines for creation and
execution of a dada network interface
************************************************************************ */
#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
/* the open socket file descriptor */
int fd;
/* pointer to the header of the current data transfer */
char* header;
/* the size of the header */
unsigned header_size;
/* total number of bytes of data to be transfered over network interface */
uint64_t total_data;
/* total number of bytes already transfered */
uint64_t total_transfered;
/* flag: -1=recv, 0=idle, 1=send */
int state;
} dada_ni_t;
/*! Create a new DADA network interface */
dada_ni_t* dada_ni_create (int fd);
/*! Destroy a DADA network interface */
void dada_ni_destroy (dada_ni_t* net);
/*! Prepare for sending data over the DADA network interface */
int dada_ni_open_send (dada_ni_t* net, uint64_t total_data);
/*! Send data over the DADA network interface */
int dada_ni_send (dada_ni_t* net, void* data, uint64_t data_size);
/*! Prepare for receiving data over the DADA network interface */
int dada_ni_open_recv (dada_ni_t* net);
/*! Receive data over the DADA network interface */
int dada_ni_recv (dada_ni_t* net, void* data, uint64_t data_size);
#ifdef __cplusplus
}
#endif
#endif