xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdNet
XrdNetWork.hh
Go to the documentation of this file.
1
#ifndef __XRDNetWork_H__
2
#define __XRDNetWork_H__
3
/******************************************************************************/
4
/* */
5
/* X r d N e t W o r k . h h */
6
/* */
7
/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
8
/* All Rights Reserved. See XrdInfo.cc for complete License Terms */
9
/* Produced by Andrew Hanushevsky for Stanford University under contract */
10
/* DE-AC03-76-SFO0515 with the Department of Energy */
11
/******************************************************************************/
12
13
// $Id$
14
15
#include <stdlib.h>
16
#ifndef WIN32
17
#include <strings.h>
18
#include <unistd.h>
19
#include <netinet/in.h>
20
#include <sys/socket.h>
21
#else
22
#include <Winsock2.h>
23
#endif
24
25
#include "
XrdNet/XrdNet.hh
"
26
27
class
XrdSysError
;
28
class
XrdNetLink
;
29
class
XrdNetSecurity
;
30
31
class
XrdNetWork
:
public
XrdNet
32
{
33
public
:
34
35
// Accept() processes incomming connections. When a succesful connection is
36
// made, it returns an XrdNetLink object suitable for communications.
37
// If a timeout occurs, or an XrdNetLink object cannot be allocated,
38
// it returns 0. Options are those defined above. A timeout, in
39
// seconds, may be specified.
40
//
41
XrdNetLink
*
Accept
(
int
opts
=0,
42
int
timeout=-1);
43
44
// Connect() Creates a socket and connects to the given host and port. Upon
45
// success, it returns an XrdNetLink object suitable for peer
46
// communications. Upon failure it returns zero. Options are as above.
47
// A second timeout may be specified.
48
//
49
XrdNetLink
*
Connect
(
const
char
*host,
// Destination host or ip address
50
int
port
,
// Port number
51
int
opts
=0,
// Options
52
int
timeout=-1
// Second timeout
53
);
54
55
// Relay() creates a UDP socket and optionally sets things up so that
56
// messages will be routed to a particular host:port destination.
57
// Upon success it returs the address of a XrdNetLink object that
58
// be used to communicate with the dest. Upon failure return zero.
59
//
60
XrdNetLink
*
Relay
(
const
char
*dest=0,
// Optional destination
61
int
opts
=0
// Optional options as above
62
);
63
64
// When creating this object, you must specify the error routing object.
65
// Optionally, specify the security object to screen incomming connections.
66
// (if zero, no screening is done).
67
//
68
XrdNetWork
(
XrdSysError
*erp,
XrdNetSecurity
*secp=0)
69
:
XrdNet
(erp, secp) {}
70
~XrdNetWork
() {}
71
};
72
#endif
Generated by
1.8.1.2