]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/external/libmar/src/mar_cmdline.h
Add libmar to build update tools to the repo.
[working/Evergreen.git] / Open-ILS / xul / staff_client / external / libmar / src / mar_cmdline.h
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /*
4  * This file is part of Evergreen.
5  *
6  * Evergreen is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published
8  * by the Free Software Foundation, either version 2 of the License,
9  * or (at your option) any later version.
10  *
11  * Evergreen is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Evergreen.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  * This Source Code Form is derived from code that was originally
20  * subject to the terms of the Mozilla Public License, v. 2.0 and
21  * included in Evergreen.  You may, therefore, use this Source Code
22  * Form under the terms of the Mozilla Public License 2.0.  This
23  * licensing option does not affect the larger Evergreen project, only
24  * the Source Code Forms bearing this exception are affected.  If a
25  * copy of the MPL was not distributed with this file, You can obtain
26  * one at http://mozilla.org/MPL/2.0/.
27  */
28
29 #ifndef MAR_CMDLINE_H__
30 #define MAR_CMDLINE_H__
31
32 #include <stdint.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 struct ProductInformationBlock;
39
40 /**
41  * Determines MAR file information.
42  *
43  * @param path                   The path of the MAR file to check.
44  * @param hasSignatureBlock      Optional out parameter specifying if the MAR
45  *                               file has a signature block or not.
46  * @param numSignatures          Optional out parameter for storing the number
47  *                               of signatures in the MAR file.
48  * @param hasAdditionalBlocks    Optional out parameter specifying if the MAR
49  *                               file has additional blocks or not.
50  * @param offsetAdditionalBlocks Optional out parameter for the offset to the 
51  *                               first additional block. Value is only valid if
52  *                               hasAdditionalBlocks is not equal to 0.
53  * @param numAdditionalBlocks    Optional out parameter for the number of
54  *                               additional blocks.  Value is only valid if
55  *                               has_additional_blocks is not equal to 0.
56  * @return 0 on success and non-zero on failure.
57  */
58 int get_mar_file_info(const char *path, 
59                       int *hasSignatureBlock,
60                       uint32_t *numSignatures,
61                       int *hasAdditionalBlocks,
62                       uint32_t *offsetAdditionalBlocks,
63                       uint32_t *numAdditionalBlocks);
64
65 /** 
66  * Reads the product info block from the MAR file's additional block section.
67  * The caller is responsible for freeing the fields in infoBlock
68  * if the return is successful.
69  *
70  * @param infoBlock Out parameter for where to store the result to
71  * @return 0 on success, -1 on failure
72 */
73 int
74 read_product_info_block(char *path, 
75                         struct ProductInformationBlock *infoBlock);
76
77 /** 
78  * Refreshes the product information block with the new information.
79  * The input MAR must not be signed or the function call will fail.
80  * 
81  * @param path             The path to the MAR file whose product info block
82  *                         should be refreshed.
83  * @param infoBlock        Out parameter for where to store the result to
84  * @return 0 on success, -1 on failure
85 */
86 int
87 refresh_product_info_block(const char *path,
88                            struct ProductInformationBlock *infoBlock);
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 #endif  /* MAR_CMDLINE_H__ */