"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.1/include/rfc2046.h" (12 Oct 2016, 5599 Bytes) of archive /linux/misc/tin-2.4.1.tar.gz:


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.4.0_vs_2.4.1.

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