home *** CD-ROM | disk | FTP | other *** search
/ Software Recommendations - 1998 Season 1 / DNBCD4.iso / share / DOS / ipxcopy / SRC.ZIP / SRC / TPTX.H < prev   
Encoding:
C/C++ Source or Header  |  1996-09-05  |  4.0 KB  |  100 lines

  1. /*
  2.  
  3.    TPTX.H
  4.  
  5.    (c) 1996 by Oliver Kraus
  6.  
  7. */
  8.  
  9. #ifndef _TPTX_H
  10. #define _TPTX_H
  11.  
  12. #include <stdio.h>
  13. #include <time.h>
  14. #include "tp.h"
  15.  
  16. #define TPTX_B_LEN  400
  17. #define TPTX_B_CNT  160
  18. #define TPTX_TX_ADD 5
  19.  
  20. struct _tptx_struct
  21. {
  22.    int flags;              /* TP_FLAGs                                */
  23.  
  24.    unsigned short socket;  /* ipx socket number                       */
  25.    int is_adr_known;       /* is destination address known            */
  26.    ipx_adr_struct adr;     /* destination address                     */
  27.  
  28.    int is_ended;           /* 1 if file ok or error                   */
  29.  
  30.    char *f_name;           /* pointer file name (allocated memory)    */
  31.    char *f_logname;        /* pointer remote name (allocated memory)  */
  32.    FILE *fp;               /* file pointer                            */
  33.    long f_len;             /* file length                             */
  34.    long f_len_sum;         /* summed length of all files              */
  35.    long f_pos;             /* current file position                   */
  36.    unsigned long f_crc;    /* crc for the original pool               */
  37.    unsigned long f_d_crc;  /* crc for the second pool                 */
  38.    clock_t f_start;        /* when did we start reading the file?     */
  39.    clock_t f_time_sum;     /* total time, summed up                   */
  40.    size_t f_read_len;      /* value returned by fread                 */
  41.    int f_is_skip;          /* skip file flag                          */
  42.    unsigned f_attr;        /* file attribute                          */
  43.    unsigned short f_time;  /* file time                               */
  44.    unsigned short f_date;  /* file date                               */
  45.  
  46.    /* Conditions:   1.   b_cnt <= b_len/2                             */
  47.    /*               2.1. 16 Bit Systems: b_cnt*b_len < 2^16           */
  48.    /*               2.2. 32 Bit Systems: b_cnt*b_len < 2^32           */
  49.  
  50.    size_t b_len;           /* block length                            */
  51.    int b_cnt;              /* max no of blks in pool (==TPTX_B_CNT)   */
  52.    int b_curr_cnt;         /* current blks in use (b_curr_cnt<=b_cnt) */
  53.    size_t b_pool_size;     /* size of block memory pool (b_cnt*b_len) */
  54.    char *b_pool_ptr;       /* block memory pool                       */
  55.    char *b_pool_dptr;      /* second pool                             */
  56.    int b_is_dptr_ok;
  57.    short *b_list_ptr;      /* array with block numbers (b_curr_cnt)   */
  58.    int b_list_cnt;         /* counter for b_list (0<=..<b_curr_cnt)   */
  59.  
  60.    int  tx_cnt;            /* tx_cnt = b_cnt+TPTX_TX_ADD              */
  61.    char **tx_data;         /* tx_cnt blocks with b_len bytes          */
  62.    ipx_ecb_struct **tx_ecb;
  63.  
  64.    char *rx_data;          /* b_len bytes receive buffer              */
  65.    ipx_ecb_struct *rx_ecb; /* receive ecb                             */
  66.  
  67.    clock_t small_delay;    /* values for repeated message generation  */
  68.    clock_t large_delay;
  69.  
  70.    clock_t clock_dest;     /* destination time                        */
  71.  
  72.    void (*state_fn)(struct _tptx_struct *tptx); /* state function ptr */
  73.    void (*rep_state_fn)(struct _tptx_struct *tptx);
  74.  
  75.    tp_pdata_struct pdata;
  76.    int (*aux)( int msg, void *data );
  77.    int is_aux;
  78. };
  79. typedef struct _tptx_struct tptx_struct;
  80. typedef struct _tptx_struct *tptx_type;
  81.  
  82.  
  83. #define tptx_SetState(tptx, _state) ((tptx)->state_fn = (_state))
  84. #define tptx_SetRepeatedState(tptx, _state) ((tptx)->rep_state_fn = (_state))
  85. #define tptx_GetRepeatedState(tptx) ((tptx)->rep_state_fn)
  86.  
  87.  
  88. /*---- public member functions --------------------------------------------*/
  89.  
  90. tptx_type tptx_Open(unsigned short socket);
  91. void tptx_Close(tptx_type tptx);
  92. int tptx_Send(tptx_type tptx, char *phy_name, char *log_name);
  93. int tptx_Dispatch(tptx_type tptx);
  94. void tptx_SetAux(tptx_type tptx, int (*aux)( int msg, void *data ));
  95. void tptx_DoAux(tptx_type tptx, int msg, void *data);
  96. #define tptx_SetFlag(tptx, flag) ((tptx)->flags |= (flag))
  97. #define tptx_ClrFlag(tptx, flag) ((tptx)->flags &= ~(flag))
  98.  
  99. #endif
  100.