00001 #ifndef _LIGO_SOCKUTIL_H
00002 #define _LIGO_SOCKUTIL_H
00003
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif
00007
00008
00009
00010 #ifndef __EXTENSIONS__
00011 #define __EXTENSIONS__
00012 #endif
00013 #ifndef _BSD_SOURCE
00014 #define _BSD_SOURCE
00015 #endif
00016 #include <sys/types.h>
00017 #include <sys/socket.h>
00018 #include <netinet/in.h>
00019 #include <sys/time.h>
00020
00031
00036 typedef double wait_time;
00037
00047 int nslookup (const char* hostname, struct in_addr* addr);
00048
00058 int nsilookup (const struct in_addr* addr, char* hostname);
00059
00070 int connectWithTimeout (int sock, struct sockaddr* name, int size,
00071 wait_time timeout);
00072
00084 int ping (const char* hostname, wait_time timeout);
00085
00092 int setRcvBufLen(int sock, int len);
00093
00100 int setSndBufLen(int sock, int len);
00101
00104 enum wait_mode {
00105 wm_read,
00106 wm_write,
00107 wm_ctrl
00108 };
00109
00119 int socketWait(int sock, wait_time maxtime, enum wait_mode mode);
00120
00123 #ifdef __cplusplus
00124 }
00125 #endif
00126
00127 #endif