libcmime  
A lightweight C mime library
cmime_internal.h
1 /* libcmime - A C mime library
2  * Copyright (C) 2013 SpaceNet AG and Axel Steiner <ast@treibsand.com>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef _CMIME_INTERNAL_H
25 #define _CMIME_INTERNAL_H
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include <stdlib.h>
32 #include <string.h>
33 #include <assert.h>
34 
35 #include "cmime_list.h"
36 #include "cmime_message.h"
37 #include "cmime_header.h"
38 
39 #define PART_CONTENT_TYPE_PATTERN "Content-Type:"
40 #define PART_CONTENT_DISPOSITION_PATTERN "Content-Disposition:"
41 #define PART_CONTENT_TRANSFER_ENCODING_PATTERN "Content-Transfer-Encoding:"
42 #define PART_CONTENT_ID_PATTERN "Content-ID:"
43 
44 #define MIMETYPE_DEFAULT "application/octet-stream"
45 #define MIMETYPE_TEXT_PLAIN "text/plain"
46 
47 #define LINE_LENGTH 72
48 
49 #define FROM_HEADER "From"
50 
52 #define CRLF "\r\n"
53 #define DCRLF "\r\n\r\n"
54 #define LF "\n"
55 #define CR "\r"
56 
57 typedef struct {
59  char *marker;
60  size_t len;
62 
63 void _cmime_internal_header_destroy(void *data);
64 
65 char *_cmime_internal_determine_linebreak_from_file(const char *s);
66 char *_cmime_internal_determine_linebreak(const char *s);
67 
68 void _cmime_internal_set_linked_header_value(CMimeList_T *l, const char *key, const char *value);
69 char *_cmime_internal_get_linked_header_value(CMimeList_T *l, const char *key);
70 CMimeHeader_T *_cmime_internal_get_linked_header(CMimeList_T *l, const char *key);
71 void _cmime_internal_parts_destroy(void *data);
72 _BoundaryInfo_T *_cmime_internal_get_boundary_info(CMimeStringList_T *boundaries, char *s, char *newline);
73 
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif /* _CMIME_INTERNAL_H */
Defines functions and structs for message handling.
Definition: cmime_internal.h:57
CMimeBoundaryType_T
Possible types of boundaries.
Definition: cmime_message.h:70
Double linked list implementation.
Definition: cmime_list.h:55
Defines functions and structs for double linked list.
Defines functions and structs for header management.
A simple list with strings.
Definition: cmime_string.h:46
A email header item.
Definition: cmime_header.h:45