libcmime
A lightweight C mime library
Home
API
Examples
Download
Header list
Data Structures
Data Fields
Globals
cmime_header.h
Go to the documentation of this file.
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
29
#ifndef _CMIME_HEADER_H
30
#define _CMIME_HEADER_H
31
32
#ifdef __cplusplus
33
extern
"C"
{
34
#endif
35
36
#include <stdio.h>
37
#include <stdlib.h>
38
#include <string.h>
39
#include <assert.h>
40
45
typedef
struct
{
46
char
*
name
;
47
char
**
value
;
48
size_t
count
;
49
int
parsed
;
50
}
CMimeHeader_T
;
51
52
58
CMimeHeader_T
*
cmime_header_new
(
void
);
59
65
void
cmime_header_free
(
CMimeHeader_T
*header);
66
73
void
cmime_header_set_name
(
CMimeHeader_T
*header,
const
char
*name);
74
79
#define cmime_header_get_name(header) (header->name)
80
81
89
void
cmime_header_set_value
(
CMimeHeader_T
*header,
const
char
*value,
int
overwrite);
90
98
char
*
cmime_header_get_value
(
CMimeHeader_T
*header,
int
pos);
99
104
#define cmime_header_get_count(header) ((int)header->count)
105
112
char
*
cmime_header_to_string
(
CMimeHeader_T
*header);
113
114
#ifdef __cplusplus
115
}
116
#endif
117
118
#endif
/* _CMIME_HEADER_H */
CMimeHeader_T::parsed
int parsed
Definition:
cmime_header.h:49
cmime_header_get_value
char * cmime_header_get_value(CMimeHeader_T *header, int pos)
Return header value (at given position, if header appears more than once)
Definition:
cmime_header.c:88
CMimeHeader_T::name
char * name
Definition:
cmime_header.h:46
cmime_header_set_name
void cmime_header_set_name(CMimeHeader_T *header, const char *name)
Set a header name, if aleready exists, name will be overwritten.
Definition:
cmime_header.c:55
cmime_header_set_value
void cmime_header_set_value(CMimeHeader_T *header, const char *value, int overwrite)
Set/append a header value.
Definition:
cmime_header.c:65
CMimeHeader_T::value
char ** value
Definition:
cmime_header.h:47
cmime_header_new
CMimeHeader_T * cmime_header_new(void)
Creates a new CMimeHeader_T object.
Definition:
cmime_header.c:29
cmime_header_to_string
char * cmime_header_to_string(CMimeHeader_T *header)
Return full header as newly allocated string.
Definition:
cmime_header.c:98
CMimeHeader_T::count
size_t count
Definition:
cmime_header.h:48
cmime_header_free
void cmime_header_free(CMimeHeader_T *header)
Free a CMimeHeader_T object.
Definition:
cmime_header.c:38
CMimeHeader_T
A email header item.
Definition:
cmime_header.h:45