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
/* Produced by Andrew Hanushevsky for Stanford University under contract */
9
/* DE-AC02-76-SFO0515 with the Department of Energy */
10
/* */
11
/* This file is part of the XRootD software suite. */
12
/* */
13
/* XRootD is free software: you can redistribute it and/or modify it under */
14
/* the terms of the GNU Lesser General Public License as published by the */
15
/* Free Software Foundation, either version 3 of the License, or (at your */
16
/* option) any later version. */
17
/* */
18
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21
/* License for more details. */
22
/* */
23
/* You should have received a copy of the GNU Lesser General Public License */
24
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26
/* */
27
/* The copyright holder's institutional names and contributor's names may not */
28
/* be used to endorse or promote products derived from this software without */
29
/* specific prior written permission of the institution or contributor. */
30
/******************************************************************************/
31
32
#include <stdlib.h>
33
#ifndef WIN32
34
#include <strings.h>
35
#include <unistd.h>
36
#include <netinet/in.h>
37
#include <sys/socket.h>
38
#else
39
#include <Winsock2.h>
40
#endif
41
42
#include "
XrdNet/XrdNet.hh
"
43
44
class
XrdSysError
;
45
class
XrdNetLink
;
46
class
XrdNetSecurity
;
47
48
class
XrdNetWork
:
public
XrdNet
49
{
50
public
:
51
52
// Accept() processes incomming connections. When a succesful connection is
53
// made, it returns an XrdNetLink object suitable for communications.
54
// If a timeout occurs, or an XrdNetLink object cannot be allocated,
55
// it returns 0. Options are those defined above. A timeout, in
56
// seconds, may be specified.
57
//
58
XrdNetLink
*
Accept
(
int
opts
=0,
59
int
timeout=-1);
60
61
// Connect() Creates a socket and connects to the given host and port. Upon
62
// success, it returns an XrdNetLink object suitable for peer
63
// communications. Upon failure it returns zero. Options are as above.
64
// A second timeout may be specified.
65
//
66
XrdNetLink
*
Connect
(
const
char
*host,
// Destination host or ip address
67
int
port
,
// Port number
68
int
opts
=0,
// Options
69
int
timeout=-1
// Second timeout
70
);
71
72
// Relay() creates a UDP socket and optionally sets things up so that
73
// messages will be routed to a particular host:port destination.
74
// Upon success it returs the address of a XrdNetLink object that
75
// be used to communicate with the dest. Upon failure return zero.
76
//
77
XrdNetLink
*
Relay
(
const
char
*dest=0,
// Optional destination
78
int
opts
=0
// Optional options as above
79
);
80
81
// When creating this object, you must specify the error routing object.
82
// Optionally, specify the security object to screen incomming connections.
83
// (if zero, no screening is done).
84
//
85
XrdNetWork
(
XrdSysError
*erp,
XrdNetSecurity
*secp=0)
86
:
XrdNet
(erp, secp) {}
87
~XrdNetWork
() {}
88
};
89
#endif
Generated by
1.8.3.1