comparison paste.h @ 0:15a06aa20298

misc: initial import
author David Demelier <markand@malikania.fr>
date Tue, 04 Feb 2020 13:35:52 +0100
parents
children 75cfe3795de3
comparison
equal deleted inserted replaced
-1:000000000000 0:15a06aa20298
1 /*
2 * paste.h -- paste definition
3 *
4 * Copyright (c) 2020 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef PASTER_PASTE_H
20 #define PASTER_PASTE_H
21
22 #include <stdbool.h>
23 #include <time.h>
24
25 #define PASTE_HOUR 3600 /*!< Seconds in one hour. */
26 #define PASTE_DAY 86400 /*!< Seconds in one day. */
27 #define PASTE_WEEK 604800 /*!< Seconds in one week. */
28 #define PASTE_MONTH 18144400 /*!< Rounded to 30 days. */
29
30 /**
31 * \brief Paste structure.
32 *
33 * Every string in the paste is assumed to be allocated on the heap.
34 */
35 struct paste {
36 char *uuid;
37 char *title;
38 char *author;
39 char *language;
40 char *code;
41 time_t timestamp;
42 bool visible;
43 long long int duration;
44 };
45
46 void
47 paste_finish(struct paste *paste);
48
49 #endif /* !PASTER_PASTE_H */