00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _CAVERNPLUS_PERF_CLIENT
00018 #define _CAVERNPLUS_PERF_CLIENT
00019
00020 #include <stdio.h>
00021
00022 #define PERF_DAEMON_DEFAULT_PORT 9500
00023 #define REGISTER_PERF_CLIENT "$$CAVERN_PERF_DAEMON_CLASS$$"
00024 #define SEND_STAT_CLIENT "$$SEND_STAT_PERF_CLIENT$$$$$"
00025 #define REGISTER_PERF_CLIENT_LENGTH 28 // length of REGISTER_PERF_CLIENT string
00026 #define SEND_STAT_CLIENT_LENGTH 28 // length of SEND_STAT_CLIENT string
00027 #define CLOSING_STAT_CLIENT "$$CLOSING_STAT_PERF_CLIENT$$"
00028 #define CLOSING_STAT_CLIENT_LENGTH 28
00029 #define CLOSING_PERF_CLIENT "$$CLOSING_PERF_DAEMON_CLASS$"
00030 #define CLOSING_PERF_CLIENT_LENGTH 28
00031
00032 class CAVERNnet_tcpClient_c;
00033
00055 class CAVERNnet_perfDaemonClient_c
00056 {
00057 private:
00058 CAVERNnet_tcpClient_c *client;
00059 int timeOut;
00060 int connectionAlive;
00061 int perfClient;
00062
00063 public:
00065
00066 static const int OK;
00067
00069 static const int FAILED;
00070
00072 static const int MEM_ALLOC_ERR;
00073
00075 static const int NON_BLOCKING_HAS_NO_DATA;
00076
00078 static const int CONNECTION_TERMINATED;
00079
00081 static const int NOT_READY;
00082
00084 static const int READY_TO_READ;
00085
00087 static const int READY_TO_WRITE;
00088
00090 static const int READY_TO_READ_AND_WRITE;
00091
00092 static const int BLOCKING;
00093 static const int NON_BLOCKING;
00094
00095 static const int NO_TIME_OUT;
00096
00098
00104 CAVERNnet_perfDaemonClient_c(int isPerfClient = 0);
00105
00107 CAVERNnet_perfDaemonClient_c(CAVERNnet_tcpClient_c*, int isPerfClient = 0);
00108 ~CAVERNnet_perfDaemonClient_c();
00109
00118 int read(char** ret, int* nbytes, int blockingType);
00119
00125 int write(char *outgoingData, int* nbytes);
00126
00131 int isReadyToRead();
00132
00137 int isReadyToWrite();
00138
00145 int isReady();
00146
00148
00149
00153 unsigned int getRemoteIP();
00154
00159 void getRemoteIP(char* name);
00160
00162 unsigned int getSelfIP();
00163
00165 void getSelfIP(char *name);
00166
00168 int getSelfPort();
00169
00171 int getRemotePort();
00173
00175 void showStatus(int status, int nbytes);
00176
00178 void showStats();
00179
00181 void close();
00182
00188 int connectToServer(char *ip, int port=PERF_DAEMON_DEFAULT_PORT);
00189
00198 void setTimeOut(int timeout=CAVERNnet_perfDaemonClient_c::NO_TIME_OUT);
00199 };
00200 #endif
00201