"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.6.0/include/rfc2046.h" (1 Dec 2020, 5701 Bytes) of package /linux/misc/tin-2.6.0.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 last Fossies "Diffs" side-by-side code changes report: 2.4.4_vs_2.4.5.

    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-2021 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  */
   76 typedef struct param
   77 {
   78     char *name;
   79     char *value;
   80     char *charset;
   81     int part;
   82     t_bool encoded;
   83     t_bool enc_fallback;
   84     struct param *next;
   85 } t_param;
   86 
   87 
   88 /*
   89  * Describes the properties of an article or article attachment
   90  * We re-use this to describe uuencoded sections
   91  */
   92 typedef 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 */
  108 } t_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  */
  116 typedef struct partlist {
  117     t_part *part;
  118     struct partlist *next;
  119     int tagged;
  120 } t_partl;
  121 
  122 
  123 /*
  124  * RFC822 compliant header with RFC2045 MIME extensions
  125  */
  126 struct t_header
  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 
  173 typedef struct lineinfo
  174 {
  175     long offset;            /* Offset of this line */
  176     int flags;              /* Info about this line */
  177 } t_lineinfo;
  178 
  179 
  180 /*
  181  * Oddball collection of information about the open article
  182  */
  183 typedef 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 */
  191     t_lineinfo *cookl;
  192 } t_openartinfo;
  193 
  194 #endif /* !RFC2046_H */