Commit d6db8028 authored by Lev Walkin's avatar Lev Walkin

better OID printing

parent d7f237b8
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
} while(0) } while(0)
static int asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags); static int asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags);
static int asn1print_oid(asn1p_oid_t *oid, enum asn1print_flags flags); static int asn1print_oid(int prior_len, asn1p_oid_t *oid, enum asn1print_flags flags);
static int asn1print_ref(asn1p_ref_t *ref, enum asn1print_flags flags); static int asn1print_ref(asn1p_ref_t *ref, enum asn1print_flags flags);
static int asn1print_tag(asn1p_expr_t *tc, enum asn1print_flags flags); static int asn1print_tag(asn1p_expr_t *tc, enum asn1print_flags flags);
static int asn1print_params(asn1p_paramlist_t *pl,enum asn1print_flags flags); static int asn1print_params(asn1p_paramlist_t *pl,enum asn1print_flags flags);
...@@ -67,7 +67,7 @@ asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags) ...@@ -67,7 +67,7 @@ asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags)
printf("%s ", mod->Identifier); printf("%s ", mod->Identifier);
if(mod->module_oid) { if(mod->module_oid) {
asn1print_oid(mod->module_oid, flags); asn1print_oid(strlen(mod->Identifier), mod->module_oid, flags);
printf("\n"); printf("\n");
} }
...@@ -116,8 +116,8 @@ asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags) ...@@ -116,8 +116,8 @@ asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags)
} }
static int static int
asn1print_oid(asn1p_oid_t *oid, enum asn1print_flags flags) { asn1print_oid(int prior_len, asn1p_oid_t *oid, enum asn1print_flags flags) {
size_t accum = 0; size_t accum = prior_len;
int ac; int ac;
(void)flags; /* Unused argument */ (void)flags; /* Unused argument */
...@@ -126,23 +126,22 @@ asn1print_oid(asn1p_oid_t *oid, enum asn1print_flags flags) { ...@@ -126,23 +126,22 @@ asn1print_oid(asn1p_oid_t *oid, enum asn1print_flags flags) {
for(ac = 0; ac < oid->arcs_count; ac++) { for(ac = 0; ac < oid->arcs_count; ac++) {
const char *arcname = oid->arcs[ac].name; const char *arcname = oid->arcs[ac].name;
if(accum + strlen(arcname ? arcname : "") > 50) { if(accum + strlen(arcname ? arcname : "") > 75) {
printf("\n\t"); printf("\n\t");
accum = 0; accum = 0;
} else if(ac) { } else {
printf(" "); accum += printf(" ");
} }
if(arcname) { if(arcname) {
printf("%s", arcname); accum += printf("%s", arcname);
if(oid->arcs[ac].number >= 0) { if(oid->arcs[ac].number >= 0) {
printf("(%" PRIdASN ")", oid->arcs[ac].number); accum += printf("(%" PRIdASN ")",
oid->arcs[ac].number);
} }
accum += strlen(oid->arcs[ac].name);
} else { } else {
printf("%" PRIdASN, oid->arcs[ac].number); accum += printf("%" PRIdASN, oid->arcs[ac].number);
} }
accum += 4;
} }
printf(" }"); printf(" }");
......
ModuleTestEnum2 {iso org(3) dod(6) internet(1) private(4) ModuleTestEnum2 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 4 }
4 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
......
ModuleTestInt1 {iso org(3) dod(6) internet(1) private(4) ModuleTestInt1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) software(1) asn1c(5) test(1) 7 }
7 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
......
ModuleTestResolver2 {iso org(3) dod(6) internet(1) private(4) ModuleTestResolver2 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 14 1 }
14 1 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
...@@ -19,9 +18,8 @@ check-other INTEGER ::= 1 ...@@ -19,9 +18,8 @@ check-other INTEGER ::= 1
END END
ModuleTestResolver3 {iso org(3) dod(6) internet(1) private(4) ModuleTestResolver3 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 14 2 }
14 2 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
...@@ -34,9 +32,8 @@ Enumeration ::= ENUMERATED { ...@@ -34,9 +32,8 @@ Enumeration ::= ENUMERATED {
END END
HiddenModule {iso org(3) dod(6) internet(1) private(4) HiddenModule { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) software(1) asn1c(5) test(1) 14 3 }
14 3 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
......
ModuleTestConstraint {iso org(3) dod(6) internet(1) private(4) ModuleTestConstraint { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 16 }
16 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
......
ModuleTestParam {iso org(3) dod(6) internet(1) private(4) ModuleTestParam { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 19 }
19 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
......
ModuleTestConstr {iso org(3) dod(6) internet(1) private(4) ModuleTestConstr { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 20 }
20 }
DEFINITIONS IMPLICIT TAGS EXTENSIBILITY IMPLIED ::= DEFINITIONS IMPLICIT TAGS EXTENSIBILITY IMPLIED ::=
BEGIN BEGIN
......
ModuleTestTags1 {iso org(3) dod(6) internet(1) private(4) ModuleTestTags1 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 21 1 }
21 1 }
DEFINITIONS EXPLICIT TAGS ::= DEFINITIONS EXPLICIT TAGS ::=
BEGIN BEGIN
...@@ -11,9 +10,8 @@ T1 ::= CHOICE { ...@@ -11,9 +10,8 @@ T1 ::= CHOICE {
END END
ModuleTestTags2 {iso org(3) dod(6) internet(1) private(4) ModuleTestTags2 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 21 2 }
21 2 }
DEFINITIONS IMPLICIT TAGS ::= DEFINITIONS IMPLICIT TAGS ::=
BEGIN BEGIN
......
ModuleTestTags3 {iso org(3) dod(6) internet(1) private(4) ModuleTestTags3 { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 22 }
22 }
DEFINITIONS AUTOMATIC TAGS ::= DEFINITIONS AUTOMATIC TAGS ::=
BEGIN BEGIN
......
ModuleTestBitString {iso org(3) dod(6) internet(1) private(4) ModuleTestBitString { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 23 }
23 }
DEFINITIONS AUTOMATIC TAGS ::= DEFINITIONS AUTOMATIC TAGS ::=
BEGIN BEGIN
......
ModuleTestSequence {iso org(3) dod(6) internet(1) private(4) ModuleTestSequence { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 24 }
24 }
DEFINITIONS IMPLICIT TAGS ::= DEFINITIONS IMPLICIT TAGS ::=
BEGIN BEGIN
......
ModuleTestSetOfSimple {iso org(3) dod(6) internet(1) private(4) ModuleTestSetOfSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 31 }
31 }
DEFINITIONS IMPLICIT TAGS ::= DEFINITIONS IMPLICIT TAGS ::=
BEGIN BEGIN
......
ModuleTestSequenceSimple {iso org(3) dod(6) internet(1) private(4) ModuleTestSequenceSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 32 }
32 }
DEFINITIONS IMPLICIT TAGS ::= DEFINITIONS IMPLICIT TAGS ::=
BEGIN BEGIN
......
ModuleTestClassSimple {iso org(3) dod(6) internet(1) private(4) ModuleTestClassSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 34 }
34 }
DEFINITIONS IMPLICIT TAGS ::= DEFINITIONS IMPLICIT TAGS ::=
BEGIN BEGIN
......
ModuleTestIndirectChoiceFine {iso org(3) dod(6) internet(1) private(4) ModuleTestIndirectChoiceFine { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 37 }
37 }
DEFINITIONS IMPLICIT TAGS ::= DEFINITIONS IMPLICIT TAGS ::=
BEGIN BEGIN
......
ModuleLAPStorage {iso org(3) dod(6) internet(1) private(4) ModuleLAPStorage { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 42 }
42 }
DEFINITIONS EXTENSIBILITY IMPLIED ::= DEFINITIONS EXTENSIBILITY IMPLIED ::=
BEGIN BEGIN
......
ModuleKnownExternType {iso org(3) dod(6) internet(1) private(4) ModuleKnownExternType { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 45 }
45 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
......
ModuleSetChoiceExtensibility {iso org(3) dod(6) internet(1) private(4) ModuleSetChoiceExtensibility { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 49 }
49 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
......
ModuleTestComponentsOf {iso org(3) dod(6) internet(1) private(4) ModuleTestComponentsOf { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 55 }
55 }
DEFINITIONS AUTOMATIC TAGS ::= DEFINITIONS AUTOMATIC TAGS ::=
BEGIN BEGIN
......
ModuleTestParam {iso org(3) dod(6) internet(1) private(4) ModuleTestParam { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 58 }
58 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
......
ModuleTestANY {iso org(3) dod(6) internet(1) private(4) ModuleTestANY { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) software(1) asn1c(5) test(1) 60 }
60 }
DEFINITIONS IMPLICIT TAGS ::= DEFINITIONS IMPLICIT TAGS ::=
BEGIN BEGIN
......
ModuleTestANYSyntax {iso org(3) dod(6) internet(1) private(4) ModuleTestANYSyntax { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 62 }
62 }
DEFINITIONS IMPLICIT TAGS ::= DEFINITIONS IMPLICIT TAGS ::=
BEGIN BEGIN
......
ModuleTestXERDecoding {iso org(3) dod(6) internet(1) private(4) ModuleTestXERDecoding { iso org(3) dod(6) internet(1) private(4) enterprise(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) spelio(9363) software(1) asn1c(5) test(1) 70 }
70 }
DEFINITIONS AUTOMATIC TAGS ::= DEFINITIONS AUTOMATIC TAGS ::=
BEGIN BEGIN
......
ModuleTestIntegerAndEnumeratedConstraints {iso org(3) dod(6) internet(1) private(4) ModuleTestIntegerAndEnumeratedConstraints { iso org(3) dod(6) internet(1)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 74 }
74 }
DEFINITIONS ::= DEFINITIONS ::=
BEGIN BEGIN
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment