created new iperf_api.c with functions defined in iperf_api.h

This commit is contained in:
kaustubhprabhu 2009-06-09 00:00:30 +00:00
parent 9f62884d32
commit b085d6d102

View File

@ -9,11 +9,17 @@ struct iperf_interval_results
struct iperf_stream_result
{
iperf_size_t bytes_received;
iperf_size_t bytes_sent;
int duration;
struct iperf_interval_results *interval_results;
void *custom_data;
iperf_size_t bytes_received;
iperf_size_t bytes_sent;
int duration;
struct iperf_interval_results *interval_results;
void *custom_data;
};
struct protocol
{
};
struct iperf_sock_opts
@ -26,60 +32,64 @@ struct iperf_udp_settings
{
int rate;
int packet_size; // size of a packet/ MSS
struct iperf_sock_opts *options;
};
struct iperf_tcp_settings
{
int window_size; // TCP window size
struct iperf_sock_opts *options;
};
struct iperf_settings
{
struct iperf_sock_opts *options; // structure to set socket options
struct *proto; // protocol specific settings
}
struct protocol *protocol; // protocol specific settings
};
struct iperf_stream
{
/* configurable members */
/* configurable members */
int local_port; // local port
int remote_port; // remote machine port
void *settings; // pointer to structure settings
int protocol; // protocol- TCP/UDP
/* non configurable members */
void *settings; // pointer to structure settings
int protocol; // protocol- TCP/UDP
/* non configurable members */
struct iperf_stream_result *result; //structure pointer to result
int socket; // socket
struct sockaddr_storage local_addr;
struct sockaddr_storage remote_addr;
int *(*init)(struct iperf_stream *stream);
int *(*recv)(struct iperf_stream *stream);
int *(*send)(struct iperf_stream *stream);
int *(*update_stats)(struct iperf_stream *stream);
struct iperf_stream *next;
int socket; // socket
struct sockaddr_storage local_addr;
struct sockaddr_storage remote_addr;
int *(*init)(struct iperf_stream *stream);
int *(*recv)(struct iperf_stream *stream);
int *(*send)(struct iperf_stream *stream);
int *(*update_stats)(struct iperf_stream *stream);
struct iperf_stream *next;
};
struct iperf_test
{
char role; // 'c'lient or 's'erver
struct sockaddr_storage *remote_ip_addr;
char role; // 'c'lient or 's'erver -s / -c
char proto;
struct sockaddr_storage *remote_ip_addr; // arg of -c
struct sockaddr_storage *local_ip_addr;
int duration; // total duration of test
int stats_interval; // time interval to gather stats
int duration; // total duration of test -t
int stats_interval; // time interval to gather stats -i
void *(*stats_callback)(struct iperf_test *); // callback function pointer for stats
int reporter_interval; // time interval for reporter
void *(*reporter_callback)(struct iperf_test *); // call back function pointer for reporter
int reporter_fd; // file descriptor for reporter
/* internal state */
int num_streams; // total streams in the test
int reporter_interval; // time interval for reporter
void *(*reporter_callback)(struct iperf_test *); // callback function pointer for reporter
int reporter_fd; // file descriptor for reporter
/* internal state */
int num_streams; // total streams in the test -P ?
struct iperf_stream *streams; // pointer to list of struct stream
};
@ -106,12 +116,12 @@ void iperf_destroy_test(struct iperf_test *test);
/**
* iperf_create_stream -- return a net iperf_test with default values
* iperf_create_stream -- return a net iperf_stream with default values
*
* returns NULL on failure
*
*/
struct iperf_stream *iperf_create_stream();
struct iperf_stream *iperf_create_stream(struct iperf_sock_opts *sockopt);
struct iperf_stream *iperf_create_tcp_stream(int window, struct iperf_sock_opts *sockopt);
struct iperf_stream *iperf_create_udp_stream(int rate, int size, struct iperf_sock_opts *sockopt);