Re: Streaming MIME parser

DINH Viet Hoa <[email protected]>
Newsgroups gmane.mail.libetpan.user
Message-ID <etPan.42688d7a.452fecb9.5198@utopia>
suresh! wrote :

> Alternatively, I can store the entire message on the
> disk and then feed the parser. RFC headers does not
> pose a problem of being in memory. But the body and
> attachments do. If the MIME parser gives me the
> position of the start and end of the body and
> attachments then I can directly goto that position in
> the file and start reading instead of having to store
> them in memory. (Ofcourse I would need more events
> from the MIME Parser as to whether it is an attachment
> beginning or a multipart beginning etc)

You can also map the file to memory :

see mmap() (2)

that will let you read the file content as if its content was in memory.
You can find an example of use in smtpsend.c in libetpan/tests/

-- 
DINH V. Hoa,

"Pétage de plomb, excès de bière, de coke... probablement..."
     -- Emmanuel Delahaye
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBCaI4C7w+pfAWHa3MRAnWJAJ4nBBlOvW1elaFbfCHPzhU2ho1vuwCfX/IG
fFXRN2K8mbhzbk2//gHHpNY=
=YiyY
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.