File: netpipe.h

package info (click to toggle)
netpipe 2.3-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 160 kB
  • ctags: 109
  • sloc: ansic: 979; makefile: 113
file content (106 lines) | stat: -rw-r--r-- 3,655 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*****************************************************************************/
/* "NetPIPE" -- Network Protocol Independent Performance Evaluator.          */
/* Copyright 1997, 1998 Iowa State University Research Foundation, Inc.      */
/*                                                                           */
/* This program is free software; you can redistribute it and/or modify      */
/* it under the terms of the GNU General Public License as published by      */
/* the Free Software Foundation.  You should have received a copy of the     */
/* GNU General Public License along with this program; if not, write to the  */
/* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   */
/*                                                                           */
/*     * netpipe.h          ---- General include file                        */
/*****************************************************************************/

/* $Id: netpipe.h,v 1.5 1998/09/24 15:18:46 ghelmer Exp $ */

#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>       /* struct timeval */
#include <stdlib.h>         /* malloc(3) */


#define  DEFPORT            5002
#define  TRIALS             7
#define  REPEAT             1000
#define  NSAMP              8000
#define  PERT               3
#define  LATENCYREPS        100
#define  LONGTIME           1e99
#define  CHARSIZE           8
#define  PATIENCE           50
#define  RUNTM              0.25
#define  STOPTM             1.0
#define  MAXINT             2147483647

#define     ABS(x)     (((x) < 0)?(-(x)):(x))
#define     MIN(x,y)   (((x) < (y))?(x):(y))
#define     MAX(x,y)   (((x) > (y))?(x):(y))

/* Need to include the protocol structure header file.                       */
/* Change this to reflect the protocol                                       */
#if defined(TCP)
#include "TCP.h"
#elif defined(MPI)
#include "MPI.h"
#elif defined(PVM)
#include "PVM.h"
#else
#error "One of TCP, MPI, or PVM must be defined during compilation"
#endif


typedef struct argstruct ArgStruct;
struct argstruct 
{
    /* This is the common information that is needed for all tests           */
    char     *host;         /* Name of receiving host                        */
    int      servicefd,     /* File descriptor of the network socket         */
             commfd;        /* Communication file descriptor                 */
    short    port;          /* Port used for connection                      */
    char     *buff;         /* Transmitted buffer                            */
    char     *buff1;        /* Transmitted buffer                            */
    int      bufflen,       /* Length of transmitted buffer                  */
             tr,            /* Transmit flag                                 */
             nbuff;         /* Number of buffers to transmit                 */

    /* Now we work with a union of information for protocol dependent stuff  */
    ProtocolStruct prot;    /* Structure holding necessary info for TCP      */
};

typedef struct data Data;
struct data
{
    double t;
    double bps;
    double variance;
    int    bits;
    int    repeat;
};

double When();

int Setup(ArgStruct *p);

void Sync(ArgStruct *p);

void PrepareToReceive(ArgStruct *p);

void SendData(ArgStruct *p);

void RecvData(ArgStruct *p);

void SendTime(ArgStruct *p, double *t);

void RecvTime(ArgStruct *p, double *t);

void SendRepeat(ArgStruct *p, int rpt);

void RecvRepeat(ArgStruct *p, int *rpt);

int Establish(ArgStruct *p);

int  CleanUp(ArgStruct *p);