/******************************************************************************
  IMM version 3.0
  Written by Winston Dang <wkd@hawaii.edu>
  
  * Copyright (c) University of Hawaii 1993. All rights reserved.
  *  
  * License is granted to copy, to use, and to make and to use derivative
  * works for research, educational, government or evaluation purposes, provided
  * that the University of Hawaii is acknowledged in all documentation pertaining
  * to any such copy or derivative work. University of Hawaii grants no other 
  * licenses expressed or implied. The University of Hawaii trade name should 
  * not be used in any advertising without its written  permission.
  *  
  * UNIVERSITY OF HAWAII MAKES NO REPRESENTATIONS CONCERNING EITHER THE
  * MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE
  * FOR ANY PARTICULAR PURPOSE.  The software is provided "as is" without
  * express or implied warranty of any kind.
  *  
  * These notices must be retained in any copies of any part of this software.
  ******************************************************************************/

#include <sys/stat.h>

#define MAXENT 10
#define MAXSILENCE 15
#define TRANSMITTIME 100000 /* for 1400 bytes this is about 100 kbps */
#define MAXTRANSMITTIME 8000000 /* for 1400 bytes this is about 1.4 kbps */ 
/*#define MINTRANSMITTIME 20000 */
#define MINTRANSMITTIME 2000  /* about 5 Mbytes/sec */

#define DEFAULTRATE 100000 /* 100 kbps */
struct key {
    char *direct;
    int  IsDirectory;
    unsigned long size;
    int  holdtime;
    time_t time;
    time_t cutoff;
    int  repeatflag;
};


struct infotype {
    int requests;     /* number of times to measure client requests */
    int frequency;    /* frequency to measure client requests */
    int duration;     /* time frame to allow for response */
    int lastid;               /* last file id transmitted */
};

struct servetype {
    int ifp;		/* open file descriptor */
    u_int lastfid;	/* last used file id */
    int inquiryflag;	/* flags */
    char *filename;	/* name of file being transferred */
    char *border;	/* directory name */
    int	 is_directory;	/* is this a directory listing */
    u_int  dirsize;	/* size of file */
    u_short fid;	/* current id of file */
    u_int  pos;		/* current position in file */
    u_long min_test_pos; /* lowest point to retransmit */
    u_long waittime;	/* required wait time between transfers */
    int hold;		/* hold time */
    u_int packets_requested; /* number of packets requested */
    u_int packets_sent; /* number of packets sent out */
    struct bufinfo buf; /* peg board */
};

/* link list structure */
struct listdef {
    char *name;
    struct listdef *next;
};

#ifdef MAIN
#define EXT
#else
#define EXT extern
#endif
EXT struct key directlist[];
EXT struct infotype infoclient;
EXT int debug;
EXT char *workingdir;

