00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef VSL_RCP_H
00014 #define VSL_RCP_H
00015
00016 #include "vsl_api.h"
00017
00018
00019 #define MAX_PATH 128
00020 #define MAX_USER 16
00021 #define MAX_HOST 64
00022
00023
00024 #define DEBUGLOG "./vsl_rcp.log"
00025
00026
00027 #define MAGIC_PARM "234958oehtedu"
00028
00029
00030 typedef struct vsl_client_msg {
00031 char local_name[MAX_PATH];
00032 char remote_path[MAX_PATH];
00033 char from_remote;
00034 uint32_t file_size;
00035 } vsl_client_msg_t;
00036
00037
00038
00039 typedef enum status_t {RCP_READY=0,
00040 RCP_ENOENT,
00041 RCP_EOPEN,
00042 RCP_ENOFILE,
00043 RCP_EUSER,
00044 RCP_EOTHER
00045 } status_t;
00046
00047
00048
00049
00050 typedef struct vsl_server_msg {
00051 uint32_t status;
00052 uint32_t file_size;
00053 } vsl_server_msg_t;
00054
00055
00056
00057
00058
00059
00060 inline void vfer_rcp_print_stats(vfer_stats* stats) {
00061 double duration;
00062 struct timeval tv_end;
00063 uint32_t data_retransmitted;
00064
00065 if (stats->tv_end.tv_sec == 0 && stats->tv_end.tv_usec == 0) {
00066 GET_TIME_OF_DAY(&(tv_end));
00067 printf("-- real time stats --\n");
00068 } else {
00069 bcopy(&(stats->tv_end), &(tv_end), sizeof(struct timeval));
00070 }
00071
00072
00073
00074
00075 duration = (tv_end.tv_sec - stats->tv_start.tv_sec);
00076 duration += 0.000000001 * (tv_end.tv_usec - stats->tv_start.tv_usec);
00077
00078 data_retransmitted = (stats->data_bytes_sent - stats->data_bytes_sender_sent);
00079
00080 printf("\n");
00081 printf("VFER transfer statistics:\n");
00082 printf("\n");
00083 printf("Duration (s) conn %f\n", duration);
00084 printf("Avg rate (Mb/s) sending %-16.2f recving %.2f\n", ((stats->bytes_sent * 8.0) / (duration * 1000000)), ((stats->bytes_recvd * 8.0) / (duration * 1000000)));
00085 printf("Total (packets) sent %-14u recvd %u\n", stats->packets_sent, stats->packets_recvd);
00086 printf("Total (bytes) sent %-14u recvd %u\n", stats->bytes_sent, stats->bytes_recvd);
00087 printf("Total data (bytes) sent %-14u recvd %-16u retrans %u\n", stats->data_bytes_sent, stats->data_bytes_recvd, data_retransmitted);
00088 printf("Avg data rate (Mb/s) sending %-16.2f recving %-16.2f eff. sending %.2f\n",
00089 ((stats->data_bytes_sent * 8.0) / (duration * 1000000)),
00090 ((stats->data_bytes_recvd * 8.0) / (duration * 1000000)),
00091 (((stats->data_bytes_sent - data_retransmitted) * 8.0) / (duration * 1000000)));
00092 printf("RTT (ms) avg %-16.2f max %-16.2f min %.2f\n", stats->avg_rtt, (double)(stats->max_rtt), (double)(stats->min_rtt));
00093 printf("\n");
00094 }
00095
00096 #endif
00097
00098
00099
00100
00101
00102
00103
00104