home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / C / HSRC_100 / HYDRACOM.H < prev    next >
C/C++ Source or Header  |  1993-01-11  |  8KB  |  252 lines

  1. /*=============================================================================
  2.  
  3.                               HydraCom Version 1.00
  4.  
  5.                          A sample implementation of the
  6.                    HYDRA Bi-Directional File Transfer Protocol
  7.  
  8.                              HydraCom was written by
  9.                    Arjen G. Lentz, LENTZ SOFTWARE-DEVELOPMENT
  10.                   COPYRIGHT (C) 1991-1993; ALL RIGHTS RESERVED
  11.  
  12.                        The HYDRA protocol was designed by
  13.                  Arjen G. Lentz, LENTZ SOFTWARE-DEVELOPMENT and
  14.                              Joaquim H. Homrighausen
  15.                   COPYRIGHT (C) 1991-1993; ALL RIGHTS RESERVED
  16.  
  17.  
  18.   Revision history:
  19.   06 Sep 1991 - (AGL) First tryout
  20.   .. ... .... - Internal development
  21.   11 Jan 1993 - HydraCom version 1.00, Hydra revision 001 (01 Dec 1992)
  22.  
  23.  
  24.   For complete details of the Hydra and HydraCom licensing restrictions,
  25.   please refer to the license agreements which are published in their entirety
  26.   in HYDRACOM.C and LICENSE.DOC, and also contained in the documentation file
  27.   HYDRACOM.DOC
  28.  
  29.   Use of this file is subject to the restrictions contained in the Hydra and
  30.   HydraCom licensing agreements. If you do not find the text of this agreement
  31.   in any of the aforementioned files, or if you do not have these files, you
  32.   should immediately contact LENTZ SOFTWARE-DEVELOPMENT and/or Joaquim
  33.   Homrighausen at one of the addresses listed below. In no event should you
  34.   proceed to use this file without having accepted the terms of the Hydra and
  35.   HydraCom licensing agreements, or such other agreement as you are able to
  36.   reach with LENTZ SOFTWARE-DEVELOMENT and Joaquim Homrighausen.
  37.  
  38.  
  39.   Hydra protocol design and HydraCom driver:         Hydra protocol design:
  40.   Arjen G. Lentz                                     Joaquim H. Homrighausen
  41.   LENTZ SOFTWARE-DEVELOPMENT                         389, route d'Arlon
  42.   Langegracht 7B                                     L-8011 Strassen
  43.   3811 BT  Amersfoort                                Luxembourg
  44.   The Netherlands
  45.   FidoNet 2:283/512, AINEX-BBS +31-33-633916         FidoNet 2:270/17
  46.   arjen_lentz@f512.n283.z2.fidonet.org               joho@ae.lu
  47.  
  48.   Please feel free to contact us at any time to share your comments about our
  49.   software and/or licensing policies.
  50.  
  51. =============================================================================*/
  52.  
  53. #ifndef WIN_AGL
  54. #define WIN_AGL 0        /* set to 1 for AGL's MS-DOS/AtariST window package */
  55. #endif
  56.  
  57. #include <stdio.h>
  58. #include <stdlib.h>
  59. #include <stdarg.h>
  60. #include <string.h>
  61. #include <ctype.h>
  62. #include <dos.h>
  63. #include <time.h>
  64. #include <sys\stat.h>
  65. #include <process.h>
  66. #include <signal.h>
  67. #if WIN_AGL
  68. #include "window.h"     /* AGL's window library */
  69. #endif
  70. #include <conio.h>      /* MS-DOS Turbo/Borland C(++) console stuff */
  71. #include "2types.h"
  72. #include "hydra.h"
  73.  
  74.  
  75. #ifdef __MSDOS__
  76. #define inteli(x) (x)
  77. #define intell(x) (x)
  78. #endif
  79. #if !WIN_AGL
  80. #define Esc   0x01b
  81. #define Alt_B 0x130
  82. #define Alt_C 0x12e
  83. #define Alt_E 0x112
  84. #define Alt_H 0x123
  85. #define Alt_X 0x12D
  86. #define PgUp  0x149
  87. #define PgDn  0x151
  88. #endif
  89.  
  90.  
  91. #define PRGNAME "HydraCom"
  92. #define LOGID   "HCom"
  93. #define VERSION "1.00"
  94. #ifdef __MSDOS__
  95. #  define HC_OS  "PC"
  96. #else /*!MSDOS*/
  97. #  ifdef __OS2__
  98. #    define HC_OS  "OS/2"
  99. #  else /*!OS2*/
  100. #    ifdef __TOS__
  101. #      define HC_OS  "ST"
  102. #    endif /*TOS*/
  103. #  endif /*OS2*/
  104. #endif /*MSDOS*/
  105.  
  106.  
  107.  
  108.  
  109. #define PATHLEN 90
  110. #define MAXARGS 50
  111.  
  112. #define DENY_ALL   0x0000
  113. #define DENY_RDWR  0x0010
  114. #define DENY_WRITE 0x0020
  115. #define DENY_READ  0x0030
  116. #define DENY_NONE  0x0040
  117.  
  118. #ifdef MAIN
  119. #define global
  120. #else
  121. #define global extern
  122. #endif
  123.  
  124. global  char     ourname[PATHLEN];
  125. global  char     work[256],
  126.                  buffer[256];
  127. global  int      port;
  128. global  word     cur_speed;
  129. global  word     com_speed;
  130. global  boolean  parity;
  131. global  boolean  noinit;
  132. global  boolean  nocarrier;
  133. global  boolean  dropdtr;
  134. global  int      flowflags;
  135. global  int      dcdmask;
  136. global  boolean  nobell;
  137. global  boolean  mailer;
  138. global  boolean  nooriginator;
  139. global  boolean  hdxsession;
  140. global  long     hydra_txwindow,
  141.                  hydra_rxwindow;
  142. global  char    **av;
  143. global  int      loglevel;
  144. global  FILE    *logfp;
  145. global  char    *result;
  146. global  char    *download;
  147. global  char     single_file[20];
  148. global  boolean  single_done;
  149. global  boolean  noresume;
  150. global  boolean  nostamp;
  151. global  dword    hydra_options;
  152. global  int      opustask;
  153. global  char    *opuslog;
  154. global  boolean  didsome;
  155. #if WIN_AGL
  156. global  WIN_IDX  file_win,
  157.                  log_win,
  158.                  remote_win,
  159.                  local_win;
  160. global  boolean  log_first;
  161. #else
  162. global  void    *term_scr;
  163. global  int      term_x,   term_y,
  164.                  file_x,   file_y,
  165.                            log_y,
  166.                  remote_x, remote_y,
  167.                  local_x,  local_y;
  168. #endif
  169.  
  170. #define CHAT_TIMEOUT 60
  171. global  word     chatfill;
  172. global  long     chattimer,
  173.                  lasttimer;
  174.  
  175.  
  176. #ifdef __PROTO__
  177. # define        PROTO(s) s
  178. #else
  179. # define        PROTO(s) ()
  180. #endif
  181.  
  182.  
  183. /* hydracom.c */
  184. void endprog     PROTO((int errcode ));
  185. int  config      PROTO((int argc , char *argv []));
  186. void init        PROTO((void ));
  187. int  batch_hydra PROTO((char *filespec, char *alias ));
  188. void hydracom    PROTO((void ));
  189.  
  190. /* fmisc.c */
  191. void     unique_name PROTO((char *pathname ));
  192. char    *xfer_init   PROTO((char *fname , long fsize , long ftime ));
  193. boolean  xfer_bad    PROTO((void ));
  194. char    *xfer_okay   PROTO((void ));
  195. void    xfer_del     PROTO((void ));
  196.  
  197. /* misc.c */
  198. int   keyabort     PROTO((void ));
  199. void  rem_chat     PROTO((byte *data, word len ));
  200. int   parse        PROTO((char *string ));
  201. void  splitpath    PROTO((char *filepath , char *path , char *file ));
  202. void  mergepath    PROTO((char *filepath , char *path , char *file ));
  203. int   fexist       PROTO((char *filename ));
  204. void  any_key      PROTO((void ));
  205. int   get_key      PROTO((void ));
  206. int   get_str      PROTO((char *prompt , char *s , int maxlen ));
  207. void  resultlog    PROTO((boolean xmit , char *fname , long bytes , long xfertime ));
  208. char *h_revdate    PROTO((long revstamp ));
  209. void  message      PROTO((int level , char *fmt , ...));
  210. void  cprint       PROTO((char *fmt , ...));
  211. void  hydra_gotoxy PROTO((int x, int y ));
  212. void  hydra_printf PROTO((char *fmt, ...));
  213. void  hydra_clreol PROTO((void ));
  214.  
  215. /* dos_file.c */
  216. void  dos_sharecheck PROTO((void ));
  217. int   dos_open       PROTO((char *pathname , byte create ));
  218. int   dos_sopen      PROTO((char *pathname , byte create ));
  219. int   dos_sappend    PROTO((char *pathname , byte create ));
  220. int   dos_close      PROTO((int handle ));
  221. int   dos_lock       PROTO((int handle , long offset , long len ));
  222. int   dos_unlock     PROTO((int handle , long offset , long len ));
  223. long  dos_seek       PROTO((int handle , long offset , int fromwhere ));
  224. long  dos_tell       PROTO((int handle ));
  225. int   dos_read       PROTO((int handle , void *buf , word len ));
  226. int   dos_write      PROTO((int handle , void *buf , word len ));
  227. FILE *sfopen         PROTO((char *name, char *mode, int shareflag));
  228.  
  229. /* syspc.c */
  230. void  dtr_out      PROTO((byte flag ));
  231. void  com_flow     PROTO((byte flags ));
  232. void  com_setspeed PROTO((word speed ));
  233. void  com_putblock PROTO((byte *s , word len ));
  234. void  sys_init     PROTO((void ));
  235. void  sys_reset    PROTO((void ));
  236. void  sys_idle     PROTO((void ));
  237. int   com_outfull  PROTO((void ));
  238. int   carrier      PROTO((void ));
  239. void  com_flush    PROTO((void ));
  240. void  com_putbyte  PROTO((byte c ));
  241. void  com_purge    PROTO((void ));
  242. void  com_dump     PROTO((void ));
  243. int   com_getbyte  PROTO((void ));
  244. void  setstamp     PROTO((char *name , long tim ));
  245. long  freespace    PROTO((char *drivepath ));
  246. char *ffirst       PROTO((char *filespec ));
  247. char *fnext        PROTO((void ));
  248.  
  249. #undef PROTO
  250.  
  251. /* end of hydracom.h */
  252.