Coverage Report

Created: 2026-12-01 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/Botan-3.13.0/build/include/public/botan/oids.h
Line
Count
Source
1
/*
2
* OID Registry
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_OIDS_H_
9
#define BOTAN_OIDS_H_
10
11
#include <botan/asn1_obj.h>
12
13
BOTAN_DEPRECATED_HEADER("oids.h")
14
15
namespace Botan::OIDS {
16
17
/**
18
* Register an OID to string mapping.
19
* @param oid the oid to register
20
* @param name the name to be associated with the oid
21
*/
22
0
BOTAN_DEPRECATED("Use OID::register_oid") inline void add_oid(const OID& oid, std::string_view name) {
23
0
   OID::register_oid(oid, name);
24
0
}
25
26
/**
27
* Register an OID to string mapping.
28
* @param oid the oid to register
29
* @param name the name to be associated with the oid
30
*/
31
BOTAN_DEPRECATED("Use OID::register_oid") BOTAN_UNSTABLE_API void add_oid2str(const OID& oid, std::string_view name);
32
33
/**
34
* Register a string to OID mapping.
35
* @param oid the oid to register
36
* @param name the name to be associated with the oid
37
*/
38
BOTAN_DEPRECATED("Use OID::register_oid") BOTAN_UNSTABLE_API void add_str2oid(const OID& oid, std::string_view name);
39
40
/**
41
* Register an OID to string mapping.
42
* @param oidstr the oid to register, as a dotted decimal string
43
* @param name the name to be associated with the oid
44
*/
45
0
BOTAN_DEPRECATED("Use OID::register_oid") inline void add_oidstr(const char* oidstr, const char* name) {
46
0
   OID::register_oid(OID(oidstr), name);
47
0
}
48
49
/**
50
* Resolve an OID
51
* @param oid the OID to look up
52
* @return name associated with this OID, or an empty string
53
*/
54
0
BOTAN_DEPRECATED("Use OID::registered_name") inline std::string oid2str_or_empty(const OID& oid) {
55
0
   return oid.registered_name().value_or("");
56
0
}
57
58
/**
59
* Find the OID to a name. The lookup will be performed in the
60
* general OID section of the configuration.
61
* @param name the name to resolve
62
* @return OID associated with the specified name
63
*/
64
0
BOTAN_DEPRECATED("Use OID::from_name") inline OID str2oid_or_empty(std::string_view name) {
65
0
   return OID::from_name(name).value_or(OID());
66
0
}
67
68
/**
69
* Resolve an OID
70
* @param oid the OID to look up
71
* @return name associated with this OID
72
* @throws Lookup_Error if the OID is not registered
73
*/
74
0
BOTAN_DEPRECATED("Use OID::registered_name") inline std::string oid2str_or_throw(const OID& oid) {
75
0
   if(const auto name = oid.registered_name()) {
76
0
      return *name;
77
0
   } else {
78
0
      throw Lookup_Error("No name associated with OID " + oid.to_string());
79
0
   }
80
0
}
81
82
/**
83
* Resolve an OID
84
* @param oid the OID to look up
85
* @return name associated with this OID, or an empty string
86
*/
87
0
BOTAN_DEPRECATED("Use OID::registered_name") inline std::string lookup(const OID& oid) {
88
0
   return oid.human_name_or_empty();
89
0
}
90
91
/**
92
* Find the OID associated with a name
93
* @param name the name to resolve
94
* @return OID associated with the specified name, or an empty OID
95
*/
96
0
BOTAN_DEPRECATED("Use OID::from_name") inline OID lookup(std::string_view name) {
97
0
   return OID::from_name(name).value_or(OID());
98
0
}
99
100
}  // namespace Botan::OIDS
101
102
#endif