File:  [ELWIX - Embedded LightWeight unIX -] / libaitwww / inc / mime.h
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Thu May 30 09:25:35 2013 UTC (10 years, 11 months ago) by misho
Branches: MAIN
CVS tags: www3_4, www3_3, www3_2, www3_1, WWW3_3, WWW3_2, WWW3_1, WWW3_0, HEAD
version 3.0

/*************************************************************************
* (C) 2012 AITNET ltd - Sofia/Bulgaria - <misho@aitnet.org>
*  by Michael Pounov <misho@elwix.org>
*
* $Author: misho $
* $Id: mime.h,v 1.2 2013/05/30 09:25:35 misho Exp $
*
**************************************************************************
The ELWIX and AITNET software is distributed under the following
terms:

All of the documentation and software included in the ELWIX and AITNET
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>

Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
	by Michael Pounov <misho@elwix.org>.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
   must display the following acknowledgement:
This product includes software developed by Michael Pounov <misho@elwix.org>
ELWIX - Embedded LightWeight unIX and its contributors.
4. Neither the name of AITNET nor the names of its contributors
   may be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY AITNET AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#ifndef __MIME_H
#define __MIME_H


/*
 * mime_parseMultiPart() - Parse multi part MIME message
 *
 * @str = String
 * @len = String length
 * @bd = Boundary tag
 * @end = End of parsed part
 * return: NULL error or !=NULL allocated MIME session
 */
mime_t *mime_parseMultiPart(const char *str, size_t len, const char *bd, const char **end);
/*
 * mime_close() - Close MIME session and free all resources
 *
 * @mime = Inited mime session
 * return: none
 */
void mime_close(mime_t ** __restrict mime);
/*
 * mime_getValue() - Get value from MIME header
 *
 * @m = Mime part
 * @name = Header name
 * return: NULL not found or !=NULL value
 */
const char *mime_getValue(struct tagMIME * __restrict m, const char *name);
/*
 * mime_readPart() Read and parse MIME part
 *
 * @m = Mime part
 * @str = String
 * @len = String length
 * return: -1 error or 0 ok
 */
int mime_readPart(struct tagMIME * __restrict m, const char *str, size_t len);
/*
 * mime_parseHeader() - Parse MIME header pairs
 *
 * @m = Mime part
 * @str = String
 * @len = String length
 * @end = End of parsed part
 * return: -1 error or 0 ok
 */
int mime_parseHeader(struct tagMIME * __restrict m, const char *str, 
		size_t len, const char **end);
/*
 * mime_calcRawSize() - Calculate estimated memory for data from parsed MIME part
 *
 * @m = Mime part
 * return: -1 error or >-1 data size in mime part
 */
int mime_calcRawSize(struct tagMIME * __restrict m);
/*
 * mime_getRawData() - Get ready parsed data from MIME part body
 *
 * @m = Mime part
 * @str = output data buffer
 * @len = output data buffer length
 * return: -1 error or >-1 data length in output buffer
 */
int mime_getRawData(struct tagMIME * __restrict m, char * __restrict str, int len);


#endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>