1 /*:ts=8*/
2 /*****************************************************************************
3  * FIDOGATE --- Gateway UNIX Mail/News <-> FIDO NetMail/EchoMail
4  *
5  *
6  * Packet structure
7  *
8  *****************************************************************************
9  * Copyright (C) 1990-2002
10  *  _____ _____
11  * |     |___  |   Martin Junius             <mj@fidogate.org>
12  * | | | |   | |   Radiumstr. 18
13  * |_|_|_|@home|   D-51069 Koeln, Germany
14  *
15  * This file is part of FIDOGATE.
16  *
17  * FIDOGATE is free software; you can redistribute it and/or modify it
18  * under the terms of the GNU General Public License as published by the
19  * Free Software Foundation; either version 2, or (at your option) any
20  * later version.
21  *
22  * FIDOGATE is distributed in the hope that it will be useful, but
23  * WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25  * General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with FIDOGATE; see the file COPYING.  If not, write to the Free
29  * Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
30  *****************************************************************************/
31 
32 #ifndef FIDOGATE_PACKET_H
33 #define FIDOGATE_PACKET_H
34 
35 #include <time.h>
36 
37 /*
38  * Packet header
39  */
40 
41 #define PKT_VERSION	2
42 
43 #define PKT_MAXPASSWD	8
44 
45 typedef struct {
46     Node from;                  /* Originating node address */
47     Node to;                    /* Destination node address */
48     time_t time;                /* Date / time */
49     int baud;
50     int version;                /* Always PKT_VERSION */
51     int product_l;              /* Product code low */
52     int product_h;              /* Product code high */
53     int rev_min;                /* Revision minor */
54     int rev_maj;                /* Revision major */
55     char passwd[PKT_MAXPASSWD + 1]; /* Password */
56     int capword;                /* Capability word (== 1 fuer 2+) */
57     char psd[4];                /* Produc Specific Data */
58 } Packet;
59 
60 /*
61  * Message header (see FTS-0001, packed message)
62  */
63 
64 #define MSG_TYPE	2
65 #define MSG_END		0
66 
67 #define MSG_MAXDATE	20
68 #define MSG_MAXNAME	36
69 #define MSG_MAXSUBJ	72
70 #define MSG_MAXORIG	72
71 
72 /* AttributeWord bits according to FTS-0001 */
73 #define MSG_PRIVATE	0x0001      /* Private */
74 #define MSG_CRASH	0x0002      /* Crash */
75 #define MSG_RECD	0x0004      /* Recd */
76 #define MSG_SENT	0x0008      /* Sent */
77 #define MSG_FILE	0x0010      /* FileAttached */
78 #define MSG_INTRANSIT	0x0020  /* InTransit */
79 #define MSG_ORPHAN	0x0040      /* Orphan */
80 #define MSG_KILLSENT	0x0080  /* KillSent */
81 #define MSG_LOCAL	0x0100      /* Local */
82 #define MSG_HOLD	0x0200      /* HoldForPickup */
83 /* Unused:              0x0400 */
84 #define MSG_DIRECT	0x0400      /* Local used only */
85 #define MSG_FREQUEST	0x0800  /* FileRequest */
86 #define MSG_RRREQ	0x1000      /* ReturnReceiptRequest */
87 #define MSG_ISRR	0x2000      /* IsReturnReceiptRequest */
88 #define MSG_AUDIT	0x4000      /* AuditRequest */
89 #define MSG_FUPDATE	0x8000      /* FileUpdateReq */
90 
91 #define MSG_MASK	0x7413      /* attr AND before packeting */
92 
93 /* max UTF-8 char is 4 */
94 #define NAMEBUFSIZE (MSG_MAXNAME * 4)
95 #define SUBJBUFSIZE (MSG_MAXNAME * 4)
96 
97 typedef struct {
98     Node node_from, node_to;    /* FTN address from, to */
99     Node node_orig;             /* FTN address sender */
100     int attr;                   /* Attribute flags */
101     int cost;                   /* Cost */
102     time_t date;                /* Date, seconds from 1970-01-01 UTC */
103     char *tz;			/* Keep timezone info */
104     char name_to[NAMEBUFSIZE];  /* To name */
105     char name_from[NAMEBUFSIZE];    /* From name */
106     char subject[SUBJBUFSIZE];  /* Subject */
107     char *area;                 /* EchoMail area or NULL */
108 } Message;
109 
110 #endif
111