"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.6.3/include/rfc2046.h" (23 Dec 2023, 5830 Bytes) of package /linux/misc/tin-2.6.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "rfc2046.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.6.2_vs_2.6.3.

    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   : 2023-10-25
    7  *  Notes     : RFC 2046 MIME article definitions
    8  *
    9  * Copyright (c) 2000-2024 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 #   define ENCODING_UNKNOWN     6
   62 
   63 #   define DISP_INLINE          0
   64 #   define DISP_ATTACH          1
   65 
   66 #   define BOUND_NONE       0
   67 #   define BOUND_START      1
   68 #   define BOUND_END        2
   69 
   70 #   define FORMAT_FIXED     0
   71 #   define FORMAT_FLOWED    1
   72 
   73 /*
   74  * Linked list of parameter/value pairs
   75  * Used for params attached to a content line
   76  */
   77 typedef struct param
   78 {
   79     char *name;
   80     char *value;
   81     char *charset;
   82     int part;
   83     t_bool encoded;
   84     t_bool enc_fallback;
   85     struct param *next;
   86 } t_param;
   87 
   88 
   89 /*
   90  * Describes the properties of an article or article attachment
   91  * We reuse this to describe uuencoded sections
   92  */
   93 typedef struct part
   94 {
   95     unsigned type:3;        /* Content major type */
   96     unsigned encoding:3;    /* Transfer encoding */
   97     unsigned format:1;      /* Format=Fixed/Flowed */
   98 #   if 0
   99     unsigned disposition:1;
  100 #   endif /* 0 */
  101     char *subtype;          /* Content subtype */
  102     char *description;      /* Content-Description */
  103     char *language;         /* Content-Language RFC 3282 */
  104     t_param *params;        /* List of Content-Type parameters */
  105     long offset;            /* offset in article of the text of attachment */
  106     unsigned long bytes;    /* part size in bytes */
  107     int line_count;         /* # lines in this part */
  108     int depth;              /* For multipart within multipart */
  109     struct part *uue;       /* UUencoded section information */
  110     struct part *next;      /* next part */
  111 } t_part;
  112 
  113 
  114 /*
  115  * Used in save.c to build a list of attachments to be displayed
  116  *
  117  * TODO: move somewhere else?
  118  */
  119 typedef struct partlist {
  120     t_part *part;
  121     struct partlist *next;
  122     int tagged;
  123 } t_partl;
  124 
  125 
  126 /*
  127  * RFC 822 compliant header with RFC 2045 MIME extensions
  128  */
  129 struct t_header
  130 {
  131     char *from;             /* From: */
  132     char *to;               /* To: */
  133     char *cc;               /* Cc: */
  134     char *bcc;              /* Bcc: */
  135     char *date;             /* Date: */
  136     char *subj;             /* Subject: */
  137     char *org;              /* Organization: */
  138     char *replyto;          /* Reply-To: */
  139     char *newsgroups;       /* Newsgroups: */
  140     char *messageid;        /* Message-ID: */
  141     char *references;       /* References: */
  142     char *distrib;          /* Distribution: */
  143     char *keywords;         /* Keywords: */
  144     char *summary;          /* Summary: */
  145     char *followup;         /* Followup-To: */
  146     char *ftnto;            /* Old X-Comment-To: (Used by FIDO) */
  147     char *xface;            /* X-Face: */
  148     t_bool mime:1;          /* Is Mime-Version: defined - TODO: change to version number */
  149     t_part *ext;            /* Extended Mime header information */
  150 };
  151 
  152 
  153 /* flags for lineinfo.flags */
  154 /* Primary colours */
  155 #   define C_HEADER     0x0001
  156 #   define C_BODY       0x0002
  157 #   define C_SIG        0x0004
  158 #   define C_ATTACH     0x0008
  159 #   define C_UUE        0x0010
  160 
  161 /* Secondary flags */
  162 #   define C_QUOTE1 0x0020
  163 #   define C_QUOTE2 0x0040
  164 #   define C_QUOTE3 0x0080
  165 
  166 #   define C_URL            0x0100  /* Contains http|ftp|gopher: */
  167 #   define C_MAIL           0x0200  /* Contains mailto: */
  168 #   define C_NEWS           0x0400  /* Contains news|nntp: */
  169 #   define C_CTRLL          0x0800  /* Contains ^L */
  170 #   define C_VERBATIM       0x1000  /* Verbatim block */
  171 #   ifdef HAVE_COLOR
  172 #       define C_EXTQUOTE   0x2000  /* Quoted text from external sources */
  173 #   endif /* HAVE_COLOR */
  174 
  175 
  176 typedef struct lineinfo
  177 {
  178     long offset;            /* Offset of this line */
  179     int flags;              /* Info about this line */
  180 } t_lineinfo;
  181 
  182 
  183 /*
  184  * Oddball collection of information about the open article
  185  */
  186 typedef struct openartinfo
  187 {
  188     struct t_header hdr;    /* Structural overview of the article */
  189     t_bool tex2iso;         /* TRUE if TeX encoding present */
  190     int cooked_lines;       /* # lines in cooked t_lineinfo */
  191     FILE *raw;              /* the actual data streams */
  192     FILE *cooked;
  193     t_lineinfo *rawl;       /* info about the data streams */
  194     t_lineinfo *cookl;
  195 } t_openartinfo;
  196 
  197 #endif /* !RFC2046_H */