@@ -36,16 +36,28 @@ namespace nmbs
3636{
3737 namespace binding
3838 {
39+ // / Holder for nmbs internal metadata. This data is not part of the ADatP-4778
40+ // / standard.
41+ struct InternalMetadata
42+ {
43+ // / @brief Set when reading bindings.
44+ std::optional<std::string> binding_profile;
45+ };
46+
3947 struct DataReference
4048 {
4149 std::string uri;
4250 std::optional<std::string> content_type;
4351 };
4452
53+ // / @brief The structure representing the XML Binding structure.
54+ // / @details This is not a pure representation, the deserialization will also
55+ // / store some metadata.
4556 struct BindingInformation
4657 {
4758 std::vector<ConfidentialityLabel> labels;
4859 DataReference reference;
60+ InternalMetadata internal_metadata;
4961 };
5062
5163 // / @brief XML namespace defined by ADatP‑4774 Ed. A, Ver. 1.
@@ -112,8 +124,23 @@ namespace nmbs
112124 return binding_flags & check;
113125 }
114126
127+ // / @brief Detects the Read and Write possibilities of the path for the current user.
128+ // / @param path
129+ // / @return flags with bits set for read or write.
115130 [[nodiscard]] AccessMode access_mode_filesystem (const std::filesystem::path& path);
116131
132+ // / @brief Reads the full ADatP-4778 binding from the file.
133+ // / @details Returns the full deserialised object. Note that if multiple bindings are present, only one will be
134+ // / returned and the precedence is not defined.
135+ // / @param path to the file
136+ // / @param binding_support flags if already known. The presence of this parameter will save CPU cycles in
137+ // / determining the available binding method for the file. Use manually, or via nmbs::binding::support.
138+ // / @return the raw XML of the stored binding.
139+ // / @since 1.0.0
140+ [[nodiscard]] Expected<std::optional<BindingInformation>> read_binding (
141+ const std::filesystem::path& path,
142+ std::optional<ProfileSupport> binding_support = std::nullopt );
143+
117144 namespace xmp
118145 {
119146 inline constexpr std::string_view profile_canonical_identifier = " urn:nato:stanag:4778:profile:xmp" ;
@@ -240,6 +267,10 @@ namespace nmbs
240267
241268 namespace xml
242269 {
270+ inline constexpr std::string_view profile_canonical_identifier = " urn:nato:stanag:4778:profile:xml:schema" ;
271+
272+ inline constexpr std::string_view profile_version_identifier = " urn:nato:stanag:4778:profile:xml:schema:1:0" ;
273+
243274 [[nodiscard]] AccessMode access_mode (const std::filesystem::path& path);
244275
245276 [[nodiscard]] std::expected<BindingInformation, Error> read (const std::filesystem::path& path);
0 commit comments