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)  

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

Go to the source code of this file.

Macros

#define isreturn(c)   ((c) == '\r' || ((c) == '\n'))
 
#define my_isspace(c)   ((c) == '\t' || (c) == '\n' || (c) == '\v' || (c) == '\f' || (c) == '\r' || (c) == ' ')
 
#define isbetween(c, s)   (my_isspace(c) || ((s) && ((c) == '(' || (c) == ')' || (c) == '"')))
 
#define NOT_RANKED   255
 

Enumerations

enum  { MIME_BOUNDARY_SIZE = sizeof(MIME_BOUNDARY_PREFIX) + sizeof(MIME_BOUNDARY_DEFAULT_PART) - 1 }
 

Functions

static FILE * compose_message_rfc822 (FILE *articlefp, t_bool *is_8bit)
 
static FILE * compose_multipart_mixed (FILE *textfp, FILE *articlefp)
 
static int do_b_encode (char *w, char *b, size_t max_ewsize, t_bool isstruct_head)
 
static int sizeofnextword (char *w)
 
static int which_encoding (char *w)
 
static t_bool contains_8bit_characters (FILE *fp)
 
static t_bool contains_nonprintables (char *w, t_bool isstruct_head)
 
static t_bool contains_string (FILE *fp, const char *str)
 
static t_bool rfc1522_do_encode (char *what, char **where, const char *charset, t_bool break_long_line)
 
static t_bool split_mail (const char *filename, FILE **headerfp, FILE **textfp)
 
static unsigned hex2bin (int x)
 
static void build_base64_rank_table (void)
 
static void do_rfc15211522_encode (FILE *f, constext *mime_encoding, struct t_group *group, t_bool allow_8bit_header, t_bool ismail, t_bool contains_headers)
 
static void generate_mime_boundary (char *boundary, FILE *f, FILE *g)
 
static void generate_random_mime_boundary (char *boundary, size_t len)
 
static void str2b64 (const char *from, char *to)
 
int mmdecode (const char *what, int encoding, int delimiter, char *where)
 
char * rfc1522_decode (const char *s)
 
char * rfc1522_encode (char *s, const char *charset, t_bool ismail)
 
void rfc15211522_encode (const char *filename, constext *mime_encoding, struct t_group *group, t_bool allow_8bit_header, t_bool ismail)
 
void compose_mail_text_plain (const char *filename, struct t_group *group)
 
void compose_mail_mime_forwarded (const char *filename, FILE *articlefp, t_bool include_text, struct t_group *group)
 

Variables

const char base64_alphabet [64]
 
static unsigned char base64_rank [256]
 
static int base64_rank_table_built
 
static const char MIME_BOUNDARY_PREFIX [] = "=_tin=_"
 
static const char MIME_BOUNDARY_DEFAULT_PART [] = "====____====____====____"
 

Macro Definition Documentation

◆ isbetween

#define isbetween (   c,
 
)    (my_isspace(c) || ((s) && ((c) == '(' || (c) == ')' || (c) == '"')))

Definition at line 64 of file rfc2047.c.

◆ isreturn

#define isreturn (   c)    ((c) == '\r' || ((c) == '\n'))

Definition at line 46 of file rfc2047.c.

◆ my_isspace

#define my_isspace (   c)    ((c) == '\t' || (c) == '\n' || (c) == '\v' || (c) == '\f' || (c) == '\r' || (c) == ' ')

Definition at line 63 of file rfc2047.c.

◆ NOT_RANKED

#define NOT_RANKED   255

Definition at line 66 of file rfc2047.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MIME_BOUNDARY_SIZE 

Definition at line 87 of file rfc2047.c.

Function Documentation

◆ build_base64_rank_table()

static void build_base64_rank_table ( void  )
static

Definition at line 113 of file rfc2047.c.

References base64_alphabet, base64_rank, base64_rank_table_built, NOT_RANKED, and TRUE.

Referenced by mmdecode().

◆ compose_mail_mime_forwarded()

◆ compose_mail_text_plain()

void compose_mail_text_plain ( const char *  filename,
struct t_group group 
)

◆ compose_message_rfc822()

static FILE * compose_message_rfc822 ( FILE *  articlefp,
t_bool is_8bit 
)
static

◆ compose_multipart_mixed()

static FILE * compose_multipart_mixed ( FILE *  textfp,
FILE *  articlefp 
)
static

◆ contains_8bit_characters()

static t_bool contains_8bit_characters ( FILE *  fp)
static

Definition at line 1354 of file rfc2047.c.

References FALSE, is_EIGHT_BIT, tin_fgets(), and TRUE.

Referenced by compose_message_rfc822(), and compose_multipart_mixed().

◆ contains_nonprintables()

static t_bool contains_nonprintables ( char *  w,
t_bool  isstruct_head 
)
static

Definition at line 481 of file rfc2047.c.

References FALSE, is_EIGHT_BIT, isbetween, strstr(), and TRUE.

Referenced by rfc1522_do_encode().

◆ contains_string()

static t_bool contains_string ( FILE *  fp,
const char *  str 
)
static

Definition at line 1375 of file rfc2047.c.

References FALSE, strstr(), tin_fgets(), and TRUE.

Referenced by generate_mime_boundary().

◆ do_b_encode()

static int do_b_encode ( char *  w,
char *  b,
size_t  max_ewsize,
t_bool  isstruct_head 
)
static

Definition at line 388 of file rfc2047.c.

References FALSE, is_EIGHT_BIT, isbetween, str2b64(), and TRUE.

Referenced by rfc1522_do_encode().

◆ do_rfc15211522_encode()

static void do_rfc15211522_encode ( FILE *  f,
constext mime_encoding,
struct t_group group,
t_bool  allow_8bit_header,
t_bool  ismail,
t_bool  contains_headers 
)
static

◆ generate_mime_boundary()

static void generate_mime_boundary ( char *  boundary,
FILE *  f,
FILE *  g 
)
static

◆ generate_random_mime_boundary()

static void generate_random_mime_boundary ( char *  boundary,
size_t  len 
)
static

Definition at line 1063 of file rfc2047.c.

References base64_alphabet.

Referenced by generate_mime_boundary().

◆ hex2bin()

static unsigned hex2bin ( int  x)
static

Definition at line 129 of file rfc2047.c.

Referenced by mmdecode().

◆ mmdecode()

int mmdecode ( const char *  what,
int  encoding,
int  delimiter,
char *  where 
)

◆ rfc15211522_encode()

void rfc15211522_encode ( const char *  filename,
constext mime_encoding,
struct t_group group,
t_bool  allow_8bit_header,
t_bool  ismail 
)

Definition at line 1038 of file rfc2047.c.

References do_rfc15211522_encode(), and TRUE.

Referenced by compose_mail_text_plain(), and submit_news_file().

◆ rfc1522_decode()

◆ rfc1522_do_encode()

static t_bool rfc1522_do_encode ( char *  what,
char **  where,
const char *  charset,
t_bool  break_long_line 
)
static

◆ rfc1522_encode()

char* rfc1522_encode ( char *  s,
const char *  charset,
t_bool  ismail 
)

◆ sizeofnextword()

static int sizeofnextword ( char *  w)
static

Definition at line 516 of file rfc2047.c.

Referenced by rfc1522_do_encode().

◆ split_mail()

static t_bool split_mail ( const char *  filename,
FILE **  headerfp,
FILE **  textfp 
)
static

Definition at line 1131 of file rfc2047.c.

References FALSE, tin_fgets(), tmpfile(), and TRUE.

Referenced by compose_mail_mime_forwarded().

◆ str2b64()

static void str2b64 ( const char *  from,
char *  to 
)
static

Definition at line 362 of file rfc2047.c.

References base64_alphabet.

Referenced by do_b_encode().

◆ which_encoding()

static int which_encoding ( char *  w)
static

Definition at line 450 of file rfc2047.c.

References is_EIGHT_BIT.

Referenced by rfc1522_do_encode().

Variable Documentation

◆ base64_alphabet

const char base64_alphabet[64]
Initial value:
=
{
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'}

Definition at line 73 of file rfc2047.c.

Referenced by build_base64_rank_table(), generate_random_mime_boundary(), rfc1521_encode(), and str2b64().

◆ base64_rank

unsigned char base64_rank[256]
static

Definition at line 80 of file rfc2047.c.

Referenced by build_base64_rank_table(), and mmdecode().

◆ base64_rank_table_built

int base64_rank_table_built
static

Definition at line 81 of file rfc2047.c.

Referenced by build_base64_rank_table().

◆ MIME_BOUNDARY_DEFAULT_PART

const char MIME_BOUNDARY_DEFAULT_PART[] = "====____====____====____"
static

Definition at line 85 of file rfc2047.c.

Referenced by generate_mime_boundary().

◆ MIME_BOUNDARY_PREFIX

const char MIME_BOUNDARY_PREFIX[] = "=_tin=_"
static

Definition at line 84 of file rfc2047.c.

Referenced by generate_mime_boundary().