This file is indexed.

/usr/include/globus/globus_net_manager.h is in libglobus-net-manager-dev 0.16-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
/*
 * Copyright 1999-2014 University of Chicago
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef GLOBUS_NET_MANAGER_H
#define GLOBUS_NET_MANAGER_H 1

#include "globus_common.h"
#include "globus_net_manager_attr.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file globus_net_manager.h
 * @brief Globus Net Manager Interface
 */

#ifndef GLOBUS_GLOBAL_DOCUMENT_SET
/**
 * @mainpage Overview
 * The Globus Net Manager library is a plug-in point for network
 * management tasks, such as:
 * - selectively open ports in a firewall and allow these ports to be closed
 *   when transfers are complete
 * - configure a virtual circuit based on a site policy and route traffic
 *   over this circuit
 * - route network traffic related to a task over a particular network
 *
 * @section globus_net_manager_implementor Implementing a Network Manager
 * For users interested in implementing such functionality,
 * the @link globus_net_manager globus_net_manager library @endlink provides a
 * low-level set of interfaces to implement specific network managers.
 *
 * These interfaces provide methods for registering functions to be called
 * before and after interesting network operations. Those functions may
 * observe or modify the attributes of the network operations. This information
 * can be used to modify the port to listen on, or modify the
 * addresses used to use a particular network interface.
 *
 * In addition, the globus_net_manager library includes sample
 * implementations to provide a starting point for implementing
 * network managers.
 * <dl>
 * <dt>Logging Manager</dt>
 * <dd>Logs network operations as they occur. This implementation
 * shows the simplest network manager implementation in C</dd>
 * <!--<dt>Exec Manager</dt>
 * <dd>Launches a command when network operations occur. This implementation
 * enables network managers to be implemented in any external process.</dd>-->
 * <dt>@ref globus_net_manager_python<dt>
 * <dd>Loads a python module, and calls python functions when network
 * operations occur.</dd>
 * </dl>
 *
 * The Logging Manager sample is broken down in detail in the
 * @ref globus_net_manager_tutorial page.
 *
 * @section globus_net_manager_user Using Network Managers
 * For users interested in using the network manager in their own services,
 * they can use the @ref globus_net_manager_context APIs to configure and
 * invoke network manager plug-ins, or the
 * @link globus_xio_net_manager_driver Globus XIO Net Manager Driver @endlink
 * to plug the network manager interface directly into the Globus XIO stack.
 *
 * To configure a GridFTP server to use the network manager, use the
 * configuration option '-xnetmgr' ('xnetmgr' in the config file). The
 * parameters to this option are a list of managers and their configuration
 * attributes. See the @ref globus_net_manager_python documentation for an
 * example.
 */
#endif

struct globus_net_manager_s;

/**
 * @brief Net Manager API
 * @defgroup globus_net_manager Net Manager
 * @details
 * This API defines the plug-in points for network manager functionality,
 * as well as functions for registering a particular network manager
 * implementation so that it can be invoked during network events.
 *
 * To implement a network manager, define a struct #globus_net_manager_s
 * with the functions you want called, and register it by calling
 * globus_net_manager_register(). More details are included in
 * @ref globus_net_manager_tutorial
 */

/**
 * @brief Net Manager Data Types
 * @defgroup globus_net_manager_types Net Manager Data Types
 * @details
 * Data types for the Net Manager interface.
 * @ref globus_net_manager_tutorial
 */

/**
 * @brief Net Manager Function Signatures
 * @defgroup globus_net_manager_signatures Function Signatures
 * @ingroup globus_net_manager
 * Function signatures for the Net Manager interface.
 * @ref globus_net_manager_tutorial
 */
/**
 * @brief Net Manager Pre-Listen Function Signature
 * @ingroup globus_net_manager_signatures
 * @details
 * A function of this signature, if included in a network manager
 * implementation, is called before the transport-specific listening port has
 * been created.
 *
 * The network manager is passed the network transport-specific options
 * for the listener. It may modify these before the
 * listener is created by the transport.
 *
 * The globus_net_manager library aborts the listen operation
 * if this function returns a value other than GLOBUS_SUCCESS. In this
 * case, the globus_net_manager will not call any other
 * globus_net_manager_pre_listen functions configured for this listener.
 *
 * @param[in] manager
 *      Pointer to the network manager struct that is being invoked.
 * @param[in] manager_attr_array
 *      An array of attributes associated with the
 *      manager. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[in] task_id
 *      An application-specific task ID associated with this network operation.
 * @param[in] transport
 *      The name of the transport associated with this listener.
 * @param[in] attr_array
 *      An array of transport attributes associated with the
 *      listener. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[out] attr_array_out
 *      A pointer to an array of transport options to apply to the
 *      listener prior to returning it to the service. This may be NULL to
 *      indicate no change in the options. If non-NULL, this array must be
 *      terminated with an attribute having a NULL scope.
 *      The array and the members of the
 *      globus_net_manager_attr_t struct will be freed by the
 *      globus_net_manager library by calling
 *      free().
 */
typedef globus_result_t (*globus_net_manager_pre_listen)(
    struct globus_net_manager_s        *manager,
    const globus_net_manager_attr_t    *manager_attr_array,
    const char                         *task_id,
    const char                         *transport,
    const globus_net_manager_attr_t    *attr_array,
    globus_net_manager_attr_t         **attr_array_out);

/**
 * @brief Net Manager Post-Listen Function Signature
 * @ingroup globus_net_manager_signatures
 * @details
 * A function of this signature, if included in a network manager
 * implementation, is called after the transport-specific listening port has
 * been created.
 *
 * The network manager is passed the network transport-specific options and
 * contact string for the listener. It may modify either of these before the
 * transport listener is made available to the service which requested
 * the listening port.
 *
 * The globus_net_manager library aborts the listen operation
 * if this function returns a value other than GLOBUS_SUCCESS. In this
 * case, the globus_net_manager will not call any other
 * globus_net_manager_post_listen functions configured for this listener.
 *
 * @param[in] manager
 *      Pointer to the network manager struct that is being invoked.
 * @param[in] manager_attr_array
 *      An array of attributes associated with the
 *      manager. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[in] task_id
 *      An application-specific task ID associated with this network operation.
 * @param[in] transport
 *      The name of the transport associated with this listener.
 * @param[in] local_contact
 *      The transport-specific contact string for the listener [in].
 * @param[in] attr_array
 *      An array of transport attributes associated with the
 *      listener. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[out] local_contact_out
 *      A pointer to the local contact which the network manager wants to
 *      return to the service. This may be NULL to indicate no change in
 *      the contact. This value will be freed() by the globus_net_manager
 *      library.
 * @param[out] attr_array_out
 *      A pointer to an array of transport options to apply to the
 *      listener prior to returning it to the service. This may be NULL to
 *      indicate no change in the options. If non-NULL, this array must be
 *      terminated with an attribute having a NULL scope.
 *      The array and the members of the
 *      globus_net_manager_attr_t struct will be freed by the
 *      globus_net_manager library by calling
 *      free().
 */
typedef globus_result_t (*globus_net_manager_post_listen)(
    struct globus_net_manager_s        *manager,
    const globus_net_manager_attr_t    *manager_attr_array,
    const char                         *task_id,
    const char                         *transport,
    const char                         *local_contact,
    const globus_net_manager_attr_t    *attr_array,
    char                              **local_contact_out,
    globus_net_manager_attr_t         **attr_array_out);

/**
 * @brief Net Manager End-Listen Function Signature
 * @ingroup globus_net_manager_signatures
 * @details
 * A function of this signature, if included in a network manager
 * implementation, is called when the transport-specific listening port will
 * be closed.
 *
 * The network manager is passed the network transport-specific options and
 * contact string for the listener.
 *
 * The globus_net_manager library aborts the closing of the listening port
 * if this function returns a value other than GLOBUS_SUCCESS. In this
 * case, the globus_net_manager will not call any other
 * globus_net_manager_end_listen functions configured for this listener.
 *
 * @param[in] manager
 *      Pointer to the network manager struct that is being invoked.
 * @param[in] manager_attr_array
 *      An array of attributes associated with the
 *      manager. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[in] task_id
 *      An application-specific task ID associated with this network operation.
 * @param[in] transport
 *      The name of the transport associated with this listener.
 * @param[in] local_contact
 *      The transport-specific contact string for the listener [in].
 * @param[in] attr_array
 *      An array of transport attributes associated with the
 *      listener. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 */
typedef globus_result_t (*globus_net_manager_end_listen)(
    struct globus_net_manager_s        *manager,
    const globus_net_manager_attr_t    *manager_attr_array,
    const char                         *task_id,
    const char                         *transport,
    const char                         *local_contact,
    const globus_net_manager_attr_t    *attr_array);

/**
 * @brief Net Manager Pre-Accept Function Signature
 * @ingroup globus_net_manager_signatures
 * @details
 * A function of this signature, if included in a network manager
 * implementation, is called before accepting a connection on a
 * transport-specific listening port.
 *
 * The network manager is passed the network transport-specific options and
 * contact string for the listener. It may modify the options before the
 * accept operation is complete.
 *
 * The globus_net_manager library aborts the accept operation
 * if this function returns a value other than GLOBUS_SUCCESS. In this
 * case, the globus_net_manager will not call any other
 * globus_net_manager_pre_accept functions configured for this listener.
 *
 * @param[in] manager
 *      Pointer to the network manager struct that is being invoked.
 * @param[in] manager_attr_array
 *      An array of attributes associated with the
 *      manager. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[in] task_id
 *      An application-specific task ID associated with this network operation.
 * @param[in] transport
 *      The name of the transport associated with this listener.
 * @param[in] local_contact
 *      The transport-specific contact string for the listener.
 * @param[in] attr_array
 *      A NULL-terminated array of transport attributes associated with the
 *      listener.
 * @param[out] attr_array_out
 *      A pointer to an array of transport options to apply to the
 *      listener prior to returning it to the service. This may be NULL to
 *      indicate no change in the options. If non-NULL, this array must be
 *      terminated with an attribute having a NULL scope.
 *      The array and the members of the
 *      globus_net_manager_attr_t struct will be freed by the
 *      globus_net_manager library by calling
 *      free().
 */
typedef globus_result_t (*globus_net_manager_pre_accept)(
    struct globus_net_manager_s        *manager,
    const globus_net_manager_attr_t    *manager_attr_array,
    const char                         *task_id,
    const char                         *transport,
    const char                         *local_contact,
    const globus_net_manager_attr_t    *attr_array,
    globus_net_manager_attr_t         **attr_array_out);

/**
 * @brief Net Manager Post-Accept Function Signature
 * @ingroup globus_net_manager_signatures
 * @details
 * A function of this signature, if included in a network manager
 * implementation, is called after accepting a connection on a
 * transport-specific listening port.
 *
 * The network manager is passed the network transport-specific options and
 * contact string for both ends of the connection. It may modify the attributes
 * of the local side of the connection.
 *
 * The globus_net_manager library aborts the accept operation
 * if this function returns a value other than GLOBUS_SUCCESS. In this
 * case, the globus_net_manager will not call any other
 * globus_net_manager_post_accept functions configured for this connection.
 *
 * @param[in] manager
 *      Pointer to the network manager struct that is being invoked.
 * @param[in] manager_attr_array
 *      An array of attributes associated with the
 *      manager. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[in] task_id
 *      An application-specific task ID associated with this network operation.
 * @param[in] transport
 *      The name of the transport associated with this listener.
 * @param[in] local_contact
 *      The transport-specific contact string for the local side of the
 *      connection.
 * @param[in] remote_contact
 *      The transport-specific contact string for the remote side of the
 *      connection.
 * @param[in] attr_array
 *      An array of transport attributes associated with the
 *      listener. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[out] attr_array_out
 *      A pointer to an array of transport options to apply to the
 *      listener prior to returning it to the service. This may be NULL to
 *      indicate no change in the options. If non-NULL, this array must be
 *      terminated with an attribute having a NULL scope.
 *      The array and the members of the
 *      globus_net_manager_attr_t struct will be freed by the
 *      globus_net_manager library by calling
 *      free().
 */
typedef globus_result_t (*globus_net_manager_post_accept)(
    struct globus_net_manager_s        *manager,
    const globus_net_manager_attr_t    *manager_attr_array,
    const char                         *task_id,
    const char                         *transport,
    const char                         *local_contact,
    const char                         *remote_contact,
    const globus_net_manager_attr_t    *attr_array,
    globus_net_manager_attr_t         **attr_array_out);

/**
 * @brief Net Manager Pre-Connect Function Signature
 * @ingroup globus_net_manager_signatures
 * @details
 * A function of this signature, if included in a network manager
 * implementation, is called after initiating a connection to a
 * transport-specific listener.
 *
 * The network manager is passed the network transport-specific options and
 * contact string for both ends of the connection. It may modify the attributes
 * of the local side of the connection.
 *
 * The globus_net_manager library aborts the connect operation
 * if this function returns a value other than GLOBUS_SUCCESS. In this
 * case, the globus_net_manager will not call any other
 * globus_net_manager_pre_connect functions configured for this connection.
 *
 * @param[in] manager
 *      Pointer to the network manager struct that is being invoked.
 * @param[in] manager_attr_array
 *      An array of attributes associated with the
 *      manager. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[in] task_id
 *      An application-specific task ID associated with this network operation.
 * @param[in] transport
 *      The name of the transport associated with this listener.
 * @param[in] remote_contact
 *      The transport-specific contact string for the remote side of the
 *      connection.
 * @param[in] attr_array
 *      An array of transport attributes associated with the
 *      listener. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[out] remote_contact_out
 *      A pointer to the remote contact which the network manager wants to
 *      connect to. This may be NULL to indicate no change in
 *      the contact. This value will be freed() by the globus_net_manager
 *      library.
 * @param[out] attr_array_out
 *      A pointer to an array of transport options to apply to the
 *      listener prior to returning it to the service. This may be NULL to
 *      indicate no change in the options. If non-NULL, this array must be
 *      terminated with an attribute having a NULL scope.
 *      The array and the members of the
 *      globus_net_manager_attr_t struct will be freed by the
 *      globus_net_manager library by calling
 *      free().
 */
typedef globus_result_t (*globus_net_manager_pre_connect)(
    struct globus_net_manager_s        *manager,
    const globus_net_manager_attr_t    *manager_attr_array,
    const char                         *task_id,
    const char                         *transport,
    const char                         *remote_contact,
    const globus_net_manager_attr_t    *attr_array,
    char                              **remote_contact_out,
    globus_net_manager_attr_t         **attr_array_out);

/**
 * @brief Net Manager Post-Connect Function Signature
 * @ingroup globus_net_manager_signatures
 * @details
 * A function of this signature, if included in a network manager
 * implementation, is called after establishing a connection to a
 * transport-specific listener.
 *
 * The network manager is passed the network transport-specific options and
 * contact string for both ends of the connection. It may modify the attributes
 * of the local side of the connection.
 *
 * The globus_net_manager library aborts the connect operation
 * if this function returns a value other than GLOBUS_SUCCESS. In this
 * case, the globus_net_manager will not call any other
 * globus_net_manager_post_connect functions configured for this connection.
 *
 * @param[in] manager
 *      Pointer to the network manager struct that is being invoked.
 * @param[in] manager_attr_array
 *      An array of attributes associated with the
 *      manager. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[in] task_id
 *      An application-specific task ID associated with this network operation.
 * @param[in] transport
 *      The name of the transport associated with this listener.
 * @param[in] remote_contact
 *      The transport-specific contact string for the remote side of the
 *      connection.
 * @param[in] attr_array
 *      An array of transport attributes associated with the
 *      listener. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[out] attr_array_out
 *      A pointer to an array of transport options to apply to the
 *      listener prior to returning it to the service. This may be NULL to
 *      indicate no change in the options. If non-NULL, this array must be
 *      terminated with an attribute having a NULL scope.
 *      The array and the members of the
 *      globus_net_manager_attr_t struct will be freed by the
 *      globus_net_manager library by calling
 *      free().
 */
typedef globus_result_t (*globus_net_manager_post_connect)(
    struct globus_net_manager_s        *manager,
    const globus_net_manager_attr_t    *manager_attr_array,
    const char                         *task_id,
    const char                         *transport,
    const char                         *local_contact,
    const char                         *remote_contact,
    const globus_net_manager_attr_t    *attr_array,
    globus_net_manager_attr_t         **attr_array_out);

/**
 * @brief Net Manager Pre-Close Function Signature
 * @ingroup globus_net_manager_signatures
 * @details
 * A function of this signature, if included in a network manager
 * implementation, is called prior to closing a connection.
 *
 * The network manager is passed the network transport-specific options and
 * contact string for both ends of the connection.
 *
 * The globus_net_manager library aborts the close operation
 * if this function returns a value other than GLOBUS_SUCCESS. In this
 * case, the globus_net_manager will not call any other
 * globus_net_manager_pre_close functions configured for this connection.
 *
 * @param[in] manager
 *      Pointer to the network manager struct that is being invoked.
 * @param[in] manager_attr_array
 *      An array of attributes associated with the
 *      manager. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[in] task_id
 *      An application-specific task ID associated with this network operation.
 * @param[in] transport
 *      The name of the transport associated with this listener.
 * @param[in] local_contact
 *      The transport-specific contact string for the local side of the
 *      connection.
 * @param[in] remote_contact
 *      The transport-specific contact string for the remote side of the
 *      connection.
 * @param[in] attr_array
 *      An array of transport attributes associated with the
 *      listener. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 */
typedef globus_result_t (*globus_net_manager_pre_close)(
    struct globus_net_manager_s        *manager,
    const globus_net_manager_attr_t    *manager_attr_array,
    const char                         *task_id,
    const char                         *transport,
    const char                         *local_contact,
    const char                         *remote_contact,
    const globus_net_manager_attr_t    *attr_array);

/**
 * @brief Net Manager Post-Close Function Signature
 * @ingroup globus_net_manager_signatures
 * @details
 * A function of this signature, if included in a network manager
 * implementation, is called after closing a connection.
 *
 * The network manager is passed the network transport-specific options and
 * contact string for both ends of the connection.
 *
 * The globus_net_manager library aborts the close operation
 * if this function returns a value other than GLOBUS_SUCCESS. In this
 * case, the globus_net_manager will not call any other
 * globus_net_manager_pre_close functions configured for this connection.
 *
 * @param[in] manager
 *      Pointer to the network manager struct that is being invoked.
 * @param[in] manager_attr_array
 *      An array of attributes associated with the
 *      manager. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 * @param[in] task_id
 *      An application-specific task ID associated with this network operation.
 * @param[in] transport
 *      The name of the transport associated with this listener.
 * @param[in] local_contact
 *      The transport-specific contact string for the local side of the
 *      connection.
 * @param[in] remote_contact
 *      The transport-specific contact string for the remote side of the
 *      connection.
 * @param[in] attr_array
 *      An array of transport attributes associated with the
 *      listener. The end of the array is indicated by
 *      an attribute containing a NULL scope.
 */
typedef globus_result_t (*globus_net_manager_post_close)(
    struct globus_net_manager_s        *manager,
    const globus_net_manager_attr_t    *manager_attr_array,
    const char                         *task_id,
    const char                         *transport,
    const char                         *local_contact,
    const char                         *remote_contact,
    const globus_net_manager_attr_t    *attr_array);

/**
 * @brief Net Manager Definition
 * @ingroup globus_net_manager_types
 * @details
 */
typedef
struct globus_net_manager_s
{
    /** Name of the network manager */
    const char                         *name;
    /** Pre-listen function implementation */
    globus_net_manager_pre_listen       pre_listen;
    /** Post-listen function implementation */
    globus_net_manager_post_listen      post_listen;
    /** End-listen function implementation */
    globus_net_manager_end_listen       end_listen;
    /** Pre-accept function implementation */
    globus_net_manager_pre_accept       pre_accept;
    /** Post-accept function implementation */
    globus_net_manager_post_accept      post_accept;
    /** Pre-connect function implementation */
    globus_net_manager_pre_connect      pre_connect;
    /** Post-connect function implementation */
    globus_net_manager_post_connect     post_connect;
    /** Pre-close function implementation */
    globus_net_manager_pre_close        pre_close;
    /** Post-close function implementation */
    globus_net_manager_post_close       post_close;
}
globus_net_manager_t;

extern globus_extension_registry_t      globus_i_net_manager_registry;
#define GLOBUS_NET_MANAGER_REGISTRY     &globus_i_net_manager_registry

globus_result_t
globus_net_manager_register(
    globus_net_manager_t               *manager,
    globus_module_descriptor_t         *module);

globus_result_t
globus_net_manager_unregister(
    globus_net_manager_t               *manager);

extern globus_module_descriptor_t       globus_i_net_manager_module;
/**
 * @brief Module descriptor
 * @ingroup globus_net_manager
 * @hideinitializer
 * @details
 * The Globus Net Manager uses Globus Toolkit module activation and
 * deactivation. Before any Net Manager functions can be called,
 * the module must be activated, like this:
 * @code
       globus_module_activate(GLOBUS_NET_MANAGER_MODULE);
   @endcode
 *
 * This function returns GLOBUS_SUCCESS if the library
 * is successfully initialized.  Otherwise, an error code is returned,
 * and Net Manager functions should not be subsequently called.
 *
 * Activations are reference counted, so it is safe to activate the
 * module multiple times or in different modules.
 *
 * To deactivate Net Manager, call
 *
 * @code
     globus_module_deactivate(GLOBUS_NET_MANAGER_MODULE);
  @endcode
 *
 * This function should be done once for each time the Net Manager
 * was activated.
 *
 */
#define GLOBUS_NET_MANAGER_MODULE     (&globus_i_net_manager_module)


typedef enum
{
    GLOBUS_NET_MANAGER_ERROR_PARAMETER,
    GLOBUS_NET_MANAGER_ERROR_MEMORY,
    GLOBUS_NET_MANAGER_ERROR_INIT,
    GLOBUS_NET_MANAGER_ERROR_MANAGER,
    GLOBUS_NET_MANAGER_ERROR_WRAPPED
} globus_net_manager_error_type_t;


/* all macros in this file require each function to 'declare' their name with
 * this
 */
#define GlobusNetManagerName(func)
/*
#ifdef __GNUC__
#define GlobusNetManagerName(func) static const char * _netmgr_name __attribute__((__unused__)) = #func
#else
#define GlobusNetManagerName(func) static const char * _netmgr_name = #func
#endif
*/



#define GlobusNetManagerErrorParameter(param_name)                   \
    globus_error_put(                                                \
        globus_error_construct_error(                                \
            GLOBUS_NET_MANAGER_MODULE,                               \
            GLOBUS_NULL,                                             \
            GLOBUS_NET_MANAGER_ERROR_PARAMETER,                      \
            __FILE__,                                                \
            __func__,                                                \
            __LINE__,                                                \
           "Bad parameter, %s",                                      \
            (param_name)))

#define GlobusNetManagerErrorMemory(mem_name)                        \
    globus_error_put(                                                \
        globus_error_construct_error(                                \
            GLOBUS_NET_MANAGER_MODULE,                               \
            GLOBUS_NULL,                                             \
            GLOBUS_NET_MANAGER_ERROR_MEMORY,                         \
            __FILE__,                                                \
            __func__,                                                \
            __LINE__,                                                \
           "Memory allocation failed on %s",                         \
            (mem_name)))

#define GlobusNetManagerErrorInit(manager, explain)                  \
    globus_error_put(                                                \
        globus_error_construct_error(                                \
            GLOBUS_NET_MANAGER_MODULE,                               \
            NULL,                                                    \
            GLOBUS_NET_MANAGER_ERROR_INIT,                           \
            __FILE__,                                                \
            __func__,                                                \
            __LINE__,                                                \
           "An error occurred accessing a module. %s: %s", manager, explain))

#define GlobusNetManagerErrorManager(result, manager, explain)       \
    globus_error_put(                                                \
        globus_error_construct_error(                                \
            GLOBUS_NET_MANAGER_MODULE,                               \
            globus_error_get((result)),                              \
            GLOBUS_NET_MANAGER_ERROR_MANAGER,                        \
            __FILE__,                                                \
            __func__,                                                \
            __LINE__,                                                \
           "A network manager (%s) errored in %s.", manager, explain))

#define GlobusNetManagerErrorWrapFailed(failed_func, result)         \
    globus_error_put(                                                \
        globus_error_construct_error(                                \
            GLOBUS_NET_MANAGER_MODULE,                               \
            globus_error_get((result)),                              \
            GLOBUS_NET_MANAGER_ERROR_WRAPPED,                        \
            __FILE__,                                                \
            __func__,                                                \
            __LINE__,                                                \
           "%s failed.",                                             \
            (failed_func)))

#define GlobusNetManagerErrorWrapFailedWithMessage(result, format, arg) \
    globus_error_put(                                                \
        globus_error_construct_error(                                \
            GLOBUS_NET_MANAGER_MODULE,                               \
            globus_error_get((result)),                              \
            GLOBUS_NET_MANAGER_ERROR_WRAPPED,                        \
            __FILE__,                                                \
            __func__,                                                \
            __LINE__,                                                \
            (format),                                                \
            (arg)))

#define GlobusNetManagerErrorWrapFailedWithMessage2(result, format, arg1, arg2) \
    globus_error_put(                                                \
        globus_error_construct_error(                                \
            GLOBUS_NET_MANAGER_MODULE,                               \
            globus_error_get((result)),                              \
            GLOBUS_NET_MANAGER_ERROR_WRAPPED,                        \
            __FILE__,                                                \
            __func__,                                                \
            __LINE__,                                                \
            (format),                                                \
            (arg1), (arg2)))


#ifdef __cplusplus
}
#endif

#endif /* GLOBUS_NET_MANAGER_H */