00001 #ifndef __XRDNETMSG_H__
00002 #define __XRDNETMSG_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <stdlib.h>
00016 #include <string.h>
00017 #ifndef WIN32
00018 #include <strings.h>
00019 #include <unistd.h>
00020 #include <netinet/in.h>
00021 #include <sys/socket.h>
00022 #else
00023 #include <Winsock2.h>
00024 #endif
00025
00026 class XrdSysError;
00027
00028 class XrdNetMsg
00029 {
00030 public:
00031
00032
00033
00034
00035
00036
00037
00038
00039 int Send(const char *buff,
00040 int blen=0,
00041 const char *dest=0,
00042 int tmo=-1);
00043
00044 int Send(const struct iovec iov[],
00045 int iovcnt,
00046 const char *dest=0,
00047 int tmo=-1);
00048
00049 XrdNetMsg(XrdSysError *erp, const char *dest=0);
00050 ~XrdNetMsg() {if (DestHN) free(DestHN);
00051 if (DestIP) free(DestIP);
00052 }
00053
00054 protected:
00055 int OK2Send(int timeout, const char *dest);
00056 int retErr(int ecode, const char *dest);
00057
00058 XrdSysError *eDest;
00059 char *DestHN;
00060 struct sockaddr *DestIP;
00061 int DestSZ;
00062 int FD;
00063 };
00064 #endif