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

rfc2046.c File Reference
#include "tin.h"
Include dependency graph for rfc2046.c:

Go to the source code of this file.

Macros

#define XVAL(c)   (xtbl[(unsigned int) (c)])
 
#define IS_XDIGIT(c)   (((c) >= '0' && (c) <= '9') || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
 
#define PARAM_SEP   "; \n"
 
#define CT_DEFPARMS   "charset=US-ASCII"
 
#define ATTRIBUTE_DELIMS   "()<>@,;:\\\"/[]?="
 
#define M_SEARCHING   1 /* Looking for boundary */
 
#define M_HDR   2 /* In MIME headers */
 
#define M_BODY   3 /* In MIME body */
 
#define TIN_EOF   0xf00 /* Used internally for error recovery */
 

Functions

static char * get_charset (char *value)
 
static char * get_quoted_string (char *source, char **dest)
 
static char * get_token (const char *source)
 
static char * strip_charset (char **value)
 
static char * skip_equal_sign (char *source)
 
static char * skip_space (char *source)
 
static int boundary_cmp (const char *line, const char *boundary)
 
static int count_lines (char *line)
 
static int parse_multipart_article (FILE *infile, t_openartinfo *artinfo, t_part *part, int depth, t_bool show_progress_meter)
 
static int parse_normal_article (FILE *in, t_openartinfo *artinfo, t_bool show_progress_meter)
 
static int parse_rfc2045_article (FILE *infile, int line_count, t_openartinfo *artinfo, t_bool show_progress_meter)
 
static unsigned int parse_content_encoding (char *encoding)
 
static void decode_value (const char *charset, t_param *part)
 
static void parse_content_type (char *type, t_part *content)
 
static void parse_content_disposition (char *disp, t_part *part)
 
static void parse_params (char *params, t_part *content)
 
static void progress (int line_count)
 
static void remove_cwsp (char *source)
 
int content_type (char *type)
 
static int boundary_check (const char *line, t_part *part)
 
t_paramnew_params (void)
 
void free_list (t_param *list)
 
const char * get_param (t_param *list, const char *name)
 
t_partnew_part (t_part *part)
 
void free_parts (t_part *ptr)
 
void free_and_init_header (struct t_header *hdr)
 
char * parse_header (char *buf, const char *pat, t_bool decode, t_bool structured, t_bool keep_tab)
 
int parse_rfc822_headers (struct t_header *hdr, FILE *from, FILE *to)
 
void unfold_header (char *line)
 
FILE * open_art_fp (struct t_group *group, t_artnum art)
 
int art_open (t_bool wrap_lines, struct t_article *art, struct t_group *group, t_openartinfo *artinfo, t_bool show_progress_meter, const char *pmesg)
 
void art_close (t_openartinfo *artinfo)
 

Variables

static int art_lines = 0
 
static const char * progress_mesg = NULL
 
static const char xtbl []
 

Macro Definition Documentation

◆ ATTRIBUTE_DELIMS

#define ATTRIBUTE_DELIMS   "()<>@,;:\\\"/[]?="

Definition at line 226 of file rfc2046.c.

◆ CT_DEFPARMS

#define CT_DEFPARMS   "charset=US-ASCII"

Definition at line 95 of file rfc2046.c.

◆ IS_XDIGIT

#define IS_XDIGIT (   c)    (((c) >= '0' && (c) <= '9') || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))

Definition at line 92 of file rfc2046.c.

◆ M_BODY

#define M_BODY   3 /* In MIME body */

Definition at line 1159 of file rfc2046.c.

◆ M_HDR

#define M_HDR   2 /* In MIME headers */

Definition at line 1158 of file rfc2046.c.

◆ M_SEARCHING

#define M_SEARCHING   1 /* Looking for boundary */

Definition at line 1157 of file rfc2046.c.

◆ PARAM_SEP

#define PARAM_SEP   "; \n"

Definition at line 93 of file rfc2046.c.

◆ TIN_EOF

#define TIN_EOF   0xf00 /* Used internally for error recovery */

Definition at line 1161 of file rfc2046.c.

◆ XVAL

#define XVAL (   c)    (xtbl[(unsigned int) (c)])

Definition at line 90 of file rfc2046.c.

Function Documentation

◆ art_close()

◆ art_open()

◆ boundary_check()

static int boundary_check ( const char *  line,
t_part part 
)
static

Definition at line 207 of file rfc2046.c.

References BOUND_NONE, boundary_cmp(), get_param(), part::next, and part::params.

Referenced by parse_multipart_article().

◆ boundary_cmp()

static int boundary_cmp ( const char *  line,
const char *  boundary 
)
static

Definition at line 138 of file rfc2046.c.

References BOUND_END, BOUND_NONE, BOUND_START, and my_strdup().

Referenced by boundary_check(), and parse_multipart_article().

◆ content_type()

int content_type ( char *  type)

Definition at line 115 of file rfc2046.c.

References content_types, and strcasecmp().

Referenced by _lookup_mimetype(), match_content_type(), and parse_content_type().

◆ count_lines()

static int count_lines ( char *  line)
static

Definition at line 1123 of file rfc2046.c.

Referenced by parse_multipart_article().

◆ decode_value()

static void decode_value ( const char *  charset,
t_param part 
)
static

Definition at line 374 of file rfc2046.c.

References FALSE, FreeAndNull, IS_XDIGIT, t_config::mm_local_charset, process_charsets(), tinrc, and XVAL.

Referenced by get_param().

◆ free_and_init_header()

◆ free_list()

void free_list ( t_param list)

Definition at line 549 of file rfc2046.c.

References param::charset, FreeIfNeeded, param::name, param::next, and param::value.

Referenced by free_parts(), and new_uue().

◆ free_parts()

void free_parts ( t_part ptr)

◆ get_charset()

static char * get_charset ( char *  value)
static

Definition at line 347 of file rfc2046.c.

References my_strdup().

Referenced by parse_params().

◆ get_param()

◆ get_quoted_string()

static char * get_quoted_string ( char *  source,
char **  dest 
)
static

Definition at line 313 of file rfc2046.c.

References FALSE, my_malloc, my_realloc, and TRUE.

Referenced by parse_params().

◆ get_token()

static char * get_token ( const char *  source)
static

Definition at line 298 of file rfc2046.c.

References ATTRIBUTE_DELIMS, isascii, my_realloc, and my_strdup().

Referenced by parse_params().

◆ new_params()

t_param* new_params ( void  )

◆ new_part()

◆ open_art_fp()

◆ parse_content_disposition()

static void parse_content_disposition ( char *  disp,
t_part part 
)
static

Definition at line 770 of file rfc2046.c.

References PARAM_SEP, parse_params(), and remove_cwsp().

Referenced by parse_multipart_article(), and parse_rfc822_headers().

◆ parse_content_encoding()

static unsigned int parse_content_encoding ( char *  encoding)
static

◆ parse_content_type()

◆ parse_header()

◆ parse_multipart_article()

◆ parse_normal_article()

static int parse_normal_article ( FILE *  in,
t_openartinfo artinfo,
t_bool  show_progress_meter 
)
static

◆ parse_params()

◆ parse_rfc2045_article()

◆ parse_rfc822_headers()

◆ progress()

static void progress ( int  line_count)
static

Definition at line 102 of file rfc2046.c.

References art_lines, MODULO_COUNT_NUM, progress_mesg, and show_progress().

Referenced by parse_multipart_article(), and parse_normal_article().

◆ remove_cwsp()

static void remove_cwsp ( char *  source)
static

Definition at line 242 of file rfc2046.c.

References bool_not, and FALSE.

Referenced by parse_content_disposition(), parse_content_encoding(), and parse_content_type().

◆ skip_equal_sign()

static char * skip_equal_sign ( char *  source)
static

Definition at line 428 of file rfc2046.c.

References skip_space().

Referenced by parse_params().

◆ skip_space()

static char * skip_space ( char *  source)
static

Definition at line 229 of file rfc2046.c.

Referenced by parse_params(), and skip_equal_sign().

◆ strip_charset()

static char * strip_charset ( char **  value)
static

Definition at line 409 of file rfc2046.c.

References my_realloc, and my_strdup().

Referenced by parse_params().

◆ unfold_header()

Variable Documentation

◆ art_lines

int art_lines = 0
static

Definition at line 75 of file rfc2046.c.

Referenced by parse_rfc2045_article(), and progress().

◆ progress_mesg

const char* progress_mesg = NULL
static

Definition at line 76 of file rfc2046.c.

Referenced by art_open(), feed_article(), and progress().

◆ xtbl

const char xtbl[]
static
Initial value:
= {
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1, -1,-1,-1,-1,
-1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1
}

Definition at line 78 of file rfc2046.c.