Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 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 * driver_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 
482 typedef globus_result_t
484  void * driver_server);
485 
506 typedef globus_result_t
508  void * driver_server,
509  globus_xio_operation_t op);
510 
512 globus_xio_driver_pass_accept(
513  globus_xio_operation_t op,
515  void * in_user_arg);
516 
520 typedef void
521 (*globus_xio_driver_cancel_callback_t)(
522  globus_xio_operation_t op,
523  void * user_arg,
524  globus_xio_error_type_t reason);
525 
545 void
547  globus_xio_operation_t op,
548  void * driver_link,
549  globus_result_t result);
550 
568 typedef globus_result_t
570  void * driver_server,
571  int cmd,
572  va_list ap);
573 
574 
578 typedef globus_result_t
579 (*globus_xio_driver_link_cntl_t)(
580  void * driver_link,
581  int cmd,
582  va_list ap);
583 
594 typedef globus_result_t
596  void * driver_link);
597 
598 
599 /**********************************************************************
600  * Open
601  *********************************************************************/
602 
630 typedef globus_result_t
632  const globus_xio_contact_t * contact_info,
633  void * driver_link,
634  void * driver_attr,
635  globus_xio_operation_t op);
636 
641 typedef globus_result_t
643  const globus_xio_contact_t * contact_info,
644  void * driver_link,
645  void * driver_attr,
646  globus_xio_operation_t op);
647 
678  globus_xio_operation_t op,
679  const globus_xio_contact_t * contact_info,
681  void * user_arg);
682 
702 void
704  void * driver_handle,
705  globus_xio_operation_t op,
706  globus_result_t result);
707 
708 /**********************************************************************
709  * Context functions
710  *********************************************************************/
731  globus_xio_operation_t * operation,
732  globus_xio_driver_handle_t handle);
733 
737 void
738 globus_xio_driver_operation_destroy(
739  globus_xio_operation_t operation);
740 
745 globus_xio_driver_operation_cancel(
746  globus_xio_driver_handle_t handle,
747  globus_xio_operation_t operation);
748 
759  globus_xio_operation_t operation);
760 
772 typedef globus_result_t
774  void * handle,
775  int cmd,
776  va_list ap);
777 
778 
780 globus_xio_driver_merge_handle(
781  globus_xio_operation_t op,
782  globus_xio_driver_handle_t handle);
783 
784 /**********************************************************************
785  * Close
786  *********************************************************************/
806 typedef globus_result_t
808  void * driver_specific_handle,
809  void * driver_attr,
810  globus_xio_operation_t op);
811 
830  globus_xio_operation_t op,
832  void * callback_arg);
833 
849 void
851  globus_xio_operation_t op,
852  globus_result_t result);
853 
854 /**********************************************************************
855  * Read
856  *********************************************************************/
880 typedef globus_result_t
882  void * driver_specific_handle,
883  const globus_xio_iovec_t * iovec,
884  int iovec_count,
885  globus_xio_operation_t op);
886 
920  globus_xio_operation_t op,
921  globus_xio_iovec_t * iovec,
922  int iovec_count,
923  globus_size_t wait_for,
925  void * user_arg);
926 
944 void
946  globus_xio_operation_t op,
947  globus_result_t result,
948  globus_size_t nread);
949 
974 void
976  globus_xio_operation_t op);
977 
1002  globus_xio_operation_t op);
1003 
1004 /**********************************************************************
1005  * Write
1006  *********************************************************************/
1030 typedef globus_result_t
1032  void * driver_specific_handle,
1033  const globus_xio_iovec_t * iovec,
1034  int iovec_count,
1035  globus_xio_operation_t op);
1036 
1071  globus_xio_operation_t op,
1072  globus_xio_iovec_t * iovec,
1073  int iovec_count,
1074  globus_size_t wait_for,
1076  void * user_arg);
1077 
1095 void
1097  globus_xio_operation_t op,
1098  globus_result_t result,
1099  globus_size_t nwritten);
1100 
1127  globus_xio_operation_t top_op,
1128  globus_xio_operation_t bottom_op);
1129 
1130 
1131 /**********************************************************************
1132  * data descriptors
1133  *********************************************************************/
1193 globus_xio_driver_init(
1194  globus_xio_driver_t * driver,
1195  const char * driver_name,
1196  void * user_data);
1197 
1202 globus_xio_driver_get_user_data(
1203  globus_xio_driver_t in_driver,
1204  void ** out_user_data);
1205 
1207 globus_xio_operation_attr_cntl(
1208  globus_xio_operation_t op,
1209  globus_xio_attr_cmd_t cmd,
1210  ...);
1211 
1216 globus_xio_driver_destroy(
1217  globus_xio_driver_t driver);
1218 
1223 globus_xio_driver_set_transport(
1224  globus_xio_driver_t driver,
1225  globus_xio_driver_transport_open_t transport_open_func,
1226  globus_xio_driver_close_t close_func,
1227  globus_xio_driver_read_t read_func,
1228  globus_xio_driver_write_t write_func,
1229  globus_xio_driver_handle_cntl_t handle_cntl_func);
1230 
1235 globus_xio_driver_set_transform(
1236  globus_xio_driver_t driver,
1237  globus_xio_driver_transform_open_t transform_open_func,
1238  globus_xio_driver_close_t close_func,
1239  globus_xio_driver_read_t read_func,
1240  globus_xio_driver_write_t write_func,
1241  globus_xio_driver_handle_cntl_t handle_cntl_func,
1242  globus_xio_driver_push_driver_t push_driver_func);
1243 
1248 globus_xio_driver_set_server(
1249  globus_xio_driver_t driver,
1250  globus_xio_driver_server_init_t server_init_func,
1251  globus_xio_driver_server_accept_t server_accept_func,
1252  globus_xio_driver_server_destroy_t server_destroy_func,
1253  globus_xio_driver_server_cntl_t server_cntl_func,
1254  globus_xio_driver_link_cntl_t link_cntl_func,
1255  globus_xio_driver_link_destroy_t link_destroy_func);
1256 
1259  globus_xio_driver_t driver,
1260  globus_xio_driver_server_init_t server_pre_init_func);
1265 globus_xio_driver_set_attr(
1266  globus_xio_driver_t driver,
1267  globus_xio_driver_attr_init_t attr_init_func,
1268  globus_xio_driver_attr_copy_t attr_copy_func,
1269  globus_xio_driver_attr_cntl_t attr_cntl_func,
1270  globus_xio_driver_attr_destroy_t attr_destroy_func);
1271 
1272 /*
1273  * operation accessors
1274  */
1275 void
1276 globus_xio_operation_block_timeout(
1277  globus_xio_operation_t op);
1278 
1279 void
1280 globus_xio_operation_unblock_timeout(
1281  globus_xio_operation_t op);
1282 
1283 void
1284 globus_xio_operation_refresh_timeout(
1285  globus_xio_operation_t op);
1286 
1289 globus_xio_operation_enable_cancel(
1290  globus_xio_operation_t op,
1291  globus_xio_driver_cancel_callback_t cb,
1292  void * user_arg);
1293 
1294 void
1295 globus_xio_operation_disable_cancel(
1296  globus_xio_operation_t op);
1297 
1299 globus_xio_operation_is_canceled(
1300  globus_xio_operation_t op);
1301 
1303 globus_xio_operation_get_wait_for(
1304  globus_xio_operation_t op);
1305 
1306 void *
1307 globus_xio_operation_get_driver_specific(
1308  globus_xio_operation_t op);
1309 
1310 globus_xio_driver_t
1311 globus_xio_operation_get_user_driver(
1312  globus_xio_operation_t op);
1313 
1314 globus_xio_driver_t
1315 globus_xio_operation_get_transport_user_driver(
1316  globus_xio_operation_t op);
1317 
1318 /* this returns the handle to the drivers below you */
1319 globus_xio_driver_handle_t
1320 globus_xio_operation_get_driver_handle(
1321  globus_xio_operation_t op);
1322 
1323 /* this returns the handle to your driver.
1324  * (only useful for canceling operations in your possession)
1325  * or getting user handle associated with the driver
1326  */
1327 globus_xio_driver_handle_t
1328 globus_xio_operation_get_driver_self_handle(
1329  globus_xio_operation_t op);
1330 
1331 void *
1332 globus_xio_operation_get_data_descriptor(
1333  globus_xio_operation_t op,
1334  globus_bool_t force_create);
1335 
1337 globus_xio_operation_copy_stack(
1338  globus_xio_operation_t op,
1339  globus_xio_stack_t * stack);
1340 
1341 /* STRING PARSING STUFF */
1345 typedef globus_result_t
1346 (*globus_xio_string_cntl_parse_func_t)(
1347  void * attr,
1348  const char * key,
1349  const char * val,
1350  int cmd,
1351  globus_xio_driver_attr_cntl_t cntl_func);
1352 
1356 typedef struct globus_xio_string_cntl_table_s
1357 {
1358  const char * key;
1359  int cmd;
1360  globus_xio_string_cntl_parse_func_t parse_func;
1361 } globus_xio_string_cntl_table_t;
1362 
1419  globus_xio_driver_t driver,
1420  globus_xio_string_cntl_table_t * table);
1421 
1428  globus_xio_driver_t driver,
1429  globus_xio_string_cntl_table_t * table);
1430 
1439  void * attr,
1440  int cmd,
1441  ...);
1442 
1443 /* list all of the built in parsing functions */
1451  void * attr,
1452  const char * key,
1453  const char * val,
1454  int cmd,
1455  globus_xio_driver_attr_cntl_t cntl_func);
1456 
1464  void * attr,
1465  const char * key,
1466  const char * val,
1467  int cmd,
1468  globus_xio_driver_attr_cntl_t cntl_func);
1469 
1477  void * attr,
1478  const char * key,
1479  const char * val,
1480  int cmd,
1481  globus_xio_driver_attr_cntl_t cntl_func);
1482 
1490  void * attr,
1491  const char * key,
1492  const char * val,
1493  int cmd,
1494  globus_xio_driver_attr_cntl_t cntl_func);
1495 
1503  void * attr,
1504  const char * key,
1505  const char * val,
1506  int cmd,
1507  globus_xio_driver_attr_cntl_t cntl_func);
1508 
1510 globus_xio_string_cntl_formated_off(
1511  void * attr,
1512  const char * key,
1513  const char * val,
1514  int cmd,
1515  globus_xio_driver_attr_cntl_t cntl_func);
1516 
1518 globus_xio_string_cntl_formated_int(
1519  void * attr,
1520  const char * key,
1521  const char * val,
1522  int cmd,
1523  globus_xio_driver_attr_cntl_t cntl_func);
1524 
1526 globus_xio_string_cntl_string_list(
1527  void * attr,
1528  const char * key,
1529  const char * val,
1530  int cmd,
1531  globus_xio_driver_attr_cntl_t cntl_func);
1532 
1533 
1534 #ifdef __cplusplus
1535 }
1536 #endif
1537 
1538 #endif /* GLOBUS_XIO_DRIVER_H */
globus_result_t(* globus_xio_driver_attr_cntl_t)(void *driver_attr, int cmd, va_list ap)
Definition: globus_xio_driver.h:404
void globus_xio_driver_finished_accept(globus_xio_operation_t op, void *driver_link, globus_result_t result)
Definition: globus_xio_pass.c:1601
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:881
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:1031
globus_result_t(* globus_xio_driver_close_t)(void *driver_specific_handle, void *driver_attr, globus_xio_operation_t op)
Close a handle.
Definition: globus_xio_driver.h:807
globus_result_t(* globus_xio_driver_server_destroy_t)(void *driver_server)
Definition: globus_xio_driver.h:483
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:2201
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:1883
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:1743
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:931
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:1043
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:642
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:773
void globus_xio_driver_finished_write(globus_xio_operation_t op, globus_result_t result, globus_size_t nwritten)
Definition: globus_xio_pass.c:757
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:631
globus_result_t(* globus_xio_driver_link_destroy_t)(void *driver_link)
Definition: globus_xio_driver.h:595
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:535
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:2321
void globus_xio_driver_finished_read(globus_xio_operation_t op, globus_result_t result, globus_size_t nread)
Definition: globus_xio_pass.c:1118
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:569
globus_result_t(* globus_xio_driver_server_accept_t)(void *driver_server, globus_xio_operation_t op)
Definition: globus_xio_driver.h:507
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:2109
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:1848
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:2171
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:608