+ /*
+ * Empty data area, only headers present
+ */
+ SILC_LOG_DEBUG(("Allocating MIME message context"));
+ mime = silc_mime_alloc();
+ if (!mime)
+ goto err;
+ SILC_LOG_DEBUG(("Adding Content-Transfer-Encoding: binary"));
+ silc_mime_add_field(mime, "Content-Transfer-Encoding", "binary");
+ SILC_LOG_DEBUG(("No data area, only header present"));
+ SILC_LOG_DEBUG(("Encoding MIME context"));
+ enc = silc_mime_encode(mime, &enc_len);
+ if (!enc)
+ goto err;
+ SILC_LOG_DEBUG(("Encoded MIME message: \n%s", enc));
+ silc_mime_free(mime);
+ SILC_LOG_DEBUG(("Decoding MIME message"));
+ mime = silc_mime_decode(NULL, enc, enc_len);
+ if (!mime)
+ goto err;
+ SILC_LOG_DEBUG(("Re-encoding MIME context"));
+ silc_free(enc);
+ enc = silc_mime_encode(mime, &enc_len);
+ if (!enc)
+ goto err;
+ SILC_LOG_HEXDUMP(("Re-encoded MIME message:"), enc, enc_len);
+ silc_free(enc);
+ silc_mime_free(mime);
+
+ /*
+ * Multipart test, with nesting
+ */