iPXE
mime.c File Reference

MIME image format. More...

#include <stdint.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <errno.h>
#include <ipxe/image.h>
#include <ipxe/base64.h>
#include <ipxe/mime.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static const struct mime_type * mime_type (const char *name)
 Identify MIME type.
static void mime_parse_attribute (struct image *image, const char *value, const char *eol, const char *name, struct mime_attribute *attr)
 Parse MIME attribute.
static void mime_parse_type (struct image *image, const char *value, const char *eol, struct mime_headers *headers)
 Parse Content-Type header.
static void mime_parse_encoding (struct image *image, const char *value, const char *eol __unused, struct mime_headers *headers)
 Parse Content-Transfer-Encoding header.
static const struct mime_header * mime_header (const char *line)
 Identify MIME header.
static int mime_parse (struct image *image, const char *text, struct mime_headers *headers)
 Parse MIME headers.
static int mime_decode_identity (struct image *image, const struct mime_headers *headers, struct image *decoded)
 Decode MIME entity with identity encoding.
static int mime_decode_base64 (struct image *image, const struct mime_headers *headers, struct image *decoded)
 Decode MIME entity with Base64 encoding.
static const struct mime_encoding * mime_encoding (const char *name)
 Identify MIME encoding.
static int mime_extract_entity (struct image *image, const struct mime_headers *headers, struct image *extracted)
 Extract single MIME entity.
static const char * mime_part_end (struct image *image, const struct mime_attribute *boundary, const char *pos)
 Find end of current part in multipart MIME image.
static const char * mime_part_next (struct image *image, const struct mime_attribute *boundary, const char *pos)
 Find start of next part in multipart MIME image.
static int mime_extract_part (struct image *image, const struct mime_headers *headers, struct image *extracted)
 Extract part from multipart MIME image.
static int mime_probe (struct image *image)
 Probe MIME image.
static int mime_extract (struct image *image, struct image *extracted)
 Extract MIME image.
struct image_type mime_image_type __image_type (PROBE_NORMAL)
 MIME image type.

Variables

const struct mime_header mime_headers []
 Recognised MIME headers.
static const struct mime_encoding mime_encodings []
 MIME encodings.
static const struct mime_type mime_types []
 MIME types.

Detailed Description

MIME image format.

The MIME format is defined in RFC 2045 and RFC 2046 (with reference to RFC 822). We treat it firstly as a simple single-member archive format where the content is extracted using the specified encoding.

We additionally support multipart MIME as an archive format from which we attempt to extract the first body part that has the MIME type "text/x-ipxe". This makes it possible to store both cloud-init configuration and an iPXE boot script in the same user metadata blob for a cloud instance.

Due to its historical origins, MIME is an irritatingly flexible format. We do not attempt to support all possible MIME files: only those that we might reasonably expect to encounter as cloud instance metadata.

Definition in file mime.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

References name.

◆ mime_type()

const struct mime_type * mime_type ( const char * name)
static

Identify MIME type.

Parameters
nameEncoding
Return values
typeMIME type, or NULL if not recognised

Definition at line 531 of file mime.c.

531 {
532 const struct mime_type *type;
533 size_t len;
534 unsigned int i;
535
536 /* Identify MIME type */
537 for ( i = 0 ; i < ( sizeof ( mime_types ) /
538 sizeof ( mime_types[0] ) ) ; i++ ) {
539 type = &mime_types[i];
540 len = strlen ( type->name );
541 if ( ( strncasecmp ( name, type->name, len ) == 0 ) &&
542 ( ( name[len] == ';' ) || isspace ( name[len] ) ) ) {
543 return type;
544 }
545 }
546
547 return NULL;
548}
#define NULL
NULL pointer (VOID *).
Definition Base.h:321
const char * name
Definition ath9k_hw.c:1986
int isspace(int character)
Check to see if character is a space.
Definition ctype.c:42
ring len
Length.
Definition dwmac.h:226
uint32_t type
Operating system type.
Definition ena.h:1
static const struct mime_type mime_types[]
MIME types.
Definition mime.c:514
int strncasecmp(const char *first, const char *second, size_t max)
Compare case-insensitive strings.
Definition string.c:222
size_t strlen(const char *src)
Get length of string.
Definition string.c:244
A MIME type.
Definition mime.h:69

References isspace(), len, mime_types, name, NULL, strlen(), strncasecmp(), and type.

Referenced by mime_extract(), and mime_extract_part().

◆ mime_parse_attribute()

void mime_parse_attribute ( struct image * image,
const char * value,
const char * eol,
const char * name,
struct mime_attribute * attr )
static

Parse MIME attribute.

Parameters
imageMIME image
valueHeader value
eolEnd of header line
nameAttribute name (including terminating equals sign)
attrMIME attribute to update

Definition at line 66 of file mime.c.

68 {
69 const char *match;
70
71 /* Locate attribute */
72 match = strcasestr ( value, name );
73 if ( ( ! match ) || ( match >= eol ) )
74 return;
75 attr->value = ( match + strlen ( name ) );
76 DBGC2 ( image, "MIME %s found %s\"", image->name, name );
77
78 /* Determine attribute length */
79 if ( attr->value[0] == '"' )
80 attr->value++;
81 attr->len = 0;
82 while ( attr->value[attr->len] && ( attr->value[attr->len] != '"' ) &&
83 ( ! isspace ( attr->value[attr->len] ) ) ) {
84 DBGC2 ( image, "%c", attr->value[attr->len] );
85 attr->len++;
86 }
87 DBGC2 ( image, "\"\n" );
88 assert ( &attr->value[attr->len] <= eol );
89}
pseudo_bit_t value[0x00020]
Definition arbel.h:2
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
#define DBGC2(...)
Definition compiler.h:547
uint8_t attr
Type and attributes.
Definition librm.h:7
char * strcasestr(const char *haystack, const char *needle)
Find case-insensitive substring.
Definition string.c:341
An executable image.
Definition image.h:24
char * name
Name.
Definition image.h:38

References assert, attr, DBGC2, isspace(), image::name, name, strcasestr(), strlen(), and value.

Referenced by mime_parse_type().

◆ mime_parse_type()

void mime_parse_type ( struct image * image,
const char * value,
const char * eol,
struct mime_headers * headers )
static

Parse Content-Type header.

Parameters
imageMIME image
valueHeader value
eolEnd of header line
headersMIME headers to update

Definition at line 99 of file mime.c.

100 {
101
102 /* Record content type */
103 headers->type = value;
104 DBGC2 ( image, "MIME %s found content type\n", image->name );
105
106 /* Check for boundary separator */
107 mime_parse_attribute ( image, value, eol, "boundary=",
108 &headers->boundary );
109}
uint8_t headers[IB_MAX_HEADER_SIZE]
Definition arbel.h:3
static void mime_parse_attribute(struct image *image, const char *value, const char *eol, const char *name, struct mime_attribute *attr)
Parse MIME attribute.
Definition mime.c:66

References DBGC2, headers, mime_parse_attribute(), image::name, and value.

◆ mime_parse_encoding()

void mime_parse_encoding ( struct image * image,
const char * value,
const char *eol __unused,
struct mime_headers * headers )
static

Parse Content-Transfer-Encoding header.

Parameters
imageMIME image
valueHeader value
eolEnd of header line
headersMIME headers to update

Definition at line 119 of file mime.c.

121 {
122
123 /* Record content transfer encoding */
124 headers->encoding = value;
125 DBGC2 ( image, "MIME %s found content transfer encoding\n",
126 image->name );
127}

References __unused, DBGC2, headers, image::name, and value.

◆ mime_header()

const struct mime_header * mime_header ( const char * line)
static

Identify MIME header.

Parameters
lineHeader line
Return values
headerMIME header, or NULL if not recognised

Definition at line 148 of file mime.c.

148 {
149 const struct mime_header *header;
150 unsigned int i;
151
152 /* Identify MIME header */
153 for ( i = 0 ; i < ( sizeof ( mime_headers ) /
154 sizeof ( mime_headers[0] ) ) ; i++ ) {
155 header = &mime_headers[i];
156 if ( strncasecmp ( line, header->name,
157 strlen ( header->name ) ) == 0 ) {
158 return header;
159 }
160 }
161
162 return NULL;
163}
struct ena_llq_option header
Header locations.
Definition ena.h:5
A recognised MIME header.
Definition mime.h:36
MIME headers.
Definition mime.h:24

References header, NULL, strlen(), and strncasecmp().

Referenced by mime_parse().

◆ mime_parse()

int mime_parse ( struct image * image,
const char * text,
struct mime_headers * headers )
static

Parse MIME headers.

Parameters
imageMIME image
textStart of MIME headers within image
headersMIME headers to fill in
Return values
rcReturn status code

Definition at line 173 of file mime.c.

174 {
175 const struct mime_header *header;
176 const char *value;
177 const char *line;
178 const char *next;
179 const char *eol;
180
181 /* Initialise headers */
182 memset ( headers, 0, sizeof ( *headers ) );
183
184 /* Parse headers until reaching empty-line separator */
185 for ( line = text ; ; line = next ) {
186
187 /* Locate end of line */
188 eol = strchr ( line, '\n' );
189 if ( ! eol ) {
190 DBGC ( image, "MIME %s premature end of file\n",
191 image->name );
192 return -EINVAL;
193 }
194 next = ( eol + 1 );
195
196 /* Check for empty line */
197 if ( eol == line )
198 break;
199 if ( eol[-1] == '\r' )
200 eol--;
201 if ( eol == line )
202 break;
203
204 /* Identify header (if recognised) */
205 header = mime_header ( line );
206 if ( ! header )
207 continue;
208
209 /* Locate start of value */
210 value = ( line + strlen ( header->name ) );
211 while ( ( *value != '\n' ) && isspace ( *value ) )
212 value++;
213
214 /* Parse header */
215 header->parse ( image, value, eol, headers );
216 }
217
218 /* Check for mandatory headers */
219 if ( ! headers->type ) {
220 DBGC ( image, "MIME %s missing content type\n", image->name );
221 return -EINVAL;
222 }
223
224 /* Record length of headers */
225 headers->len = ( next - text );
226
227 return 0;
228}
uint32_t next
Next descriptor address.
Definition dwmac.h:11
#define DBGC(...)
Definition compiler.h:530
#define EINVAL
Invalid argument.
Definition errno.h:429
void * memset(void *dest, int character, size_t len) __nonnull
static const struct mime_header * mime_header(const char *line)
Identify MIME header.
Definition mime.c:148
char * strchr(const char *src, int character)
Find character within a string.
Definition string.c:288

References DBGC, EINVAL, header, headers, isspace(), memset(), mime_header(), image::name, next, strchr(), strlen(), and value.

Referenced by mime_extract(), mime_extract_part(), and mime_probe().

◆ mime_decode_identity()

int mime_decode_identity ( struct image * image,
const struct mime_headers * headers,
struct image * decoded )
static

Decode MIME entity with identity encoding.

Parameters
imageMIME image
headersMIME headers
decodedDecoded image
Return values
rcReturn status code

Definition at line 238 of file mime.c.

240 {
241 size_t len;
242 int rc;
243
244 /* Allocate space */
245 len = ( image->len - headers->len );
246 if ( ( rc = image_set_len ( decoded, len ) ) != 0 )
247 return rc;
248
249 /* Decode data */
250 memcpy ( decoded->rwdata, ( image->data + headers->len ), len );
251
252 return 0;
253}
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
int image_set_len(struct image *image, size_t len)
Set image length.
Definition image.c:249
void * memcpy(void *dest, const void *src, size_t len) __nonnull
const void * data
Read-only data.
Definition image.h:51
size_t len
Length of raw file image.
Definition image.h:63
void * rwdata
Writable data.
Definition image.h:53

References image::data, headers, image_set_len(), image::len, len, memcpy(), rc, and image::rwdata.

◆ mime_decode_base64()

int mime_decode_base64 ( struct image * image,
const struct mime_headers * headers,
struct image * decoded )
static

Decode MIME entity with Base64 encoding.

Parameters
imageMIME image
headersMIME headers
decodedDecoded image
Return values
rcReturn status code

Definition at line 263 of file mime.c.

265 {
266 const char *encoded;
267 size_t max_len;
268 int len;
269 int rc;
270
271 /* Allocate space for decoded data */
272 encoded = ( image->text + headers->len );
273 max_len = base64_decoded_max_len ( encoded );
274 if ( ( rc = image_set_len ( decoded, max_len ) ) != 0 )
275 return rc;
276
277 /* Decode data */
278 len = base64_decode ( encoded, decoded->rwdata, decoded->len );
279 if ( len < 0 ) {
280 rc = len;
281 DBGC ( image, "MIME %s could not decode base64: %s\n",
282 image->name, strerror ( rc ) );
283 return rc;
284 }
285 assert ( ( ( size_t ) len ) <= max_len );
286
287 /* Set decoded length */
288 if ( ( rc = image_set_len ( decoded, len ) ) != 0 )
289 return rc;
290
291 return 0;
292}
int base64_decode(const char *encoded, void *data, size_t len)
Base64-decode string.
Definition base64.c:92
static size_t base64_decoded_max_len(const char *encoded)
Calculate maximum length of base64-decoded string.
Definition base64.h:35
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
const char * text
Read-only text (guaranteed to be NUL terminated).
Definition image.h:60

References assert, base64_decode(), base64_decoded_max_len(), DBGC, headers, image_set_len(), image::len, len, image::name, rc, image::rwdata, strerror(), and image::text.

◆ mime_encoding()

const struct mime_encoding * mime_encoding ( const char * name)
static

Identify MIME encoding.

Parameters
nameEncoding name, or NULL to use default
Return values
encodingMIME encoding, or NULL if not recognised

Definition at line 321 of file mime.c.

321 {
322 const struct mime_encoding *encoding;
323 size_t len;
324 unsigned int i;
325
326 /* Use default encoding if no name specified */
327 if ( ! name )
328 return &mime_encodings[0];
329
330 /* Identify MIME encoding */
331 for ( i = 0 ; i < ( sizeof ( mime_encodings ) /
332 sizeof ( mime_encodings[0] ) ) ; i++ ) {
333 encoding = &mime_encodings[i];
334 len = strlen ( encoding->name );
335 if ( ( strncasecmp ( name, encoding->name, len ) == 0 ) &&
336 ( ( name[len] == ';' ) || isspace ( name[len] ) ) ) {
337 return encoding;
338 }
339 }
340
341 return NULL;
342}
static const struct mime_encoding mime_encodings[]
MIME encodings.
Definition mime.c:295
A MIME content transfer encoding.
Definition mime.h:52
const char * name
Name.
Definition mime.h:54

References isspace(), len, mime_encodings, mime_encoding::name, name, NULL, strlen(), and strncasecmp().

Referenced by mime_extract_entity().

◆ mime_extract_entity()

int mime_extract_entity ( struct image * image,
const struct mime_headers * headers,
struct image * extracted )
static

Extract single MIME entity.

Parameters
imageMIME image
headersMIME headers
extractedExtracted image
Return values
rcReturn status code

Definition at line 352 of file mime.c.

354 {
355 const struct mime_encoding *encoding;
356 int rc;
357
358 /* Identify encoding */
359 encoding = mime_encoding ( headers->encoding );
360 if ( ! encoding ) {
361 DBGC ( image, "MIME %s has unrecognised encoding\n",
362 image->name );
363 return -ENOTSUP;
364 }
365 DBGC ( image, "MIME %s has encoding %s\n",
366 image->name, encoding->name );
367
368 /* Decode via applicable encoding */
369 if ( ( rc = encoding->decode ( image, headers, extracted ) ) != 0 )
370 return rc;
371
372 return 0;
373}
#define ENOTSUP
Operation not supported.
Definition errno.h:590
static const struct mime_encoding * mime_encoding(const char *name)
Identify MIME encoding.
Definition mime.c:321
int(* decode)(struct image *image, const struct mime_headers *headers, struct image *decoded)
Decode entity.
Definition mime.h:63

References DBGC, mime_encoding::decode, ENOTSUP, headers, mime_encoding(), image::name, mime_encoding::name, and rc.

◆ mime_part_end()

const char * mime_part_end ( struct image * image,
const struct mime_attribute * boundary,
const char * pos )
static

Find end of current part in multipart MIME image.

Parameters
imageMIME image
boundaryBoundary separator
posCurrent position within image
Return values
endEnd of current part, or NULL if not found

Definition at line 383 of file mime.c.

385 {
386
387 /* Locate boundary marker */
388 while ( 1 ) {
389 pos = strstr ( pos, "\n--" );
390 if ( ! pos )
391 break;
392 pos += ( 1 /* newline */ );
393 if ( strncmp ( ( pos + 2 /* -- */ ), boundary->value,
394 boundary->len ) != 0 ) {
395 continue;
396 }
397 return pos;
398 }
399
400 DBGC ( image, "MIME %s missing boundary marker\n", image->name );
401 return NULL;
402}
int strncmp(const char *first, const char *second, size_t max)
Compare strings.
Definition string.c:187
char * strstr(const char *haystack, const char *needle)
Find substring.
Definition string.c:324
size_t len
Length of value.
Definition mime.h:20
const char * value
Attribute value (not NUL-terminated).
Definition mime.h:18

References DBGC, mime_attribute::len, image::name, NULL, strncmp(), strstr(), and mime_attribute::value.

Referenced by mime_extract_part().

◆ mime_part_next()

const char * mime_part_next ( struct image * image,
const struct mime_attribute * boundary,
const char * pos )
static

Find start of next part in multipart MIME image.

Parameters
imageMIME image
boundaryBoundary separator
posEnd of current part within image
nextStart of next part, or NULL if not found

Definition at line 412 of file mime.c.

414 {
415
416 /* Skip boundary marker */
417 pos += ( 2 /* -- */ + boundary->len );
418
419 /* Check for end boundary */
420 if ( strcmp ( pos, "--" ) == 0 )
421 return NULL;
422
423 /* Skip trailing whitespace */
424 while ( ( *pos != '\n' ) && isspace ( *pos ) )
425 pos++;
426
427 /* Check for and skip terminating newline */
428 if ( *pos != '\n' ) {
429 DBGC ( image, "MIME %s malformed boundary marker\n",
430 image->name );
431 return NULL;
432 }
433 pos++;
434
435 return pos;
436}
int strcmp(const char *first, const char *second)
Compare strings.
Definition string.c:174

References DBGC, isspace(), mime_attribute::len, image::name, NULL, and strcmp().

Referenced by mime_extract_part().

◆ mime_extract_part()

int mime_extract_part ( struct image * image,
const struct mime_headers * headers,
struct image * extracted )
static

Extract part from multipart MIME image.

Parameters
imageMIME image
headersMIME headers
extractedExtracted image
Return values
rcReturn status code

Extraction will produce a MIME image containing only the selected part. (We rely on the recursive behaviour of image_extract_exec() to extract the content within the extracted part.)

Definition at line 450 of file mime.c.

452 {
453 const struct mime_attribute *boundary = &headers->boundary;
454 const struct mime_type *type;
455 struct mime_headers subheaders;
456 const char *part;
457 const char *end;
458 size_t len;
459 int rc;
460
461 /* Find end of preamble */
463 if ( ! end )
464 return -ENOENT;
465
466 /* Look for a usable part */
467 while ( ( part = mime_part_next ( image, boundary, end ) ) &&
468 ( end = mime_part_end ( image, boundary, part ) ) ) {
469
470 /* Parse part headers */
471 DBGC ( image, "MIME %s found part at [%#zx,%#zx)\n",
472 image->name, ( part - image->text ),
473 ( end - image->text ) );
474 if ( ( rc = mime_parse ( image, part, &subheaders ) ) != 0 )
475 return rc;
476
477 /* Check for a recognised MIME type */
478 type = mime_type ( subheaders.type );
479 if ( ! type )
480 continue;
481 DBGC ( image, "MIME %s found part with type %s\n",
482 image->name, type->name );
483
484 /* Extract part */
485 len = ( end - part );
486 if ( ( rc = image_set_len ( extracted, len ) ) != 0 )
487 return rc;
488 memcpy ( extracted->rwdata, part, len );
489 return 0;
490 }
491
492 DBGC ( image, "MIME %s found no usable part\n", image->name );
493 return -ENOENT;
494}
#define ENOENT
No such file or directory.
Definition errno.h:515
static const char * mime_part_end(struct image *image, const struct mime_attribute *boundary, const char *pos)
Find end of current part in multipart MIME image.
Definition mime.c:383
static const struct mime_type * mime_type(const char *name)
Identify MIME type.
Definition mime.c:531
static int mime_parse(struct image *image, const char *text, struct mime_headers *headers)
Parse MIME headers.
Definition mime.c:173
static const char * mime_part_next(struct image *image, const struct mime_attribute *boundary, const char *pos)
Find start of next part in multipart MIME image.
Definition mime.c:412
uint32_t end
Ending offset.
Definition netvsc.h:7
A MIME attribute.
Definition mime.h:16
struct mime_attribute boundary
Boundary separator.
Definition mime.h:30

References mime_headers::boundary, DBGC, end, ENOENT, headers, image_set_len(), len, memcpy(), mime_parse(), mime_part_end(), mime_part_next(), mime_type(), image::name, rc, image::rwdata, image::text, mime_headers::type, and type.

◆ mime_probe()

int mime_probe ( struct image * image)
static

Probe MIME image.

Parameters
imageCompressed kernel image
Return values
rcReturn status code

Definition at line 502 of file mime.c.

502 {
503 struct mime_headers headers;
504 int rc;
505
506 /* Check for MIME headers */
507 if ( ( rc = mime_parse ( image, image->text, &headers ) ) != 0 )
508 return rc;
509
510 return 0;
511}

References headers, mime_parse(), rc, and image::text.

Referenced by __image_type().

◆ mime_extract()

int mime_extract ( struct image * image,
struct image * extracted )
static

Extract MIME image.

Parameters
imageCompressed kernel image
extractedExtracted image
Return values
rcReturn status code

Definition at line 557 of file mime.c.

557 {
558 const struct mime_type *type;
559 struct mime_headers headers;
560 int rc;
561
562 /* Parse headers */
563 if ( ( rc = mime_parse ( image, image->text, &headers ) ) != 0 )
564 return rc;
565
566 /* Identify MIME type */
567 type = mime_type ( headers.type );
568 if ( ! type ) {
569 DBGC ( image, "MIME %s has no type\n", image->name );
570 return -ENOTSUP;
571 }
572 DBGC ( image, "MIME %s has type %s\n", image->name, type->name );
573
574 /* Extract image */
575 if ( ( rc = type->extract ( image, &headers, extracted ) ) != 0 )
576 return rc;
577
578 return 0;
579}

References DBGC, ENOTSUP, headers, mime_parse(), mime_type(), image::name, rc, image::text, and type.

Referenced by __image_type().

◆ __image_type()

struct image_type mime_image_type __image_type ( PROBE_NORMAL )

Variable Documentation

◆ mime_headers

const struct mime_header mime_headers[]
Initial value:
= {
{
.name = "Content-Type:",
.parse = mime_parse_type,
},
{
.name = "Content-Transfer-Encoding:",
},
}
static void mime_parse_encoding(struct image *image, const char *value, const char *eol __unused, struct mime_headers *headers)
Parse Content-Transfer-Encoding header.
Definition mime.c:119
static void mime_parse_type(struct image *image, const char *value, const char *eol, struct mime_headers *headers)
Parse Content-Type header.
Definition mime.c:99

Recognised MIME headers.

Definition at line 130 of file mime.c.

130 {
131 {
132 .name = "Content-Type:",
133 .parse = mime_parse_type,
134
135 },
136 {
137 .name = "Content-Transfer-Encoding:",
138 .parse = mime_parse_encoding,
139 },
140};

◆ mime_encodings

const struct mime_encoding mime_encodings[]
static
Initial value:
= {
{
.name = "7bit",
},
{
.name = "8bit",
},
{
.name = "binary",
},
{
.name = "base64",
.decode = mime_decode_base64,
},
}
static int mime_decode_identity(struct image *image, const struct mime_headers *headers, struct image *decoded)
Decode MIME entity with identity encoding.
Definition mime.c:238
static int mime_decode_base64(struct image *image, const struct mime_headers *headers, struct image *decoded)
Decode MIME entity with Base64 encoding.
Definition mime.c:263

MIME encodings.

Definition at line 295 of file mime.c.

295 {
296 {
297 /* Default encoding */
298 .name = "7bit",
299 .decode = mime_decode_identity,
300 },
301 {
302 .name = "8bit",
303 .decode = mime_decode_identity,
304 },
305 {
306 .name = "binary",
307 .decode = mime_decode_identity,
308 },
309 {
310 .name = "base64",
311 .decode = mime_decode_base64,
312 },
313};

Referenced by mime_encoding().

◆ mime_types

const struct mime_type mime_types[]
static
Initial value:
= {
{
.name = "multipart/mixed",
.extract = mime_extract_part,
},
{
.name = "text/x-ipxe",
.extract = mime_extract_entity,
},
}
static int mime_extract_entity(struct image *image, const struct mime_headers *headers, struct image *extracted)
Extract single MIME entity.
Definition mime.c:352
static int mime_extract_part(struct image *image, const struct mime_headers *headers, struct image *extracted)
Extract part from multipart MIME image.
Definition mime.c:450

MIME types.

Definition at line 514 of file mime.c.

514 {
515 {
516 .name = "multipart/mixed",
517 .extract = mime_extract_part,
518 },
519 {
520 .name = "text/x-ipxe",
521 .extract = mime_extract_entity,
522 },
523};

Referenced by mime_type().