blob: 1b7ba52bcf38edf751c9cd74c52badfb6ef32c27 [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*
2 * Object Identifier definition.
3 */
4#ifndef ASN1_PARSER_OID_H
5#define ASN1_PARSER_OID_H
6
7/********************************
8 * Single Object Identifier Arc *
9 ********************************/
10
11/*
12 * Object identifier arc (one number in the hierarchy).
13 */
14typedef struct asn1p_oid_arc_s {
Lev Walkind21c5052004-09-29 13:18:09 +000015 asn1c_integer_t number; /* -1 if not yet defined */
Lev Walkinf15320b2004-06-03 03:38:44 +000016 char *name; /* 0 if not defined */
17} asn1p_oid_arc_t;
18
19
20/*
21 * Arc constructor.
22 */
23asn1p_oid_arc_t *asn1p_oid_arc_new(
Lev Walkind21c5052004-09-29 13:18:09 +000024 const char *optName, asn1c_integer_t optNumber /* = -1 */);
Lev Walkinf15320b2004-06-03 03:38:44 +000025/*
26 * Arc destructor.
27 */
28void asn1p_oid_arc_free(asn1p_oid_arc_t *);
29
30
31/**************************************************
32 * Object Identifier itself, a collection of arcs *
33 **************************************************/
34
35/*
36 * Object Identifier as a collection of arcs.
37 */
38typedef struct asn1p_oid_s {
39 asn1p_oid_arc_t *arcs;
40 int arcs_count;
41} asn1p_oid_t;
42
43/*
Lev Walkin6b3ff542006-03-06 14:51:00 +000044 * OID constructors.
Lev Walkinf15320b2004-06-03 03:38:44 +000045 */
46asn1p_oid_t *asn1p_oid_new(void);
Lev Walkin6b3ff542006-03-06 14:51:00 +000047asn1p_oid_t *asn1p_oid_construct(asn1p_oid_arc_t *, int narcs);
Lev Walkinf15320b2004-06-03 03:38:44 +000048
49/*
50 * Add another arc using given one as a template
51 */
52int asn1p_oid_add_arc(asn1p_oid_t *, asn1p_oid_arc_t *template);
53
54/*
55 * OID destructor.
56 */
57void asn1p_oid_free(asn1p_oid_t *);
58
59/*
60 * RETURN VALUES:
61 * 0: The specified OIDs are equal.
62 * -1 or 1 otherwise.
63 */
Lev Walkinea6635b2017-08-06 23:23:04 -070064int asn1p_oid_compare(const asn1p_oid_t *a, const asn1p_oid_t *b);
Lev Walkinf15320b2004-06-03 03:38:44 +000065
66
67#endif /* ASN1_PARSER_OID_H */