Mercury
na_private.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Argonne National Laboratory, Department of Energy,
3  *                    UChicago Argonne, LLC and The HDF Group.
4  * All rights reserved.
5  *
6  * The full copyright notice, including terms governing use, modification,
7  * and redistribution, is contained in the COPYING file that can be
8  * found at the root of the source code distribution tree.
9  */
10 
11 #ifndef NA_PRIVATE_H
12 #define NA_PRIVATE_H
13 
14 #include "na.h"
15 
16 /* Remove warnings when plugin does not use callback arguments */
17 #if defined(__cplusplus)
18  #define NA_UNUSED
19 #elif defined(__GNUC__) && (__GNUC__ >= 4)
20  #define NA_UNUSED __attribute__((unused))
21 #else
22  #define NA_UNUSED
23 #endif
24 
25 /* NA info definition */
26 struct na_info {
27  char *class_name; /* Class name (e.g., ssm, bmi, mpi) */
28  char *protocol_name; /* Protocol (e.g., tcp, ib) */
29  char *host_name; /* Host */
30  int port; /* Port for communication */
31  char *port_name; /* Identifies the server and can be used by a client */
32 };
33 
34 /* Class description */
35 struct na_class_info {
36  const char *class_name; /* Class name (e.g., ssm, bmi, mpi) */
37  na_bool_t (*check_protocol)(const char *protocol_name);
38  na_class_t *(*initialize)(const struct na_info *na_info, na_bool_t listen);
39 };
40 
41 /* Private callback type for NA plugins */
42 typedef void (*na_plugin_cb_t)(struct na_cb_info *callback_info, void *arg);
43 
44 /* NA execution context, plugins may use plugin context if protocol supports
45  * progress on separate contexts/queues/etc */
46 typedef void *na_plugin_context_t;
47 struct na_context {
49 };
50 
51 /* NA class definition */
52 struct na_class {
53  /* plugin private data */
54  void *private_data;
55 
56  /* plugin callbacks */
60  );
64  na_plugin_context_t *plugin_context
65  );
69  na_plugin_context_t plugin_context
70  );
74  na_context_t *context,
75  na_cb_t callback,
76  void *arg,
77  const char *name,
78  na_op_id_t *op_id
79  );
83  na_addr_t addr
84  );
88  na_addr_t *addr
89  );
93  na_addr_t addr,
94  na_addr_t *new_addr
95  );
96  na_bool_t
99  na_addr_t addr
100  );
104  char *buf,
105  na_size_t buf_size,
106  na_addr_t addr
107  );
108  na_size_t
111  );
112  na_size_t
115  );
116  na_tag_t
119  );
123  na_context_t *context,
124  na_cb_t callback,
125  void *arg,
126  const void *buf,
127  na_size_t buf_size,
128  na_addr_t dest,
129  na_tag_t tag,
130  na_op_id_t *op_id
131  );
135  na_context_t *context,
136  na_cb_t callback,
137  void *arg,
138  void *buf,
139  na_size_t buf_size,
140  na_op_id_t *op_id
141  );
145  na_context_t *context,
146  na_cb_t callback,
147  void *arg,
148  const void *buf,
149  na_size_t buf_size,
150  na_addr_t dest,
151  na_tag_t tag,
152  na_op_id_t *op_id
153  );
157  na_context_t *context,
158  na_cb_t callback,
159  void *arg,
160  void *buf,
161  na_size_t buf_size,
162  na_addr_t source,
163  na_tag_t tag,
164  na_op_id_t *op_id
165  );
169  void *buf,
170  na_size_t buf_size,
171  unsigned long flags,
172  na_mem_handle_t *mem_handle
173  );
177  struct na_segment *segments,
178  na_size_t segment_count,
179  unsigned long flags,
180  na_mem_handle_t *mem_handle
181  );
185  na_mem_handle_t mem_handle
186  );
190  na_mem_handle_t mem_handle
191  );
195  na_mem_handle_t mem_handle
196  );
197  na_size_t
200  na_mem_handle_t mem_handle
201  );
205  void *buf,
206  na_size_t buf_size,
207  na_mem_handle_t mem_handle
208  );
212  na_mem_handle_t *mem_handle,
213  const void *buf,
214  na_size_t buf_size
215  );
217  (*put)(
219  na_context_t *context,
220  na_cb_t callback,
221  void *arg,
222  na_mem_handle_t local_mem_handle,
223  na_offset_t local_offset,
224  na_mem_handle_t remote_mem_handle,
225  na_offset_t remote_offset,
226  na_size_t length,
227  na_addr_t remote_addr,
228  na_op_id_t *op_id
229  );
231  (*get)(
233  na_context_t *context,
234  na_cb_t callback,
235  void *arg,
236  na_mem_handle_t local_mem_handle,
237  na_offset_t local_offset,
238  na_mem_handle_t remote_mem_handle,
239  na_offset_t remote_offset,
240  na_size_t length,
241  na_addr_t remote_addr,
242  na_op_id_t *op_id
243  );
247  na_context_t *context,
248  unsigned int timeout
249  );
251  (*cancel)(
253  na_context_t *context,
254  na_op_id_t op_id
255  );
256 };
257 
258 /* Private routines for use inside NA plugins */
259 
272 NA_EXPORT na_return_t
274  na_context_t *context,
275  na_cb_t callback,
276  struct na_cb_info *callback_info,
277  na_plugin_cb_t plugin_callback,
278  void *plugin_callback_args
279  );
280 
281 #endif /* NA_PRIVATE_H */
void(* na_plugin_cb_t)(struct na_cb_info *callback_info, void *arg)
Definition: na_private.h:42
na_return_t(* finalize)(na_class_t *na_class)
Definition: na_private.h:58
na_return_t(* mem_handle_create)(na_class_t *na_class, void *buf, na_size_t buf_size, unsigned long flags, na_mem_handle_t *mem_handle)
Definition: na_private.h:167
na_return_t(* addr_self)(na_class_t *na_class, na_addr_t *addr)
Definition: na_private.h:86
na_return_t(* mem_handle_deserialize)(na_class_t *na_class, na_mem_handle_t *mem_handle, const void *buf, na_size_t buf_size)
Definition: na_private.h:210
void * na_plugin_context_t
Definition: na_private.h:46
na_return_t(* addr_to_string)(na_class_t *na_class, char *buf, na_size_t buf_size, na_addr_t addr)
Definition: na_private.h:102
na_return_t(* mem_handle_serialize)(na_class_t *na_class, void *buf, na_size_t buf_size, na_mem_handle_t mem_handle)
Definition: na_private.h:203
na_return_t(* addr_dup)(na_class_t *na_class, na_addr_t addr, na_addr_t *new_addr)
Definition: na_private.h:91
char * port_name
Definition: na_private.h:31
na_return_t(* cancel)(na_class_t *na_class, na_context_t *context, na_op_id_t op_id)
Definition: na_private.h:251
char * class_name
Definition: na_private.h:27
void * arg
Definition: na.h:93
na_return_t(* mem_deregister)(na_class_t *na_class, na_mem_handle_t mem_handle)
Definition: na_private.h:193
void * na_addr_t
Definition: na.h:20
na_return_t(* addr_lookup)(na_class_t *na_class, na_context_t *context, na_cb_t callback, void *arg, const char *name, na_op_id_t *op_id)
Definition: na_private.h:72
na_return_t(* context_create)(na_class_t *na_class, na_plugin_context_t *plugin_context)
Definition: na_private.h:62
enum na_return na_return_t
na_tag_t(* msg_get_max_tag)(na_class_t *na_class)
Definition: na_private.h:117
na_uint64_t na_size_t
Definition: na.h:21
Definition: na.h:92
na_return_t(* progress)(na_class_t *na_class, na_context_t *context, unsigned int timeout)
Definition: na_private.h:245
na_return_t(* mem_handle_create_segments)(na_class_t *na_class, struct na_segment *segments, na_size_t segment_count, unsigned long flags, na_mem_handle_t *mem_handle)
Definition: na_private.h:175
na_return_t(* msg_send_unexpected)(na_class_t *na_class, na_context_t *context, na_cb_t callback, void *arg, const void *buf, na_size_t buf_size, na_addr_t dest, na_tag_t tag, na_op_id_t *op_id)
Definition: na_private.h:121
char * host_name
Definition: na_private.h:29
na_return_t(* msg_recv_expected)(na_class_t *na_class, na_context_t *context, na_cb_t callback, void *arg, void *buf, na_size_t buf_size, na_addr_t source, na_tag_t tag, na_op_id_t *op_id)
Definition: na_private.h:155
na_size_t(* msg_get_max_unexpected_size)(na_class_t *na_class)
Definition: na_private.h:113
const char * class_name
Definition: na_private.h:36
na_bool_t(* addr_is_self)(na_class_t *na_class, na_addr_t addr)
Definition: na_private.h:97
char * protocol_name
Definition: na_private.h:28
na_size_t(* mem_handle_get_serialize_size)(na_class_t *na_class, na_mem_handle_t mem_handle)
Definition: na_private.h:198
na_size_t(* msg_get_max_expected_size)(na_class_t *na_class)
Definition: na_private.h:109
na_return_t(* put)(na_class_t *na_class, na_context_t *context, na_cb_t callback, void *arg, na_mem_handle_t local_mem_handle, na_offset_t local_offset, na_mem_handle_t remote_mem_handle, na_offset_t remote_offset, na_size_t length, na_addr_t remote_addr, na_op_id_t *op_id)
Definition: na_private.h:217
na_return_t(* mem_register)(na_class_t *na_class, na_mem_handle_t mem_handle)
Definition: na_private.h:188
Definition: na.h:29
na_return_t(* msg_recv_unexpected)(na_class_t *na_class, na_context_t *context, na_cb_t callback, void *arg, void *buf, na_size_t buf_size, na_op_id_t *op_id)
Definition: na_private.h:133
int port
Definition: na_private.h:30
NA_EXPORT na_return_t na_cb_completion_add(na_context_t *context, na_cb_t callback, struct na_cb_info *callback_info, na_plugin_cb_t plugin_callback, void *plugin_callback_args)
Add callback to context completion queue.
void * na_mem_handle_t
Definition: na.h:25
na_uint64_t na_offset_t
Definition: na.h:26
na_return_t(* na_cb_t)(const struct na_cb_info *callback_info)
Definition: na.h:103
void * na_op_id_t
Definition: na.h:23
na_return_t(* context_destroy)(na_class_t *na_class, na_plugin_context_t plugin_context)
Definition: na_private.h:67
na_bool_t(* check_protocol)(const char *protocol_name)
Definition: na_private.h:37
na_return_t(* addr_free)(na_class_t *na_class, na_addr_t addr)
Definition: na_private.h:81
na_return_t(* msg_send_expected)(na_class_t *na_class, na_context_t *context, na_cb_t callback, void *arg, const void *buf, na_size_t buf_size, na_addr_t dest, na_tag_t tag, na_op_id_t *op_id)
Definition: na_private.h:143
na_uint32_t na_tag_t
Definition: na.h:22
na_plugin_context_t plugin_context
Definition: na_private.h:48
void * private_data
Definition: na_private.h:54
na_return_t(* mem_handle_free)(na_class_t *na_class, na_mem_handle_t mem_handle)
Definition: na_private.h:183