home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * DNET.H
- *
- * DNET (c)Copyright 1988, Matthew Dillon, All Rights Reserved.
- *
- */
-
- #include <local/typedefs.h>
- #include <local/ioctl.h>
- #include "/version.h"
-
- #define DNET_H
-
- #define DMNWOFF 4 /* Deemu offset to NewWindow structure */
-
- typedef struct IOStdReq IOR;
-
- #include "/dnet/channel.h"
-
- #ifndef MAX(a,b)
- #define MAX(a,b) (((a)>(b))?(a):(b))
- #endif
-
- #define CFGFILE "s:dnet.config"
-
- #define PKT struct _PKT
- #define PNODE struct _PNODE
- #define IOMSG struct _IOMSG
-
- #define BTOC(yow) ((ubyte *)((long)(yow) << 2))
- #define DNETPORTNAME "DNET.UNIT."
- #define OFFSET(ptr,elem) ((long)((char *)&(ptr)->elem - (char *)(ptr)))
-
- #define EMPTY 0 /* empty (sent) */
- #define READY 1 /* data ready (not sent yet) */
-
- #define MAXCHAN 128 /* Max # of channels supported */
- #define SYNC 0xFF /* SYNC character */
- #define MAXPKT 200 /* maximum packet size */
- #define MINPKT 32 /* minimum maximum packet size
- (for priority scheme) */
-
- #define OVERHEAD 7 /* for packets with data */
-
- PNODE {
- NODE node;
- char name[32];
- ulong seg;
- };
-
- PKT {
- uword iolength; /* send: length of packet, recv: length of data */
- ubyte state; /* EMPTY, READY */
-
- ubyte sync; /* THE PACKET */
- ubyte ctl;
- ubyte cchk;
- ubyte lenh;
- ubyte lenl;
- ubyte data[MAXPKT+2];
- };
-
- /*
- * Used by the IoCtl() support routines.
- */
-
- IOMSG {
- MSG Msg;
- TASK *ReplyTask;
- ulong Cmd;
- ulong Arg1;
- ulong Arg2;
- ulong Res;
- };
-
- /* RECEIVER STATES */
- #define RS_SYNC 0 /* Waiting for sync */
- #define RS_CTL 1 /* Waiting for command */
- #define RS_CCHK 2 /* Waiting for check byte */
- #define RS_LEN1 3 /* Waiting for MSB length byte */
- #define RS_LEN2 4 /* Waiting for LSB length byte */
- #define RS_DATA 5 /* Waiting for data & checksum */
-
- #define DNCMD_OPEN 32 /* Application open */
- #define DNCMD_SOPEN 33 /* Server open */
- #define DNCMD_CLOSE 34 /* Close a channel */
- #define DNCMD_EOF 35 /* Will no longer write to channel */
-
- #define DNCMD_WRITE 36 /* Write data to a channel */
- #define DNCMD_QUIT 37 /* Kill the DNET server */
- #define DNCMD_IOCTL 38
-
- #define DNCMD_INFO 64 /* Ascii status message */
-
- /* REQUEST TYPES */
- #define RTO_REQ 1 /* Network read timeout */
- #define WTO_REQ 2 /* Network write-ack timeout */
- #define RNET_REQ 3 /* Network read data */
- #define WNET_REQ 4 /* Network write data sent */
- #define PKT_REQ 5 /* Returned packets from servers */
- #define OPEN_REQ 6
- #define IGWNET_REQ 7
- #define CTO_REQ 8
- #define CNET_REQ 9
-
- /* PACKET CONTROL BYTE */
- #define PKF_SEQUENCE 0xE0 /* Sequence # */
- #define PKF_DATA 0x10 /* 1-65535 bytes */
- #define PKF_RESERVED 0x08 /* reserved bit */
- #define PKF_MASK 0x07 /* command mask */
-
- #define PKCMD_WRITE 1 /* A DATA packet */
- #define PKCMD_CHECK 2 /* Request ACK or NAK for win */
- #define PKCMD_ACK 3 /* ACK a window */
- #define PKCMD_NAK 4 /* NAK a window */
- #define PKCMD_RESTART 5 /* Restart */
- #define PKCMD_ACKRSTART 6 /* Restart Acknowledge */
- #define PKCMD_RESERVE3 7
- /* CHANNEL COMMANDS */
- #define SCMD_SWITCH 0x00 /* switch active channel # */
- #define SCMD_OPEN 0x01 /* open a channel */
- #define SCMD_CLOSE 0x02 /* close a channel */
- #define SCMD_ACKCMD 0x03 /* ack an open/close request */
- #define SCMD_EOFCMD 0x04 /* Reof or Weof */
- #define SCMD_QUIT 0x05 /* crash dnet */
- #define SCMD_IOCTL 0x06 /* ioctl */
-
- #define SCMD_DATA 0x08 /* stream command, DATA */
- #define SCMD_DATA7 0x09 /* stream command, 7 bit DATA */
-
- #define CHAN_FREE 0x01 /* free channel */
- #define CHAN_ROPEN 0x02 /* remote open, wait port msg */
- #define CHAN_LOPEN 0x03 /* local open, wait reply */
- #define CHAN_OPEN 0x04
- #define CHAN_CLOSE 0x05 /* see flags */
- #define CHANF_ROK 0x01 /* NOT read eof */
- #define CHANF_WOK 0x02 /* remote will accept data */
- #define CHANF_LCLOSE 0x04
- #define CHANF_RCLOSE 0x08
-
- extern void *GetMsg();
- extern void *RemHead();
- extern void *AllocMem();
- extern void *FindTask();
- extern void *ArbitrateNext();
- extern long IoHandler();
-
- #ifndef NOEXT
- extern IOT Rto; /* Read-Timeout/reset */
- extern IOT Wto; /* Write-Timeout/retry */
- extern IOT Cto;
- extern PKT Pkts[9];
- extern PKT *Raux; /* next packet in */
- extern PKT *RPak[4];
- extern PKT *WPak[4];
- extern PORT *DNetPort; /* Remote Command/Control in */
- extern PORT *IOSink; /* Return port for ALL IO */
- extern PORT *IPCPort; /* IPC comm port. */
- extern CHAN Chan[MAXCHAN];
- extern LIST TxList; /* For pending DNCMD_WRITE reqs. */
- extern LIST SvList;
- extern ubyte Rto_act;
- extern ubyte Wto_act;
- extern ubyte Cto_act;
- extern ubyte Cd;
- extern uword RChan;
- extern uword WChan;
- extern uword RPStart;
- extern uword WPStart;
- extern uword WPUsed;
- extern uword RState;
- extern short DDebug;
- extern short PDebug;
- extern ubyte Restart;
- extern ubyte OnLine;
- extern ubyte Quit;
- extern short AutoHangup;
- extern short DialOut;
- extern short AutoAnswer;
- extern short Master8;
- extern short NetworkNum;
- extern ulong NumCon;
- extern ulong WTimeoutVal;
- extern ulong RTimeoutVal;
- extern long Baud;
- extern long TOBaud;
- extern char *HostName; /* The Amiga's HostName */
- extern long DResBase;
- extern char PortName[];
-
- extern ubyte RestartPkt[3];
- extern ubyte AckPkt[8][3];
- extern ubyte NakPkt[8][3];
- extern ubyte CheckPkt[8][3];
-
- extern short Deemu[];
-
- extern long BytesOut, PacketsOut, PacketsResent;
- extern long BytesIn , PacketsIn , PacketsNakd;
- extern long GarbageIn;
-
- extern char *GetCfgLine();
-
- extern IOSER *NetReadReady();
- extern IOSER *NetAbortRead();
-
- #endif
-
-