Implemented PTS attributes Request File Metadata, Unix-Style File Metadata
[strongswan.git] / src / libpts / pts / pts_file_meta.h
1 /*
2 * Copyright (C) 2011 Sansar Choinyambuu
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup pts_file_meta pts_file_meta
18 * @{ @ingroup pts
19 */
20
21 #ifndef PTS_FILE_META_H_
22 #define PTS_FILE_META_H_
23
24 #include "pts_file_type.h"
25
26 #include <time.h>
27 #include <library.h>
28
29 typedef struct pts_file_meta_t pts_file_meta_t;
30 typedef struct pts_file_metadata_t pts_file_metadata_t;
31
32 /* Without filename field included */
33 #define PTS_FILE_METADATA_SIZE 52
34
35 /**
36 * Structure holding file metadata
37 */
38 struct pts_file_metadata_t {
39 u_int16_t meta_length;
40 pts_file_type_t type;
41 u_int64_t filesize;
42 time_t create_time;
43 time_t last_modify_time;
44 time_t last_access_time;
45 u_int64_t owner_id;
46 u_int64_t group_id;
47 char *filename;
48 };
49
50 /**
51 * Class storing PTS File Metadata
52 */
53 struct pts_file_meta_t {
54
55 /**
56 * Get the number of files
57 *
58 * @return Number of files
59 */
60 int (*get_file_count)(pts_file_meta_t *this);
61
62 /**
63 * Add a PTS File Metadata
64 *
65 * @param filename Name of measured file or directory
66 * @param metadata File metadata
67 */
68 void (*add)(pts_file_meta_t *this, char *filename, pts_file_type_t type,
69 u_int64_t filesize, time_t create_time, time_t last_modfy_time, time_t last_access_time,
70 u_int64_t owner_id, u_int64_t group_id);
71
72 /**
73 * Create a PTS File Metadata enumerator
74 *
75 * @return Enumerator returning file metadata
76 */
77 enumerator_t* (*create_enumerator)(pts_file_meta_t *this);
78
79 /**
80 * Destroys a pts_file_meta_t object.
81 */
82 void (*destroy)(pts_file_meta_t *this);
83
84 };
85
86 /**
87 * Creates a pts_file_meta_t object
88 */
89 pts_file_meta_t* pts_file_meta_create();
90
91 #endif /** PTS_FILE_MEAS_H_ @}*/