home *** CD-ROM | disk | FTP | other *** search
/ Software Recommendations - 1998 Season 1 / DNBCD4.iso / share / DOS / ipxcopy / SRC.ZIP / SRC / TPRX.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-12  |  3.9 KB  |  108 lines

  1. /*
  2.  
  3.    TPRX.H
  4.  
  5.    (c) 1996 by Oliver Kraus
  6.  
  7. */
  8.  
  9. #ifndef _TPRX_H
  10. #define _TPRX_H
  11.  
  12. #include <stdio.h>
  13. #include <time.h>
  14. #include "tp.h"
  15.  
  16. /*
  17. #define TPRX_B_LEN  500
  18. #define TPRX_B_CNT  130
  19. */
  20. #define TPRX_B_LEN  400
  21. #define TPRX_B_CNT  160
  22. #define TPRX_RX_ADD 10
  23.  
  24. struct _tprx_struct
  25. {
  26.    int flags;              /* TP_FLAGs                                */
  27.  
  28.    int is_test_mode;       /* == 0 normal mode                        */
  29.  
  30.    unsigned short socket;  /* ipx socket number                       */
  31.    int is_adr_known;       /* is destination address known            */
  32.    ipx_adr_struct adr;     /* destination address                     */
  33.  
  34.    int is_ended;           /* 1 if file ok or error                   */
  35.  
  36.    char *f_name;           /* pointer file name (allocated memory)    */
  37.    int  f_exist;           /* 0 if f_name does not exist              */
  38.    FILE *fp;               /* file pointer                            */
  39.    long f_len;             /* file length                             */
  40.    long f_pos;             /* current file position                   */
  41.    clock_t f_start;        /* when did we start writing to the file?  */
  42.    int f_is_write_data;
  43.    int f_is_skip;
  44.    unsigned long f_crc;
  45.    unsigned long f_remote_crc;
  46.    unsigned f_attr;        /* file attribute                          */
  47.    unsigned short f_time;  /* file time                               */
  48.    unsigned short f_date;  /* file date                               */
  49.  
  50.    /* Conditions:   1.   b_cnt <= b_len/2                             */
  51.    /*               2.1. 16 Bit Systems: b_cnt*b_len < 2^16           */
  52.    /*               2.2. 32 Bit Systems: b_cnt*b_len < 2^32           */
  53.  
  54.    int b_is_any_present;   /* is there any a block present            */
  55.    size_t b_len;           /* block length                            */
  56.    int b_cnt;              /* max no of blks in pool (==TPRX_B_CNT)   */
  57.    int b_curr_cnt;         /* current blks in use (b_curr_cnt<=b_cnt) */
  58.    int b_in_cnt;           /* incoming block counter                  */
  59.    char *b_is_present;     /* block received array (b_cnt)            */
  60.    size_t b_pool_size;     /* size of block memory pool (b_cnt*b_len) */
  61.    char *b_pool_ptr;       /* block memory pool                       */
  62.  
  63.    short *b_missed_list;
  64.    int b_missed_cnt;
  65.  
  66.    int  rx_cnt;            /* rx_cnt = b_cnt+TPRX_RX_ADD              */
  67.    char **rx_data;         /* rx_cnt blocks with b_len bytes          */
  68.    ipx_ecb_struct **rx_ecb;
  69.  
  70.    char *tx_data;          /* b_len bytes transmit buffer             */
  71.    ipx_ecb_struct *tx_ecb; /* transmit ecb                            */
  72.  
  73.    clock_t small_delay;    /* values for repeated message generation  */
  74.    clock_t large_delay;
  75.  
  76.    clock_t clock_dest;     /* destination time                        */
  77.  
  78.    void (*state_fn)(struct _tprx_struct *tprx); /* state function ptr */
  79.    void (*rep_state_fn)(struct _tprx_struct *tprx);
  80.  
  81.    tp_pdata_struct pdata;
  82.    int (*aux)( int msg, void *data );
  83.    int is_aux;
  84. };
  85. typedef struct _tprx_struct tprx_struct;
  86. typedef struct _tprx_struct *tprx_type;
  87.  
  88. #define tprx_IsAnyPresent(tprx) ((tprx)->b_is_any_present)
  89.  
  90. #define tprx_SetState(tprx, _state) ((tprx)->state_fn = (_state))
  91. #define tprx_SetRepeatedState(tprx, _state) ((tprx)->rep_state_fn = (_state))
  92. #define tprx_GetRepeatedState(tprx) ((tprx)->rep_state_fn)
  93.  
  94.  
  95. /*---- public member functions --------------------------------------------*/
  96.  
  97. tprx_type tprx_Open(unsigned short socket);
  98. void tprx_Close(tprx_type tprx);
  99. int tprx_Dispatch(tprx_type tprx);
  100. /* #define tprx_Dispatch(tprx) ((tprx)->state_fn(tprx)) */
  101. void tprx_SetAux(tprx_type tprx, int (*aux)( int msg, void *data ));
  102. void tprx_DoAux(tprx_type tprx, int msg, void *data);
  103.  
  104. #define tprx_SetFlag(tprx, flag) ((tprx)->flags |= (flag))
  105. #define tprx_ClrFlag(tprx, flag) ((tprx)->flags &= ~(flag))
  106.  
  107. #endif
  108.