|
xrootd
|
00001 #ifndef __XRDNetWork_H__ 00002 #define __XRDNetWork_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d N e t W o r k . h h */ 00006 /* */ 00007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00009 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00010 /* */ 00011 /* This file is part of the XRootD software suite. */ 00012 /* */ 00013 /* XRootD is free software: you can redistribute it and/or modify it under */ 00014 /* the terms of the GNU Lesser General Public License as published by the */ 00015 /* Free Software Foundation, either version 3 of the License, or (at your */ 00016 /* option) any later version. */ 00017 /* */ 00018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00020 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00021 /* License for more details. */ 00022 /* */ 00023 /* You should have received a copy of the GNU Lesser General Public License */ 00024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00025 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00026 /* */ 00027 /* The copyright holder's institutional names and contributor's names may not */ 00028 /* be used to endorse or promote products derived from this software without */ 00029 /* specific prior written permission of the institution or contributor. */ 00030 /******************************************************************************/ 00031 00032 #include <stdlib.h> 00033 #ifndef WIN32 00034 #include <strings.h> 00035 #include <unistd.h> 00036 #include <netinet/in.h> 00037 #include <sys/socket.h> 00038 #else 00039 #include <Winsock2.h> 00040 #endif 00041 00042 #include "XrdNet/XrdNet.hh" 00043 00044 class XrdSysError; 00045 class XrdNetLink; 00046 class XrdNetSecurity; 00047 00048 class XrdNetWork : public XrdNet 00049 { 00050 public: 00051 00052 // Accept() processes incomming connections. When a succesful connection is 00053 // made, it returns an XrdNetLink object suitable for communications. 00054 // If a timeout occurs, or an XrdNetLink object cannot be allocated, 00055 // it returns 0. Options are those defined above. A timeout, in 00056 // seconds, may be specified. 00057 // 00058 XrdNetLink *Accept(int opts=0, 00059 int timeout=-1); 00060 00061 // Connect() Creates a socket and connects to the given host and port. Upon 00062 // success, it returns an XrdNetLink object suitable for peer 00063 // communications. Upon failure it returns zero. Options are as above. 00064 // A second timeout may be specified. 00065 // 00066 XrdNetLink *Connect(const char *host, // Destination host or ip address 00067 int port, // Port number 00068 int opts=0, // Options 00069 int timeout=-1 // Second timeout 00070 ); 00071 00072 // Relay() creates a UDP socket and optionally sets things up so that 00073 // messages will be routed to a particular host:port destination. 00074 // Upon success it returs the address of a XrdNetLink object that 00075 // be used to communicate with the dest. Upon failure return zero. 00076 // 00077 XrdNetLink *Relay(const char *dest=0, // Optional destination 00078 int opts=0 // Optional options as above 00079 ); 00080 00081 // When creating this object, you must specify the error routing object. 00082 // Optionally, specify the security object to screen incomming connections. 00083 // (if zero, no screening is done). 00084 // 00085 XrdNetWork(XrdSysError *erp, XrdNetSecurity *secp=0) 00086 : XrdNet(erp, secp) {} 00087 ~XrdNetWork() {} 00088 }; 00089 #endif
1.7.6.1