2020-04-28 18:50:30 +02:00
|
|
|
/*
|
|
|
|
* tools.h - Utility functions
|
|
|
|
* The author licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TOOLS_H
|
|
|
|
#define TOOLS_H
|
|
|
|
|
2020-04-29 02:01:35 +02:00
|
|
|
#include "mail.h"
|
2020-04-28 18:50:30 +02:00
|
|
|
#include <stddef.h>
|
2020-04-30 22:11:54 +02:00
|
|
|
#include <stdbool.h>
|
2020-04-28 18:50:30 +02:00
|
|
|
|
2020-04-29 00:32:25 +02:00
|
|
|
char* insert_string(char * destination, const char* source,
|
2020-04-28 18:50:30 +02:00
|
|
|
size_t dest_orig_len, size_t offset);
|
|
|
|
|
2020-04-30 22:11:54 +02:00
|
|
|
bool remove_string(char * root, size_t len, size_t offset, size_t remove);
|
2020-04-30 21:12:29 +02:00
|
|
|
|
2020-04-29 19:19:38 +02:00
|
|
|
char* search_header_key(const struct email_t* mail, const char* key);
|
2020-04-29 02:01:35 +02:00
|
|
|
|
|
|
|
char* get_value_from_key(size_t* val_len, size_t key_offset,
|
2020-04-29 19:19:38 +02:00
|
|
|
const struct email_t* mail);
|
2020-04-28 23:43:09 +02:00
|
|
|
|
2020-04-29 20:18:10 +02:00
|
|
|
char* get_value_equals(char* content_type, size_t content_len,
|
|
|
|
size_t* boundary_len, char* key);
|
2020-04-29 14:47:50 +02:00
|
|
|
|
|
|
|
const char* get_next_line(const char* message, size_t len);
|
|
|
|
const char* get_prev_line(const char* message, size_t len_neg);
|
2020-04-29 19:19:38 +02:00
|
|
|
|
|
|
|
bool detect_base64(const struct email_t* mail);
|
2020-04-30 21:12:29 +02:00
|
|
|
|
|
|
|
void propagate_size_change(struct email_t *mail, ssize_t change);
|
|
|
|
|
2020-04-28 18:50:30 +02:00
|
|
|
#endif /* TOOLS_H */
|