Back to index

courier  0.68.2
Classes | Functions
encode.h File Reference
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
#include <time.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  libmail_encode_info

Functions

const char * libmail_encode_autodetect_fp (FILE *, int, int *)
const char * libmail_encode_autodetect_fpoff (FILE *, int, off_t, off_t, int *)
const char * libmail_encode_autodetect_buf (const char *, int)
void libmail_encode_start (struct libmail_encode_info *info, const char *transfer_encoding, int(*callback_func)(const char *, size_t, void *), void *callback_arg)
int libmail_encode (struct libmail_encode_info *info, const char *ptr, size_t cnt)
int libmail_encode_end (struct libmail_encode_info *info)

Function Documentation

int libmail_encode ( struct libmail_encode_info info,
const char *  ptr,
size_t  cnt 
)

Definition at line 45 of file encode.c.

{
       return ((*info->encoding_func)(info, ptr, cnt));
}

Here is the caller graph for this function:

const char* libmail_encode_autodetect_buf ( const char *  ,
int   
)

Definition at line 134 of file encodeautodetect.c.

{
       return libmail_encode_autodetect(use7bit, &read_string, &str,
                                    NULL);
}

Here is the call graph for this function:

const char* libmail_encode_autodetect_fp ( FILE *  ,
int  ,
int *   
)

Definition at line 98 of file encodeautodetect.c.

{
       return libmail_encode_autodetect_fpoff(fp, use7bit, 0, -1,
                                          binaryflag);
}

Here is the call graph for this function:

const char* libmail_encode_autodetect_fpoff ( FILE *  ,
int  ,
off_t  ,
off_t  ,
int *   
)

Definition at line 105 of file encodeautodetect.c.

{
struct file_info fi;
off_t orig_pos = ftell(fp);
off_t pos = orig_pos;
const char *rc;

       if (start_pos >= 0)
       {
              if (fseek(fp, start_pos, SEEK_SET) == (off_t)-1)
                     return NULL;
              else
                     pos = start_pos;
       }

       fi.fp = fp;
       fi.pos = pos;
       fi.end = end_pos;

       rc = libmail_encode_autodetect(use7bit, &read_file, &fi,
                                   binaryflag);
  
       if (fseek(fp, orig_pos, SEEK_SET) == (off_t)-1)
              return NULL;
       return rc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int libmail_encode_end ( struct libmail_encode_info info)

Definition at line 52 of file encode.c.

{
       int rc=(*info->encoding_func)(info, NULL, 0);

       if (rc == 0 && info->output_buf_cnt > 0)
       {
              rc= (*info->callback_func)(info->output_buffer,
                                      info->output_buf_cnt,
                                      info->callback_arg);
              info->output_buf_cnt=0;
       }

       return rc;
}

Here is the caller graph for this function:

void libmail_encode_start ( struct libmail_encode_info info,
const char *  transfer_encoding,
int(*)(const char *, size_t, void *)  callback_func,
void *  callback_arg 
)

Definition at line 19 of file encode.c.

{
       info->output_buf_cnt=0;
       info->input_buf_cnt=0;

       switch (*transfer_encoding) {
       case 'q':
       case 'Q':
              info->encoding_func=quoted_printable;
              info->input_buffer[0]=0; /* Recycle for qp encoding */
              break;
       case 'b':
       case 'B':
              info->encoding_func=base64;
              break;
       default:
              info->encoding_func=eflush;
              break;
       }
       info->callback_func=callback_func;
       info->callback_arg=callback_arg;
}

Here is the call graph for this function:

Here is the caller graph for this function: