📄 sealink.imp
字号:
SEAlink - Sliding window file transfer protocol XENIX System V version by Scott Reynolds additional XENIX modifications by Sanford Zelkovitz, without whose help this couldn't have been accomplished Based on: MS-DOS Version 1.16, created on 01/15/87 at 01:40:52(C) COPYRIGHT 1986,87 by System Enhancement Associates; ALL RIGHTS RESERVED By: Thom Henderson Description: This file contains a set of routines to illustrate the SEAlink sliding window file transfer protocol. SEAlink is fully backward compatible to XMODEM, and can be easily adapted to most XMODEM variants. The intent of SEAlink is to provide a file transfer protocol that does not suffer from propagation delays, such as are introduced by satellite relays or packet switched networks. Instructions: Two routines are provided to implement SEAlink file transfers. int xmtfile(name) /+ transmit a file +/ char *name; /+ name of file to transmit +/ This routine is used to send a file. One file is sent at a time. If the name is blank (name is null or *name points to a null), then only an end of transmission marker is sent. This routine returns a one if the file is successfully transmitted, or a zero if a fatal error occurs. char *rcvfile(name) /+ receive a file +/ char *name; /+ name of file (optional) +/ This routine is used to receive a file. One file is received. The name, if given, takes precedence and will be the name of the resulting file. If the name is blank (name is null or *name points to a null), then the name given by the transmitter is used. If the transmitter does not give a name, then the file transfer is aborted. This routine returns a pointer to the name of the file that was received. If the file transfer is not successful, then a null pointer is returned. The pointer returned by rcvfile() points to a static data buffer. This does not have to be freed (and should not be), but it will be overwritten the next time rcvfile() is called. The rcvfile() function works on a temporary file whose name is the same as the final file, but with a period (".") added at the beginning. If a file transfer is aborted, then this temporary file will be retained. An aborted file transfer will not harm a pre-existing file of the same name. Programming notes: These routines can be used for either single or multiple file transfers. To send multiple files, send each one one at a time until either a transmit fails or all files are sent. If all files are sent, then signal the end by calling xmtfile() with a null pointer. To receive multiple files, call rcvfile() repeatedly until it returns a null pointer. These routines pass a "block zero", which contains information about the original file name, size, and date/time of last modification. If you cannot implement block zero, then you can leave it out. If you cannot set any given field in block zero when transmitting, then you should leave it set to zeros. If you cannot use any given field of block zero when receiving, then you should ignore it. These routines are fully compatible with XMODEM, including the original checksum method and later CRC adaptations. It can be easily adapted to Modem7 protocol by adding a Modem7 filename transfer shell, though we do not recommend it. The underlying logic, of course, can be adapted to almost any variant of XMODEM. License: You are granted a license to use this code in your programs, and to adapt it to your particular situation and needs, subject only to the following conditions: 1) You must refer to it as the SEAlink protocol, and you must give credit to System Enhancement Associates. 2) If you modify it in such a way that your version cannot converse with the original code as supplied by us, then you should refer to it as "SEAlink derived", or as a "variation of SEAlink", or words to that effect. In short, we're not asking for any money, but we'd like to get some credit for our work. Language: Computer Innovations C86 Adapted for IBM PC XENIX 2.00.2 C using UNIX System V compatible calls Notes on XENIX modifications: The com_getc() routine has a minimum delay of .1 seconds, due to the nature of the read() system call. Attempts to eliminate this delay have proven more costly than leaving it in. CRC maintenance functions were added to the original code, as they are not library calls under XENIX. All output is performed through file descriptor 0, and is done in blocks using the write() system call rather than individual character writes. File descriptor 1 may be selected by invoking the program with a "-1" argument. Most low level routines utilize register class variables to decrease overhead and improve overall system response slightly. A rudimentary command line processor was added to the original routines to drive the transmitter and receiver. The two options, "s" and "r", are for sending and receiving respectively. When invoked without proper arguments the program will display a short message including usage notes. -- Scott Reynolds, Sysop U.S.S. Enterprise BBS, (906)228-9460
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -