## CamelMimeParser

CamelMimeParser

## Synopsis

    struct              CamelMimeParser;
    enum                camel_mime_parser_state_t;
    CamelMimeParser*    camel_mime_parser_new               (void);
    int                 camel_mime_parser_errno             (CamelMimeParser *parser);
    int                 camel_mime_parser_init_with_fd      (CamelMimeParser *parser,
                                                             int fd);
    int                 camel_mime_parser_init_with_stream  (CamelMimeParser *parser,
                                                             CamelStream *stream);
    CamelStream*        camel_mime_parser_stream            (CamelMimeParser *parser);
    int                 camel_mime_parser_fd                (CamelMimeParser *parser);
    void                camel_mime_parser_scan_from         (CamelMimeParser *parser,
                                                             gboolean scan_from);
    void                camel_mime_parser_scan_pre_from     (CamelMimeParser *parser,
                                                             gboolean scan_pre_from);
    int                 camel_mime_parser_set_header_regex  (CamelMimeParser *parser,
                                                             char *matchstr);
    camel_mime_parser_state_t camel_mime_parser_step        (CamelMimeParser *parser,
                                                             char **buf,
                                                             size_t *buflen);
    void                camel_mime_parser_unstep            (CamelMimeParser *parser);
    void                camel_mime_parser_drop_step         (CamelMimeParser *parser);
    camel_mime_parser_state_t camel_mime_parser_state       (CamelMimeParser *parser);
    void                camel_mime_parser_push_state        (CamelMimeParser *mp,
                                                             camel_mime_parser_state_t newstate,
                                                             const char *boundary);
    int                 camel_mime_parser_read              (CamelMimeParser *parser,
                                                             const char **databuffer,
                                                             int len);
    CamelContentType*   camel_mime_parser_content_type      (CamelMimeParser *parser);
    const char*         camel_mime_parser_header            (CamelMimeParser *parser,
                                                             const char *name,
                                                             int *offset);
    struct _camel_header_raw* camel_mime_parser_headers_raw (CamelMimeParser *parser);
    const char*         camel_mime_parser_preface           (CamelMimeParser *parser);
    const char*         camel_mime_parser_postface          (CamelMimeParser *parser);
    const char*         camel_mime_parser_from_line         (CamelMimeParser *parser);
    int                 camel_mime_parser_filter_add        (CamelMimeParser *parser,
                                                             CamelMimeFilter *filter);
    void                camel_mime_parser_filter_remove     (CamelMimeParser *parser,
                                                             int id);
    off_t               camel_mime_parser_tell              (CamelMimeParser *parser);
    off_t               camel_mime_parser_seek              (CamelMimeParser *parser,
                                                             off_t offset,
                                                             int whence);
    off_t               camel_mime_parser_tell_start_headers
                                                            (CamelMimeParser *parser);
    off_t               camel_mime_parser_tell_start_from   (CamelMimeParser *parser);
    off_t               camel_mime_parser_tell_start_boundary
                                                            (CamelMimeParser *parser);

## Description

## Details

### struct CamelMimeParser

    struct CamelMimeParser {
    	CamelObject parent;

    	struct _CamelMimeParserPrivate *priv;
    };

### enum camel_mime_parser_state_t

    typedef enum _camel_mime_parser_state_t {
    	CAMEL_MIME_PARSER_STATE_INITIAL,
    	CAMEL_MIME_PARSER_STATE_PRE_FROM,       /* data before a 'From' line */
    	CAMEL_MIME_PARSER_STATE_FROM,           /* got 'From' line */
    	CAMEL_MIME_PARSER_STATE_HEADER,         /* toplevel header */
    	CAMEL_MIME_PARSER_STATE_BODY,           /* scanning body of message */
    	CAMEL_MIME_PARSER_STATE_MULTIPART,      /* got multipart header */
    	CAMEL_MIME_PARSER_STATE_MESSAGE,        /* rfc822 message */

    	CAMEL_MIME_PARSER_STATE_PART,           /* part of a multipart */

    	CAMEL_MIME_PARSER_STATE_END = 8,        /* bit mask for 'end' flags */

    	CAMEL_MIME_PARSER_STATE_EOF = 8,        /* end of file */
    	CAMEL_MIME_PARSER_STATE_PRE_FROM_END,   /* pre from end */
    	CAMEL_MIME_PARSER_STATE_FROM_END,       /* end of whole from bracket */
    	CAMEL_MIME_PARSER_STATE_HEADER_END,     /* dummy value */
    	CAMEL_MIME_PARSER_STATE_BODY_END,       /* end of message */
    	CAMEL_MIME_PARSER_STATE_MULTIPART_END,  /* end of multipart  */
    	CAMEL_MIME_PARSER_STATE_MESSAGE_END     /* end of message */
    } camel_mime_parser_state_t;

### camel_mime_parser_new ()

    CamelMimeParser*    camel_mime_parser_new               (void);

Returns : |

### camel_mime_parser_errno ()

    int                 camel_mime_parser_errno             (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_init_with_fd ()

    int                 camel_mime_parser_init_with_fd      (CamelMimeParser *parser,
                                                             int fd);

`parser` : |
`fd` : |
Returns : |

### camel_mime_parser_init_with_stream ()

    int                 camel_mime_parser_init_with_stream  (CamelMimeParser *parser,
                                                             CamelStream *stream);

`parser` : |
`stream` : |
Returns : |

### camel_mime_parser_stream ()

    CamelStream*        camel_mime_parser_stream            (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_fd ()

    int                 camel_mime_parser_fd                (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_scan_from ()

    void                camel_mime_parser_scan_from         (CamelMimeParser *parser,
                                                             gboolean scan_from);

`parser` : |
`scan_from` : |

### camel_mime_parser_scan_pre_from ()

    void                camel_mime_parser_scan_pre_from     (CamelMimeParser *parser,
                                                             gboolean scan_pre_from);

`parser` : |
`scan_pre_from` : |

### camel_mime_parser_set_header_regex ()

    int                 camel_mime_parser_set_header_regex  (CamelMimeParser *parser,
                                                             char *matchstr);

`parser` : |
`matchstr` : |
Returns : |

### camel_mime_parser_step ()

    camel_mime_parser_state_t camel_mime_parser_step        (CamelMimeParser *parser,
                                                             char **buf,
                                                             size_t *buflen);

`parser` : |
`buf` : |
`buflen` : |
Returns : |

### camel_mime_parser_unstep ()

    void                camel_mime_parser_unstep            (CamelMimeParser *parser);

`parser` : |

### camel_mime_parser_drop_step ()

    void                camel_mime_parser_drop_step         (CamelMimeParser *parser);

`parser` : |

### camel_mime_parser_state ()

    camel_mime_parser_state_t camel_mime_parser_state       (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_push_state ()

    void                camel_mime_parser_push_state        (CamelMimeParser *mp,
                                                             camel_mime_parser_state_t newstate,
                                                             const char *boundary);

`mp` : |
`newstate` : |
`boundary` : |

### camel_mime_parser_read ()

    int                 camel_mime_parser_read              (CamelMimeParser *parser,
                                                             const char **databuffer,
                                                             int len);

`parser` : |
`databuffer` : |
`len` : |
Returns : |

### camel_mime_parser_content_type ()

    CamelContentType*   camel_mime_parser_content_type      (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_header ()

    const char*         camel_mime_parser_header            (CamelMimeParser *parser,
                                                             const char *name,
                                                             int *offset);

`parser` : |
`name` : |
`offset` : |
Returns : |

### camel_mime_parser_headers_raw ()

    struct _camel_header_raw* camel_mime_parser_headers_raw (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_preface ()

    const char*         camel_mime_parser_preface           (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_postface ()

    const char*         camel_mime_parser_postface          (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_from_line ()

    const char*         camel_mime_parser_from_line         (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_filter_add ()

    int                 camel_mime_parser_filter_add        (CamelMimeParser *parser,
                                                             CamelMimeFilter *filter);

`parser` : |
`filter` : |
Returns : |

### camel_mime_parser_filter_remove ()

    void                camel_mime_parser_filter_remove     (CamelMimeParser *parser,
                                                             int id);

`parser` : |
`id` : |

### camel_mime_parser_tell ()

    off_t               camel_mime_parser_tell              (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_seek ()

    off_t               camel_mime_parser_seek              (CamelMimeParser *parser,
                                                             off_t offset,
                                                             int whence);

`parser` : |
`offset` : |
`whence` : |
Returns : |

### camel_mime_parser_tell_start_headers ()

    off_t               camel_mime_parser_tell_start_headers
                                                            (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_tell_start_from ()

    off_t               camel_mime_parser_tell_start_from   (CamelMimeParser *parser);

`parser` : |
Returns : |

### camel_mime_parser_tell_start_boundary ()

    off_t               camel_mime_parser_tell_start_boundary
                                                            (CamelMimeParser *parser);

`parser` : |
Returns : |