45#define SERIAL_MAX_CHAR_SIZE (256 * 1024)
48#define SERIAL_MAX_LIST_COUNT 1024
63 return (off >= 0) && (need <= dlen) && ((
size_t) off <= (dlen - need));
75 void **p = (
void **) ptr;
77 if (p && (size < 4096))
93 memcpy(d + *off, &i,
sizeof(
int));
94 (*off) +=
sizeof(int);
109 memcpy(d + *off, &s,
sizeof(uint32_t));
110 (*off) +=
sizeof(uint32_t);
125 memcpy(d + *off, &s,
sizeof(uint64_t));
126 (*off) +=
sizeof(uint64_t);
145 memcpy(i, d + *off,
sizeof(
int));
146 (*off) +=
sizeof(int);
164 memcpy(s, d + *off,
sizeof(uint32_t));
165 (*off) +=
sizeof(uint32_t);
183 memcpy(s, d + *off,
sizeof(uint64_t));
184 (*off) +=
sizeof(uint64_t);
198 unsigned char *d,
int *off,
bool convert)
202 if (!c || (*c ==
'\0') || (size == 0))
218 memcpy(d + *off, p ? p : c, size);
253 unsigned int size = 0;
264 memcpy(*c, d + *off, size);
291 unsigned char *d,
int *off,
bool convert)
293 unsigned int counter = 0;
294 unsigned int start_off = *off;
307 memcpy(d + start_off, &counter,
sizeof(
int));
323 int *off,
size_t dlen,
bool convert)
325 unsigned int counter = 0;
373 int *off,
bool convert)
375 unsigned int counter = 0;
376 unsigned int start_off = *off;
387 memcpy(d + start_off, &counter,
sizeof(
int));
403 size_t dlen,
bool convert)
405 unsigned int counter = 0;
434 int *off,
bool convert)
460 size_t dlen,
bool convert)
464 unsigned int used = 0;
488 unsigned char *d,
int *off,
bool convert)
490 unsigned int counter = 0;
491 unsigned int start_off = *off;
503 memcpy(d + start_off, &counter,
sizeof(
int));
519 int *off,
size_t dlen,
bool convert)
521 unsigned int counter = 0;
557 uint32_t packed = b->
type +
587 b->
type = (packed & ((1 << 4) - 1));
588 b->
encoding = ((packed >> 4) & ((1 << 3) - 1));
591 b->
badsig = (packed & (1 << 9));
593 b->
goodsig = (packed & (1 << 11));
594 b->
noconv = (packed & (1 << 12));
596 b->
warnsig = (packed & (1 << 14));
647 size_t dlen,
bool convert)
696 unsigned char *d,
int *off,
bool convert)
747 int *off,
size_t dlen,
bool convert)
749 int real_subj_off = 0;
771 if (c_auto_subscribe)
780 if ((real_subj_off < 0) || (real_subj_off >= len))
823 unsigned int counter = 0;
824 unsigned int start_off = *off;
828 struct Tag *tag = NULL;
835 memcpy(d + start_off, &counter,
sizeof(
int));
851 unsigned int counter = 0;
void mutt_addrlist_append(struct AddressList *al, struct Address *a)
Append an Address to an AddressList.
struct Address * mutt_addr_new(void)
Create a new Address.
void mutt_auto_subscribe(const char *mailto)
Check if user is subscribed to mailing list.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
void buf_free(struct Buffer **ptr)
Deallocates a buffer.
struct Buffer * buf_new(const char *str)
Allocate a new Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
const char * cc_charset(void)
Get the cached value of $charset.
Convenience wrapper for the core headers.
Structs that make up an email.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
void mutt_mem_realloc(void *pptr, size_t size)
Resize a block of memory on the heap.
#define FREE(x)
Free memory and set the pointer to NULL.
#define MUTT_MEM_MALLOC(n, type)
int mutt_ch_convert_string(char **ps, const char *from, const char *to, uint8_t flags)
Convert a string between encodings.
#define MUTT_ICONV_NONE
No flags are set.
Convenience wrapper for the library headers.
char * mutt_strn_dup(const char *begin, size_t len)
Duplicate a sub-string.
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool mutt_str_is_ascii(const char *str, size_t len)
Is a string ASCII (7-bit)?
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
struct Parameter * mutt_param_new(void)
Create a new Parameter.
#define TAILQ_FOREACH(var, head, field)
#define TAILQ_INSERT_TAIL(head, elm, field)
#define STAILQ_FOREACH(var, head, field)
bool serial_restore_stailq(struct ListHead *l, const unsigned char *d, int *off, size_t dlen, bool convert)
Unpack a STAILQ from a binary blob.
unsigned char * serial_dump_body(const struct Body *b, unsigned char *d, int *off, bool convert)
Pack an Body into a binary blob.
bool serial_restore_uint32_t(uint32_t *s, const unsigned char *d, int *off, size_t dlen)
Unpack an uint32_t from a binary blob.
bool serial_restore_address(struct AddressList *al, const unsigned char *d, int *off, size_t dlen, bool convert)
Unpack an Address from a binary blob.
unsigned char * serial_dump_tags(const struct TagList *tl, unsigned char *d, int *off)
Pack a TagList into a binary blob.
unsigned char * serial_dump_uint64_t(const uint64_t s, unsigned char *d, int *off)
Pack a uint64_t into a binary blob.
bool serial_restore_parameter(struct ParameterList *pl, const unsigned char *d, int *off, size_t dlen, bool convert)
Unpack a Parameter from a binary blob.
static bool serial_in_bounds(int off, size_t need, size_t dlen)
Does a read stay within the serialized blob?
unsigned char * serial_dump_int(const unsigned int i, unsigned char *d, int *off)
Pack an integer into a binary blob.
unsigned char * serial_dump_envelope(const struct Envelope *env, unsigned char *d, int *off, bool convert)
Pack an Envelope into a binary blob.
static uint32_t body_pack_flags(const struct Body *b)
Pack the Body flags into a uint32_t.
unsigned char * serial_dump_buffer(const struct Buffer *buf, unsigned char *d, int *off, bool convert)
Pack a Buffer into a binary blob.
unsigned char * serial_dump_address(const struct AddressList *al, unsigned char *d, int *off, bool convert)
Pack an Address into a binary blob.
bool serial_restore_buffer(struct Buffer *buf, const unsigned char *d, int *off, size_t dlen, bool convert)
Unpack a Buffer from a binary blob.
bool serial_restore_uint64_t(uint64_t *s, const unsigned char *d, int *off, size_t dlen)
Unpack an uint64_t from a binary blob.
void lazy_realloc(void *ptr, size_t size)
Reallocate some memory.
unsigned char * serial_dump_parameter(const struct ParameterList *pl, unsigned char *d, int *off, bool convert)
Pack a Parameter into a binary blob.
#define SERIAL_MAX_LIST_COUNT
Max entries in a serialized list (addresses, headers, parameters, tags)
bool serial_restore_tags(struct TagList *tl, const unsigned char *d, int *off, size_t dlen)
Unpack a TagList from a binary blob.
unsigned char * serial_dump_uint32_t(const uint32_t s, unsigned char *d, int *off)
Pack a uint32_t into a binary blob.
unsigned char * serial_dump_stailq(const struct ListHead *l, unsigned char *d, int *off, bool convert)
Pack a STAILQ into a binary blob.
#define SERIAL_MAX_CHAR_SIZE
Max size for a single serialized string field (256 KiB)
bool serial_restore_int(unsigned int *i, const unsigned char *d, int *off, size_t dlen)
Unpack an integer from a binary blob.
unsigned char * serial_dump_char_size(const char *c, ssize_t size, unsigned char *d, int *off, bool convert)
Pack a fixed-length string into a binary blob.
bool serial_restore_body(struct Body *b, const unsigned char *d, int *off, size_t dlen, bool convert)
Unpack a Body from a binary blob.
static void body_unpack_flags(struct Body *b, uint32_t packed)
Unpack the Body flags from a uint32_t.
bool serial_restore_envelope(struct Envelope *env, const unsigned char *d, int *off, size_t dlen, bool convert)
Unpack an Envelope from a binary blob.
unsigned char * serial_dump_char(const char *c, unsigned char *d, int *off, bool convert)
Pack a variable-length string into a binary blob.
bool serial_restore_char(char **c, const unsigned char *d, int *off, size_t dlen, bool convert)
Unpack a variable-length string from a binary blob.
struct Buffer * personal
Real name of address.
struct Buffer * mailbox
Mailbox and host address.
char * content_id
Content-Id (RFC2392)
char * d_filename
filename to be used for the content-disposition header If NULL, filename is used instead.
LOFF_T offset
offset where the actual data begins
char * xtype
content-type if x-unknown
bool noconv
Don't do character set conversion.
bool badsig
Bad cryptographic signature (needed to check encrypted s/mime-signatures)
bool is_autocrypt
Flag autocrypt-decrypted messages for replying.
LOFF_T length
length (in bytes) of attachment
struct ParameterList parameter
Parameters of the content-type.
bool use_disp
Content-Disposition uses filename= ?
char * description
content-description
unsigned int disposition
content-disposition, ContentDisposition
bool force_charset
Send mode: don't adjust the character set when in send-mode.
char * subtype
content-type subtype
unsigned int encoding
content-transfer-encoding, ContentEncoding
bool goodsig
Good cryptographic signature.
char * form_name
Content-Disposition form-data name param.
bool warnsig
Maybe good signature.
unsigned int type
content-type primary type, ContentType
char * filename
When sending a message, this is the file to which this structure refers.
String manipulation buffer.
char * data
Pointer to data.
struct ListHead userhdrs
user defined headers
char * supersedes
Supersedes header.
char * list_subscribe
This stores a list URI, preferring mailto.
struct AddressList return_path
Return path for the Email.
char *const subject
Email's subject.
struct AddressList to
Email's 'To' list.
char * followup_to
List of 'followup-to' fields.
struct AddressList reply_to
Email's 'reply-to'.
char * message_id
Message ID.
char * x_comment_to
List of 'X-comment-to' fields.
struct AddressList mail_followup_to
Email's 'mail-followup-to'.
struct AddressList cc
Email's 'Cc' list.
struct AddressList sender
Email's sender.
struct ListHead references
message references (in reverse order)
struct Buffer spam
Spam header.
struct ListHead in_reply_to
in-reply-to header content
struct AddressList bcc
Email's 'Bcc' list.
char * xref
List of cross-references.
char * organization
Organisation header.
char * list_post
This stores a mailto URL, or nothing.
char *const real_subj
Offset of the real subject.
char * list_unsubscribe
This stores a list URI, preferring mailto.
struct AddressList from
Email's 'From' list.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Attribute associated with a MIME part.
char * attribute
Parameter name.
char * value
Parameter value.