diff options
Diffstat (limited to 'src/daemon/https/minitasn1/structure.c')
-rw-r--r-- | src/daemon/https/minitasn1/structure.c | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/src/daemon/https/minitasn1/structure.c b/src/daemon/https/minitasn1/structure.c index e0abe594..fdaeea47 100644 --- a/src/daemon/https/minitasn1/structure.c +++ b/src/daemon/https/minitasn1/structure.c | |||
@@ -583,107 +583,3 @@ MHD__asn1_create_element (ASN1_TYPE definitions, const char *source_name, | |||
583 | 583 | ||
584 | return res; | 584 | return res; |
585 | } | 585 | } |
586 | |||
587 | |||
588 | /** | ||
589 | * MHD__asn1_number_of_elements - Counts the number of elements of a structure. | ||
590 | * @element: pointer to the root of an ASN1 structure. | ||
591 | * @name: the name of a sub-structure of ROOT. | ||
592 | * @num: pointer to an integer where the result will be stored | ||
593 | * | ||
594 | * Counts the number of elements of a sub-structure called NAME with | ||
595 | * names equal to "?1","?2", ... | ||
596 | * | ||
597 | * Returns: | ||
598 | * | ||
599 | * ASN1_SUCCESS: Creation OK. | ||
600 | * | ||
601 | * ASN1_ELEMENT_NOT_FOUND: NAME isn't known. | ||
602 | * | ||
603 | * ASN1_GENERIC_ERROR: Pointer num equal to NULL. | ||
604 | * | ||
605 | **/ | ||
606 | MHD__asn1_retCode | ||
607 | MHD__asn1_number_of_elements (ASN1_TYPE element, const char *name, int *num) | ||
608 | { | ||
609 | node_asn *node, *p; | ||
610 | |||
611 | if (num == NULL) | ||
612 | return ASN1_GENERIC_ERROR; | ||
613 | |||
614 | *num = 0; | ||
615 | |||
616 | node = MHD__asn1_find_node (element, name); | ||
617 | if (node == NULL) | ||
618 | return ASN1_ELEMENT_NOT_FOUND; | ||
619 | |||
620 | p = node->down; | ||
621 | |||
622 | while (p) | ||
623 | { | ||
624 | if ((p->name) && (p->name[0] == '?')) | ||
625 | (*num)++; | ||
626 | p = p->right; | ||
627 | } | ||
628 | |||
629 | return ASN1_SUCCESS; | ||
630 | } | ||
631 | |||
632 | |||
633 | /** | ||
634 | * MHD__asn1_find_structure_from_oid - Locate structure defined by a specific OID. | ||
635 | * @definitions: ASN1 definitions | ||
636 | * @oidValue: value of the OID to search (e.g. "1.2.3.4"). | ||
637 | * | ||
638 | * Search the structure that is defined just after an OID definition. | ||
639 | * | ||
640 | * Returns: NULL when OIDVALUE not found, otherwise the pointer to a | ||
641 | * constant string that contains the element name defined just | ||
642 | * after the OID. | ||
643 | * | ||
644 | **/ | ||
645 | const char * | ||
646 | MHD__asn1_find_structure_from_oid (ASN1_TYPE definitions, | ||
647 | const char *oidValue) | ||
648 | { | ||
649 | char definitionsName[MAX_NAME_SIZE], name[2 * MAX_NAME_SIZE + 1]; | ||
650 | char value[MAX_NAME_SIZE]; | ||
651 | ASN1_TYPE p; | ||
652 | int len; | ||
653 | MHD__asn1_retCode result; | ||
654 | |||
655 | if ((definitions == ASN1_TYPE_EMPTY) || (oidValue == NULL)) | ||
656 | return NULL; /* ASN1_ELEMENT_NOT_FOUND; */ | ||
657 | |||
658 | |||
659 | strcpy (definitionsName, definitions->name); | ||
660 | strcat (definitionsName, "."); | ||
661 | |||
662 | /* search the OBJECT_ID into definitions */ | ||
663 | p = definitions->down; | ||
664 | while (p) | ||
665 | { | ||
666 | if ((type_field (p->type) == TYPE_OBJECT_ID) && | ||
667 | (p->type & CONST_ASSIGN)) | ||
668 | { | ||
669 | strcpy (name, definitionsName); | ||
670 | strcat (name, p->name); | ||
671 | |||
672 | len = MAX_NAME_SIZE; | ||
673 | result = MHD__asn1_read_value (definitions, name, value, &len); | ||
674 | |||
675 | if ((result == ASN1_SUCCESS) && (!strcmp (oidValue, value))) | ||
676 | { | ||
677 | p = p->right; | ||
678 | if (p == NULL) /* reach the end of ASN1 definitions */ | ||
679 | return NULL; /* ASN1_ELEMENT_NOT_FOUND; */ | ||
680 | |||
681 | return p->name; | ||
682 | } | ||
683 | } | ||
684 | p = p->right; | ||
685 | } | ||
686 | |||
687 | return NULL; /* ASN1_ELEMENT_NOT_FOUND; */ | ||
688 | } | ||
689 | |||