home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / ftp.vapor.com / microdot-1 / md1_src_02.lzx / hydracom.h < prev    next >
C/C++ Source or Header  |  2014-05-19  |  9KB  |  277 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. #define AMIGA
  54. #define __PROTO__
  55.  
  56. #ifndef WIN_AGL
  57. #define WIN_AGL 0        /* set to 1 for AGL's MS-DOS/AtariST window package */
  58. #endif
  59.  
  60. #include <stdio.h>
  61. #include <stdlib.h>
  62. #include <stdarg.h>
  63. #include <string.h>
  64. #include <ctype.h>
  65. #ifdef AMIGA
  66. #define byte foo234234
  67. #include <dos.h>
  68. #undef byte
  69. #else
  70. #include <dos.h>
  71. #endif    /* AMIGA */
  72. #include <time.h>
  73. #include <sys/stat.h>
  74. /*#include <process.h>*/    /* OLSEN */
  75. /*#include <signal.h>*/        /* OLSEN */
  76. #if WIN_AGL
  77. #include "window.h"     /* AGL's window library */
  78. #endif
  79. #ifdef AMIGA
  80. #include <fcntl.h>        /* OLSEN */
  81. #else
  82. #include <conio.h>      /* MS-DOS Turbo/Borland C(++) console stuff */
  83. #endif
  84. #include "2types.h"
  85. #include "hydra.h"
  86.  
  87. #ifdef __MSDOS__
  88. #define inteli(x) (x)
  89. #define intell(x) (x)
  90. #endif
  91. #if !WIN_AGL
  92. #define Esc   0x01b
  93. #define Alt_B 0x130
  94. #define Alt_C 0x12e
  95. #define Alt_E 0x112
  96. #define Alt_H 0x123
  97. #define Alt_X 0x12D
  98. #define PgUp  0x149
  99. #define PgDn  0x151
  100. #endif
  101.  
  102. #ifdef AMIGA
  103. #include "amiga.h"
  104. #define intell(x) (((x & 0x000000FF) << 24) | ((x & 0x0000FF00) << 8) | ((x & 0x00FF0000) >> 8) | ((x & 0xFF000000) >> 24))
  105. #endif    /* AMIGA */
  106.  
  107. #include "microdot.h"
  108.  
  109. #define PRGNAME "MicroDot"
  110. #define LOGID   "HCom"
  111. #define VERSION MDVER
  112. #ifdef __MSDOS__
  113. #  define HC_OS  "PC"
  114. #else /*!MSDOS*/
  115. #  ifdef __OS2__
  116. #    define HC_OS  "OS/2"
  117. #  else /*!OS2*/
  118. #    ifdef __TOS__
  119. #      define HC_OS  "ST"
  120. #    endif /*TOS*/
  121. #  endif /*OS2*/
  122. #endif /*MSDOS*/
  123.  
  124. #ifdef AMIGA
  125. #define HC_OS "AMIGA"
  126. #endif    /* AMIGA */
  127.  
  128.  
  129. #define PATHLEN 90
  130. #define MAXARGS 50
  131.  
  132. #define DENY_ALL   0x0000
  133. #define DENY_RDWR  0x0010
  134. #define DENY_WRITE 0x0020
  135. #define DENY_READ  0x0030
  136. #define DENY_NONE  0x0040
  137.  
  138. #ifdef MAIN
  139. #define global
  140. #else
  141. #define global extern
  142. #endif
  143.  
  144. global  char     ourname[PATHLEN];
  145. global  char     work[256],
  146.                  buffer[256];
  147. //global  char     device[256];    /* OLSEN */
  148. global  int      port;
  149. global  ULONG     cur_speed;
  150. global  ULONG    com_speed;
  151. global  boolean  parity;
  152. global  boolean  noinit;
  153. global  boolean  nocarrier;
  154. global  boolean  dropdtr;
  155. global  int      flowflags;
  156. global  int      dcdmask;
  157. global  boolean  nobell;
  158. global  boolean  mailer;
  159. global  boolean  nooriginator;
  160. global  boolean  hdxsession;
  161. global  long     hydra_txwindow,
  162.                  hydra_rxwindow;
  163. global  char    **av;
  164. global  int      loglevel;
  165. global  FILE    *logfp;
  166. global  char    *result;
  167. global  char    *download;
  168. global  char     single_file[32];
  169. global  boolean  single_done;
  170. global  boolean  noresume;
  171. global  boolean  nostamp;
  172. global  dword    hydra_options;
  173. global  int      opustask;
  174. global  char    *opuslog;
  175. global  boolean  didsome;
  176. #if WIN_AGL
  177. global  WIN_IDX  file_win,
  178.                  log_win,
  179.                  remote_win,
  180.                  local_win;
  181. global  boolean  log_first;
  182. #else
  183. /*global  void    *term_scr;
  184. global  int      term_x,   term_y,
  185.                  file_x,   file_y,
  186.                            log_y,
  187.                  remote_x, remote_y,
  188.                  local_x,  local_y;*/
  189. #endif
  190.  
  191. #define CHAT_TIMEOUT 60
  192. //global  word     chatfill;
  193. global  long     chattimer,
  194.                  lasttimer;
  195.  
  196.  
  197. #ifdef __PROTO__
  198. # define        PROTO(s) s
  199. #else
  200. # define        PROTO(s) ()
  201. #endif
  202.  
  203.  
  204. /* hydracom.c */
  205. void endprog     PROTO((int errcode ));
  206. //int  config      PROTO((int argc , char *argv []));
  207. //void init        PROTO((void ));
  208. //int  batch_hydra PROTO((char *filespec, char *alias ));
  209. //void hydracom    PROTO((void ));
  210. void __stdargs gaugereport( int, int, int, char *, ... );
  211. void addrecfile( char *, long );
  212. void gaugedone( int );
  213. void loc_puts( char * );
  214.  
  215. /* fmisc.c */
  216. void     unique_name PROTO((char *pathname ));
  217. char    *xfer_init   PROTO((char *fname , long fsize , long ftime ));
  218. boolean  xfer_bad    PROTO((void ));
  219. char    *xfer_okay   PROTO((void ));
  220. void    xfer_del     PROTO((void ));
  221.  
  222. /* misc.c */
  223. int   keyabort     PROTO((void ));
  224. void  rem_chat     PROTO((byte *data, word len ));
  225. int   parse        PROTO((char *string ));
  226. void  splitpath    PROTO((char *filepath , char *path , char *file ));
  227. void  mergepath    PROTO((char *filepath , char *path , char *file ));
  228. int   fexist       PROTO((char *filename ));
  229. void  any_key      PROTO((void ));
  230. int   get_key      PROTO((void ));
  231. int   get_str      PROTO((char *prompt , char *s , int maxlen ));
  232. void  resultlog    PROTO((boolean xmit , char *fname , long bytes , long xfertime ));
  233. char *h_revdate    PROTO((long revstamp ));
  234. void  message      PROTO((int level , char *fmt , ...));
  235. void  cprint       PROTO((char *fmt , ...));
  236. void  hydra_gotoxy PROTO((int x, int y ));
  237. void  hydra_printf PROTO((char *fmt, ...));
  238. void  hydra_clreol PROTO((void ));
  239.  
  240. /* dos_file.c */
  241. void  dos_sharecheck PROTO((void ));
  242. int   dos_open       PROTO((char *pathname , byte create ));
  243. int   dos_sopen      PROTO((char *pathname , byte create ));
  244. int   dos_sappend    PROTO((char *pathname , byte create ));
  245. int   dos_close      PROTO((int handle ));
  246. int   dos_lock       PROTO((int handle , long offset , long len ));
  247. int   dos_unlock     PROTO((int handle , long offset , long len ));
  248. long  dos_seek       PROTO((int handle , long offset , int fromwhere ));
  249. long  dos_tell       PROTO((int handle ));
  250. int   dos_read       PROTO((int handle , void *buf , word len ));
  251. int   dos_write      PROTO((int handle , void *buf , word len ));
  252. FILE *sfopen         PROTO((char *name, char *mode, int shareflag));
  253.  
  254. /* syspc.c */
  255. void  dtr_out      PROTO((byte flag ));
  256. void  com_flow     PROTO((byte flags ));
  257. void  com_setspeed PROTO((ULONG speed ));
  258. void  com_putblock PROTO((byte *s , word len ));
  259. void  sys_init     PROTO((void ));
  260. void  sys_reset    PROTO((void ));
  261. void  sys_idle     PROTO((void ));
  262. int   com_outfull  PROTO((void ));
  263. int   carrier      PROTO((void ));
  264. void  com_flush    PROTO((void ));
  265. void  com_putbyte  PROTO((byte c ));
  266. void  com_purge    PROTO((void ));
  267. void  com_dump     PROTO((void ));
  268. int   com_getbyte  PROTO((void ));
  269. void  setstamp     PROTO((char *name , long tim ));
  270. long  freespace    PROTO((char *drivepath ));
  271. char *ffirst       PROTO((char *filespec ));
  272. char *fnext        PROTO((void ));
  273.  
  274. #undef PROTO
  275.  
  276. /* end of hydracom.h */
  277.