iPXE
mime.h
Go to the documentation of this file.
1#ifndef _IPXE_MIME_H
2#define _IPXE_MIME_H
3
4/** @file
5 *
6 * MIME format
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12#include <stdint.h>
13#include <ipxe/image.h>
14
15/** A MIME attribute */
17 /** Attribute value (not NUL-terminated) */
18 const char *value;
19 /** Length of value */
20 size_t len;
21};
22
23/** MIME headers */
25 /** Content transfer encoding (not NUL-terminated) */
26 const char *encoding;
27 /** Content type (not NUL-terminated) */
28 const char *type;
29 /** Boundary separator */
31 /** Length of headers (including empty line separator) */
32 size_t len;
33};
34
35/** A recognised MIME header */
37 /** Name (including terminating colon) */
38 const char *name;
39 /**
40 * Parse header value
41 *
42 * @v image MIME image
43 * @v value Header value
44 * @v eol End of header line
45 * @v headers MIME headers to update
46 */
47 void ( * parse ) ( struct image *image, const char *value,
48 const char *eol, struct mime_headers *headers );
49};
50
51/** A MIME content transfer encoding */
53 /** Name */
54 const char *name;
55 /**
56 * Decode entity
57 *
58 * @v image MIME image
59 * @v headers MIME headers
60 * @v decoded Decoded image
61 * @ret rc Return status code
62 */
63 int ( * decode ) ( struct image *image,
64 const struct mime_headers *headers,
65 struct image *decoded );
66};
67
68/** A MIME type */
69struct mime_type {
70 /** Name */
71 const char *name;
72 /**
73 * Extract image
74 *
75 * @v mime MIME image
76 * @v headers MIME headers
77 * @v extracted Extracted image
78 * @ret rc Return status code
79 */
80 int ( * extract ) ( struct image *image,
81 const struct mime_headers *headers,
82 struct image *extracted );
83};
84
85extern struct image_type mime_image_type __image_type ( PROBE_NORMAL );
86
87#endif /* _IPXE_MIME_H */
pseudo_bit_t value[0x00020]
Definition arbel.h:2
uint8_t headers[IB_MAX_HEADER_SIZE]
Definition arbel.h:3
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:921
Executable images.
#define PROBE_NORMAL
Normal image probe priority.
Definition image.h:163
#define __image_type(probe_order)
An executable image type.
Definition image.h:177
An executable image type.
Definition image.h:102
An executable image.
Definition image.h:24
A MIME attribute.
Definition mime.h:16
size_t len
Length of value.
Definition mime.h:20
const char * value
Attribute value (not NUL-terminated).
Definition mime.h:18
A MIME content transfer encoding.
Definition mime.h:52
int(* decode)(struct image *image, const struct mime_headers *headers, struct image *decoded)
Decode entity.
Definition mime.h:63
const char * name
Name.
Definition mime.h:54
A recognised MIME header.
Definition mime.h:36
void(* parse)(struct image *image, const char *value, const char *eol, struct mime_headers *headers)
Parse header value.
Definition mime.h:47
const char * name
Name (including terminating colon).
Definition mime.h:38
MIME headers.
Definition mime.h:24
const char * type
Content type (not NUL-terminated).
Definition mime.h:28
size_t len
Length of headers (including empty line separator).
Definition mime.h:32
struct mime_attribute boundary
Boundary separator.
Definition mime.h:30
const char * encoding
Content transfer encoding (not NUL-terminated).
Definition mime.h:26
A MIME type.
Definition mime.h:69
int(* extract)(struct image *image, const struct mime_headers *headers, struct image *extracted)
Extract image.
Definition mime.h:80
const char * name
Name.
Definition mime.h:71