mime.h (1219B)
1 /* 2 * Copy me if you can. 3 * by 20h 4 */ 5 6 #ifndef __MIME_H__ 7 #define __MIME_H__ 8 9 #include <time.h> 10 11 #include "llist.h" 12 13 typedef struct mime_t mime_t; 14 struct mime_t { 15 llist_t *hdrs; 16 llist_t *parts; 17 18 char *body; 19 int bodylen; 20 21 char *rawhdrs; 22 int rawhdrslen; 23 24 char *partid; 25 char *ct; 26 char *cte; 27 char *charset; 28 29 char *boundary; 30 31 int state; 32 }; 33 34 mime_t *mime_new(void); 35 void mime_free(mime_t *mime); 36 37 struct tm *mime_parsedate(char *str); 38 char *mime_iconv(char *str, char *from, char *to); 39 char *mime_decodeheaderext(char *value); 40 int mime_isextws(char *str, int len); 41 char *mime_decodeheader(char *value); 42 char *mime_guessheader(char *value); 43 char *mime_decodeparam(char *value); 44 char *mime_encodestring(char *value); 45 char *mime_encodeheader(char *header, char *value); 46 int mime_paramsort(llistelem_t *elem1, llistelem_t *elem2); 47 llist_t *mime_sanitizeparams(llist_t *phdr); 48 49 llist_t *mime_parseheader(char *field); 50 mime_t *mime_parsebuf(char *str, int len); 51 52 void mime_print(mime_t *mime); 53 54 char *mime_decodepartencoding(mime_t *mime, int *len); 55 char *mime_decodepart(mime_t *mime, int *len); 56 char *mime_filename(mime_t *mime); 57 char *mime_mkfilename(char *id, mime_t *mime); 58 char *mime_mkboundary(void); 59 60 #endif 61