Back to index

enigmail  1.4.3
Typedefs | Functions
modmimee2.h File Reference
#include "prtypes.h"
#include "nsError.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct MimeDecoderData
typedef struct MimeEncoderData

Functions

MimeDecoderDataMimeB64DecoderInit (nsresult(*output_fn)(const char *buf, PRInt32 size, void *closure), void *closure)
MimeDecoderDataMimeQPDecoderInit (nsresult(*output_fn)(const char *buf, PRInt32 size, void *closure), void *closure, MimeObject *object=nsnull)
MimeDecoderDataMimeUUDecoderInit (nsresult(*output_fn)(const char *buf, PRInt32 size, void *closure), void *closure)
MimeDecoderDataMimeYDecoderInit (nsresult(*output_fn)(const char *buf, PRInt32 size, void *closure), void *closure)
MimeEncoderDataMimeB64EncoderInit (nsresult(*output_fn)(const char *buf, PRInt32 size, void *closure), void *closure)
MimeEncoderDataMimeQPEncoderInit (nsresult(*output_fn)(const char *buf, PRInt32 size, void *closure), void *closure)
MimeEncoderDataMimeUUEncoderInit (char *filename, nsresult(*output_fn)(const char *buf, PRInt32 size, void *closure), void *closure)
int MimeDecoderWrite (MimeDecoderData *data, const char *buffer, PRInt32 size)
int MimeEncoderWrite (MimeEncoderData *data, const char *buffer, PRInt32 size)
int MimeDecoderDestroy (MimeDecoderData *data, EMBool abort_p)
int MimeEncoderDestroy (MimeEncoderData *data, EMBool abort_p)

Typedef Documentation

typedef struct MimeDecoderData

Definition at line 52 of file modmimee2.h.

typedef struct MimeEncoderData

Definition at line 53 of file modmimee2.h.


Function Documentation

MimeDecoderData* MimeB64DecoderInit ( nsresult(*)(const char *buf, PRInt32 size, void *closure)  output_fn,
void *  closure 
)
MimeEncoderData* MimeB64EncoderInit ( nsresult(*)(const char *buf, PRInt32 size, void *closure)  output_fn,
void *  closure 
)
int MimeDecoderDestroy ( MimeDecoderData data,
EMBool  abort_p 
)

Definition at line 763 of file mimeenc2.cpp.

{
  int status = 0;
  /* Flush out the last few buffered characters. */
  if (!abort_p &&
    data->token_size > 0 &&
    data->token[0] != '=')
  {
    if (data->encoding == mime_Base64)
    while ((unsigned int)data->token_size < sizeof (data->token))
      data->token [data->token_size++] = '=';

    status = data->write_buffer (data->token, data->token_size,
                   data->closure);
  }

  if (data->line_buffer)
    PR_Free(data->line_buffer);
  PR_Free (data);
  return status;
}

Here is the caller graph for this function:

int MimeDecoderWrite ( MimeDecoderData data,
const char *  buffer,
PRInt32  size 
)

Definition at line 835 of file mimeenc2.cpp.

{
  NS_ASSERTION(data, "1.1 <rhp@netscape.com> 19 Mar 1999 12:00");
  if (!data) return -1;
  switch(data->encoding)
  {
  case mime_Base64:
    return mime_decode_base64_buffer (data, buffer, size);
  case mime_QuotedPrintable:
    return mime_decode_qp_buffer (data, buffer, size);
  case mime_uuencode:
    return mime_decode_uue_buffer (data, buffer, size);
  case mime_yencode:
    return mime_decode_yenc_buffer (data, buffer, size);
  default:
    NS_ASSERTION(0, "1.1 <rhp@netscape.com> 19 Mar 1999 12:00");
    return -1;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int MimeEncoderDestroy ( MimeEncoderData data,
EMBool  abort_p 
)

Definition at line 1248 of file mimeenc2.cpp.

{
  int status = 0;

  /* If we're uuencoding, we have our own finishing routine. */
  if (data->encoding == mime_uuencode)
   mime_uuencode_finish(data);

  /* Since Base64 (and uuencode) output needs to do some buffering to get
   a multiple of three bytes on each block, there may be a few bytes
   left in the buffer after the last block has been written.  We need to
   flush those out now.
   */

  NS_ASSERTION (data->encoding == mime_Base64 ||
       data->in_buffer_count == 0, "1.1 <rhp@netscape.com> 19 Mar 1999 12:00");

  if (!abort_p &&
    data->in_buffer_count > 0)
  {
    char buf2 [6];
    char *buf = buf2 + 2;
    char *out = buf;
    int j;
    /* fixed bug 55998, 61302, 61866
     * type casting to PRUint32 before shifting
     */
    PRUint32 n = ((PRUint32) data->in_buffer[0]) << 16;
    if (data->in_buffer_count > 1)
    n = n | (((PRUint32) data->in_buffer[1]) << 8);

    buf2[0] = '\r';
    buf2[1] = '\n';

    for (j = 18; j >= 0; j -= 6)
    {
      unsigned int k = (n >> j) & 0x3F;
      if (k < 26)       *out++ = k      + 'A';
      else if (k < 52)  *out++ = k - 26 + 'a';
      else if (k < 62)  *out++ = k - 52 + '0';
      else if (k == 62) *out++ = '+';
      else if (k == 63) *out++ = '/';
      else abort ();
    }

    /* Pad with equal-signs. */
    if (data->in_buffer_count == 1)
    buf[2] = '=';
    buf[3] = '=';

    if (data->current_column >= 72)
    status = data->write_buffer (buf2, 6, data->closure);
    else
    status = data->write_buffer (buf,  4, data->closure);
  }

  PR_FREEIF(data->filename);
  PR_Free (data);
  return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int MimeEncoderWrite ( MimeEncoderData data,
const char *  buffer,
PRInt32  size 
)

Definition at line 1352 of file mimeenc2.cpp.

{
  NS_ASSERTION(data, "1.1 <rhp@netscape.com> 19 Mar 1999 12:00");
  if (!data) return -1;
  switch(data->encoding)
  {
  case mime_Base64:
    return mime_encode_base64_buffer (data, buffer, size);
  case mime_QuotedPrintable:
    return mime_encode_qp_buffer (data, buffer, size);
  case mime_uuencode:
    return mime_uuencode_buffer(data, buffer, size);
  default:
    NS_ASSERTION(0, "1.1 <rhp@netscape.com> 19 Mar 1999 12:00");
    return -1;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

MimeDecoderData* MimeQPDecoderInit ( nsresult(*)(const char *buf, PRInt32 size, void *closure)  output_fn,
void *  closure,
MimeObject *  object = nsnull 
)
MimeEncoderData* MimeQPEncoderInit ( nsresult(*)(const char *buf, PRInt32 size, void *closure)  output_fn,
void *  closure 
)
MimeDecoderData* MimeUUDecoderInit ( nsresult(*)(const char *buf, PRInt32 size, void *closure)  output_fn,
void *  closure 
)
MimeEncoderData* MimeUUEncoderInit ( char *  filename,
nsresult(*)(const char *buf, PRInt32 size, void *closure)  output_fn,
void *  closure 
)
MimeDecoderData* MimeYDecoderInit ( nsresult(*)(const char *buf, PRInt32 size, void *closure)  output_fn,
void *  closure 
)