tin  2.6.1
About: TIN is a threaded NNTP and spool based UseNet newsreader.
  Fossies Dox: tin-2.6.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

rfc2046.h
Go to the documentation of this file.
1/*
2 * Project : tin - a Usenet reader
3 * Module : rfc2046.h
4 * Author : Jason Faultless <jason@altarstone.com>
5 * Created : 2000-02-18
6 * Updated : 2016-01-01
7 * Notes : rfc2046 MIME article definitions
8 *
9 * Copyright (c) 2000-2022 Jason Faultless <jason@altarstone.com>
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * 1. Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 *
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * 3. Neither the name of the copyright holder nor the names of its
24 * contributors may be used to endorse or promote products derived from
25 * this software without specific prior written permission.
26 *
27 * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef RFC2046_H
41# define RFC2046_H 1
42
43/* The version of MIME we conform to */
44# define MIME_SUPPORTED_VERSION "1.0"
45
46/* These must track the array definitions in lang.c */
47# define TYPE_TEXT 0
48# define TYPE_MULTIPART 1
49# define TYPE_APPLICATION 2
50# define TYPE_MESSAGE 3
51# define TYPE_IMAGE 4
52# define TYPE_AUDIO 5
53# define TYPE_VIDEO 6
54
55# define ENCODING_7BIT 0
56# define ENCODING_QP 1
57# define ENCODING_BASE64 2
58# define ENCODING_8BIT 3
59# define ENCODING_BINARY 4
60# define ENCODING_UUE 5
61
62# define DISP_INLINE 0
63# define DISP_ATTACH 1
64
65# define BOUND_NONE 0
66# define BOUND_START 1
67# define BOUND_END 2
68
69# define FORMAT_FIXED 0
70# define FORMAT_FLOWED 1
71
72/*
73 * Linked list of parameter/value pairs
74 * Used for params attached to a content line
75 */
76typedef struct param
77{
78 char *name;
79 char *value;
80 char *charset;
81 int part;
84 struct param *next;
86
87
88/*
89 * Describes the properties of an article or article attachment
90 * We re-use this to describe uuencoded sections
91 */
92typedef struct part
93{
94 unsigned type:3; /* Content major type */
95 unsigned encoding:3; /* Transfer encoding */
96 unsigned format:1; /* Format=Fixed/Flowed */
97# if 0
98 unsigned disposition:1;
99# endif /* 0 */
100 char *subtype; /* Content subtype */
101 char *description; /* Content-Description */
102 t_param *params; /* List of Content-Type parameters */
103 long offset; /* offset in article of the text of attachment */
104 int line_count; /* # lines in this part */
105 int depth; /* For multipart within multipart */
106 struct part *uue; /* UUencoded section information */
107 struct part *next; /* next part */
109
110
111/*
112 * Used in save.c to build a list of attachments to be displayed
113 *
114 * TODO: move somewhere else?
115 */
116typedef struct partlist {
118 struct partlist *next;
121
122
123/*
124 * RFC822 compliant header with RFC2045 MIME extensions
125 */
127{
128 char *from; /* From: */
129 char *to; /* To: */
130 char *cc; /* Cc: */
131 char *bcc; /* Bcc: */
132 char *date; /* Date: */
133 char *subj; /* Subject: */
134 char *org; /* Organization: */
135 char *replyto; /* Reply-To: */
136 char *newsgroups; /* Newsgroups: */
137 char *messageid; /* Message-ID: */
138 char *references; /* References: */
139 char *distrib; /* Distribution: */
140 char *keywords; /* Keywords: */
141 char *summary; /* Summary: */
142 char *followup; /* Followup-To: */
143 char *ftnto; /* Old X-Comment-To: (Used by FIDO) */
144 char *xface; /* X-Face: */
145 t_bool mime:1; /* Is Mime-Version: defined - TODO: change to version number */
146 t_part *ext; /* Extended Mime header information */
147};
148
149
150/* flags for lineinfo.flags */
151/* Primary colours */
152# define C_HEADER 0x0001
153# define C_BODY 0x0002
154# define C_SIG 0x0004
155# define C_ATTACH 0x0008
156# define C_UUE 0x0010
157
158/* Secondary flags */
159# define C_QUOTE1 0x0020
160# define C_QUOTE2 0x0040
161# define C_QUOTE3 0x0080
162
163# define C_URL 0x0100 /* Contains http|ftp|gopher: */
164# define C_MAIL 0x0200 /* Contains mailto: */
165# define C_NEWS 0x0400 /* Contains news|nntp: */
166# define C_CTRLL 0x0800 /* Contains ^L */
167# define C_VERBATIM 0x1000 /* Verbatim block */
168# ifdef HAVE_COLOR
169# define C_EXTQUOTE 0x2000 /* Quoted text from external sources */
170# endif /* HAVE_COLOR */
171
172
173typedef struct lineinfo
174{
175 long offset; /* Offset of this line */
176 int flags; /* Info about this line */
178
179
180/*
181 * Oddball collection of information about the open article
182 */
183typedef struct openartinfo
184{
185 struct t_header hdr; /* Structural overview of the article */
186 t_bool tex2iso; /* TRUE if TeX encoding present */
187 int cooked_lines; /* # lines in cooked t_lineinfo */
188 FILE *raw; /* the actual data streams */
189 FILE *cooked;
190 t_lineinfo *rawl; /* info about the data streams */
193
194#endif /* !RFC2046_H */
unsigned t_bool
Definition: bool.h:77
struct partlist t_partl
struct lineinfo t_lineinfo
struct openartinfo t_openartinfo
struct part t_part
struct param t_param
int flags
Definition: rfc2046.h:176
long offset
Definition: rfc2046.h:175
t_lineinfo * cookl
Definition: rfc2046.h:191
t_bool tex2iso
Definition: rfc2046.h:186
int cooked_lines
Definition: rfc2046.h:187
FILE * cooked
Definition: rfc2046.h:189
struct t_header hdr
Definition: rfc2046.h:185
FILE * raw
Definition: rfc2046.h:188
t_lineinfo * rawl
Definition: rfc2046.h:190
Definition: rfc2046.h:77
struct param * next
Definition: rfc2046.h:84
char * charset
Definition: rfc2046.h:80
t_bool encoded
Definition: rfc2046.h:82
t_bool enc_fallback
Definition: rfc2046.h:83
int part
Definition: rfc2046.h:81
char * name
Definition: rfc2046.h:78
char * value
Definition: rfc2046.h:79
Definition: rfc2046.h:93
long offset
Definition: rfc2046.h:103
unsigned type
Definition: rfc2046.h:94
char * subtype
Definition: rfc2046.h:100
int line_count
Definition: rfc2046.h:104
struct part * uue
Definition: rfc2046.h:106
int depth
Definition: rfc2046.h:105
char * description
Definition: rfc2046.h:101
unsigned format
Definition: rfc2046.h:96
t_param * params
Definition: rfc2046.h:102
unsigned encoding
Definition: rfc2046.h:95
struct part * next
Definition: rfc2046.h:107
t_part * part
Definition: rfc2046.h:117
int tagged
Definition: rfc2046.h:119
struct partlist * next
Definition: rfc2046.h:118
char * to
Definition: rfc2046.h:129
char * replyto
Definition: rfc2046.h:135
char * subj
Definition: rfc2046.h:133
char * distrib
Definition: rfc2046.h:139
char * ftnto
Definition: rfc2046.h:143
char * org
Definition: rfc2046.h:134
char * followup
Definition: rfc2046.h:142
char * cc
Definition: rfc2046.h:130
char * date
Definition: rfc2046.h:132
char * keywords
Definition: rfc2046.h:140
char * messageid
Definition: rfc2046.h:137
t_part * ext
Definition: rfc2046.h:146
t_bool mime
Definition: rfc2046.h:145
char * bcc
Definition: rfc2046.h:131
char * xface
Definition: rfc2046.h:144
char * references
Definition: rfc2046.h:138
char * from
Definition: rfc2046.h:128
char * summary
Definition: rfc2046.h:141
char * newsgroups
Definition: rfc2046.h:136