Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / common / mime.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4  * Ceph - scalable distributed file system
5  *
6  * Copyright (C) 2011 New Dream Network
7  *
8  * This is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License version 2.1, as published by the Free Software
11  * Foundation.  See file COPYING.
12  *
13  */
14
15 #ifndef CEPH_COMMON_MIME_H
16 #define CEPH_COMMON_MIME_H
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 /* Encode a buffer as quoted-printable.
23  *
24  * The input is a null-terminated string.
25  * The output is a null-terminated string representing the input encoded as
26  * a MIME quoted-printable.
27  *
28  * Returns the length of the buffer we would need to do the encoding.
29  * If we don't have enough buffer space, the output will be truncated.
30  *
31  * You may call mime_encode_as_qp(input, NULL, 0) to find the size of the
32  * buffer you will need.
33  */
34 signed int mime_encode_as_qp(const char *input, char *output, int outlen);
35
36 /* Decode a quoted-printable buffer.
37  *
38  * The input is a null-terminated string encoded as a MIME quoted-printable.
39  * The output is a null-terminated string representing the input decoded.
40  *
41  * Returns a negative error code if the input is not a valid quoted-printable
42  * buffer.
43  * Returns the length of the buffer we would need to do the encoding.
44  * If we don't have enough buffer space, the output will be truncated.
45  *
46  * You may call mime_decode_as_qp(input, NULL, 0) to find the size of the
47  * buffer you will need. The output will never be longer than the input for
48  * this function.
49  */
50 signed int mime_decode_from_qp(const char *input, char *output, int outlen);
51
52 #ifdef __cplusplus
53 }
54 #endif
55
56 #endif