Grid Community Toolkit  6.2.1629922860 (tag: v6.2.20210826)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_xio_driver.h
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #if !defined(GLOBUS_XIO_DRIVER_H)
18 #define GLOBUS_XIO_DRIVER_H 1
19 
20 #include "globus_common.h"
21 #include "globus_xio_load.h"
22 #include "globus_common.h"
23 #include "globus_xio_types.h"
24 #include "globus_xio.h"
25 #include "globus_xio_util.h"
26 #include <stdarg.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*-**********************************************************************
33  * attribute macros
34  ***********************************************************************/
35 #define GlobusIXIOAttrGetDS(_out_ds, _in_attr, _in_driver) \
36 do \
37 { \
38  int _ctr; \
39  globus_i_xio_attr_t * _attr; \
40  globus_xio_driver_t _driver; \
41  globus_i_xio_attr_ent_t * _entry; \
42  void * _ds = NULL; \
43  \
44  _attr = (_in_attr); \
45  _driver = (_in_driver); \
46  \
47  if(_in_attr == NULL) \
48  { \
49  _out_ds = NULL; \
50  } \
51  else \
52  { \
53  _entry = _attr->entry; \
54  for(_ctr = 0; _ctr < _attr->ndx && _ds == NULL; _ctr++) \
55  { \
56  if(_entry[_ctr].driver == _driver) \
57  { \
58  _ds = _entry[_ctr].driver_data; \
59  } \
60  } \
61  _out_ds = _ds; \
62  } \
63 } while(0)
64 
65 /*-*****************************************************************
66  * driver interface
67  ******************************************************************/
253 /*******************************************************************
254  * callbacks
255  ******************************************************************/
272 typedef void
274  globus_xio_operation_t op,
275  globus_result_t result,
276  void * user_arg);
277 
278 
300 typedef void
302  globus_xio_operation_t op,
303  globus_result_t result,
304  globus_size_t nbytes,
305  void * user_arg);
306 
307 
308 typedef globus_result_t
309 (*globus_xio_driver_push_driver_t)(
310  globus_xio_driver_t driver,
311  globus_xio_stack_t stack);
312 
314 globus_xio_driver_attr_cntl(
315  globus_xio_operation_t op,
316  globus_xio_driver_t driver,
317  int cmd,
318  ...);
319 
321 globus_xio_driver_data_descriptor_cntl(
322  globus_xio_operation_t op,
323  globus_xio_driver_t driver,
324  int cmd,
325  ...);
326 
338  globus_xio_driver_handle_t handle,
339  globus_xio_driver_t driver,
340  int cmd,
341  ...);
342 
346 typedef globus_result_t
347 (*globus_xio_driver_get_driver_t)(
348  globus_xio_driver_t * out_driver);
357 typedef globus_result_t
359  void ** out_driver_attr);
360 
368 typedef globus_result_t
370  void ** dst,
371  void * src);
372 
380 typedef globus_result_t
382  void * driver_attr);
383 
403 typedef globus_result_t
405  void * attr,
406  int cmd,
407  va_list ap);
408 
434 typedef globus_result_t
436  void * driver_attr,
437  const globus_xio_contact_t * contact_info,
438  globus_xio_operation_t op);
439 
466 globus_xio_driver_pass_server_init(
467  globus_xio_operation_t op,
468  const globus_xio_contact_t * contact_info,
469  void * driver_server);
470 
485 typedef globus_result_t
487  void * driver_server);
488 
509 typedef globus_result_t
511  void * driver_server,
512  globus_xio_operation_t op);
513 
515 globus_xio_driver_pass_accept(
516  globus_xio_operation_t op,
518  void * in_user_arg);
519 
523 typedef void
524 (*globus_xio_driver_cancel_callback_t)(
525  globus_xio_operation_t op,
526  void * user_arg,
527  globus_xio_error_type_t reason);
528 
548 void
550  globus_xio_operation_t op,
551  void * driver_link,
552  globus_result_t result);
553 
571 typedef globus_result_t
573  void * driver_server,
574  int cmd,
575  va_list ap);
576 
577 
581 typedef globus_result_t
582 (*globus_xio_driver_link_cntl_t)(
583  void * driver_link,
584  int cmd,
585  va_list ap);
586 
597 typedef globus_result_t
599  void * driver_link);
600 
601 
602 /**********************************************************************
603  * Open
604  *********************************************************************/
605 
633 typedef globus_result_t
635  const globus_xio_contact_t * contact_info,
636  void * driver_link,
637  void * driver_attr,
638  globus_xio_operation_t op);
639 
644 typedef globus_result_t
646  const globus_xio_contact_t * contact_info,
647  void * driver_link,
648  void * driver_attr,
649  globus_xio_operation_t op);
650 
681  globus_xio_operation_t op,
682  const globus_xio_contact_t * contact_info,
684  void * user_arg);
685 
705 void
707  void * driver_handle,
708  globus_xio_operation_t op,
709  globus_result_t result);
710 
711 /**********************************************************************
712  * Context functions
713  *********************************************************************/
734  globus_xio_operation_t * operation,
735  globus_xio_driver_handle_t handle);
736 
740 void
741 globus_xio_driver_operation_destroy(
742  globus_xio_operation_t operation);
743 
748 globus_xio_driver_operation_cancel(
749  globus_xio_driver_handle_t handle,
750  globus_xio_operation_t operation);
751 
762  globus_xio_operation_t operation);
763 
775 typedef globus_result_t
777  void * handle,
778  int cmd,
779  va_list ap);
780 
781 
783 globus_xio_driver_merge_handle(
784  globus_xio_operation_t op,
785  globus_xio_driver_handle_t handle);
786 
787 /**********************************************************************
788  * Close
789  *********************************************************************/
809 typedef globus_result_t
811  void * driver_handle,
812  void * driver_attr,
813  globus_xio_operation_t op);
814 
833  globus_xio_operation_t op,
835  void * callback_arg);
836 
852 void
854  globus_xio_operation_t op,
855  globus_result_t result);
856 
857 /**********************************************************************
858  * Read
859  *********************************************************************/
883 typedef globus_result_t
885  void * driver_specific_handle,
886  const globus_xio_iovec_t * iovec,
887  int iovec_count,
888  globus_xio_operation_t op);
889 
923  globus_xio_operation_t op,
924  globus_xio_iovec_t * iovec,
925  int iovec_count,
926  globus_size_t wait_for,
928  void * user_arg);
929 
947 void
949  globus_xio_operation_t op,
950  globus_result_t result,
951  globus_size_t nread);
952 
977 void
979  globus_xio_operation_t op);
980 
1005  globus_xio_operation_t op);
1006 
1007 /**********************************************************************
1008  * Write
1009  *********************************************************************/
1033 typedef globus_result_t
1035  void * driver_specific_handle,
1036  const globus_xio_iovec_t * iovec,
1037  int iovec_count,
1038  globus_xio_operation_t op);
1039 
1074  globus_xio_operation_t op,
1075  globus_xio_iovec_t * iovec,
1076  int iovec_count,
1077  globus_size_t wait_for,
1079  void * user_arg);
1080 
1098 void
1100  globus_xio_operation_t op,
1101  globus_result_t result,
1102  globus_size_t nwritten);
1103 
1130  globus_xio_operation_t top_op,
1131  globus_xio_operation_t bottom_op);
1132 
1133 
1134 /**********************************************************************
1135  * data descriptors
1136  *********************************************************************/
1196 globus_xio_driver_init(
1197  globus_xio_driver_t * driver,
1198  const char * driver_name,
1199  void * user_data);
1200 
1205 globus_xio_driver_get_user_data(
1206  globus_xio_driver_t in_driver,
1207  void ** out_user_data);
1208 
1210 globus_xio_operation_attr_cntl(
1211  globus_xio_operation_t op,
1212  globus_xio_attr_cmd_t cmd,
1213  ...);
1214 
1219 globus_xio_driver_destroy(
1220  globus_xio_driver_t driver);
1221 
1226 globus_xio_driver_set_transport(
1227  globus_xio_driver_t driver,
1228  globus_xio_driver_transport_open_t transport_open_func,
1229  globus_xio_driver_close_t close_func,
1230  globus_xio_driver_read_t read_func,
1231  globus_xio_driver_write_t write_func,
1232  globus_xio_driver_handle_cntl_t handle_cntl_func);
1233 
1238 globus_xio_driver_set_transform(
1239  globus_xio_driver_t driver,
1240  globus_xio_driver_transform_open_t transform_open_func,
1241  globus_xio_driver_close_t close_func,
1242  globus_xio_driver_read_t read_func,
1243  globus_xio_driver_write_t write_func,
1244  globus_xio_driver_handle_cntl_t handle_cntl_func,
1245  globus_xio_driver_push_driver_t push_driver_func);
1246 
1251 globus_xio_driver_set_server(
1252  globus_xio_driver_t driver,
1253  globus_xio_driver_server_init_t server_init_func,
1254  globus_xio_driver_server_accept_t server_accept_func,
1255  globus_xio_driver_server_destroy_t server_destroy_func,
1256  globus_xio_driver_server_cntl_t server_cntl_func,
1257  globus_xio_driver_link_cntl_t link_cntl_func,
1258  globus_xio_driver_link_destroy_t link_destroy_func);
1259 
1262  globus_xio_driver_t driver,
1263  globus_xio_driver_server_init_t server_pre_init_func);
1268 globus_xio_driver_set_attr(
1269  globus_xio_driver_t driver,
1270  globus_xio_driver_attr_init_t attr_init_func,
1271  globus_xio_driver_attr_copy_t attr_copy_func,
1272  globus_xio_driver_attr_cntl_t attr_cntl_func,
1273  globus_xio_driver_attr_destroy_t attr_destroy_func);
1274 
1275 /*
1276  * operation accessors
1277  */
1278 void
1279 globus_xio_operation_block_timeout(
1280  globus_xio_operation_t op);
1281 
1282 void
1283 globus_xio_operation_unblock_timeout(
1284  globus_xio_operation_t op);
1285 
1286 void
1287 globus_xio_operation_refresh_timeout(
1288  globus_xio_operation_t op);
1289 
1292 globus_xio_operation_enable_cancel(
1293  globus_xio_operation_t op,
1294  globus_xio_driver_cancel_callback_t cb,
1295  void * user_arg);
1296 
1297 void
1298 globus_xio_operation_disable_cancel(
1299  globus_xio_operation_t op);
1300 
1302 globus_xio_operation_is_canceled(
1303  globus_xio_operation_t op);
1304 
1306 globus_xio_operation_get_wait_for(
1307  globus_xio_operation_t op);
1308 
1309 void *
1310 globus_xio_operation_get_driver_specific(
1311  globus_xio_operation_t op);
1312 
1313 globus_xio_driver_t
1314 globus_xio_operation_get_user_driver(
1315  globus_xio_operation_t op);
1316 
1317 globus_xio_driver_t
1318 globus_xio_operation_get_transport_user_driver(
1319  globus_xio_operation_t op);
1320 
1321 /* this returns the handle to the drivers below you */
1322 globus_xio_driver_handle_t
1323 globus_xio_operation_get_driver_handle(
1324  globus_xio_operation_t op);
1325 
1326 /* this returns the handle to your driver.
1327  * (only useful for canceling operations in your possession)
1328  * or getting user handle associated with the driver
1329  */
1330 globus_xio_driver_handle_t
1331 globus_xio_operation_get_driver_self_handle(
1332  globus_xio_operation_t op);
1333 
1334 void *
1335 globus_xio_operation_get_data_descriptor(
1336  globus_xio_operation_t op,
1337  globus_bool_t force_create);
1338 
1340 globus_xio_operation_copy_stack(
1341  globus_xio_operation_t op,
1342  globus_xio_stack_t * stack);
1343 
1344 /* STRING PARSING STUFF */
1348 typedef globus_result_t
1349 (*globus_xio_string_cntl_parse_func_t)(
1350  void * attr,
1351  const char * key,
1352  const char * val,
1353  int cmd,
1354  globus_xio_driver_attr_cntl_t cntl_func);
1355 
1359 typedef struct globus_xio_string_cntl_table_s
1360 {
1361  const char * key;
1362  int cmd;
1363  globus_xio_string_cntl_parse_func_t parse_func;
1364 } globus_xio_string_cntl_table_t;
1365 
1422  globus_xio_driver_t driver,
1423  globus_xio_string_cntl_table_t * table);
1424 
1431  globus_xio_driver_t driver,
1432  globus_xio_string_cntl_table_t * table);
1433 
1442  void * attr,
1443  int cmd,
1444  ...);
1445 
1446 /* list all of the built in parsing functions */
1454  void * attr,
1455  const char * key,
1456  const char * val,
1457  int cmd,
1458  globus_xio_driver_attr_cntl_t cntl_func);
1459 
1467  void * attr,
1468  const char * key,
1469  const char * val,
1470  int cmd,
1471  globus_xio_driver_attr_cntl_t cntl_func);
1472 
1480  void * attr,
1481  const char * key,
1482  const char * val,
1483  int cmd,
1484  globus_xio_driver_attr_cntl_t cntl_func);
1485 
1493  void * attr,
1494  const char * key,
1495  const char * val,
1496  int cmd,
1497  globus_xio_driver_attr_cntl_t cntl_func);
1498 
1506  void * attr,
1507  const char * key,
1508  const char * val,
1509  int cmd,
1510  globus_xio_driver_attr_cntl_t cntl_func);
1511 
1513 globus_xio_string_cntl_formated_off(
1514  void * attr,
1515  const char * key,
1516  const char * val,
1517  int cmd,
1518  globus_xio_driver_attr_cntl_t cntl_func);
1519 
1521 globus_xio_string_cntl_formated_int(
1522  void * attr,
1523  const char * key,
1524  const char * val,
1525  int cmd,
1526  globus_xio_driver_attr_cntl_t cntl_func);
1527 
1529 globus_xio_string_cntl_string_list(
1530  void * attr,
1531  const char * key,
1532  const char * val,
1533  int cmd,
1534  globus_xio_driver_attr_cntl_t cntl_func);
1535 
1536 
1537 #ifdef __cplusplus
1538 }
1539 #endif
1540 
1541 #endif /* GLOBUS_XIO_DRIVER_H */
void globus_xio_driver_finished_accept(globus_xio_operation_t op, void *driver_link, globus_result_t result)
Definition: globus_xio_pass.c:1603
void globus_xio_driver_finished_open(void *driver_handle, globus_xio_operation_t op, globus_result_t result)
Definition: globus_xio_pass.c:156
void(* globus_xio_driver_data_callback_t)(globus_xio_operation_t op, globus_result_t result, globus_size_t nbytes, void *user_arg)
Definition: globus_xio_driver.h:301
globus_result_t(* globus_xio_driver_attr_copy_t)(void **dst, void *src)
Definition: globus_xio_driver.h:369
globus_result_t(* globus_xio_driver_read_t)(void *driver_specific_handle, const globus_xio_iovec_t *iovec, int iovec_count, globus_xio_operation_t op)
Definition: globus_xio_driver.h:884
globus_result_t(* globus_xio_driver_write_t)(void *driver_specific_handle, const globus_xio_iovec_t *iovec, int iovec_count, globus_xio_operation_t op)
Definition: globus_xio_driver.h:1034
globus_result_t(* globus_xio_driver_server_destroy_t)(void *driver_server)
Definition: globus_xio_driver.h:486
globus_result_t globus_xio_driver_handle_string_cntl_set_table(globus_xio_driver_t driver, globus_xio_string_cntl_table_t *table)
Definition: globus_xio_driver.c:2220
globus_result_t(* globus_xio_driver_attr_cntl_t)(void *attr, int cmd, va_list ap)
Definition: globus_xio_driver.h:404
globus_result_t globus_xio_string_cntl_string(void *attr, const char *key, const char *val, int cmd, globus_xio_driver_attr_cntl_t cntl_func)
Definition: globus_xio_attr.c:1428
globus_bool_t globus_xio_driver_eof_received(globus_xio_operation_t op)
Definition: globus_xio_driver.c:1902
globus_result_t(* globus_xio_driver_close_t)(void *driver_handle, void *driver_attr, globus_xio_operation_t op)
Close a handle.
Definition: globus_xio_driver.h:810
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
globus_result_t globus_xio_driver_handle_cntl(globus_xio_driver_handle_t driver_handle, globus_xio_driver_t driver, int cmd,...)
Definition: globus_xio_driver.c:1762
globus_result_t globus_xio_driver_pass_close(globus_xio_operation_t op, globus_xio_driver_callback_t cb, void *callback_arg)
Pass the close operation down the driver stack.
Definition: globus_xio_pass.c:394
globus_result_t globus_xio_driver_pass_read(globus_xio_operation_t op, globus_xio_iovec_t *iovec, int iovec_count, globus_size_t wait_for, globus_xio_driver_data_callback_t cb, void *user_arg)
Definition: globus_xio_pass.c:933
globus_result_t globus_xio_driver_operation_create(globus_xio_operation_t *operation, globus_xio_driver_handle_t driver_handle)
Definition: globus_xio_driver.c:1062
globus_result_t(* globus_xio_driver_transport_open_t)(const globus_xio_contact_t *contact_info, void *driver_link, void *driver_attr, globus_xio_operation_t op)
Open a handle.
Definition: globus_xio_driver.h:645
globus_result_t(* globus_xio_driver_attr_destroy_t)(void *driver_attr)
Definition: globus_xio_driver.h:381
globus_result_t globus_xio_string_cntl_float(void *attr, const char *key, const char *val, int cmd, globus_xio_driver_attr_cntl_t cntl_func)
Definition: globus_xio_attr.c:1400
void(* globus_xio_driver_callback_t)(globus_xio_operation_t op, globus_result_t result, void *user_arg)
Open and Close Callback Signature.
Definition: globus_xio_driver.h:273
globus_result_t(* globus_xio_driver_handle_cntl_t)(void *handle, int cmd, va_list ap)
Definition: globus_xio_driver.h:776
void globus_xio_driver_finished_write(globus_xio_operation_t op, globus_result_t result, globus_size_t nwritten)
Definition: globus_xio_pass.c:759
globus_result_t(* globus_xio_driver_server_init_t)(void *driver_attr, const globus_xio_contact_t *contact_info, globus_xio_operation_t op)
Definition: globus_xio_driver.h:435
globus_result_t(* globus_xio_driver_transform_open_t)(const globus_xio_contact_t *contact_info, void *driver_link, void *driver_attr, globus_xio_operation_t op)
Open a handle.
Definition: globus_xio_driver.h:634
globus_result_t(* globus_xio_driver_link_destroy_t)(void *driver_link)
Definition: globus_xio_driver.h:598
globus_result_t globus_xio_string_cntl_int(void *attr, const char *key, const char *val, int cmd, globus_xio_driver_attr_cntl_t cntl_func)
Definition: globus_xio_attr.c:1323
void globus_xio_driver_finished_close(globus_xio_operation_t op, globus_result_t result)
Definition: globus_xio_pass.c:537
size_t globus_size_t
Standard size of memory objectThe globus_size_t is the size of a memory object. It is identical to si...
Definition: globus_types.h:48
globus_result_t globus_xio_string_cntl_bool(void *attr, const char *key, const char *val, int cmd, globus_xio_driver_attr_cntl_t cntl_func)
Definition: globus_xio_attr.c:1447
globus_result_t globus_xio_driver_pass_open(globus_xio_operation_t op, const globus_xio_contact_t *contact_info, globus_xio_driver_callback_t cb, void *user_arg)
Definition: globus_xio_pass.c:27
globus_bool_t globus_xio_driver_operation_is_blocking(globus_xio_operation_t op)
Definition: globus_xio_driver.c:2340
void globus_xio_driver_finished_read(globus_xio_operation_t op, globus_result_t result, globus_size_t nread)
Definition: globus_xio_pass.c:1120
Headers common to all of Globus.
uint32_t globus_result_t
Definition: globus_types.h:99
globus_result_t(* globus_xio_driver_server_cntl_t)(void *driver_server, int cmd, va_list ap)
Definition: globus_xio_driver.h:572
globus_result_t(* globus_xio_driver_server_accept_t)(void *driver_server, globus_xio_operation_t op)
Definition: globus_xio_driver.h:510
globus_result_t globus_xio_driver_set_server_pre_init(globus_xio_driver_t driver, globus_xio_driver_server_init_t server_pre_init_func)
Server Pre-Init.
Definition: globus_xio_driver.c:2128
globus_result_t globus_xio_string_cntl_int_int(void *attr, const char *key, const char *val, int cmd, globus_xio_driver_attr_cntl_t cntl_func)
Definition: globus_xio_attr.c:1351
globus_result_t globus_xio_string_cntl_bouncer(globus_xio_driver_attr_cntl_t cntl_func, void *attr, int cmd,...)
Definition: globus_xio_attr.c:1190
globus_result_t(* globus_xio_driver_attr_init_t)(void **out_driver_attr)
Definition: globus_xio_driver.h:358
void globus_xio_driver_set_eof_received(globus_xio_operation_t op)
Definition: globus_xio_driver.c:1867
globus_result_t globus_xio_driver_string_cntl_set_table(globus_xio_driver_t driver, globus_xio_string_cntl_table_t *table)
Definition: globus_xio_driver.c:2190
globus_result_t globus_xio_driver_merge_operation(globus_xio_operation_t top_op, globus_xio_operation_t bottom_op)
globus_result_t globus_xio_driver_pass_write(globus_xio_operation_t op, globus_xio_iovec_t *iovec, int iovec_count, globus_size_t wait_for, globus_xio_driver_data_callback_t cb, void *user_arg)
Definition: globus_xio_pass.c:610