home *** CD-ROM | disk | FTP | other *** search
/ Software Recommendations - 1998 Season 1 / DNBCD4.iso / share / DOS / ipxcopy / SRC.ZIP / SRC / TP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-15  |  3.2 KB  |  146 lines

  1. /*
  2.  
  3.    TP.H
  4.  
  5.    Transfer Protokol
  6.  
  7.    (c) 1996 Oliver Kraus
  8.  
  9.    Transfer Block:
  10.  
  11.    short id
  12.    short version
  13.    id specific data
  14.  
  15. */
  16.  
  17. #ifndef _TP_H
  18. #define _TP_H
  19.  
  20. #include "ipx.h"
  21.  
  22. #define TP_VERSION (0x0101)
  23.  
  24. #define TP_MSG_PSTART 1000
  25. #define TP_MSG_PDATA  1001
  26. #define TP_MSG_PEND   1002
  27.  
  28. struct _tp_pdata_struct
  29. {
  30.    long total;
  31.    long curr;
  32.    unsigned long crc;
  33.    char *path;
  34.    clock_t file_start;
  35. };
  36. typedef struct _tp_pdata_struct tp_pdata_struct;
  37.  
  38.  
  39. /* #define tp_debug_out(str) (puts(str)) */
  40. #define tp_debug_out(str)
  41.  
  42. #define tp_get_blk_id(blk)       (((short *)(blk))[0])
  43. #define tp_get_blk_ver(blk)      (((short *)(blk))[1])
  44. #define tp_get_blk_data_adr(blk) ((char *)(((short *)(blk))+2))
  45.  
  46. #define tp_set_blk_id(blk,id)       ((((short *)(blk))[0]) = (id))
  47. #define tp_set_blk_ver(blk,ver)     ((((short *)(blk))[1]) = (ver))
  48.  
  49. #define tp_ecb_get_id(ecb)       tp_get_blk_id((ecb)->fragaddr2)
  50. #define tp_ecb_get_ver(ecb)      tp_get_blk_ver((ecb)->fragaddr2)
  51. #define tp_ecb_get_data_adr(ecb) tp_get_blk_data_adr((ecb)->fragaddr2)
  52.  
  53. #define TP_BLK_HEADER_SIZE    (2*sizeof(short))
  54.  
  55. #define TP_FLAG_IS_NO_USER_CHECK    (0x0001)
  56. #define TP_FLAG_IS_SKIP             (0x0002)
  57. #define TP_FLAG_IS_DISABLE_CRC      (0x0004)
  58. #define TP_FLAG_IS_TEST_MODE        (0x0008)
  59. #define TP_FLAG_IS_CRC32            (0x0010)
  60. #define TP_FLAG_IS_DIR              (0x0020)
  61.  
  62. #define TP_ID_ERROR (-1)
  63.  
  64. #define TP_ID_REQUEST (-2)
  65. struct _tp_request_struct
  66. {
  67.    ipx_adr_struct adr;
  68.    long file_size;
  69.    int flags;
  70.    unsigned attr;
  71.    unsigned time;
  72.    unsigned date;
  73. };
  74. typedef struct _tp_request_struct tp_request_struct;
  75. typedef struct _tp_request_struct *tp_request;
  76.  
  77. #define TP_ID_ACK_REQUEST (-3)
  78. struct _tp_ack_request_struct
  79. {
  80.    ipx_adr_struct adr;
  81.    int exist;
  82. };
  83. typedef struct _tp_ack_request_struct tp_ack_request_struct;
  84. typedef struct _tp_ack_request_struct *tp_ack_request;
  85.  
  86. #define TP_ID_FILE_START (-4)
  87. struct _tp_file_start_struct
  88. {
  89.    int is_skip_file;
  90.    int flags;
  91. };
  92. typedef struct _tp_file_start_struct tp_file_start_struct;
  93. typedef struct _tp_file_start_struct *tp_file_start;
  94.  
  95. #define TP_ID_ACK_FILE_START (-5)
  96.  
  97. #define TP_ID_BLOCK_START (-6)
  98.  
  99. struct _tp_block_start_struct
  100. {
  101.    short cnt;
  102. };
  103. typedef struct _tp_block_start_struct tp_block_start_struct;
  104. typedef struct _tp_block_start_struct *tp_block_start;
  105.  
  106. #define TP_ID_ACK_BLOCK_START (-7)
  107.  
  108. #define TP_ID_DATA (-8)
  109.  
  110. struct _tp_data_struct
  111. {
  112.    short no;
  113.    short len;
  114. };
  115. typedef struct _tp_data_struct tp_data_struct;
  116. typedef struct _tp_data_struct *tp_data;
  117.  
  118. #define TP_ID_BLOCK_END (-9)
  119.  
  120. struct _tp_block_end_struct
  121. {
  122.    unsigned long crc;
  123. };
  124. typedef struct _tp_block_end_struct tp_block_end_struct;
  125. typedef struct _tp_block_end_struct *tp_block_end;
  126.  
  127. #define TP_ID_MISSED_BLOCKS (-10)
  128.  
  129. struct _tp_missed_blocks_struct
  130. {
  131.    short cnt;
  132. };
  133. typedef struct _tp_missed_blocks_struct tp_missed_blocks_struct;
  134. typedef struct _tp_missed_blocks_struct *tp_missed_blocks;
  135.  
  136. #define TP_ID_ACK_BLOCK_END (-11)
  137.  
  138. #define TP_ID_FILE_END (-12)
  139.  
  140. #define TP_ID_ACK_FILE_END (-13)
  141.  
  142. #define TP_ID_NONE (-100)
  143.  
  144. #define TP_BLK_INFO_SIZE (TP_BLK_HEADER_SIZE+sizeof(tp_data_struct))
  145. #endif
  146.