home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 4
/
CDPD_IV.bin
/
networking
/
uucp
/
amigauucpsrc
/
bms
/
defs.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-29
|
9KB
|
322 lines
/*
* DEFS.H
*/
#ifndef DEFS_H
#define DEFS_H
#include <exec/types.h>
#include <exec/lists.h>
#include <exec/nodes.h>
#include <dos/dos.h>
#include <clib/exec_protos.h>
#include <clib/alib_protos.h>
#include <clib/dos_protos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <fcntl.h>
#include <time.h>
#include <lists.h>
#ifndef DEBUG_TIMEMPX
#define DEBUG_TIMEMPX 1
#endif
#define Prototype extern
#define arysize(ary) (sizeof(ary)/sizeof((ary)[0]))
#define markersize(type) offsetof(type,DBMarker)
#define NO 'n'
#define YES 'y'
typedef struct Node Node;
typedef struct List List;
typedef struct FileInfoBlock FileInfoBlock;
typedef unsigned char ubyte;
typedef unsigned short uword;
typedef unsigned long ulong;
typedef long bool_t;
#include "database.h"
#include "protocol.h"
/*
* Comm Communications, including source & destination id's
* Param Operating Parameters
* Stat Statistics
*/
typedef struct Comm {
short com_Flags;
short com_Control; /* who controls this connection? */
long com_SID; /* source identifier */
long com_CID; /* cache identifier */
long com_DID; /* destination identifier */
long com_SeqNo; /* so out of order STOP/STARTs not misinterpreted */
short com_State; /* operating state */
short com_Flags; /* various flags */
short com_Retries; /* retries taken */
short com_TmpFileNo; /* semi-temporary files */
short com_Reserved;
long com_TxReq; /* amount of data we have to send */
long com_TxOk; /* amount of data we are allowed to send */
long com_TmpTx; /* temporary storage, max tx bytes this session */
long com_RemTxBpd; /* eventually takes into acct remote node */
long com_RemTxBpw; /* eventually takes into acct remote node */
long com_TOTime; /* timeout time left (as a double check) */
long com_TOStamp; /* timeout time stamp */
long com_TOMisc; /* misc, depends on protocol */
long DBMarker; /* database marker end of structure */
char *com_Msg;
record_t com_RId; /* record id */
record_t com_MId;
} Comm;
typedef struct Param {
short pm_Flags;
short pm_Reserved;
long pm_MaxRxBpd;
long pm_MaxTxBpd;
long pm_MaxRxBpw;
long pm_MaxTxBpw;
long pm_MaxRxMail;
long pm_MaxTxMail;
long pm_MinMail;
long pm_MirRxBpd;
long pm_MirTxBpd;
long pm_CacBwPerc;
long pm_ReqSwamp;
long pm_MirSwamp;
long DBMarker; /* database marker end of structure */
record_t pm_RId;
} Param;
typedef struct Stat {
short st_Flags;
short st_Reserved;
long st_BytesOut; /* bytes sent */
long st_BytesIn; /* bytes received */
long st_BytesResent; /* transmitted bytes resent */
long st_BytesDup; /* received bytes duplicated */
long DBMarker; /* database marker end of structure */
record_t st_RId;
} Stat;
/*
* RegNode - Registration node (\0 name indicates default node)
* CtlNode - High level control node
* FilNode - Low level control node, for each queued file/directory
*/
typedef struct RegNode {
Node rn_Node; /* ln_Name == dest path */
short rn_Flags;
char *rn_RetPath; /* specified return path */
char *rn_Alias; /* specified node alias */
long rn_CommId; /* next allocatable id */
long DBMarker; /* database marker end of structure */
record_t rn_RId;
record_t rn_NId;
record_t rn_RPId;
record_t rn_ALId;
record_t rn_TxHId;
record_t rn_FAId;
List rn_HistList; /* histogram of data sent */
List rn_CtlList; /* list of control nodes */
List rn_AccList; /* file access list */
Comm rn_Comm; /* communications */
Param rn_Param; /* parameters */
Stat rn_Stat; /* statistics */
} RegNode;
typedef struct CtlNode {
Node cn_Node; /* ln_Name holds control argument(s) */
short cn_Flags;
long DBMarker; /* database marker end of structure */
record_t cn_RId;
record_t cn_NId; /* cn_Node.ln_Name */
List cn_FileList; /* list of files & directories */
Comm cn_Comm; /* communications */
Stat cn_Stat; /* statistics */
} CtlNode;
#define CNF_DONE 0x0100 /* cn_Flags, operation DONE flag */
/*
* The FileAccess structure is a permanent subtree under a RegNode
* which holds the overall file permissions. Entries are of the
* form: +name or -name
*/
typedef struct FileAccess {
Node fa_Node;
short fa_Flags;
long DBMarker;
record_t fa_RId;
record_t fa_NId;
} FileAccess;
#define FAF_RESTRICT 0x0100
/*
* The FileNode structure serves as a placeholder during a file
* transfer. It contains FileChunks indicating which parts of the
* file have been received or transmitted. Directories are converted
* into a flat namespace of multiple FileNode's for the purposes of
* the file transfer.
*
* For the transmitter, fn_Files is set to the total number of nodes
* to be sent (this value is sent with every file). fn_FilNo
* individually identifies each file allowing the receiver to
* request a retry.
*/
typedef struct FileNode {
Node fn_Node;
short fn_Flags;
long fn_Files; /* total number of files */
long fn_FileNo; /* entry number */
long fn_Size; /* file size */
long fn_Date[3]; /* AmigaDOS date */
long fn_Protection; /* file protection(s) */
long DBMarker; /* database marker end of struct */
char *fn_RemFileName; /* remote file name */
char *fn_LocFileName; /* local file name */
char *fn_Comment; /* comment field, if any */
List fn_ChunkList; /* list of FileChunks */
record_t fn_RId; /* Record ID for this structure */
record_t fn_LFId; /* fn_LocFileName */
record_t fn_RFId; /* fn_RemFileName */
record_t fn_CMId; /* fn_Comment */
record_t fn_FCId; /* DBTYPE_CHUNK root */
} FileNode;
#define FNF_ILLEGAL 0x0100
#define FNF_BAD 0x0200
#define FNF_DONE 0x0400 /* also effects file name */
#define FNF_SIZE 0x0800 /* size is known */
#define FNF_DIR 0x1000 /* is a directory */
#define FNF_MASTER 0x2000 /* get, master (root) node */
/*
* FileChunk
*
* A FileChunk contains part of a file. A FileChunk does not contain
* actual data, that is assembled in the file itself (for recv) or
* extracted (for transmit)
*/
typedef struct FileChunk {
Node fc_Node;
short fc_Flags;
long fc_Offset;
long fc_Bytes;
long DBMarker;
record_t fc_RId;
} FileChunk;
/*
* A HistNode contains information relating to bytes sent and bytes
* received over a period of time.
*/
typedef struct HistNode {
Node hn_Node;
time_t hn_TimeStamp; /* when */
long hn_Bytes; /* how much */
short hn_Flags;
short hn_Reserved;
long DBMarker;
record_t hn_RId;
} HistNode;
/*
* Global Flags
*/
#define GF_DELETED 0x0001
#define GF_MODIFIED 0x0002
#define GF_LOADED 0x0004
#define GF_MARKED 0x0008 /* RegNode only */
#define GF_ALERT 0x0010 /* alert state machine */
#define GF_NODISP 0x0020 /* do not display - 'done' or 'dequeued' wait states */
#define GF_COMMENT 0x0040 /* expect comment field (FileNode) */
#define GF_CUSTOM 0xFF00
/*
* Database TYPEs. Bit 31 reserved by database to mark 'deleted' nodes.
*/
#define DBTYPE_COMM 0x00000010 /* Comm sub structure */
#define DBTYPE_COMM_MSG 0x00000011 /* com_Msg */
#define DBTYPE_PARAM 0x00000020 /* Param sub structure */
#define DBTYPE_STAT 0x00000030 /* Stat sub structure */
#define DBTYPE_REG 0x00000040 /* RegNode */
#define DBTYPE_REG_NAME 0x00000041
#define DBTYPE_REG_RETPATH 0x00000042 /* rn_RetPath */
#define DBTYPE_REG_ALIAS 0x00000043 /* rn_Alias */
#define DBTYPE_CTL 0x00000050 /* CtlNode */
#define DBTYPE_CTL_NAME 0x00000051
#define DBTYPE_FILE 0x00000060 /* FileNode */
#define DBTYPE_FILE_REMNAME 0x00000061 /* fn_LocFileName */
#define DBTYPE_FILE_LOCNAME 0x00000062 /* fn_RemFileName */
#define DBTYPE_FILE_COMMENT 0x00000063 /* fn_Comment */
#define DBTYPE_CHUNK 0x00000070 /* subtree root */
#define DBTYPE_CHUNK_NODE 0x00000071 /* FileChunk */
#define DBTYPE_TXHIST 0x00000080 /* under RegNode */
#define DBTYPE_TXHIST_NODE 0x00000081 /* HistNode */
#define DBTYPE_ACCESS 0x00000090 /* subtree root */
#define DBTYPE_ACCESS_NODE 0x00000091 /* File Access */
#define DBTYPE_ACCESS_NAME 0x00000092 /* fa_Node.ln_Name */
#define DBTYPE_CONTROL 0x00010000 /* formatted data for email */
#define DBTYPE_CONTROL_MASK 0x0000FFFF /* bits protocol.h can play w/ */
/*
* Prototypes
*/
#ifndef TEST
#include "bms-protos.h"
#endif
#endif