Implement sepolicy section in compatibility-matrix.
* kernel-sepolicy-version will be checked against
security_policyvers().
* sepolicy-version is not yet defined; put a placeholder
entry so that it parses the compatibility matrix XML
file correctly.
Test: libvintf_test
Change-Id: I41f69623728deedd00c511e6b99f43697c9eeda8
diff --git a/parse_string.cpp b/parse_string.cpp
index abeeb06..fae395d 100644
--- a/parse_string.cpp
+++ b/parse_string.cpp
@@ -320,6 +320,33 @@
<< (req.optional ? kOptional : kRequired);
}
+
+std::ostream &operator<<(std::ostream &os, KernelSepolicyVersion ksv){
+ return os << ksv.value;
+}
+
+bool parse(const std::string &s, KernelSepolicyVersion *ksv){
+ return ParseUint(s, &ksv->value);
+}
+
+std::ostream &operator<<(std::ostream &os, const SepolicyVersion &sv){
+ return os << sv.minVer << "-" << sv.maxVer;
+}
+
+bool parse(const std::string &s, SepolicyVersion *sv){
+ std::vector<std::string> v = SplitString(s, '-');
+ if (v.size() != 2) {
+ return false;
+ }
+ if (!ParseUint(v[0], &sv->minVer)) {
+ return false;
+ }
+ if (!ParseUint(v[1], &sv->maxVer)) {
+ return false;
+ }
+ return true;
+}
+
std::string dump(const VendorManifest &vm) {
std::ostringstream oss;
bool first = true;