Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

fidodefs.h 9.88 KB
Newer Older
1 2
/* FidoNet constants, macros, and structure definitions */

3
/* $Id: fidodefs.h,v 1.24 2020/03/24 00:50:48 rswindell Exp $ */
4 5 6 7 8

/****************************************************************************
 * @format.tab-size 4		(Plain Text/Source Code File Header)			*
 * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
 *																			*
rswindell's avatar
rswindell committed
9
 * Copyright Rob Swindell - http://www.synchro.net/copyright.html			*
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
 *																			*
 * This program is free software; you can redistribute it and/or			*
 * modify it under the terms of the GNU General Public License				*
 * as published by the Free Software Foundation; either version 2			*
 * of the License, or (at your option) any later version.					*
 * See the GNU General Public License for more details: gpl.txt or			*
 * http://www.fsf.org/copyleft/gpl.html										*
 *																			*
 * Anonymous FTP access to the most recent released source is available at	*
 * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net	*
 *																			*
 * Anonymous CVS access to the development source and modification history	*
 * is available at cvs.synchro.net:/cvsroot/sbbs, example:					*
 * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login			*
 *     (just hit return, no password is necessary)							*
 * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src		*
 *																			*
 * For Synchronet coding style and modification guidelines, see				*
 * http://www.synchro.net/source.html										*
 *																			*
 * You are encouraged to submit any modifications (preferably in Unix diff	*
 * format) via e-mail to mods@synchro.net									*
 *																			*
 * Note: If this box doesn't appear square, then you need to fix your tabs.	*
 ****************************************************************************/

#ifndef _FIDODEFS_H_
#define _FIDODEFS_H_

39
#include "gen_defs.h"
40

41
#define FIDO_TLD		".fidonet"	/* Fake top-level domain for gating netmail through SMTP  */
42 43
#define FIDO_ORIGIN_PREFIX_FORM_1	"\r * Origin: "
#define FIDO_ORIGIN_PREFIX_FORM_2	"\n * Origin: "
rswindell's avatar
rswindell committed
44
#define FIDO_PING_NAME		"PING"		/* 'To' username for PING netmail (FTS-5001) */
45
#define FIDO_AREAMGR_NAME	"AreaFix"	/* De-facto pseudo-standard */
46
#define FIDO_CONFMGR_NAME	"ConfMgr"	/* FSC-0057 */
47 48 49
#define FIDO_CHARSET_ASCII  "ASCII 1"	/* FTS-5003 */
#define FIDO_CHARSET_CP437  "CP437 2"	/* FTS-5003 */
#define FIDO_CHARSET_UTF8	"UTF-8 4"	/* FTS-5003 */
rswindell's avatar
rswindell committed
50

51 52 53
#define FIDO_NAME_LEN			36	/* Includes '\0' terminator				*/
#define FIDO_SUBJ_LEN			72	/* Includes '\0' terminator				*/
#define FIDO_TIME_LEN			20	/* Includes '\0' terminator				*/
54 55 56
#define FIDO_PASS_LEN			8	/* May NOT include '\0' terminator		*/
#define FIDO_DOMAIN_LEN			8	/* May NOT include '\0' terminator		*/
#define FIDO_PRODDATA_LEN		4	/* Product-specific Data */
57
#define FIDO_AREATAG_LEN		50	// Echo "area tag" (NOT including '\0') (see FMail.txt)
58
#define FIDO_ECHO_TITLE_LEN		55	// Brief echo description, per echobase.hlp
59
#define FIDO_ORIGIN_PREFIX_LEN	12	/* Includes new-line character			*/
rswindell's avatar
rswindell committed
60

61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
									/* Attribute bits for fmsghdr_t.attr	*/
#define FIDO_PRIVATE	(1<<0)		/* Private message						*/
#define FIDO_CRASH		(1<<1)		/* Crash-mail (send immediately)		*/
#define FIDO_RECV		(1<<2)		/* Received successfully				*/
#define FIDO_SENT		(1<<3)		/* Sent successfully					*/
#define FIDO_FILE		(1<<4)		/* File attached						*/
#define FIDO_INTRANS	(1<<5)		/* In transit							*/
#define FIDO_ORPHAN 	(1<<6)		/* Orphan								*/
#define FIDO_KILLSENT	(1<<7)		/* Kill it after sending it				*/
#define FIDO_LOCAL		(1<<8)		/* Created locally - on this system		*/
#define FIDO_HOLD		(1<<9)		/* Hold - don't send it yet				*/
#define FIDO_FREQ		(1<<11) 	/* File request							*/
#define FIDO_RRREQ		(1<<12) 	/* Return receipt request				*/
#define FIDO_RR 		(1<<13) 	/* This is a return receipt				*/
#define FIDO_AUDIT		(1<<14) 	/* Audit request						*/
#define FIDO_FUPREQ 	(1<<15) 	/* File update request					*/

#if defined(_WIN32) || defined(__BORLANDC__)
	#define PRAGMA_PACK
#endif

82
#if defined(PRAGMA_PACK) || defined(__WATCOMC__)
83 84 85 86 87 88
	#define _PACK
#else
	#define _PACK __attribute__ ((packed))
#endif

#if defined(PRAGMA_PACK)
89
	#pragma pack(push,1)			/* Disk image structures must be packed */
90 91
#endif

rswindell's avatar
rswindell committed
92
typedef struct _PACK {				/* Fidonet Packet Header (Type-2), FTS-1 */
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
	uint16_t	orignode;			// Origination Node of Packet (all types)
	uint16_t	destnode;			// Destination Node of Packet (all types)
	uint16_t	year;				// Year of Packet Creation e.g. 1995
	uint16_t	month;				// Month of Packet Creation 0-11
	uint16_t	day;				// Day of Packet Creation 1-31
	uint16_t	hour;				// Hour of Packet Creation 0-23
	uint16_t	min;				// Minute of Packet Creation 0-59
	uint16_t	sec;				// Second of Packet Creation 0-59
	uint16_t	baud;				// Max Baud Rate of Orig & Dest
	uint16_t	pkttype;			// Packet Type (2)
	uint16_t	orignet;			// Origination Net of Packet
	uint16_t	destnet;			// Destination Net of Packet
	uint8_t		prodcode;			// Product Code (00h is Fido)
	uint8_t		sernum;				// Binary Serial Number or NULL
	uint8_t		password[FIDO_PASS_LEN];	// Session Password or NULL
	uint16_t	origzone;			// Origination Zone of Packet or NULL (added in rev 12 of FTS-1)
	uint16_t	destzone;			// Destination Zone of Packet or NULL (added in rev 12 of FTS-1)
	uint8_t		fill[20];			// Unused (zeroed)
} fpkthdr2_t;

rswindell's avatar
rswindell committed
113
typedef struct _PACK {				/* Fidonet Packet Header (Type-2+), FSC-48 and FSC-39.4 (sans auxnet) */
114 115 116 117 118 119 120 121 122 123 124 125 126
	uint16_t	orignode;			// Origination Node of Packet (all types)
	uint16_t	destnode;			// Destination Node of Packet (all types)
	uint16_t	year;				// Year of Packet Creation e.g. 1995
	uint16_t	month;				// Month of Packet Creation 0-11
	uint16_t	day;				// Day of Packet Creation 1-31
	uint16_t	hour;				// Hour of Packet Creation 0-23
	uint16_t	min;				// Minute of Packet Creation 0-59
	uint16_t	sec;				// Second of Packet Creation 0-59
	uint16_t	baud;				// Max Baud Rate of Orig & Dest
	uint16_t	pkttype;			// Packet Type (2)
	uint16_t	orignet;			// Origination Net of Packet
	uint16_t	destnet;			// Destination Net of Packet
	uint8_t		prodcodeLo;			// Product Code (00h is Fido)
127
	uint8_t		prodrevMajor;		// Revision (major)
128
	uint8_t		password[FIDO_PASS_LEN];	// Session Password or NULL
rswindell's avatar
rswindell committed
129 130 131
	uint16_t	oldOrigZone;		// Origination Zone in type 2 packet, unused in 2+
	uint16_t	oldDestZone;		// Destination Zone in type 2 packet, unused in 2+
	/* 2 Fill data area: */
132
	uint16_t	auxnet;				// Orig Net if Origin is a Point
rswindell's avatar
rswindell committed
133
	uint16_t	cwcopy;				// Must be Equal to cword (byte-swapped), added in rev 4 of FSC-39
134
	uint8_t		prodcodeHi;			// Product Code	
135
	uint8_t		prodrevMinor; 		// Revision (minor)
136 137 138 139 140
	uint16_t	cword;				// Compatibility Word
	uint16_t	origzone; 			// Zone of Packet Sender or NULL
	uint16_t	destzone; 			// Zone of Packet Receiver or NULL
	uint16_t	origpoint;			// Origination Point of Packet
	uint16_t	destpoint;			// Destination Point of Packet
141
	uint8_t		proddata[FIDO_PRODDATA_LEN];		// Product Specific Data
142 143
} fpkthdr2plus_t;

rswindell's avatar
rswindell committed
144
typedef struct _PACK {				/* Fidonet Packet Header (Type-2.2), FSC-45 */
145 146 147 148 149 150 151 152 153 154
	uint16_t	orignode;			// Origination Node of Packet (all types)
	uint16_t	destnode;			// Destination Node of Packet (all types)
	uint16_t	origpoint;			// Origination Point of Packet
	uint16_t	destpoint;			// Destination Point of Packet
	uint8_t		reserved[8];		// Reserved, must be zero
	uint16_t	subversion;			// Packet sub-version (2, indicates type 2.2 packet header)
	uint16_t	pkttype;			// Packet Type (2)
	uint16_t	orignet;			// Origination Net of Packet
	uint16_t	destnet;			// Destination Net of Packet
	uint8_t		prodcode;			// Product code (00h is Fido)
155
	uint8_t		prodrev;			// Product revision level
156 157 158
	uint8_t		password[FIDO_PASS_LEN];	// Session Password or NULL
	uint16_t	origzone;			// Origination Zone of Packet or NULL (added in rev 12 of FTS-1)
	uint16_t	destzone;			// Destination Zone of Packet or NULL (added in rev 12 of FTS-1)
rswindell's avatar
rswindell committed
159
	/* 2 Fill data area: */
160 161 162
	uint8_t		origdomn[FIDO_DOMAIN_LEN];		// Origination Domain
	uint8_t		destdomn[FIDO_DOMAIN_LEN];		// Destination Domain
	uint8_t		proddata[FIDO_PRODDATA_LEN];		// Product Specific Data
163 164 165
} fpkthdr2_2_t;


rswindell's avatar
rswindell committed
166
typedef union _PACK {				/* Fidonet Packet Header (types 2, 2+, and 2.2) */
167 168 169
	fpkthdr2_t		type2;
	fpkthdr2plus_t	type2plus;
	fpkthdr2_2_t	type2_2;
170 171
} fpkthdr_t;

172 173
#define FIDO_PACKET_HDR_LEN			58
#define FIDO_PACKET_TERMINATOR		0x0000	/* 16-bits */
174 175

typedef struct _PACK {				/* FidoNet Packed Message Header 		*/
deuce's avatar
64-bit  
deuce committed
176 177 178 179 180 181 182
	int16_t	type;					/* Message type: 2						*/
	int16_t	orignode;
	int16_t	destnode;
	int16_t	orignet;
	int16_t	destnet;
	int16_t	attr;
	int16_t	cost;
183 184 185
	char	time[FIDO_TIME_LEN];	/* Time in goof-ball ASCII format		*/
} fpkdmsg_t;

186 187
#define FIDO_PACKED_MSG_HDR_LEN		34		/* Fixed header fields only */
#define FIDO_PACKED_MSG_TERMINATOR	'\0'	/* 8-bits */
188

rswindell's avatar
rswindell committed
189
typedef struct _PACK {				/* FidoNet Stored Message Header *.msg	*/
190 191 192 193
	char	from[FIDO_NAME_LEN],	/* From user							*/
			to[FIDO_NAME_LEN], 		/* To user								*/
			subj[FIDO_SUBJ_LEN],	/* Message title						*/
			time[FIDO_TIME_LEN];	/* Time in goof-ball ASCII format		*/
deuce's avatar
64-bit  
deuce committed
194
	int16_t	read,					/* Times read							*/
195 196 197 198 199 200 201 202 203 204 205 206 207 208
			destnode,				/* Destination node						*/
			orignode,				/* Origin node							*/
			cost,					/* Cost in pennies						*/
			orignet,				/* Origin net							*/
			destnet,				/* Destination net						*/
			destzone,				/* Destination zone						*/
			origzone,				/* Origin zone							*/
			destpoint,				/* Destination point					*/
			origpoint,				/* Origin point							*/
			re, 					/* Message number regarding				*/
			attr,					/* Attributes - see FIDO_*				*/
			next;					/* Next message number in stream		*/
} fmsghdr_t;

209
struct _PACK fidoaddr {		/* FidoNet 5D address (zone:net/node.point@domain) */
210 211 212 213
	uint16_t	zone;
	uint16_t	net;
	uint16_t	node;
	uint16_t	point;
214 215
	char		domain[FIDO_DOMAIN_LEN + 1];
};
216

217 218
#define FIDO_STORED_MSG_HDR_LEN		190
#define FIDO_STORED_MSG_TERMINATOR	'\0'	/* 8-bits */
219

220 221
#define FIDO_SOFT_CR				0x8d

222 223 224 225 226 227
#if defined(PRAGMA_PACK)
#pragma pack(pop)		/* original packing */
#endif

#endif	/* Don't add anything after this line */