aboutsummaryrefslogtreecommitdiffstats
path: root/src/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/asn1')
-rw-r--r--src/asn1/asn1_oid.h72
1 files changed, 58 insertions, 14 deletions
diff --git a/src/asn1/asn1_oid.h b/src/asn1/asn1_oid.h
index 73d0079a8..3802c69b6 100644
--- a/src/asn1/asn1_oid.h
+++ b/src/asn1/asn1_oid.h
@@ -12,38 +12,82 @@
namespace Botan {
-/*************************************************
-* ASN.1 Object Identifier *
-*************************************************/
+/**
+* This class represents ASN.1 object identifiers.
+*/
class BOTAN_DLL OID : public ASN1_Object
{
public:
void encode_into(class DER_Encoder&) const;
void decode_from(class BER_Decoder&);
+ /**
+ * Find out whether this OID is empty
+ * @return true is no OID value is set
+ */
bool is_empty() const { return id.size() == 0; }
+
+ /**
+ * Get this OID as list (vector) of its components.
+ * @return a vector representing this OID
+ */
std::vector<u32bit> get_id() const { return id; }
+
+ /**
+ * Get this OID as a string
+ * @return a string representing this OID
+ */
std::string as_string() const;
+ /**
+ * Compare two OIDs.
+ * @return true if they are equal, false otherwise
+ */
bool operator==(const OID&) const;
+
+ /**
+ * Reset this instance to an empty OID.
+ */
void clear();
- OID& operator+=(u32bit);
- OID(const std::string& = "");
+ /**
+ * Add a component to this OID.
+ * @param new_comp the new component to add to the end of this OID
+ * @return a reference to *this
+ */
+ OID& operator+=(u32bit new_comp);
+
+ /**
+ * Construct an OID from a string.
+ * @param str a string in the form "a.b.c" etc., where a,b,c are numbers
+ */
+ OID(const std::string& str = "");
private:
std::vector<u32bit> id;
};
-/*************************************************
-* Append another component onto the OID *
-*************************************************/
-OID BOTAN_DLL operator+(const OID&, u32bit);
+/**
+* Append another component onto the OID.
+* @param oid the OID to add the new component to
+* @param new_comp the new component to add
+*/
+OID operator+(const OID& oid, u32bit new_comp);
-/*************************************************
-* Compare two OIDs *
-*************************************************/
-bool BOTAN_DLL operator!=(const OID&, const OID&);
-bool BOTAN_DLL operator<(const OID&, const OID&);
+/**
+* Compare two OIDs.
+* @param a the first OID
+* @param b the second OID
+* @return true if a is not equal to b
+*/
+bool operator!=(const OID& a, const OID& b);
+
+/**
+* Compare two OIDs.
+* @param a the first OID
+* @param b the second OID
+* @return true if a is lexicographically smaller than b
+*/
+bool operator<(const OID& a, const OID& b);
}