1 /*
2    BAREOS® - Backup Archiving REcovery Open Sourced
3 
4    Copyright (C) 2003-2010 Free Software Foundation Europe e.V.
5    Copyright (C) 2016-2018 Bareos GmbH & Co. KG
6 
7    This program is Free Software; you can redistribute it and/or
8    modify it under the terms of version three of the GNU Affero General Public
9    License as published by the Free Software Foundation and included
10    in the file LICENSE.
11 
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15    Affero General Public License for more details.
16 
17    You should have received a copy of the GNU Affero General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20    02110-1301, USA.
21 */
22 /*
23  * Kern Sibbald, June MMIII
24  */
25 /**
26  * @file
27  * Definition of attributes packet for unpacking from tape
28  */
29 
30 #ifndef BAREOS_LIB_ATTR_H_
31 #define BAREOS_LIB_ATTR_H_ 1
32 
33 
34 struct Attributes {
35   int32_t stream;      /**< attribute stream id */
36   int32_t data_stream; /**< id of data stream to follow */
37   int32_t type;        /**< file type FT */
38   int32_t file_index;  /**< file index */
39   int32_t LinkFI;      /**< file index to data if hard link */
40   int32_t delta_seq;   /**< delta sequence numbr */
41   uid_t uid;           /**< userid */
42   struct stat statp;   /**< decoded stat packet */
43   POOLMEM* attrEx;     /**< extended attributes if any */
44   POOLMEM* ofname;     /**< output filename */
45   POOLMEM* olname;     /**< output link name */
46   /*
47    * Note the following three variables point into the
48    *  current BareosSocket record, so they are invalid after
49    *  the next socket read!
50    */
51   char* attr;            /**< attributes position */
52   char* fname;           /**< filename */
53   char* lname;           /**< link name if any */
54   JobControlRecord* jcr; /**< jcr pointer */
55 };
56 
57 Attributes* new_attr(JobControlRecord* jcr);
58 void FreeAttr(Attributes* attr);
59 int UnpackAttributesRecord(JobControlRecord* jcr,
60                            int32_t stream,
61                            char* rec,
62                            int32_t reclen,
63                            Attributes* attr);
64 void BuildAttrOutputFnames(JobControlRecord* jcr, Attributes* attr);
65 const char* attr_to_str(PoolMem& resultbuffer,
66                         JobControlRecord* jcr,
67                         Attributes* attr);
68 void PrintLsOutput(JobControlRecord* jcr, Attributes* attr);
69 
70 #endif /* BAREOS_LIB_ATTR_H_ */
71