From: Alberto Leiva Popper Date: Wed, 22 May 2024 01:25:33 +0000 (-0600) Subject: Straighten up #includes X-Git-Tag: 1.6.2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fe44a003a1633c3de42a150c1eaeb06027a4c395;p=thirdparty%2FFORT-validator.git Straighten up #includes Also, remove cyclical #includes, to further automate this. --- diff --git a/src/algorithm.h b/src/algorithm.h index a7a7e062..322e09f9 100644 --- a/src/algorithm.h +++ b/src/algorithm.h @@ -2,6 +2,7 @@ #define SRC_ALGORITHM_H_ #include + #include "asn1/asn1c/AlgorithmIdentifier.h" #include "asn1/asn1c/OBJECT_IDENTIFIER.h" diff --git a/src/asn1/asn1c/ANY.c b/src/asn1/asn1c/ANY.c index 8edaa8e9..3c0e10bd 100644 --- a/src/asn1/asn1c/ANY.c +++ b/src/asn1/asn1c/ANY.c @@ -2,11 +2,17 @@ * Copyright (c) 2004-2017 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/ANY.h" + #include #include +#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/ber_decoder.h" +#include "asn1/asn1c/der_encoder.h" +#include "asn1/asn1c/json_encoder.h" +#include "asn1/asn1c/xer_encoder.h" + asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs = { sizeof(ANY_t), offsetof(ANY_t, _asn_ctx), @@ -43,7 +49,7 @@ asn_TYPE_descriptor_t asn_DEF_ANY = { asn_enc_rval_t ANY_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, + int flags, asn_app_consume_bytes_f *cb, void *app_key) { if(flags & XER_F_CANONICAL) { /* diff --git a/src/asn1/asn1c/ANY.h b/src/asn1/asn1c/ANY.h index 01c7d41b..462ddb75 100644 --- a/src/asn1/asn1c/ANY.h +++ b/src/asn1/asn1c/ANY.h @@ -5,7 +5,8 @@ #ifndef ASN_TYPE_ANY_H #define ASN_TYPE_ANY_H -#include "asn1/asn1c/OCTET_STRING.h" /* Implemented via OCTET STRING type */ +#include "asn1/asn1c/OCTET_STRING.h" +#include "asn1/asn1c/constraints.h" typedef struct ANY { uint8_t *buf; /* BER-encoded ANY contents */ diff --git a/src/asn1/asn1c/ASId.h b/src/asn1/asn1c/ASId.h index eb03c848..1355d95f 100644 --- a/src/asn1/asn1c/ASId.h +++ b/src/asn1/asn1c/ASId.h @@ -8,11 +8,8 @@ #ifndef _ASId_H_ #define _ASId_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/INTEGER.h" +#include "asn1/asn1c/constr_TYPE.h" /* ASId */ typedef INTEGER_t ASId_t; @@ -27,4 +24,3 @@ der_type_encoder_f ASId_encode_der; xer_type_encoder_f ASId_encode_xer; #endif /* _ASId_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/ASIdOrRange.h b/src/asn1/asn1c/ASIdOrRange.h index 87f3dee3..2f47e307 100644 --- a/src/asn1/asn1c/ASIdOrRange.h +++ b/src/asn1/asn1c/ASIdOrRange.h @@ -8,13 +8,10 @@ #ifndef _ASIdOrRange_H_ #define _ASIdOrRange_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/ASId.h" #include "asn1/asn1c/ASRange.h" #include "asn1/asn1c/constr_CHOICE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Dependencies */ typedef enum ASIdOrRange_PR { @@ -41,4 +38,3 @@ extern asn_CHOICE_specifics_t asn_SPC_ASIdOrRange_specs_1; extern asn_TYPE_member_t asn_MBR_ASIdOrRange_1[2]; #endif /* _ASIdOrRange_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/ASIdentifierChoice.h b/src/asn1/asn1c/ASIdentifierChoice.h index 1f5d7875..1c66f74b 100644 --- a/src/asn1/asn1c/ASIdentifierChoice.h +++ b/src/asn1/asn1c/ASIdentifierChoice.h @@ -8,14 +8,12 @@ #ifndef _ASIdentifierChoice_H_ #define _ASIdentifierChoice_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/ASIdOrRange.h" #include "asn1/asn1c/NULL.h" #include "asn1/asn1c/asn_SEQUENCE_OF.h" -#include "asn1/asn1c/constr_SEQUENCE_OF.h" #include "asn1/asn1c/constr_CHOICE.h" +#include "asn1/asn1c/constr_SEQUENCE_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Dependencies */ typedef enum ASIdentifierChoice_PR { @@ -49,8 +47,4 @@ extern asn_TYPE_descriptor_t asn_DEF_ASIdentifierChoice; extern asn_CHOICE_specifics_t asn_SPC_ASIdentifierChoice_specs_1; extern asn_TYPE_member_t asn_MBR_ASIdentifierChoice_1[2]; -/* Referred external types */ -#include "asn1/asn1c/ASIdOrRange.h" - #endif /* _ASIdentifierChoice_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/ASIdentifiers.h b/src/asn1/asn1c/ASIdentifiers.h index bf64f35c..5c17193d 100644 --- a/src/asn1/asn1c/ASIdentifiers.h +++ b/src/asn1/asn1c/ASIdentifiers.h @@ -8,11 +8,9 @@ #ifndef _ASIdentifiers_H_ #define _ASIdentifiers_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/ASIdentifierChoice.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct ASIdentifierChoice; @@ -29,8 +27,4 @@ typedef struct ASIdentifiers { /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_ASIdentifiers; -/* Referred external types */ -#include "asn1/asn1c/ASIdentifierChoice.h" - #endif /* _ASIdentifiers_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/ASRange.h b/src/asn1/asn1c/ASRange.h index ac25726f..99e14d13 100644 --- a/src/asn1/asn1c/ASRange.h +++ b/src/asn1/asn1c/ASRange.h @@ -8,12 +8,9 @@ #ifndef _ASRange_H_ #define _ASRange_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/ASId.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* ASRange */ typedef struct ASRange { @@ -30,4 +27,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_ASRange_specs_1; extern asn_TYPE_member_t asn_MBR_ASRange_1[2]; #endif /* _ASRange_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/AlgorithmIdentifier.h b/src/asn1/asn1c/AlgorithmIdentifier.h index bc40e960..08bd7e9a 100644 --- a/src/asn1/asn1c/AlgorithmIdentifier.h +++ b/src/asn1/asn1c/AlgorithmIdentifier.h @@ -8,13 +8,10 @@ #ifndef _AlgorithmIdentifier_H_ #define _AlgorithmIdentifier_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include "asn1/asn1c/ANY.h" +#include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* AlgorithmIdentifier */ typedef struct AlgorithmIdentifier { @@ -31,4 +28,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_AlgorithmIdentifier_specs_1; extern asn_TYPE_member_t asn_MBR_AlgorithmIdentifier_1[2]; #endif /* _AlgorithmIdentifier_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/AttributeType.h b/src/asn1/asn1c/AttributeType.h index 8552996e..99881aeb 100644 --- a/src/asn1/asn1c/AttributeType.h +++ b/src/asn1/asn1c/AttributeType.h @@ -8,11 +8,8 @@ #ifndef _AttributeType_H_ #define _AttributeType_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/OBJECT_IDENTIFIER.h" +#include "asn1/asn1c/constr_TYPE.h" /* AttributeType */ typedef OBJECT_IDENTIFIER_t AttributeType_t; @@ -27,4 +24,3 @@ der_type_encoder_f AttributeType_encode_der; xer_type_encoder_f AttributeType_encode_xer; #endif /* _AttributeType_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/AttributeTypeAndValue.h b/src/asn1/asn1c/AttributeTypeAndValue.h index 8c21acca..7de860b3 100644 --- a/src/asn1/asn1c/AttributeTypeAndValue.h +++ b/src/asn1/asn1c/AttributeTypeAndValue.h @@ -8,13 +8,10 @@ #ifndef _AttributeTypeAndValue_H_ #define _AttributeTypeAndValue_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/AttributeType.h" #include "asn1/asn1c/AttributeValue.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* AttributeTypeAndValue */ typedef struct AttributeTypeAndValue { @@ -31,4 +28,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_AttributeTypeAndValue_specs_1; extern asn_TYPE_member_t asn_MBR_AttributeTypeAndValue_1[2]; #endif /* _AttributeTypeAndValue_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/AttributeValue.h b/src/asn1/asn1c/AttributeValue.h index d9462dc8..81f0b07f 100644 --- a/src/asn1/asn1c/AttributeValue.h +++ b/src/asn1/asn1c/AttributeValue.h @@ -8,11 +8,8 @@ #ifndef _AttributeValue_H_ #define _AttributeValue_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/ANY.h" +#include "asn1/asn1c/constr_TYPE.h" /* AttributeValue */ typedef ANY_t AttributeValue_t; @@ -27,4 +24,3 @@ der_type_encoder_f AttributeValue_encode_der; xer_type_encoder_f AttributeValue_encode_xer; #endif /* _AttributeValue_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/BIT_STRING.c b/src/asn1/asn1c/BIT_STRING.c index 94f9d788..fbca75be 100644 --- a/src/asn1/asn1c/BIT_STRING.c +++ b/src/asn1/asn1c/BIT_STRING.c @@ -3,11 +3,12 @@ * Redistribution and modifications are permitted subject to BSD license. */ +#include "asn1/asn1c/BIT_STRING.h" + #include #include "asn1/asn1c/asn_internal.h" -#include "asn1/asn1c/BIT_STRING.h" -#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/xer_encoder.h" /* * BIT STRING basic type description. @@ -78,7 +79,7 @@ static const char *_bit_pattern[16] = { asn_enc_rval_t BIT_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, + int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; char scratch[128]; diff --git a/src/asn1/asn1c/BIT_STRING.h b/src/asn1/asn1c/BIT_STRING.h index 0176dde7..6f0f748d 100644 --- a/src/asn1/asn1c/BIT_STRING.h +++ b/src/asn1/asn1c/BIT_STRING.h @@ -5,7 +5,7 @@ #ifndef _BIT_STRING_H_ #define _BIT_STRING_H_ -#include "asn1/asn1c/OCTET_STRING.h" /* Some help from OCTET STRING */ +#include "asn1/asn1c/OCTET_STRING.h" typedef struct BIT_STRING_s { uint8_t *buf; /* BIT STRING body */ diff --git a/src/asn1/asn1c/BOOLEAN.c b/src/asn1/asn1c/BOOLEAN.c index d646f7b1..e825aec4 100644 --- a/src/asn1/asn1c/BOOLEAN.c +++ b/src/asn1/asn1c/BOOLEAN.c @@ -2,10 +2,14 @@ * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" -#include "asn1/asn1c/asn_codecs_prim.h" #include "asn1/asn1c/BOOLEAN.h" +#include "asn1/asn1c/asn_codecs_prim.h" +#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/ber_decoder.h" +#include "asn1/asn1c/constraints.h" +#include "asn1/asn1c/der_encoder.h" + /* * BOOLEAN basic type description. */ @@ -141,8 +145,7 @@ BOOLEAN_encode_json(const struct asn_TYPE_descriptor_s *td, const void *sptr) asn_enc_rval_t BOOLEAN_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { + int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) { const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; asn_enc_rval_t er = {0, 0, 0}; diff --git a/src/asn1/asn1c/BOOLEAN.h b/src/asn1/asn1c/BOOLEAN.h index 22f4272a..fb2411ba 100644 --- a/src/asn1/asn1c/BOOLEAN.h +++ b/src/asn1/asn1c/BOOLEAN.h @@ -5,7 +5,7 @@ #ifndef _BOOLEAN_H_ #define _BOOLEAN_H_ -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" /* * The underlying integer may contain various values, but everything diff --git a/src/asn1/asn1c/BinarySigningTime.h b/src/asn1/asn1c/BinarySigningTime.h index 80507c1f..f118b85f 100644 --- a/src/asn1/asn1c/BinarySigningTime.h +++ b/src/asn1/asn1c/BinarySigningTime.h @@ -8,11 +8,8 @@ #ifndef _BinarySigningTime_H_ #define _BinarySigningTime_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/BinaryTime.h" +#include "asn1/asn1c/constr_TYPE.h" /* BinarySigningTime */ typedef BinaryTime_t BinarySigningTime_t; @@ -27,4 +24,3 @@ der_type_encoder_f BinarySigningTime_encode_der; xer_type_encoder_f BinarySigningTime_encode_xer; #endif /* _BinarySigningTime_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/BinaryTime.h b/src/asn1/asn1c/BinaryTime.h index 727d03b8..25d18883 100644 --- a/src/asn1/asn1c/BinaryTime.h +++ b/src/asn1/asn1c/BinaryTime.h @@ -8,11 +8,8 @@ #ifndef _BinaryTime_H_ #define _BinaryTime_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/INTEGER.h" +#include "asn1/asn1c/constr_TYPE.h" /* BinaryTime */ typedef INTEGER_t BinaryTime_t; @@ -27,4 +24,3 @@ der_type_encoder_f BinaryTime_encode_der; xer_type_encoder_f BinaryTime_encode_xer; #endif /* _BinaryTime_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/CMSAttribute.c b/src/asn1/asn1c/CMSAttribute.c index d4425609..5b0a2684 100644 --- a/src/asn1/asn1c/CMSAttribute.c +++ b/src/asn1/asn1c/CMSAttribute.c @@ -7,11 +7,12 @@ #include "asn1/asn1c/CMSAttribute.h" -#include -#include "json_util.h" +#include + #include "asn1/asn1c/ContentType.h" #include "asn1/asn1c/MessageDigest.h" #include "asn1/asn1c/SigningTime.h" +#include "json_util.h" json_t * CMSAttribute_encode_json(const asn_TYPE_descriptor_t *td, const void *sptr) diff --git a/src/asn1/asn1c/CMSAttribute.h b/src/asn1/asn1c/CMSAttribute.h index ad7552bb..414cd5c6 100644 --- a/src/asn1/asn1c/CMSAttribute.h +++ b/src/asn1/asn1c/CMSAttribute.h @@ -8,15 +8,12 @@ #ifndef _CMSAttribute_H_ #define _CMSAttribute_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include "asn1/asn1c/CMSAttributeValue.h" +#include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include "asn1/asn1c/asn_SET_OF.h" -#include "asn1/asn1c/constr_SET_OF.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_SET_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* CMSAttribute */ typedef struct CMSAttribute { @@ -38,4 +35,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_CMSAttribute_specs_1; extern asn_TYPE_member_t asn_MBR_CMSAttribute_1[2]; #endif /* _CMSAttribute_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/CMSAttributeValue.h b/src/asn1/asn1c/CMSAttributeValue.h index 8a445f74..9bb9d85e 100644 --- a/src/asn1/asn1c/CMSAttributeValue.h +++ b/src/asn1/asn1c/CMSAttributeValue.h @@ -8,11 +8,8 @@ #ifndef _CMSAttributeValue_H_ #define _CMSAttributeValue_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/ANY.h" +#include "asn1/asn1c/constr_TYPE.h" /* CMSAttributeValue */ typedef ANY_t CMSAttributeValue_t; @@ -27,4 +24,3 @@ der_type_encoder_f CMSAttributeValue_encode_der; xer_type_encoder_f CMSAttributeValue_encode_xer; #endif /* _CMSAttributeValue_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/CMSSubjectKeyIdentifier.h b/src/asn1/asn1c/CMSSubjectKeyIdentifier.h index 7fe5da2a..8e6a468b 100644 --- a/src/asn1/asn1c/CMSSubjectKeyIdentifier.h +++ b/src/asn1/asn1c/CMSSubjectKeyIdentifier.h @@ -8,11 +8,8 @@ #ifndef _CMSSubjectKeyIdentifier_H_ #define _CMSSubjectKeyIdentifier_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/OCTET_STRING.h" +#include "asn1/asn1c/constr_TYPE.h" /* CMSSubjectKeyIdentifier */ typedef OCTET_STRING_t CMSSubjectKeyIdentifier_t; @@ -27,4 +24,3 @@ der_type_encoder_f CMSSubjectKeyIdentifier_encode_der; xer_type_encoder_f CMSSubjectKeyIdentifier_encode_xer; #endif /* _CMSSubjectKeyIdentifier_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/CMSVersion.h b/src/asn1/asn1c/CMSVersion.h index 05235e7f..ffd6ee50 100644 --- a/src/asn1/asn1c/CMSVersion.h +++ b/src/asn1/asn1c/CMSVersion.h @@ -8,11 +8,8 @@ #ifndef _CMSVersion_H_ #define _CMSVersion_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/INTEGER.h" +#include "asn1/asn1c/constr_TYPE.h" /* Dependencies */ typedef enum CMSVersion { @@ -37,4 +34,3 @@ der_type_encoder_f CMSVersion_encode_der; xer_type_encoder_f CMSVersion_encode_xer; #endif /* _CMSVersion_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/CRL.c b/src/asn1/asn1c/CRL.c index 89edd6b3..fbcc02ec 100644 --- a/src/asn1/asn1c/CRL.c +++ b/src/asn1/asn1c/CRL.c @@ -1,7 +1,6 @@ #include "asn1/asn1c/CRL.h" -#include -#include +#include #include "extension.h" #include "json_util.h" diff --git a/src/asn1/asn1c/Certificate.c b/src/asn1/asn1c/Certificate.c index df6542c4..7352786e 100644 --- a/src/asn1/asn1c/Certificate.c +++ b/src/asn1/asn1c/Certificate.c @@ -1,6 +1,6 @@ #include "asn1/asn1c/Certificate.h" -#include +#include #include "extension.h" #include "json_util.h" diff --git a/src/asn1/asn1c/Certificate.h b/src/asn1/asn1c/Certificate.h index 1eeac081..39f0126f 100644 --- a/src/asn1/asn1c/Certificate.h +++ b/src/asn1/asn1c/Certificate.h @@ -1,8 +1,8 @@ #ifndef SRC_ASN1_ASN1C_CERTIFICATE_H_ #define SRC_ASN1_ASN1C_CERTIFICATE_H_ -#include #include + #include "asn1/asn1c/ANY.h" json_t *Certificate_any2json(ANY_t *); diff --git a/src/asn1/asn1c/CertificateList.h b/src/asn1/asn1c/CertificateList.h index 4f2ddfbd..19c92520 100644 --- a/src/asn1/asn1c/CertificateList.h +++ b/src/asn1/asn1c/CertificateList.h @@ -8,14 +8,11 @@ #ifndef _CertificateList_H_ #define _CertificateList_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/TBSCertList.h" #include "asn1/asn1c/AlgorithmIdentifier.h" #include "asn1/asn1c/BIT_STRING.h" +#include "asn1/asn1c/TBSCertList.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* CertificateList */ typedef struct CertificateList { @@ -33,4 +30,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_CertificateList_specs_1; extern asn_TYPE_member_t asn_MBR_CertificateList_1[3]; #endif /* _CertificateList_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/CertificateSerialNumber.h b/src/asn1/asn1c/CertificateSerialNumber.h index 6851cd01..b02927cb 100644 --- a/src/asn1/asn1c/CertificateSerialNumber.h +++ b/src/asn1/asn1c/CertificateSerialNumber.h @@ -8,11 +8,8 @@ #ifndef _CertificateSerialNumber_H_ #define _CertificateSerialNumber_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/INTEGER.h" +#include "asn1/asn1c/constr_TYPE.h" /* CertificateSerialNumber */ typedef INTEGER_t CertificateSerialNumber_t; @@ -27,4 +24,3 @@ der_type_encoder_f CertificateSerialNumber_encode_der; xer_type_encoder_f CertificateSerialNumber_encode_xer; #endif /* _CertificateSerialNumber_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/CertificateSet.c b/src/asn1/asn1c/CertificateSet.c index b627f29f..d83c6dc6 100644 --- a/src/asn1/asn1c/CertificateSet.c +++ b/src/asn1/asn1c/CertificateSet.c @@ -7,8 +7,8 @@ #include "asn1/asn1c/CertificateSet.h" -#include "json_util.h" #include "asn1/asn1c/Certificate.h" +#include "json_util.h" static json_t * CertificateSet_encode_json(const struct asn_TYPE_descriptor_s *td, diff --git a/src/asn1/asn1c/CertificateSet.h b/src/asn1/asn1c/CertificateSet.h index f5e96d87..09027225 100644 --- a/src/asn1/asn1c/CertificateSet.h +++ b/src/asn1/asn1c/CertificateSet.h @@ -8,13 +8,10 @@ #ifndef _CertificateSet_H_ #define _CertificateSet_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/ANY.h" #include "asn1/asn1c/asn_SET_OF.h" #include "asn1/asn1c/constr_SET_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* CertificateSet */ typedef struct CertificateSet { @@ -30,4 +27,3 @@ extern asn_SET_OF_specifics_t asn_SPC_CertificateSet_specs_1; extern asn_TYPE_member_t asn_MBR_CertificateSet_1[1]; #endif /* _CertificateSet_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/ContentInfo.c b/src/asn1/asn1c/ContentInfo.c index 0a0b2d7e..0a97f082 100644 --- a/src/asn1/asn1c/ContentInfo.c +++ b/src/asn1/asn1c/ContentInfo.c @@ -7,9 +7,10 @@ #include "asn1/asn1c/ContentInfo.h" -#include -#include "json_util.h" +#include + #include "asn1/asn1c/SignedData.h" +#include "json_util.h" json_t * ContentInfo_encode_json(const asn_TYPE_descriptor_t *td, const void *sptr) diff --git a/src/asn1/asn1c/ContentInfo.h b/src/asn1/asn1c/ContentInfo.h index 838525ba..8bc91ad7 100644 --- a/src/asn1/asn1c/ContentInfo.h +++ b/src/asn1/asn1c/ContentInfo.h @@ -8,13 +8,10 @@ #ifndef _ContentInfo_H_ #define _ContentInfo_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/ContentType.h" #include "asn1/asn1c/ANY.h" +#include "asn1/asn1c/ContentType.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* ContentInfo */ typedef struct ContentInfo { @@ -29,4 +26,3 @@ typedef struct ContentInfo { extern asn_TYPE_descriptor_t asn_DEF_ContentInfo; #endif /* _ContentInfo_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/ContentType.h b/src/asn1/asn1c/ContentType.h index a03f9a98..0fcff7a8 100644 --- a/src/asn1/asn1c/ContentType.h +++ b/src/asn1/asn1c/ContentType.h @@ -8,11 +8,8 @@ #ifndef _ContentType_H_ #define _ContentType_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/OBJECT_IDENTIFIER.h" +#include "asn1/asn1c/constr_TYPE.h" /* ContentType */ typedef OBJECT_IDENTIFIER_t ContentType_t; @@ -27,4 +24,3 @@ der_type_encoder_f ContentType_encode_der; xer_type_encoder_f ContentType_encode_xer; #endif /* _ContentType_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/ContentTypePKCS7.h b/src/asn1/asn1c/ContentTypePKCS7.h index f09c3d19..d3050ed1 100644 --- a/src/asn1/asn1c/ContentTypePKCS7.h +++ b/src/asn1/asn1c/ContentTypePKCS7.h @@ -8,11 +8,8 @@ #ifndef _ContentTypePKCS7_H_ #define _ContentTypePKCS7_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/OCTET_STRING.h" +#include "asn1/asn1c/constr_TYPE.h" /* ContentTypePKCS7 */ typedef OCTET_STRING_t ContentTypePKCS7_t; @@ -27,4 +24,3 @@ der_type_encoder_f ContentTypePKCS7_encode_der; xer_type_encoder_f ContentTypePKCS7_encode_xer; #endif /* _ContentTypePKCS7_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/Countersignature.h b/src/asn1/asn1c/Countersignature.h index cb6cca45..755b76db 100644 --- a/src/asn1/asn1c/Countersignature.h +++ b/src/asn1/asn1c/Countersignature.h @@ -8,11 +8,8 @@ #ifndef _Countersignature_H_ #define _Countersignature_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/SignerInfo.h" +#include "asn1/asn1c/constr_TYPE.h" /* Countersignature */ typedef SignerInfo_t Countersignature_t; @@ -27,4 +24,3 @@ der_type_encoder_f Countersignature_encode_der; xer_type_encoder_f Countersignature_encode_xer; #endif /* _Countersignature_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/DigestAlgorithmIdentifier.h b/src/asn1/asn1c/DigestAlgorithmIdentifier.h index 3e0f636d..cc360663 100644 --- a/src/asn1/asn1c/DigestAlgorithmIdentifier.h +++ b/src/asn1/asn1c/DigestAlgorithmIdentifier.h @@ -8,11 +8,8 @@ #ifndef _DigestAlgorithmIdentifier_H_ #define _DigestAlgorithmIdentifier_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/AlgorithmIdentifier.h" +#include "asn1/asn1c/constr_TYPE.h" /* DigestAlgorithmIdentifier */ typedef AlgorithmIdentifier_t DigestAlgorithmIdentifier_t; @@ -27,4 +24,3 @@ der_type_encoder_f DigestAlgorithmIdentifier_encode_der; xer_type_encoder_f DigestAlgorithmIdentifier_encode_xer; #endif /* _DigestAlgorithmIdentifier_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/DigestAlgorithmIdentifiers.h b/src/asn1/asn1c/DigestAlgorithmIdentifiers.h index 86bde701..27783eeb 100644 --- a/src/asn1/asn1c/DigestAlgorithmIdentifiers.h +++ b/src/asn1/asn1c/DigestAlgorithmIdentifiers.h @@ -8,12 +8,10 @@ #ifndef _DigestAlgorithmIdentifiers_H_ #define _DigestAlgorithmIdentifiers_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/DigestAlgorithmIdentifier.h" #include "asn1/asn1c/asn_SET_OF.h" #include "asn1/asn1c/constr_SET_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct DigestAlgorithmIdentifier; @@ -31,8 +29,4 @@ extern asn_TYPE_descriptor_t asn_DEF_DigestAlgorithmIdentifiers; extern asn_SET_OF_specifics_t asn_SPC_DigestAlgorithmIdentifiers_specs_1; extern asn_TYPE_member_t asn_MBR_DigestAlgorithmIdentifiers_1[1]; -/* Referred external types */ -#include "asn1/asn1c/DigestAlgorithmIdentifier.h" - #endif /* _DigestAlgorithmIdentifiers_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/DistinguishedName.h b/src/asn1/asn1c/DistinguishedName.h index 602accb1..698b589f 100644 --- a/src/asn1/asn1c/DistinguishedName.h +++ b/src/asn1/asn1c/DistinguishedName.h @@ -8,11 +8,8 @@ #ifndef _DistinguishedName_H_ #define _DistinguishedName_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/RDNSequence.h" +#include "asn1/asn1c/constr_TYPE.h" /* DistinguishedName */ typedef RDNSequence_t DistinguishedName_t; @@ -27,4 +24,3 @@ der_type_encoder_f DistinguishedName_encode_der; xer_type_encoder_f DistinguishedName_encode_xer; #endif /* _DistinguishedName_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/EncapsulatedContentInfo.c b/src/asn1/asn1c/EncapsulatedContentInfo.c index 2d0b259d..bc9f7c4e 100644 --- a/src/asn1/asn1c/EncapsulatedContentInfo.c +++ b/src/asn1/asn1c/EncapsulatedContentInfo.c @@ -7,10 +7,10 @@ #include "asn1/asn1c/EncapsulatedContentInfo.h" -#include "nid.h" -#include "json_util.h" #include "asn1/asn1c/Manifest.h" #include "asn1/asn1c/RouteOriginAttestation.h" +#include "json_util.h" +#include "nid.h" json_t * EncapsulatedContentInfo_encode_json(const asn_TYPE_descriptor_t *td, diff --git a/src/asn1/asn1c/EncapsulatedContentInfo.h b/src/asn1/asn1c/EncapsulatedContentInfo.h index 9faa6da6..57683b55 100644 --- a/src/asn1/asn1c/EncapsulatedContentInfo.h +++ b/src/asn1/asn1c/EncapsulatedContentInfo.h @@ -8,13 +8,10 @@ #ifndef _EncapsulatedContentInfo_H_ #define _EncapsulatedContentInfo_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/ContentType.h" #include "asn1/asn1c/OCTET_STRING.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* EncapsulatedContentInfo */ typedef struct EncapsulatedContentInfo { @@ -31,4 +28,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_EncapsulatedContentInfo_specs_1; extern asn_TYPE_member_t asn_MBR_EncapsulatedContentInfo_1[2]; #endif /* _EncapsulatedContentInfo_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/EncapsulatedContentInfoPKCS7.h b/src/asn1/asn1c/EncapsulatedContentInfoPKCS7.h index fc28c4fd..0a80e0ba 100644 --- a/src/asn1/asn1c/EncapsulatedContentInfoPKCS7.h +++ b/src/asn1/asn1c/EncapsulatedContentInfoPKCS7.h @@ -8,13 +8,10 @@ #ifndef _EncapsulatedContentInfoPKCS7_H_ #define _EncapsulatedContentInfoPKCS7_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/ContentType.h" #include "asn1/asn1c/ANY.h" +#include "asn1/asn1c/ContentType.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* EncapsulatedContentInfoPKCS7 */ typedef struct EncapsulatedContentInfoPKCS7 { @@ -31,4 +28,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_EncapsulatedContentInfoPKCS7_specs_1; extern asn_TYPE_member_t asn_MBR_EncapsulatedContentInfoPKCS7_1[2]; #endif /* _EncapsulatedContentInfoPKCS7_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/Extension.c b/src/asn1/asn1c/Extension.c index 5588ed75..b868c88c 100644 --- a/src/asn1/asn1c/Extension.c +++ b/src/asn1/asn1c/Extension.c @@ -7,6 +7,8 @@ #include "asn1/asn1c/Extension.h" +#include "asn1/asn1c/asn_internal.h" + static int asn_DFL_3_cmp_0(const void *sptr) { const BOOLEAN_t *st = sptr; diff --git a/src/asn1/asn1c/Extension.h b/src/asn1/asn1c/Extension.h index 6b0749a0..ad427001 100644 --- a/src/asn1/asn1c/Extension.h +++ b/src/asn1/asn1c/Extension.h @@ -8,14 +8,11 @@ #ifndef _Extension_H_ #define _Extension_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include "asn1/asn1c/BOOLEAN.h" +#include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include "asn1/asn1c/OCTET_STRING.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Extension */ typedef struct Extension { @@ -33,4 +30,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_Extension_specs_1; extern asn_TYPE_member_t asn_MBR_Extension_1[3]; #endif /* _Extension_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/Extensions.h b/src/asn1/asn1c/Extensions.h index 10ff3374..81badbc3 100644 --- a/src/asn1/asn1c/Extensions.h +++ b/src/asn1/asn1c/Extensions.h @@ -8,12 +8,10 @@ #ifndef _Extensions_H_ #define _Extensions_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/Extension.h" #include "asn1/asn1c/asn_SEQUENCE_OF.h" #include "asn1/asn1c/constr_SEQUENCE_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct Extension; @@ -31,8 +29,4 @@ extern asn_TYPE_descriptor_t asn_DEF_Extensions; extern asn_SET_OF_specifics_t asn_SPC_Extensions_specs_1; extern asn_TYPE_member_t asn_MBR_Extensions_1[1]; -/* Referred external types */ -#include "asn1/asn1c/Extension.h" - #endif /* _Extensions_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/FileAndHash.h b/src/asn1/asn1c/FileAndHash.h index d61d2a3a..52d90096 100644 --- a/src/asn1/asn1c/FileAndHash.h +++ b/src/asn1/asn1c/FileAndHash.h @@ -8,13 +8,10 @@ #ifndef _FileAndHash_H_ #define _FileAndHash_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/IA5String.h" #include "asn1/asn1c/BIT_STRING.h" +#include "asn1/asn1c/IA5String.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* FileAndHash */ typedef struct FileAndHash { @@ -31,4 +28,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_FileAndHash_specs_1; extern asn_TYPE_member_t asn_MBR_FileAndHash_1[2]; #endif /* _FileAndHash_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/GeneralizedTime.c b/src/asn1/asn1c/GeneralizedTime.c index 933fa20f..8bee55a1 100644 --- a/src/asn1/asn1c/GeneralizedTime.c +++ b/src/asn1/asn1c/GeneralizedTime.c @@ -6,11 +6,13 @@ #define _REENTRANT /* for Sun */ #define __EXTENSIONS__ /* for Sun */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/GeneralizedTime.h" #include #include + +#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/xer_encoder.h" #include "json_util.h" #define ATZVARS do { \ @@ -156,7 +158,7 @@ GeneralizedTime_encode_json(const struct asn_TYPE_descriptor_s *td, const void * asn_enc_rval_t GeneralizedTime_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, + int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) { if(flags & XER_F_CANONICAL) { GeneralizedTime_t *gt; diff --git a/src/asn1/asn1c/GeneralizedTime.h b/src/asn1/asn1c/GeneralizedTime.h index fa98755f..95baefb9 100644 --- a/src/asn1/asn1c/GeneralizedTime.h +++ b/src/asn1/asn1c/GeneralizedTime.h @@ -5,10 +5,11 @@ #ifndef _GeneralizedTime_H_ #define _GeneralizedTime_H_ -#include "asn1/asn1c/OCTET_STRING.h" #include #include +#include "asn1/asn1c/OCTET_STRING.h" + typedef OCTET_STRING_t GeneralizedTime_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_GeneralizedTime; diff --git a/src/asn1/asn1c/IA5String.c b/src/asn1/asn1c/IA5String.c index 5f574e83..573f560e 100644 --- a/src/asn1/asn1c/IA5String.c +++ b/src/asn1/asn1c/IA5String.c @@ -2,7 +2,6 @@ * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/IA5String.h" /* diff --git a/src/asn1/asn1c/INTEGER.c b/src/asn1/asn1c/INTEGER.c index c95996ce..3885fd79 100644 --- a/src/asn1/asn1c/INTEGER.c +++ b/src/asn1/asn1c/INTEGER.c @@ -3,14 +3,14 @@ * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/INTEGER.h" #include #include +#include "asn1/asn1c/asn_codecs_prim.h" +#include "asn1/asn1c/asn_internal.h" #include "json_util.h" -#include "asn1/asn1c/asn_codecs_prim.h" /* Encoder and decoder of a primitive type */ /* * INTEGER basic type description. @@ -246,7 +246,7 @@ INTEGER_encode_json(const struct asn_TYPE_descriptor_s *td, const void *sptr) asn_enc_rval_t INTEGER_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, + int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; asn_enc_rval_t er; diff --git a/src/asn1/asn1c/INTEGER.h b/src/asn1/asn1c/INTEGER.h index 584f8fc9..b09933a7 100644 --- a/src/asn1/asn1c/INTEGER.h +++ b/src/asn1/asn1c/INTEGER.h @@ -5,8 +5,9 @@ #ifndef _INTEGER_H_ #define _INTEGER_H_ -#include "asn1/asn1c/asn_application.h" #include "asn1/asn1c/asn_codecs_prim.h" +#include "asn1/asn1c/constr_TYPE.h" +#include "asn1/asn1c/constraints.h" typedef ASN__PRIMITIVE_TYPE_t INTEGER_t; diff --git a/src/asn1/asn1c/IPAddrBlocks.h b/src/asn1/asn1c/IPAddrBlocks.h index 3d55e79b..a41fd0af 100644 --- a/src/asn1/asn1c/IPAddrBlocks.h +++ b/src/asn1/asn1c/IPAddrBlocks.h @@ -8,12 +8,10 @@ #ifndef _IPAddrBlocks_H_ #define _IPAddrBlocks_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/IPAddressFamily.h" #include "asn1/asn1c/asn_SEQUENCE_OF.h" #include "asn1/asn1c/constr_SEQUENCE_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct IPAddressFamily; @@ -29,8 +27,4 @@ typedef struct IPAddrBlocks { /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_IPAddrBlocks; -/* Referred external types */ -#include "asn1/asn1c/IPAddressFamily.h" - #endif /* _IPAddrBlocks_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/IPAddress.h b/src/asn1/asn1c/IPAddress.h index bf173143..ea139996 100644 --- a/src/asn1/asn1c/IPAddress.h +++ b/src/asn1/asn1c/IPAddress.h @@ -8,11 +8,8 @@ #ifndef _IPAddress_H_ #define _IPAddress_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/BIT_STRING.h" +#include "asn1/asn1c/constr_TYPE.h" /* IPAddress */ typedef BIT_STRING_t IPAddress_t; @@ -27,4 +24,3 @@ der_type_encoder_f IPAddress_encode_der; xer_type_encoder_f IPAddress_encode_xer; #endif /* _IPAddress_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/IPAddressChoice.h b/src/asn1/asn1c/IPAddressChoice.h index fc275fb3..54ee62ef 100644 --- a/src/asn1/asn1c/IPAddressChoice.h +++ b/src/asn1/asn1c/IPAddressChoice.h @@ -8,14 +8,12 @@ #ifndef _IPAddressChoice_H_ #define _IPAddressChoice_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/IPAddressOrRange.h" #include "asn1/asn1c/NULL.h" #include "asn1/asn1c/asn_SEQUENCE_OF.h" -#include "asn1/asn1c/constr_SEQUENCE_OF.h" #include "asn1/asn1c/constr_CHOICE.h" +#include "asn1/asn1c/constr_SEQUENCE_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Dependencies */ typedef enum IPAddressChoice_PR { @@ -49,8 +47,4 @@ extern asn_TYPE_descriptor_t asn_DEF_IPAddressChoice; extern asn_CHOICE_specifics_t asn_SPC_IPAddressChoice_specs_1; extern asn_TYPE_member_t asn_MBR_IPAddressChoice_1[2]; -/* Referred external types */ -#include "asn1/asn1c/IPAddressOrRange.h" - #endif /* _IPAddressChoice_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/IPAddressFamily.h b/src/asn1/asn1c/IPAddressFamily.h index 3fddc08f..b1619214 100644 --- a/src/asn1/asn1c/IPAddressFamily.h +++ b/src/asn1/asn1c/IPAddressFamily.h @@ -8,13 +8,10 @@ #ifndef _IPAddressFamily_H_ #define _IPAddressFamily_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/OCTET_STRING.h" #include "asn1/asn1c/IPAddressChoice.h" +#include "asn1/asn1c/OCTET_STRING.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* IPAddressFamily */ typedef struct IPAddressFamily { @@ -31,4 +28,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_IPAddressFamily_specs_1; extern asn_TYPE_member_t asn_MBR_IPAddressFamily_1[2]; #endif /* _IPAddressFamily_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/IPAddressOrRange.h b/src/asn1/asn1c/IPAddressOrRange.h index b6c86ab2..b7cd15e2 100644 --- a/src/asn1/asn1c/IPAddressOrRange.h +++ b/src/asn1/asn1c/IPAddressOrRange.h @@ -8,13 +8,10 @@ #ifndef _IPAddressOrRange_H_ #define _IPAddressOrRange_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/IPAddress.h" #include "asn1/asn1c/IPAddressRange.h" #include "asn1/asn1c/constr_CHOICE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Dependencies */ typedef enum IPAddressOrRange_PR { @@ -41,4 +38,3 @@ extern asn_CHOICE_specifics_t asn_SPC_IPAddressOrRange_specs_1; extern asn_TYPE_member_t asn_MBR_IPAddressOrRange_1[2]; #endif /* _IPAddressOrRange_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/IPAddressRange.h b/src/asn1/asn1c/IPAddressRange.h index 8be2d3ab..d218d8cc 100644 --- a/src/asn1/asn1c/IPAddressRange.h +++ b/src/asn1/asn1c/IPAddressRange.h @@ -8,12 +8,9 @@ #ifndef _IPAddressRange_H_ #define _IPAddressRange_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/IPAddress.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* IPAddressRange */ typedef struct IPAddressRange { @@ -30,4 +27,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_IPAddressRange_specs_1; extern asn_TYPE_member_t asn_MBR_IPAddressRange_1[2]; #endif /* _IPAddressRange_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/IssuerAndSerialNumber.h b/src/asn1/asn1c/IssuerAndSerialNumber.h index 9198b824..18820a9f 100644 --- a/src/asn1/asn1c/IssuerAndSerialNumber.h +++ b/src/asn1/asn1c/IssuerAndSerialNumber.h @@ -8,13 +8,10 @@ #ifndef _IssuerAndSerialNumber_H_ #define _IssuerAndSerialNumber_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/Name.h" #include "asn1/asn1c/CertificateSerialNumber.h" +#include "asn1/asn1c/Name.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* IssuerAndSerialNumber */ typedef struct IssuerAndSerialNumber { @@ -31,4 +28,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_IssuerAndSerialNumber_specs_1; extern asn_TYPE_member_t asn_MBR_IssuerAndSerialNumber_1[2]; #endif /* _IssuerAndSerialNumber_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/Makefile.include b/src/asn1/asn1c/Makefile.include index 5fafde39..9b602c27 100644 --- a/src/asn1/asn1c/Makefile.include +++ b/src/asn1/asn1c/Makefile.include @@ -159,8 +159,6 @@ ASN_MODULE_HDRS+=asn1/asn1c/constr_SEQUENCE_OF.h ASN_MODULE_SRCS+=asn1/asn1c/constr_SEQUENCE_OF.c ASN_MODULE_HDRS+=asn1/asn1c/constr_SET_OF.h ASN_MODULE_SRCS+=asn1/asn1c/constr_SET_OF.c -ASN_MODULE_HDRS+=asn1/asn1c/asn_application.h -ASN_MODULE_SRCS+=asn1/asn1c/asn_application.c ASN_MODULE_HDRS+=asn1/asn1c/asn_ioc.h ASN_MODULE_HDRS+=asn1/asn1c/asn_system.h ASN_MODULE_HDRS+=asn1/asn1c/asn_codecs.h diff --git a/src/asn1/asn1c/Manifest.c b/src/asn1/asn1c/Manifest.c index 0d591121..1ae4f76d 100644 --- a/src/asn1/asn1c/Manifest.c +++ b/src/asn1/asn1c/Manifest.c @@ -7,6 +7,8 @@ #include "asn1/asn1c/Manifest.h" +#include "asn1/asn1c/asn_internal.h" + static int memb_manifestNumber_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { diff --git a/src/asn1/asn1c/Manifest.h b/src/asn1/asn1c/Manifest.h index 1444ba18..c066cf94 100644 --- a/src/asn1/asn1c/Manifest.h +++ b/src/asn1/asn1c/Manifest.h @@ -8,16 +8,14 @@ #ifndef _Manifest_H_ #define _Manifest_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/INTEGER.h" +#include "asn1/asn1c/FileAndHash.h" #include "asn1/asn1c/GeneralizedTime.h" +#include "asn1/asn1c/INTEGER.h" #include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include "asn1/asn1c/asn_SEQUENCE_OF.h" -#include "asn1/asn1c/constr_SEQUENCE_OF.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_SEQUENCE_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct FileAndHash; @@ -43,8 +41,4 @@ typedef struct Manifest { /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_Manifest; -/* Referred external types */ -#include "asn1/asn1c/FileAndHash.h" - #endif /* _Manifest_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/MessageDigest.h b/src/asn1/asn1c/MessageDigest.h index 0b786db9..5b72392e 100644 --- a/src/asn1/asn1c/MessageDigest.h +++ b/src/asn1/asn1c/MessageDigest.h @@ -8,11 +8,8 @@ #ifndef _MessageDigest_H_ #define _MessageDigest_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/OCTET_STRING.h" +#include "asn1/asn1c/constr_TYPE.h" /* MessageDigest */ typedef OCTET_STRING_t MessageDigest_t; @@ -27,4 +24,3 @@ der_type_encoder_f MessageDigest_encode_der; xer_type_encoder_f MessageDigest_encode_xer; #endif /* _MessageDigest_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/NULL.c b/src/asn1/asn1c/NULL.c index b4bd1717..7daf9247 100644 --- a/src/asn1/asn1c/NULL.c +++ b/src/asn1/asn1c/NULL.c @@ -2,10 +2,14 @@ * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" -#include "asn1/asn1c/asn_codecs_prim.h" #include "asn1/asn1c/NULL.h" +#include "asn1/asn1c/asn_codecs_prim.h" +#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/ber_decoder.h" +#include "asn1/asn1c/constraints.h" +#include "asn1/asn1c/der_encoder.h" + /* * NULL basic type description. */ @@ -116,7 +120,7 @@ NULL_encode_json(const struct asn_TYPE_descriptor_s *td, const void *sptr) asn_enc_rval_t NULL_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, + int flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; diff --git a/src/asn1/asn1c/NULL.h b/src/asn1/asn1c/NULL.h index 1c9bfec6..b19d853c 100644 --- a/src/asn1/asn1c/NULL.h +++ b/src/asn1/asn1c/NULL.h @@ -5,7 +5,7 @@ #ifndef ASN_TYPE_NULL_H #define ASN_TYPE_NULL_H -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" /* * The value of the NULL type is meaningless. diff --git a/src/asn1/asn1c/Name.h b/src/asn1/asn1c/Name.h index a543aca5..431506e9 100644 --- a/src/asn1/asn1c/Name.h +++ b/src/asn1/asn1c/Name.h @@ -8,12 +8,9 @@ #ifndef _Name_H_ #define _Name_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/RDNSequence.h" #include "asn1/asn1c/constr_CHOICE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Dependencies */ typedef enum Name_PR { @@ -38,4 +35,3 @@ extern asn_CHOICE_specifics_t asn_SPC_Name_specs_1; extern asn_TYPE_member_t asn_MBR_Name_1[1]; #endif /* _Name_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/OBJECT_IDENTIFIER.c b/src/asn1/asn1c/OBJECT_IDENTIFIER.c index f5df8df4..e3d0cb1a 100644 --- a/src/asn1/asn1c/OBJECT_IDENTIFIER.c +++ b/src/asn1/asn1c/OBJECT_IDENTIFIER.c @@ -3,16 +3,18 @@ * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include #include +#include +#include #include -#include "json_util.h" #include "asn1/asn1c/INTEGER.h" #include "asn1/asn1c/OCTET_STRING.h" +#include "asn1/asn1c/asn_internal.h" +#include "json_util.h" /* * OBJECT IDENTIFIER basic type description. @@ -174,7 +176,7 @@ OBJECT_IDENTIFIER__dump_body(const OBJECT_IDENTIFIER_t *st, asn_enc_rval_t OBJECT_IDENTIFIER_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, + int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) { const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr; asn_enc_rval_t er; diff --git a/src/asn1/asn1c/OBJECT_IDENTIFIER.h b/src/asn1/asn1c/OBJECT_IDENTIFIER.h index 461e9632..db74cae5 100644 --- a/src/asn1/asn1c/OBJECT_IDENTIFIER.h +++ b/src/asn1/asn1c/OBJECT_IDENTIFIER.h @@ -5,10 +5,11 @@ #ifndef _OBJECT_IDENTIFIER_H_ #define _OBJECT_IDENTIFIER_H_ -#include -#include "asn1/asn1c/asn_application.h" -#include "asn1/asn1c/asn_codecs_prim.h" +#include + #include "asn1/asn1c/OCTET_STRING.h" +#include "asn1/asn1c/asn_codecs_prim.h" +#include "asn1/asn1c/constr_TYPE.h" typedef uint32_t asn_oid_arc_t; #define ASN_OID_ARC_MAX (~((asn_oid_arc_t)0)) diff --git a/src/asn1/asn1c/OCTET_STRING.c b/src/asn1/asn1c/OCTET_STRING.c index 3994bf59..247c1c4c 100644 --- a/src/asn1/asn1c/OCTET_STRING.c +++ b/src/asn1/asn1c/OCTET_STRING.c @@ -3,15 +3,19 @@ * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/OCTET_STRING.h" #include #include #include "alloc.h" +#include "asn1/asn1c/BIT_STRING.h" +#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/ber_decoder.h" +#include "asn1/asn1c/der_encoder.h" +#include "asn1/asn1c/json_encoder.h" +#include "asn1/asn1c/xer_encoder.h" #include "json_util.h" -#include "asn1/asn1c/BIT_STRING.h" /* for .bits_unused member */ /* * OCTET STRING basic type description. @@ -619,7 +623,7 @@ OCTET_STRING_encode_json_utf8(const struct asn_TYPE_descriptor_s *td, asn_enc_rval_t OCTET_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, + int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) { const char * const h2c = "0123456789ABCDEF"; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; @@ -731,7 +735,7 @@ static const struct OCTET_STRING__xer_escape_table_s { asn_enc_rval_t OCTET_STRING_encode_xer_utf8(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, + int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; asn_enc_rval_t er; diff --git a/src/asn1/asn1c/OCTET_STRING.h b/src/asn1/asn1c/OCTET_STRING.h index 28b0872a..10060518 100644 --- a/src/asn1/asn1c/OCTET_STRING.h +++ b/src/asn1/asn1c/OCTET_STRING.h @@ -5,7 +5,8 @@ #ifndef _OCTET_STRING_H_ #define _OCTET_STRING_H_ -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" +#include "asn1/asn1c/constraints.h" /* * Note: Though this sometimes represents an actual string, I don't see any diff --git a/src/asn1/asn1c/OPEN_TYPE.c b/src/asn1/asn1c/OPEN_TYPE.c index 4fcee5a9..0ffe7cba 100644 --- a/src/asn1/asn1c/OPEN_TYPE.c +++ b/src/asn1/asn1c/OPEN_TYPE.c @@ -2,10 +2,10 @@ * Copyright (c) 2017 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/OPEN_TYPE.h" + +#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/constr_CHOICE.h" -#include asn_TYPE_operation_t asn_OP_OPEN_TYPE = { OPEN_TYPE_free, diff --git a/src/asn1/asn1c/OPEN_TYPE.h b/src/asn1/asn1c/OPEN_TYPE.h index 87ed5919..75ed60ef 100644 --- a/src/asn1/asn1c/OPEN_TYPE.h +++ b/src/asn1/asn1c/OPEN_TYPE.h @@ -5,7 +5,7 @@ #ifndef ASN_OPEN_TYPE_H #define ASN_OPEN_TYPE_H -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" #define OPEN_TYPE_free CHOICE_free #define OPEN_TYPE_print CHOICE_print diff --git a/src/asn1/asn1c/OtherRevocationInfoFormat.h b/src/asn1/asn1c/OtherRevocationInfoFormat.h index f5db354a..dabc56cd 100644 --- a/src/asn1/asn1c/OtherRevocationInfoFormat.h +++ b/src/asn1/asn1c/OtherRevocationInfoFormat.h @@ -8,13 +8,10 @@ #ifndef _OtherRevocationInfoFormat_H_ #define _OtherRevocationInfoFormat_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include "asn1/asn1c/ANY.h" +#include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* OtherRevocationInfoFormat */ typedef struct OtherRevocationInfoFormat { @@ -31,4 +28,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_OtherRevocationInfoFormat_specs_1; extern asn_TYPE_member_t asn_MBR_OtherRevocationInfoFormat_1[2]; #endif /* _OtherRevocationInfoFormat_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/RDNSequence.h b/src/asn1/asn1c/RDNSequence.h index ee9cbe78..60fb1fa3 100644 --- a/src/asn1/asn1c/RDNSequence.h +++ b/src/asn1/asn1c/RDNSequence.h @@ -8,12 +8,10 @@ #ifndef _RDNSequence_H_ #define _RDNSequence_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/RelativeDistinguishedName.h" #include "asn1/asn1c/asn_SEQUENCE_OF.h" #include "asn1/asn1c/constr_SEQUENCE_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct RelativeDistinguishedName; @@ -31,8 +29,4 @@ extern asn_TYPE_descriptor_t asn_DEF_RDNSequence; extern asn_SET_OF_specifics_t asn_SPC_RDNSequence_specs_1; extern asn_TYPE_member_t asn_MBR_RDNSequence_1[1]; -/* Referred external types */ -#include "asn1/asn1c/RelativeDistinguishedName.h" - #endif /* _RDNSequence_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/ROAIPAddress.h b/src/asn1/asn1c/ROAIPAddress.h index 42d9fdc4..ff60eec3 100644 --- a/src/asn1/asn1c/ROAIPAddress.h +++ b/src/asn1/asn1c/ROAIPAddress.h @@ -8,13 +8,10 @@ #ifndef _ROAIPAddress_H_ #define _ROAIPAddress_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/IPAddress.h" #include "asn1/asn1c/INTEGER.h" +#include "asn1/asn1c/IPAddress.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* ROAIPAddress */ typedef struct ROAIPAddress { @@ -31,4 +28,3 @@ extern asn_SEQUENCE_specifics_t asn_SPC_ROAIPAddress_specs_1; extern asn_TYPE_member_t asn_MBR_ROAIPAddress_1[2]; #endif /* _ROAIPAddress_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/ROAIPAddressFamily.h b/src/asn1/asn1c/ROAIPAddressFamily.h index fabd266e..302b457d 100644 --- a/src/asn1/asn1c/ROAIPAddressFamily.h +++ b/src/asn1/asn1c/ROAIPAddressFamily.h @@ -8,14 +8,12 @@ #ifndef _ROAIPAddressFamily_H_ #define _ROAIPAddressFamily_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/OCTET_STRING.h" +#include "asn1/asn1c/ROAIPAddress.h" #include "asn1/asn1c/asn_SEQUENCE_OF.h" -#include "asn1/asn1c/constr_SEQUENCE_OF.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_SEQUENCE_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct ROAIPAddress; @@ -39,8 +37,4 @@ extern asn_TYPE_descriptor_t asn_DEF_ROAIPAddressFamily; extern asn_SEQUENCE_specifics_t asn_SPC_ROAIPAddressFamily_specs_1; extern asn_TYPE_member_t asn_MBR_ROAIPAddressFamily_1[2]; -/* Referred external types */ -#include "asn1/asn1c/ROAIPAddress.h" - #endif /* _ROAIPAddressFamily_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/RelativeDistinguishedName.h b/src/asn1/asn1c/RelativeDistinguishedName.h index 1ddd5661..d41f2d92 100644 --- a/src/asn1/asn1c/RelativeDistinguishedName.h +++ b/src/asn1/asn1c/RelativeDistinguishedName.h @@ -8,12 +8,10 @@ #ifndef _RelativeDistinguishedName_H_ #define _RelativeDistinguishedName_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/AttributeTypeAndValue.h" #include "asn1/asn1c/asn_SET_OF.h" #include "asn1/asn1c/constr_SET_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct AttributeTypeAndValue; @@ -31,8 +29,4 @@ extern asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName; extern asn_SET_OF_specifics_t asn_SPC_RelativeDistinguishedName_specs_1; extern asn_TYPE_member_t asn_MBR_RelativeDistinguishedName_1[1]; -/* Referred external types */ -#include "asn1/asn1c/AttributeTypeAndValue.h" - #endif /* _RelativeDistinguishedName_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/RevocationInfoChoice.h b/src/asn1/asn1c/RevocationInfoChoice.h index 26576a83..97407314 100644 --- a/src/asn1/asn1c/RevocationInfoChoice.h +++ b/src/asn1/asn1c/RevocationInfoChoice.h @@ -8,13 +8,10 @@ #ifndef _RevocationInfoChoice_H_ #define _RevocationInfoChoice_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/CertificateList.h" #include "asn1/asn1c/OtherRevocationInfoFormat.h" #include "asn1/asn1c/constr_CHOICE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Dependencies */ typedef enum RevocationInfoChoice_PR { @@ -41,4 +38,3 @@ extern asn_CHOICE_specifics_t asn_SPC_RevocationInfoChoice_specs_1; extern asn_TYPE_member_t asn_MBR_RevocationInfoChoice_1[2]; #endif /* _RevocationInfoChoice_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/RevocationInfoChoices.h b/src/asn1/asn1c/RevocationInfoChoices.h index 342fbbff..a37537d4 100644 --- a/src/asn1/asn1c/RevocationInfoChoices.h +++ b/src/asn1/asn1c/RevocationInfoChoices.h @@ -8,12 +8,10 @@ #ifndef _RevocationInfoChoices_H_ #define _RevocationInfoChoices_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/RevocationInfoChoice.h" #include "asn1/asn1c/asn_SET_OF.h" #include "asn1/asn1c/constr_SET_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct RevocationInfoChoice; @@ -31,8 +29,4 @@ extern asn_TYPE_descriptor_t asn_DEF_RevocationInfoChoices; extern asn_SET_OF_specifics_t asn_SPC_RevocationInfoChoices_specs_1; extern asn_TYPE_member_t asn_MBR_RevocationInfoChoices_1[1]; -/* Referred external types */ -#include "asn1/asn1c/RevocationInfoChoice.h" - #endif /* _RevocationInfoChoices_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/RouteOriginAttestation.c b/src/asn1/asn1c/RouteOriginAttestation.c index 7871f584..ecaa7db5 100644 --- a/src/asn1/asn1c/RouteOriginAttestation.c +++ b/src/asn1/asn1c/RouteOriginAttestation.c @@ -7,6 +7,8 @@ #include "asn1/asn1c/RouteOriginAttestation.h" +#include "asn1/asn1c/asn_internal.h" + static int memb_ipAddrBlocks_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { diff --git a/src/asn1/asn1c/RouteOriginAttestation.h b/src/asn1/asn1c/RouteOriginAttestation.h index a5a07229..1320aa77 100644 --- a/src/asn1/asn1c/RouteOriginAttestation.h +++ b/src/asn1/asn1c/RouteOriginAttestation.h @@ -8,15 +8,13 @@ #ifndef _RouteOriginAttestation_H_ #define _RouteOriginAttestation_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/INTEGER.h" #include "asn1/asn1c/ASId.h" +#include "asn1/asn1c/INTEGER.h" +#include "asn1/asn1c/ROAIPAddressFamily.h" #include "asn1/asn1c/asn_SEQUENCE_OF.h" -#include "asn1/asn1c/constr_SEQUENCE_OF.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_SEQUENCE_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct ROAIPAddressFamily; @@ -39,8 +37,4 @@ typedef struct RouteOriginAttestation { /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_RouteOriginAttestation; -/* Referred external types */ -#include "asn1/asn1c/ROAIPAddressFamily.h" - #endif /* _RouteOriginAttestation_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/SignatureAlgorithmIdentifier.h b/src/asn1/asn1c/SignatureAlgorithmIdentifier.h index 9a725150..6575c3d3 100644 --- a/src/asn1/asn1c/SignatureAlgorithmIdentifier.h +++ b/src/asn1/asn1c/SignatureAlgorithmIdentifier.h @@ -8,11 +8,8 @@ #ifndef _SignatureAlgorithmIdentifier_H_ #define _SignatureAlgorithmIdentifier_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/AlgorithmIdentifier.h" +#include "asn1/asn1c/constr_TYPE.h" /* SignatureAlgorithmIdentifier */ typedef AlgorithmIdentifier_t SignatureAlgorithmIdentifier_t; @@ -27,4 +24,3 @@ der_type_encoder_f SignatureAlgorithmIdentifier_encode_der; xer_type_encoder_f SignatureAlgorithmIdentifier_encode_xer; #endif /* _SignatureAlgorithmIdentifier_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/SignatureValue.h b/src/asn1/asn1c/SignatureValue.h index 20c7b65f..2c5dbd82 100644 --- a/src/asn1/asn1c/SignatureValue.h +++ b/src/asn1/asn1c/SignatureValue.h @@ -8,11 +8,8 @@ #ifndef _SignatureValue_H_ #define _SignatureValue_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/OCTET_STRING.h" +#include "asn1/asn1c/constr_TYPE.h" /* SignatureValue */ typedef OCTET_STRING_t SignatureValue_t; @@ -27,4 +24,3 @@ der_type_encoder_f SignatureValue_encode_der; xer_type_encoder_f SignatureValue_encode_xer; #endif /* _SignatureValue_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/SignedAttributes.h b/src/asn1/asn1c/SignedAttributes.h index fb97588f..0f6900e4 100644 --- a/src/asn1/asn1c/SignedAttributes.h +++ b/src/asn1/asn1c/SignedAttributes.h @@ -8,12 +8,10 @@ #ifndef _SignedAttributes_H_ #define _SignedAttributes_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/CMSAttribute.h" #include "asn1/asn1c/asn_SET_OF.h" #include "asn1/asn1c/constr_SET_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct CMSAttribute; @@ -31,8 +29,4 @@ extern asn_TYPE_descriptor_t asn_DEF_SignedAttributes; extern asn_SET_OF_specifics_t asn_SPC_SignedAttributes_specs_1; extern asn_TYPE_member_t asn_MBR_SignedAttributes_1[1]; -/* Referred external types */ -#include "asn1/asn1c/CMSAttribute.h" - #endif /* _SignedAttributes_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/SignedData.h b/src/asn1/asn1c/SignedData.h index 5c3e4fec..36270934 100644 --- a/src/asn1/asn1c/SignedData.h +++ b/src/asn1/asn1c/SignedData.h @@ -8,15 +8,14 @@ #ifndef _SignedData_H_ #define _SignedData_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/CMSVersion.h" +#include "asn1/asn1c/CertificateSet.h" #include "asn1/asn1c/DigestAlgorithmIdentifiers.h" #include "asn1/asn1c/EncapsulatedContentInfo.h" +#include "asn1/asn1c/RevocationInfoChoices.h" #include "asn1/asn1c/SignerInfos.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct CertificateSet; @@ -38,9 +37,4 @@ typedef struct SignedData { /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_SignedData; -/* Referred external types */ -#include "asn1/asn1c/CertificateSet.h" -#include "asn1/asn1c/RevocationInfoChoices.h" - #endif /* _SignedData_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/SignedDataPKCS7.h b/src/asn1/asn1c/SignedDataPKCS7.h index df4f9e6f..c019472a 100644 --- a/src/asn1/asn1c/SignedDataPKCS7.h +++ b/src/asn1/asn1c/SignedDataPKCS7.h @@ -8,15 +8,14 @@ #ifndef _SignedDataPKCS7_H_ #define _SignedDataPKCS7_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/CMSVersion.h" +#include "asn1/asn1c/CertificateSet.h" #include "asn1/asn1c/DigestAlgorithmIdentifiers.h" #include "asn1/asn1c/EncapsulatedContentInfoPKCS7.h" +#include "asn1/asn1c/RevocationInfoChoices.h" #include "asn1/asn1c/SignerInfos.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct CertificateSet; @@ -38,9 +37,4 @@ typedef struct SignedDataPKCS7 { /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_SignedDataPKCS7; -/* Referred external types */ -#include "asn1/asn1c/CertificateSet.h" -#include "asn1/asn1c/RevocationInfoChoices.h" - #endif /* _SignedDataPKCS7_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/SignerIdentifier.h b/src/asn1/asn1c/SignerIdentifier.h index 60edd293..5cb7a84b 100644 --- a/src/asn1/asn1c/SignerIdentifier.h +++ b/src/asn1/asn1c/SignerIdentifier.h @@ -8,13 +8,10 @@ #ifndef _SignerIdentifier_H_ #define _SignerIdentifier_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/IssuerAndSerialNumber.h" #include "asn1/asn1c/CMSSubjectKeyIdentifier.h" +#include "asn1/asn1c/IssuerAndSerialNumber.h" #include "asn1/asn1c/constr_CHOICE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Dependencies */ typedef enum SignerIdentifier_PR { @@ -41,4 +38,3 @@ extern asn_CHOICE_specifics_t asn_SPC_SignerIdentifier_specs_1; extern asn_TYPE_member_t asn_MBR_SignerIdentifier_1[2]; #endif /* _SignerIdentifier_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/SignerInfo.h b/src/asn1/asn1c/SignerInfo.h index ff1a7491..b68ef389 100644 --- a/src/asn1/asn1c/SignerInfo.h +++ b/src/asn1/asn1c/SignerInfo.h @@ -8,16 +8,15 @@ #ifndef _SignerInfo_H_ #define _SignerInfo_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/CMSVersion.h" -#include "asn1/asn1c/SignerIdentifier.h" #include "asn1/asn1c/DigestAlgorithmIdentifier.h" #include "asn1/asn1c/SignatureAlgorithmIdentifier.h" #include "asn1/asn1c/SignatureValue.h" +#include "asn1/asn1c/SignedAttributes.h" +#include "asn1/asn1c/SignerIdentifier.h" +#include "asn1/asn1c/UnsignedAttributes.h" #include "asn1/asn1c/constr_SEQUENCE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct SignedAttributes; @@ -42,9 +41,4 @@ extern asn_TYPE_descriptor_t asn_DEF_SignerInfo; extern asn_SEQUENCE_specifics_t asn_SPC_SignerInfo_specs_1; extern asn_TYPE_member_t asn_MBR_SignerInfo_1[7]; -/* Referred external types */ -#include "asn1/asn1c/SignedAttributes.h" -#include "asn1/asn1c/UnsignedAttributes.h" - #endif /* _SignerInfo_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/SignerInfos.h b/src/asn1/asn1c/SignerInfos.h index 977ec013..4005a47c 100644 --- a/src/asn1/asn1c/SignerInfos.h +++ b/src/asn1/asn1c/SignerInfos.h @@ -8,12 +8,10 @@ #ifndef _SignerInfos_H_ #define _SignerInfos_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/SignerInfo.h" #include "asn1/asn1c/asn_SET_OF.h" #include "asn1/asn1c/constr_SET_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct SignerInfo; @@ -31,8 +29,4 @@ extern asn_TYPE_descriptor_t asn_DEF_SignerInfos; extern asn_SET_OF_specifics_t asn_SPC_SignerInfos_specs_1; extern asn_TYPE_member_t asn_MBR_SignerInfos_1[1]; -/* Referred external types */ -#include "asn1/asn1c/SignerInfo.h" - #endif /* _SignerInfos_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/SigningTime.h b/src/asn1/asn1c/SigningTime.h index 9e94881e..a396e3e9 100644 --- a/src/asn1/asn1c/SigningTime.h +++ b/src/asn1/asn1c/SigningTime.h @@ -8,11 +8,8 @@ #ifndef _SigningTime_H_ #define _SigningTime_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/Time.h" +#include "asn1/asn1c/constr_TYPE.h" /* SigningTime */ typedef Time_t SigningTime_t; @@ -27,4 +24,3 @@ der_type_encoder_f SigningTime_encode_der; xer_type_encoder_f SigningTime_encode_xer; #endif /* _SigningTime_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/TBSCertList.h b/src/asn1/asn1c/TBSCertList.h index 844b560f..bfbbbfd7 100644 --- a/src/asn1/asn1c/TBSCertList.h +++ b/src/asn1/asn1c/TBSCertList.h @@ -8,18 +8,16 @@ #ifndef _TBSCertList_H_ #define _TBSCertList_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/Version.h" #include "asn1/asn1c/AlgorithmIdentifier.h" +#include "asn1/asn1c/CertificateSerialNumber.h" +#include "asn1/asn1c/Extensions.h" #include "asn1/asn1c/Name.h" #include "asn1/asn1c/Time.h" +#include "asn1/asn1c/Version.h" #include "asn1/asn1c/asn_SEQUENCE_OF.h" -#include "asn1/asn1c/CertificateSerialNumber.h" #include "asn1/asn1c/constr_SEQUENCE.h" #include "asn1/asn1c/constr_SEQUENCE_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct Time; @@ -59,9 +57,4 @@ extern asn_TYPE_descriptor_t asn_DEF_TBSCertList; extern asn_SEQUENCE_specifics_t asn_SPC_TBSCertList_specs_1; extern asn_TYPE_member_t asn_MBR_TBSCertList_1[7]; -/* Referred external types */ -#include "asn1/asn1c/Time.h" -#include "asn1/asn1c/Extensions.h" - #endif /* _TBSCertList_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/Time.h b/src/asn1/asn1c/Time.h index 413c957e..3ed85802 100644 --- a/src/asn1/asn1c/Time.h +++ b/src/asn1/asn1c/Time.h @@ -8,13 +8,10 @@ #ifndef _Time_H_ #define _Time_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ -#include "asn1/asn1c/UTCTime.h" #include "asn1/asn1c/GeneralizedTime.h" +#include "asn1/asn1c/UTCTime.h" #include "asn1/asn1c/constr_CHOICE.h" +#include "asn1/asn1c/constr_TYPE.h" /* Dependencies */ typedef enum Time_PR { @@ -41,4 +38,3 @@ extern asn_CHOICE_specifics_t asn_SPC_Time_specs_1; extern asn_TYPE_member_t asn_MBR_Time_1[2]; #endif /* _Time_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/UTCTime.c b/src/asn1/asn1c/UTCTime.c index 5409ba68..f3ba02ab 100644 --- a/src/asn1/asn1c/UTCTime.c +++ b/src/asn1/asn1c/UTCTime.c @@ -3,14 +3,15 @@ * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/UTCTime.h" #include #include -#include "json_util.h" #include "asn1/asn1c/GeneralizedTime.h" +#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/xer_encoder.h" +#include "json_util.h" #ifndef ASN___INTERNAL_TEST_MODE @@ -74,7 +75,7 @@ UTCTime_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, asn_enc_rval_t UTCTime_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, + int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) { if(flags & XER_F_CANONICAL) { asn_enc_rval_t rv; diff --git a/src/asn1/asn1c/UTCTime.h b/src/asn1/asn1c/UTCTime.h index 1e085cbf..f3266172 100644 --- a/src/asn1/asn1c/UTCTime.h +++ b/src/asn1/asn1c/UTCTime.h @@ -5,10 +5,11 @@ #ifndef _UTCTime_H_ #define _UTCTime_H_ -#include "asn1/asn1c/OCTET_STRING.h" #include #include +#include "asn1/asn1c/OCTET_STRING.h" + typedef OCTET_STRING_t UTCTime_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_UTCTime; diff --git a/src/asn1/asn1c/UnsignedAttributes.h b/src/asn1/asn1c/UnsignedAttributes.h index 6bbc8044..9079b59a 100644 --- a/src/asn1/asn1c/UnsignedAttributes.h +++ b/src/asn1/asn1c/UnsignedAttributes.h @@ -8,12 +8,10 @@ #ifndef _UnsignedAttributes_H_ #define _UnsignedAttributes_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ +#include "asn1/asn1c/CMSAttribute.h" #include "asn1/asn1c/asn_SET_OF.h" #include "asn1/asn1c/constr_SET_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* Forward declarations */ struct CMSAttribute; @@ -31,8 +29,4 @@ extern asn_TYPE_descriptor_t asn_DEF_UnsignedAttributes; extern asn_SET_OF_specifics_t asn_SPC_UnsignedAttributes_specs_1; extern asn_TYPE_member_t asn_MBR_UnsignedAttributes_1[1]; -/* Referred external types */ -#include "asn1/asn1c/CMSAttribute.h" - #endif /* _UnsignedAttributes_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/Version.h b/src/asn1/asn1c/Version.h index 574113e3..1c744c1f 100644 --- a/src/asn1/asn1c/Version.h +++ b/src/asn1/asn1c/Version.h @@ -8,11 +8,8 @@ #ifndef _Version_H_ #define _Version_H_ - -#include "asn1/asn1c/asn_application.h" - -/* Including external dependencies */ #include "asn1/asn1c/INTEGER.h" +#include "asn1/asn1c/constr_TYPE.h" /* Dependencies */ typedef enum Version { @@ -34,4 +31,3 @@ der_type_encoder_f Version_encode_der; xer_type_encoder_f Version_encode_xer; #endif /* _Version_H_ */ -#include "asn1/asn1c/asn_internal.h" diff --git a/src/asn1/asn1c/asn_SEQUENCE_OF.c b/src/asn1/asn1c/asn_SEQUENCE_OF.c index ef80a023..640cf764 100644 --- a/src/asn1/asn1c/asn_SEQUENCE_OF.c +++ b/src/asn1/asn1c/asn_SEQUENCE_OF.c @@ -2,7 +2,6 @@ * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/asn_SEQUENCE_OF.h" typedef A_SEQUENCE_OF(void) asn_sequence; diff --git a/src/asn1/asn1c/asn_SET_OF.c b/src/asn1/asn1c/asn_SET_OF.c index fcf2ce95..cffea4a9 100644 --- a/src/asn1/asn1c/asn_SET_OF.c +++ b/src/asn1/asn1c/asn_SET_OF.c @@ -2,10 +2,12 @@ * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/asn_SET_OF.h" + #include +#include "asn1/asn1c/asn_internal.h" + /* * Add another element into the set. */ diff --git a/src/asn1/asn1c/asn_application.c b/src/asn1/asn1c/asn_application.c deleted file mode 100644 index 469a0a48..00000000 --- a/src/asn1/asn1c/asn_application.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2017 Lev Walkin . All rights reserved. - * Redistribution and modifications are permitted subject to BSD license. - */ -#include "asn1/asn1c/asn_internal.h" -#include "asn1/asn1c/asn_application.h" -#include -#include - -static asn_enc_rval_t asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx, - enum asn_transfer_syntax syntax, - const asn_TYPE_descriptor_t *td, - const void *sptr, - asn_app_consume_bytes_f *callback, - void *callback_key); - - -struct callback_count_bytes_key { - asn_app_consume_bytes_f *callback; - void *callback_key; - size_t computed_size; -}; - -/* - * Encoder which just counts bytes that come through it. - */ -static int -callback_count_bytes_cb(const void *data, size_t size, void *keyp) { - struct callback_count_bytes_key *key = keyp; - int ret; - - ret = key->callback(data, size, key->callback_key); - if(ret >= 0) { - key->computed_size += size; - } - - return ret; -} - -struct overrun_encoder_key { - void *buffer; - size_t buffer_size; - size_t computed_size; -}; - -struct dynamic_encoder_key { - void *buffer; - size_t buffer_size; - size_t computed_size; -}; - -struct callback_failure_catch_key { - asn_app_consume_bytes_f *callback; - void *callback_key; - int callback_failed; -}; - -/* - * Encoder which doesn't stop counting bytes - * even if it reaches the end of the buffer. - */ -static int -overrun_encoder_cb(const void *data, size_t size, void *keyp) { - struct overrun_encoder_key *key = keyp; - - if(key->computed_size + size > key->buffer_size) { - /* - * Avoid accident on the next call: - * stop adding bytes to the buffer. - */ - key->buffer_size = 0; - } else { - memcpy((char *)key->buffer + key->computed_size, data, size); - } - key->computed_size += size; - - return 0; -} - -/* - * Encoder which dynamically allocates output, and continues - * to count even if allocation failed. - */ -static int -dynamic_encoder_cb(const void *data, size_t size, void *keyp) { - struct dynamic_encoder_key *key = keyp; - - if(key->buffer) { - if(key->computed_size + size >= key->buffer_size) { - void *p; - size_t new_size = key->buffer_size; - - do { - new_size *= 2; - } while(new_size <= key->computed_size + size); - - p = REALLOC(key->buffer, new_size); - if(p) { - key->buffer = p; - key->buffer_size = new_size; - } else { - FREEMEM(key->buffer); - key->buffer = 0; - key->buffer_size = 0; - key->computed_size += size; - return 0; - } - } - memcpy((char *)key->buffer + key->computed_size, data, size); - } - - key->computed_size += size; - - return 0; -} - -/* - * Encoder which help convert the application level encoder failure into EIO. - */ -static int -callback_failure_catch_cb(const void *data, size_t size, void *keyp) { - struct callback_failure_catch_key *key = keyp; - int ret; - - ret = key->callback(data, size, key->callback_key); - if(ret < 0) { - key->callback_failed = 1; - } - - return ret; -} - -asn_enc_rval_t -asn_encode(const asn_codec_ctx_t *opt_codec_ctx, - enum asn_transfer_syntax syntax, const asn_TYPE_descriptor_t *td, - const void *sptr, asn_app_consume_bytes_f *callback, void *callback_key) { - struct callback_failure_catch_key cb_key; - asn_enc_rval_t er; - - if(!callback) { - errno = EINVAL; - ASN__ENCODE_FAILED; - } - - cb_key.callback = callback; - cb_key.callback_key = callback_key; - cb_key.callback_failed = 0; - - er = asn_encode_internal(opt_codec_ctx, syntax, td, sptr, - callback_failure_catch_cb, &cb_key); - if(cb_key.callback_failed) { - assert(er.encoded == -1); - assert(errno == EBADF); - errno = EIO; - } - - return er; -} - -asn_enc_rval_t -asn_encode_to_buffer(const asn_codec_ctx_t *opt_codec_ctx, - enum asn_transfer_syntax syntax, - const asn_TYPE_descriptor_t *td, const void *sptr, - void *buffer, size_t buffer_size) { - struct overrun_encoder_key buf_key; - asn_enc_rval_t er; - - if(buffer_size > 0 && !buffer) { - errno = EINVAL; - ASN__ENCODE_FAILED; - } - - buf_key.buffer = buffer; - buf_key.buffer_size = buffer_size; - buf_key.computed_size = 0; - - er = asn_encode_internal(opt_codec_ctx, syntax, td, sptr, - overrun_encoder_cb, &buf_key); - - if(er.encoded >= 0 && (size_t)er.encoded != buf_key.computed_size) { - ASN_DEBUG("asn_encode() returned %" ASN_PRI_SSIZE - " yet produced %" ASN_PRI_SIZE " bytes", - er.encoded, buf_key.computed_size); - assert(er.encoded < 0 || (size_t)er.encoded == buf_key.computed_size); - } - - return er; -} - -asn_encode_to_new_buffer_result_t -asn_encode_to_new_buffer(const asn_codec_ctx_t *opt_codec_ctx, - enum asn_transfer_syntax syntax, - const asn_TYPE_descriptor_t *td, const void *sptr) { - struct dynamic_encoder_key buf_key; - asn_encode_to_new_buffer_result_t res; - - buf_key.buffer_size = 16; - buf_key.buffer = MALLOC(buf_key.buffer_size); - buf_key.computed_size = 0; - - res.result = asn_encode_internal(opt_codec_ctx, syntax, td, sptr, - dynamic_encoder_cb, &buf_key); - - if(res.result.encoded >= 0 - && (size_t)res.result.encoded != buf_key.computed_size) { - ASN_DEBUG("asn_encode() returned %" ASN_PRI_SSIZE - " yet produced %" ASN_PRI_SIZE " bytes", - res.result.encoded, buf_key.computed_size); - assert(res.result.encoded < 0 - || (size_t)res.result.encoded == buf_key.computed_size); - } - - res.buffer = buf_key.buffer; - - /* 0-terminate just in case. */ - if(res.buffer) { - assert(buf_key.computed_size < buf_key.buffer_size); - ((char *)res.buffer)[buf_key.computed_size] = '\0'; - } - - return res; -} - -static asn_enc_rval_t -asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx, - enum asn_transfer_syntax syntax, - const asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_consume_bytes_f *callback, void *callback_key) { - asn_enc_rval_t er; - - (void)opt_codec_ctx; /* Parameters are not checked on encode yet. */ - - if(!td || !sptr) { - errno = EINVAL; - ASN__ENCODE_FAILED; - } - - switch(syntax) { - case ATS_NONSTANDARD_PLAINTEXT: - if(td->op->print_struct) { - struct callback_count_bytes_key cb_key; - cb_key.callback = callback; - cb_key.callback_key = callback_key; - cb_key.computed_size = 0; - if(td->op->print_struct(td, sptr, 1, callback_count_bytes_cb, - &cb_key) - < 0 - || callback_count_bytes_cb("\n", 1, &cb_key) < 0) { - errno = EBADF; /* Structure has incorrect form. */ - er.encoded = -1; - er.failed_type = td; - er.structure_ptr = sptr; - } else { - er.encoded = cb_key.computed_size; - er.failed_type = 0; - er.structure_ptr = 0; - } - } else { - errno = ENOENT; /* Transfer syntax is not defined for this type. */ - ASN__ENCODE_FAILED; - } - break; - - case ATS_BER: - /* BER is a superset of DER. */ - /* Fall through. */ - case ATS_DER: - if(td->op->der_encoder) { - er = der_encode(td, sptr, callback, callback_key); - if(er.encoded == -1) { - if(er.failed_type && er.failed_type->op->der_encoder) { - errno = EBADF; /* Structure has incorrect form. */ - } else { - errno = ENOENT; /* DER is not defined for this type. */ - } - } - } else { - errno = ENOENT; /* Transfer syntax is not defined for this type. */ - ASN__ENCODE_FAILED; - } - break; - case ATS_CER: - errno = ENOENT; /* Transfer syntax is not defined for any type. */ - ASN__ENCODE_FAILED; - - default: - errno = ENOENT; - ASN__ENCODE_FAILED; - } - - return er; -} diff --git a/src/asn1/asn1c/asn_application.h b/src/asn1/asn1c/asn_application.h deleted file mode 100644 index e59ab437..00000000 --- a/src/asn1/asn1c/asn_application.h +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * Copyright (c) 2004-2017 Lev Walkin . All rights reserved. - * Redistribution and modifications are permitted subject to BSD license. - */ -/* - * Application-level ASN.1 callbacks. - */ -#ifndef ASN_APPLICATION_H -#define ASN_APPLICATION_H - -#include "asn1/asn1c/asn_system.h" /* for platform-dependent types */ -#include "asn1/asn1c/asn_codecs.h" /* for ASN.1 codecs specifics */ - -/* - * A selection of ASN.1 Transfer Syntaxes to use with generalized - * encoders and decoders declared further in this .h file. - */ -enum asn_transfer_syntax { - /* Avoid appearance of a default transfer syntax. */ - ATS_INVALID = 0, - /* Plaintext output (not conforming to any standard), for debugging. */ - ATS_NONSTANDARD_PLAINTEXT, - /* - * X.690: - * BER: Basic Encoding Rules. - * DER: Distinguished Encoding Rules. - * CER: Canonical Encoding Rules. - * DER and CER are more strict variants of BER. - */ - ATS_BER, - ATS_DER, - ATS_CER, /* Only decoding is supported */ -}; - -/* - * A generic encoder for any supported transfer syntax. - * RETURN VALUES: - * The (.encoded) field of the return value is REDEFINED to mean the following: - * >=0: The computed size of the encoded data. Can exceed the (buffer_size). - * -1: Error encoding the structure. See the error code in (errno): - * EINVAL: Incorrect parameters to the function, such as NULLs. - * ENOENT: Encoding transfer syntax is not defined (for this type). - * EBADF: The structure has invalid form or content constraint failed. - * The (.failed_type) and (.structure_ptr) MIGHT be set to the appropriate - * values at the place of failure, if at all possible. - * WARNING: The (.encoded) field of the return value can exceed the buffer_size. - * This is similar to snprintf(3) contract which might return values - * greater than the buffer size. - */ -asn_enc_rval_t asn_encode_to_buffer( - const asn_codec_ctx_t *opt_codec_parameters, /* See asn_codecs.h */ - enum asn_transfer_syntax, - const struct asn_TYPE_descriptor_s *type_to_encode, - const void *structure_to_encode, void *buffer, size_t buffer_size); - -/* - * A variant of asn_encode_to_buffer() with automatically allocated buffer. - * RETURN VALUES: - * On success, returns a newly allocated (.buffer) containing the whole message. - * The message size is returned in (.result.encoded). - * On failure: - * (.buffer) is NULL, - * (.result.encoded) as in asn_encode_to_buffer(), - * The errno codes as in asn_encode_to_buffer(), plus the following: - * ENOMEM: Memory allocation failed due to system or internal limits. - * The user is responsible for freeing the (.buffer). - */ -typedef struct asn_encode_to_new_buffer_result_s { - void *buffer; /* NULL if failed to encode. */ - asn_enc_rval_t result; -} asn_encode_to_new_buffer_result_t; -asn_encode_to_new_buffer_result_t asn_encode_to_new_buffer( - const asn_codec_ctx_t *opt_codec_parameters, /* See asn_codecs.h */ - enum asn_transfer_syntax, - const struct asn_TYPE_descriptor_s *type_to_encode, - const void *structure_to_encode); - - -/* - * Generic type of an application-defined callback to return various - * types of data to the application. - * EXPECTED RETURN VALUES: - * -1: Failed to consume bytes. Abort the mission. - * Non-negative return values indicate success, and ignored. - */ -typedef int(asn_app_consume_bytes_f)(const void *buffer, size_t size, - void *application_specific_key); - - -/* - * A generic encoder for any supported transfer syntax. - * Returns the comprehensive encoding result descriptor (see asn_codecs.h). - * RETURN VALUES: - * The negative (.encoded) field of the return values is accompanied with the - * following error codes (errno): - * EINVAL: Incorrect parameters to the function, such as NULLs. - * ENOENT: Encoding transfer syntax is not defined (for this type). - * EBADF: The structure has invalid form or content constraint failed. - * EIO: The (callback) has returned negative value during encoding. - */ -asn_enc_rval_t asn_encode( - const asn_codec_ctx_t *opt_codec_parameters, /* See asn_codecs.h */ - enum asn_transfer_syntax, - const struct asn_TYPE_descriptor_s *type_to_encode, - const void *structure_to_encode, - asn_app_consume_bytes_f *callback, void *callback_key); - - -/* - * A callback of this type is called whenever constraint validation fails - * on some ASN.1 type. See "constraints.h" for more details on constraint - * validation. - * This callback specifies a descriptor of the ASN.1 type which failed - * the constraint check, as well as human readable message on what - * particular constraint has failed. - */ -typedef void (asn_app_constraint_failed_f)(void *application_specific_key, - const struct asn_TYPE_descriptor_s *type_descriptor_which_failed, - const void *structure_which_failed_ptr, - const char *error_message_format, ...) CC_PRINTFLIKE(4, 5); - -#include "asn1/asn1c/constr_TYPE.h" /* for asn_TYPE_descriptor_t */ - -#endif /* ASN_APPLICATION_H */ diff --git a/src/asn1/asn1c/asn_codecs_prim.c b/src/asn1/asn1c/asn_codecs_prim.c index cc2fcf86..d1616092 100644 --- a/src/asn1/asn1c/asn_codecs_prim.c +++ b/src/asn1/asn1c/asn_codecs_prim.c @@ -2,10 +2,14 @@ * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/asn_codecs_prim.h" + #include +#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/ber_decoder.h" +#include "asn1/asn1c/der_encoder.h" + /* * Decode an always-primitive type. */ diff --git a/src/asn1/asn1c/asn_codecs_prim.h b/src/asn1/asn1c/asn_codecs_prim.h index 30675ca9..08a75a84 100644 --- a/src/asn1/asn1c/asn_codecs_prim.h +++ b/src/asn1/asn1c/asn_codecs_prim.h @@ -5,7 +5,7 @@ #ifndef ASN_CODECS_PRIM_H #define ASN_CODECS_PRIM_H -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" typedef struct ASN__PRIMITIVE_TYPE_s { uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */ diff --git a/src/asn1/asn1c/asn_internal.h b/src/asn1/asn1c/asn_internal.h index ae8157f6..54aa25e1 100644 --- a/src/asn1/asn1c/asn_internal.h +++ b/src/asn1/asn1c/asn_internal.h @@ -10,7 +10,7 @@ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ /* for Sun */ #endif -#include "asn1/asn1c/asn_application.h" /* Application-visible API */ +#include "asn1/asn1c/constr_TYPE.h" /* Environment version might be used to avoid running with the old library */ #define ASN1C_ENVIRONMENT_VERSION 923 /* Compile-time version */ diff --git a/src/asn1/asn1c/asn_ioc.h b/src/asn1/asn1c/asn_ioc.h index 06c2a35e..90026908 100644 --- a/src/asn1/asn1c/asn_ioc.h +++ b/src/asn1/asn1c/asn_ioc.h @@ -6,7 +6,7 @@ #ifndef ASN_IOC_H #define ASN_IOC_H -#include "asn1/asn1c/asn_system.h" /* Platform-specific types */ +#include "asn1/asn1c/asn_system.h" struct asn_TYPE_descriptor_s; struct asn_ioc_cell_s; diff --git a/src/asn1/asn1c/ber_decoder.c b/src/asn1/asn1c/ber_decoder.c index b7ba96dd..fa712df9 100644 --- a/src/asn1/asn1c/ber_decoder.c +++ b/src/asn1/asn1c/ber_decoder.c @@ -2,6 +2,7 @@ * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ +#include "asn1/asn1c/ber_decoder.h" #include diff --git a/src/asn1/asn1c/ber_decoder.h b/src/asn1/asn1c/ber_decoder.h index 72fb98b7..6178c3ac 100644 --- a/src/asn1/asn1c/ber_decoder.h +++ b/src/asn1/asn1c/ber_decoder.h @@ -5,7 +5,7 @@ #ifndef _BER_DECODER_H_ #define _BER_DECODER_H_ -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" struct asn_TYPE_descriptor_s; /* Forward declaration */ struct asn_codec_ctx_s; /* Forward declaration */ @@ -25,14 +25,6 @@ asn_dec_rval_t ber_decode( size_t size /* Size of that buffer */ ); -/* - * Type of generic function which decodes the byte stream into the structure. - */ -typedef asn_dec_rval_t(ber_type_decoder_f)( - const struct asn_codec_ctx_s *opt_codec_ctx, - const struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, - const void *buf_ptr, size_t size, int tag_mode); - /******************************* * INTERNALLY USEFUL FUNCTIONS * *******************************/ diff --git a/src/asn1/asn1c/ber_tlv_length.c b/src/asn1/asn1c/ber_tlv_length.c index 1e9d58d0..0df8a740 100644 --- a/src/asn1/asn1c/ber_tlv_length.c +++ b/src/asn1/asn1c/ber_tlv_length.c @@ -2,8 +2,9 @@ * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/ber_tlv_length.h" + +#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/ber_tlv_tag.h" ssize_t diff --git a/src/asn1/asn1c/ber_tlv_length.h b/src/asn1/asn1c/ber_tlv_length.h index 133fc098..93cb4f92 100644 --- a/src/asn1/asn1c/ber_tlv_length.h +++ b/src/asn1/asn1c/ber_tlv_length.h @@ -5,13 +5,7 @@ #ifndef _BER_TLV_LENGTH_H_ #define _BER_TLV_LENGTH_H_ -#include -#include -#include -#include -#include -#include -#include +#include "asn1/asn1c/asn_codecs.h" typedef ssize_t ber_tlv_len_t; diff --git a/src/asn1/asn1c/ber_tlv_tag.c b/src/asn1/asn1c/ber_tlv_tag.c index b0c78792..2380f945 100644 --- a/src/asn1/asn1c/ber_tlv_tag.c +++ b/src/asn1/asn1c/ber_tlv_tag.c @@ -3,8 +3,8 @@ * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/ber_tlv_tag.h" + #include ssize_t diff --git a/src/asn1/asn1c/constr_CHOICE.c b/src/asn1/asn1c/constr_CHOICE.c index df67ffa3..2efec8fe 100644 --- a/src/asn1/asn1c/constr_CHOICE.c +++ b/src/asn1/asn1c/constr_CHOICE.c @@ -2,11 +2,15 @@ * Copyright (c) 2003-2017 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ +#include "asn1/asn1c/constr_CHOICE.h" #include #include "asn1/asn1c/asn_internal.h" -#include "asn1/asn1c/constr_CHOICE.h" +#include "asn1/asn1c/ber_decoder.h" +#include "asn1/asn1c/constraints.h" +#include "asn1/asn1c/der_encoder.h" +#include "asn1/asn1c/xer_encoder.h" /* * Number of bytes left for this structure. @@ -548,7 +552,7 @@ CHOICE_encode_json(const asn_TYPE_descriptor_t *td, const void *sptr) asn_enc_rval_t CHOICE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, + int flags, asn_app_consume_bytes_f *cb, void *app_key) { const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics; diff --git a/src/asn1/asn1c/constr_CHOICE.h b/src/asn1/asn1c/constr_CHOICE.h index 704a4d44..87c473e5 100644 --- a/src/asn1/asn1c/constr_CHOICE.h +++ b/src/asn1/asn1c/constr_CHOICE.h @@ -5,7 +5,7 @@ #ifndef _CONSTR_CHOICE_H_ #define _CONSTR_CHOICE_H_ -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" typedef struct asn_CHOICE_specifics_s { /* diff --git a/src/asn1/asn1c/constr_SEQUENCE.c b/src/asn1/asn1c/constr_SEQUENCE.c index 64f402c3..d2342eab 100644 --- a/src/asn1/asn1c/constr_SEQUENCE.c +++ b/src/asn1/asn1c/constr_SEQUENCE.c @@ -4,12 +4,17 @@ * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/constr_SEQUENCE.h" #include -#include "json_util.h" + #include "asn1/asn1c/OPEN_TYPE.h" +#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/ber_decoder.h" +#include "asn1/asn1c/constraints.h" +#include "asn1/asn1c/der_encoder.h" +#include "asn1/asn1c/xer_encoder.h" +#include "json_util.h" /* * Number of bytes left for this structure. @@ -650,7 +655,7 @@ fail: json_decref(parent); asn_enc_rval_t SEQUENCE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, + int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; int xcan = (flags & XER_F_CANONICAL); diff --git a/src/asn1/asn1c/constr_SEQUENCE.h b/src/asn1/asn1c/constr_SEQUENCE.h index c64142c1..4507f3be 100644 --- a/src/asn1/asn1c/constr_SEQUENCE.h +++ b/src/asn1/asn1c/constr_SEQUENCE.h @@ -5,7 +5,7 @@ #ifndef _CONSTR_SEQUENCE_H_ #define _CONSTR_SEQUENCE_H_ -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" typedef struct asn_SEQUENCE_specifics_s { /* diff --git a/src/asn1/asn1c/constr_SEQUENCE_OF.c b/src/asn1/asn1c/constr_SEQUENCE_OF.c index 1e7475fa..117e0291 100644 --- a/src/asn1/asn1c/constr_SEQUENCE_OF.c +++ b/src/asn1/asn1c/constr_SEQUENCE_OF.c @@ -3,9 +3,12 @@ * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/constr_SEQUENCE_OF.h" + #include "asn1/asn1c/asn_SEQUENCE_OF.h" +#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/der_encoder.h" +#include "asn1/asn1c/xer_encoder.h" /* * The DER encoder of the SEQUENCE OF type. @@ -89,7 +92,7 @@ SEQUENCE_OF_encode_der(const asn_TYPE_descriptor_t *td, const void *ptr, asn_enc_rval_t SEQUENCE_OF_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, + int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics; diff --git a/src/asn1/asn1c/constr_SEQUENCE_OF.h b/src/asn1/asn1c/constr_SEQUENCE_OF.h index 916f063c..ec2e4389 100644 --- a/src/asn1/asn1c/constr_SEQUENCE_OF.h +++ b/src/asn1/asn1c/constr_SEQUENCE_OF.h @@ -5,8 +5,8 @@ #ifndef _CONSTR_SEQUENCE_OF_H_ #define _CONSTR_SEQUENCE_OF_H_ -#include "asn1/asn1c/asn_application.h" -#include "asn1/asn1c/constr_SET_OF.h" /* Implemented using SET OF */ +#include "asn1/asn1c/constr_SET_OF.h" +#include "asn1/asn1c/constr_TYPE.h" /* * A set specialized functions dealing with the SEQUENCE OF type. diff --git a/src/asn1/asn1c/constr_SET_OF.c b/src/asn1/asn1c/constr_SET_OF.c index cadbacf0..e4a01a5b 100644 --- a/src/asn1/asn1c/constr_SET_OF.c +++ b/src/asn1/asn1c/constr_SET_OF.c @@ -4,12 +4,17 @@ * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/constr_SET_OF.h" #include -#include "json_util.h" + #include "asn1/asn1c/asn_SET_OF.h" +#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/ber_decoder.h" +#include "asn1/asn1c/constraints.h" +#include "asn1/asn1c/der_encoder.h" +#include "asn1/asn1c/xer_encoder.h" +#include "json_util.h" /* * Number of bytes left for this structure. @@ -560,7 +565,7 @@ SET_OF_xer_order(const void *aptr, const void *bptr) { asn_enc_rval_t SET_OF_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, + int flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics; diff --git a/src/asn1/asn1c/constr_SET_OF.h b/src/asn1/asn1c/constr_SET_OF.h index 3d77f381..dba104db 100644 --- a/src/asn1/asn1c/constr_SET_OF.h +++ b/src/asn1/asn1c/constr_SET_OF.h @@ -5,7 +5,7 @@ #ifndef CONSTR_SET_OF_H #define CONSTR_SET_OF_H -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" typedef struct asn_SET_OF_specifics_s { /* diff --git a/src/asn1/asn1c/constr_TYPE.c b/src/asn1/asn1c/constr_TYPE.c index 602b2631..9e329dd8 100644 --- a/src/asn1/asn1c/constr_TYPE.c +++ b/src/asn1/asn1c/constr_TYPE.c @@ -2,11 +2,13 @@ * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/constr_TYPE.h" + #include #include +#include "asn1/asn1c/asn_internal.h" + /* * Version of the ASN.1 infrastructure shipped with compiler. */ diff --git a/src/asn1/asn1c/constr_TYPE.h b/src/asn1/asn1c/constr_TYPE.h index 758e6312..065830e6 100644 --- a/src/asn1/asn1c/constr_TYPE.h +++ b/src/asn1/asn1c/constr_TYPE.h @@ -11,6 +11,9 @@ #ifndef _CONSTR_TYPE_H_ #define _CONSTR_TYPE_H_ +#include + +#include "asn1/asn1c/asn_system.h" #include "asn1/asn1c/ber_tlv_length.h" #include "asn1/asn1c/ber_tlv_tag.h" @@ -30,12 +33,6 @@ typedef struct asn_struct_ctx_s { ber_tlv_len_t left; /* Number of bytes left, -1 for indefinite */ } asn_struct_ctx_t; -#include "asn1/asn1c/ber_decoder.h" /* Basic Encoding Rules decoder */ -#include "asn1/asn1c/der_encoder.h" /* Distinguished Encoding Rules encoder */ -#include "asn1/asn1c/xer_encoder.h" /* Encoder into XER (XML, text) */ -#include "asn1/asn1c/json_encoder.h" /* Encoder into JSON */ -#include "asn1/asn1c/constraints.h" /* Subtype constraints support */ - /* * Free the structure according to its specification. * Use one of ASN_STRUCT_{FREE,RESET,CONTENTS_ONLY} macros instead. @@ -77,6 +74,16 @@ typedef void (asn_struct_free_f)( #define ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr) \ (asn_DEF).op->free_struct(&(asn_DEF), (ptr), ASFM_FREE_UNDERLYING) +/* + * Generic type of an application-defined callback to return various + * types of data to the application. + * EXPECTED RETURN VALUES: + * -1: Failed to consume bytes. Abort the mission. + * Non-negative return values indicate success, and ignored. + */ +typedef int(asn_app_consume_bytes_f)(const void *buffer, size_t size, + void *application_specific_key); + /* * Print the structure according to its specification. */ @@ -97,6 +104,37 @@ typedef int (asn_struct_compare_f)( const void *struct_A, const void *struct_B); +/* Decodes a BER byte stream into a structure. */ +typedef asn_dec_rval_t(ber_type_decoder_f)( + const struct asn_codec_ctx_s *opt_codec_ctx, + const struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, + const void *buf_ptr, size_t size, int tag_mode); + +/* Encodes a structure into a DER byte stream. */ +typedef asn_enc_rval_t(der_type_encoder_f)( + const struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, /* Structure to be encoded */ + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ + void *app_key /* Arbitrary callback argument */ +); + +/* Encodes a structure into a JSON. */ +typedef json_t *(json_type_encoder_f)( + const struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr /* Structure to be encoded */ +); + +/* Encodes a structure into an XML stream. */ +typedef asn_enc_rval_t(xer_type_encoder_f)( + const struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, /* Structure to be encoded */ + int ilevel, /* Level of indentation */ + int xer_flags, /* enum xer_encoder_flags_e */ + asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ + void *app_key /* Arbitrary callback argument */ +); + /* * Return the outmost tag of the type. * If the type is untagged CHOICE, the dynamic operation is performed. @@ -109,6 +147,29 @@ typedef ber_tlv_tag_t (asn_outmost_tag_f)( /* The instance of the above function type; used internally. */ asn_outmost_tag_f asn_TYPE_outmost_tag; +/* + * A callback of this type is called whenever constraint validation fails + * on some ASN.1 type. See "constraints.h" for more details on constraint + * validation. + * This callback specifies a descriptor of the ASN.1 type which failed + * the constraint check, as well as human readable message on what + * particular constraint has failed. + */ +typedef void (asn_app_constraint_failed_f)(void *application_specific_key, + const struct asn_TYPE_descriptor_s *type_descriptor_which_failed, + const void *structure_which_failed_ptr, + const char *error_message_format, ...) CC_PRINTFLIKE(4, 5); + +/* + * Generic type for constraint checking callback, + * associated with every type descriptor. + */ +typedef int(asn_constr_check_f)( + const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, + asn_app_constraint_failed_f *optional_callback, /* Log the error */ + void *optional_app_key /* Opaque key passed to a callback */ +); + /* * Fetch the desired type of the Open Type based on the * Information Object Set driven constraints. diff --git a/src/asn1/asn1c/constraints.c b/src/asn1/asn1c/constraints.c index 3cfbe94c..f3dffc6d 100644 --- a/src/asn1/asn1c/constraints.c +++ b/src/asn1/asn1c/constraints.c @@ -1,5 +1,5 @@ -#include "asn1/asn1c/asn_internal.h" #include "asn1/asn1c/constraints.h" + #include int diff --git a/src/asn1/asn1c/constraints.h b/src/asn1/asn1c/constraints.h index 16150e07..18d97863 100644 --- a/src/asn1/asn1c/constraints.h +++ b/src/asn1/asn1c/constraints.h @@ -5,7 +5,8 @@ #ifndef ASN1_CONSTRAINTS_VALIDATOR_H #define ASN1_CONSTRAINTS_VALIDATOR_H -#include "asn1/asn1c/asn_system.h" /* Platform-dependent types */ +#include "asn1/asn1c/asn_system.h" +#include "asn1/asn1c/constr_TYPE.h" struct asn_TYPE_descriptor_s; /* Forward declaration */ @@ -28,17 +29,6 @@ int asn_check_constraints( size_t *errlen /* Length of the error description */ ); - -/* - * Generic type for constraint checking callback, - * associated with every type descriptor. - */ -typedef int(asn_constr_check_f)( - const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, - asn_app_constraint_failed_f *optional_callback, /* Log the error */ - void *optional_app_key /* Opaque key passed to a callback */ -); - /******************************* * INTERNALLY USEFUL FUNCTIONS * *******************************/ diff --git a/src/asn1/asn1c/der_encoder.c b/src/asn1/asn1c/der_encoder.c index d0db21ed..58621076 100644 --- a/src/asn1/asn1c/der_encoder.c +++ b/src/asn1/asn1c/der_encoder.c @@ -2,9 +2,12 @@ * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/der_encoder.h" + #include +#include "asn1/asn1c/asn_internal.h" + static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, asn_app_consume_bytes_f *cb, void *app_key, int constructed); diff --git a/src/asn1/asn1c/der_encoder.h b/src/asn1/asn1c/der_encoder.h index 37005550..c6420b93 100644 --- a/src/asn1/asn1c/der_encoder.h +++ b/src/asn1/asn1c/der_encoder.h @@ -5,7 +5,7 @@ #ifndef _DER_ENCODER_H_ #define _DER_ENCODER_H_ -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" struct asn_TYPE_descriptor_s; /* Forward declaration */ @@ -30,18 +30,6 @@ asn_enc_rval_t der_encode_to_buffer( size_t buffer_size /* Initial buffer size (maximum) */ ); -/* - * Type of the generic DER encoder. - */ -typedef asn_enc_rval_t(der_type_encoder_f)( - const struct asn_TYPE_descriptor_s *type_descriptor, - const void *struct_ptr, /* Structure to be encoded */ - int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ - ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ - void *app_key /* Arbitrary callback argument */ -); - - /******************************* * INTERNALLY USEFUL FUNCTIONS * *******************************/ diff --git a/src/asn1/asn1c/json_encoder.c b/src/asn1/asn1c/json_encoder.c index fce881c8..b14c697e 100644 --- a/src/asn1/asn1c/json_encoder.c +++ b/src/asn1/asn1c/json_encoder.c @@ -1,6 +1,7 @@ #include "asn1/asn1c/json_encoder.h" #include "asn1/asn1c/asn_internal.h" +#include "asn1/asn1c/ber_decoder.h" json_t * json_encode(const asn_TYPE_descriptor_t *td, const void *sptr) diff --git a/src/asn1/asn1c/json_encoder.h b/src/asn1/asn1c/json_encoder.h index e5e6c8b0..f1cc4ec5 100644 --- a/src/asn1/asn1c/json_encoder.h +++ b/src/asn1/asn1c/json_encoder.h @@ -2,7 +2,15 @@ #define SRC_ASN1_ASN1C_JSON_ENCODER_H_ #include +#include +#include #include +#include +#include +#include +#include +#include +#include struct asn_TYPE_descriptor_s; /* Forward declaration */ @@ -13,12 +21,4 @@ json_t *json_encode( json_t *ber2json(struct asn_TYPE_descriptor_s const *, uint8_t *, size_t); -/* - * Type of the generic JSON encoder. - */ -typedef json_t *(json_type_encoder_f)( - const struct asn_TYPE_descriptor_s *type_descriptor, - const void *struct_ptr /* Structure to be encoded */ -); - #endif /* SRC_ASN1_ASN1C_JSON_ENCODER_H_ */ diff --git a/src/asn1/asn1c/xer_encoder.c b/src/asn1/asn1c/xer_encoder.c index e3d411c3..6b7a864e 100644 --- a/src/asn1/asn1c/xer_encoder.c +++ b/src/asn1/asn1c/xer_encoder.c @@ -2,6 +2,8 @@ * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ +#include "asn1/asn1c/xer_encoder.h" + #include "asn1/asn1c/asn_internal.h" /* diff --git a/src/asn1/asn1c/xer_encoder.h b/src/asn1/asn1c/xer_encoder.h index 95a4cf78..0d9a4a02 100644 --- a/src/asn1/asn1c/xer_encoder.h +++ b/src/asn1/asn1c/xer_encoder.h @@ -5,7 +5,7 @@ #ifndef _XER_ENCODER_H_ #define _XER_ENCODER_H_ -#include "asn1/asn1c/asn_application.h" +#include "asn1/asn1c/constr_TYPE.h" struct asn_TYPE_descriptor_s; /* Forward declaration */ @@ -38,16 +38,4 @@ asn_enc_rval_t xer_encode(const struct asn_TYPE_descriptor_s *type_descriptor, int xer_fprint(FILE *stream, const struct asn_TYPE_descriptor_s *td, const void *struct_ptr); -/* - * Type of the generic XER encoder. - */ -typedef asn_enc_rval_t(xer_type_encoder_f)( - const struct asn_TYPE_descriptor_s *type_descriptor, - const void *struct_ptr, /* Structure to be encoded */ - int ilevel, /* Level of indentation */ - enum xer_encoder_flags_e xer_flags, - asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ - void *app_key /* Arbitrary callback argument */ -); - #endif /* _XER_ENCODER_H_ */ diff --git a/src/asn1/content_info.c b/src/asn1/content_info.c index fa6900bb..8088c632 100644 --- a/src/asn1/content_info.c +++ b/src/asn1/content_info.c @@ -1,10 +1,10 @@ #include "asn1/content_info.h" +#include "asn1/asn1c/ContentType.h" +#include "asn1/decode.h" +#include "asn1/oid.h" #include "file.h" #include "log.h" -#include "asn1/oid.h" -#include "asn1/decode.h" -#include "asn1/asn1c/ContentType.h" static int validate(struct ContentInfo *info) diff --git a/src/asn1/decode.c b/src/asn1/decode.c index 48abd16a..1de93080 100644 --- a/src/asn1/decode.c +++ b/src/asn1/decode.c @@ -1,8 +1,10 @@ #include "asn1/decode.h" +#include "asn1/asn1c/ber_decoder.h" +#include "asn1/asn1c/constraints.h" #include "common.h" -#include "log.h" #include "incidence/incidence.h" +#include "log.h" #define COND_LOG(log, pr) (log ? pr : -EINVAL) diff --git a/src/asn1/decode.h b/src/asn1/decode.h index 217a4fb1..f16cbccb 100644 --- a/src/asn1/decode.h +++ b/src/asn1/decode.h @@ -1,9 +1,11 @@ #ifndef SRC_ASN1_DECODE_H_ #define SRC_ASN1_DECODE_H_ -#include "file.h" +#include + #include "asn1/asn1c/ANY.h" #include "asn1/asn1c/constr_TYPE.h" +#include "file.h" int asn1_decode(const void *, size_t, asn_TYPE_descriptor_t const *, void **, bool); diff --git a/src/asn1/oid.c b/src/asn1/oid.c index 53271b4f..5a331c06 100644 --- a/src/asn1/oid.c +++ b/src/asn1/oid.c @@ -1,9 +1,9 @@ #include "asn1/oid.h" #include "alloc.h" +#include "asn1/decode.h" #include "common.h" #include "log.h" -#include "asn1/decode.h" void free_arcs(struct oid_arcs *arcs) diff --git a/src/asn1/oid.h b/src/asn1/oid.h index 8718e3b9..4fb051c5 100644 --- a/src/asn1/oid.h +++ b/src/asn1/oid.h @@ -1,9 +1,9 @@ #ifndef SRC_OID_H_ #define SRC_OID_H_ -#include "common.h" #include "asn1/asn1c/ANY.h" #include "asn1/asn1c/OBJECT_IDENTIFIER.h" +#include "common.h" /* These objects are expected to live on the stack. */ struct oid_arcs { diff --git a/src/asn1/signed_data.c b/src/asn1/signed_data.c index 8dd1bcff..1604ccc5 100644 --- a/src/asn1/signed_data.c +++ b/src/asn1/signed_data.c @@ -2,17 +2,17 @@ #include "algorithm.h" #include "alloc.h" -#include "config.h" -#include "log.h" -#include "asn1/oid.h" -#include "thread_var.h" -#include "asn1/decode.h" #include "asn1/asn1c/ContentType.h" #include "asn1/asn1c/ContentTypePKCS7.h" #include "asn1/asn1c/MessageDigest.h" #include "asn1/asn1c/SignedDataPKCS7.h" +#include "asn1/decode.h" +#include "asn1/oid.h" +#include "config.h" #include "crypto/hash.h" +#include "log.h" #include "object/certificate.h" +#include "thread_var.h" static const OID oid_cta = OID_CONTENT_TYPE_ATTR; static const OID oid_mda = OID_MESSAGE_DIGEST_ATTR; diff --git a/src/asn1/signed_data.h b/src/asn1/signed_data.h index 9bf41072..3ab2d03c 100644 --- a/src/asn1/signed_data.h +++ b/src/asn1/signed_data.h @@ -3,9 +3,9 @@ /* Some wrappers for asn1/asn1c/SignedData.h. */ -#include "resource.h" #include "asn1/asn1c/SignedData.h" #include "object/certificate.h" +#include "resource.h" struct ee_cert { /** CRL that might or might not revoke the EE certificate. */ diff --git a/src/cache/local_cache.c b/src/cache/local_cache.c index 802b5914..506f7309 100644 --- a/src/cache/local_cache.c +++ b/src/cache/local_cache.c @@ -8,14 +8,14 @@ #include "common.h" #include "config.h" #include "configure_ac.h" -#include "file.h" -#include "json_util.h" -#include "log.h" -#include "rrdp.h" #include "data_structure/array_list.h" #include "data_structure/path_builder.h" #include "data_structure/uthash.h" +#include "file.h" #include "http/http.h" +#include "json_util.h" +#include "log.h" +#include "rrdp.h" #include "rsync/rsync.h" struct cache_node { diff --git a/src/cert_stack.c b/src/cert_stack.c index 2fd64c68..be29978f 100644 --- a/src/cert_stack.c +++ b/src/cert_stack.c @@ -4,11 +4,11 @@ #include #include "alloc.h" +#include "data_structure/array_list.h" +#include "object/name.h" #include "resource.h" #include "str_token.h" #include "thread_var.h" -#include "data_structure/array_list.h" -#include "object/name.h" enum defer_node_type { DNT_SEPARATOR, diff --git a/src/cert_stack.h b/src/cert_stack.h index e2fedb6b..8801ea42 100644 --- a/src/cert_stack.h +++ b/src/cert_stack.h @@ -2,9 +2,10 @@ #define SRC_CERT_STACK_H_ #include -#include "resource.h" + #include "object/certificate.h" #include "object/name.h" +#include "resource.h" #include "types/uri.h" /* diff --git a/src/config.c b/src/config.c index 87040334..69373460 100644 --- a/src/config.c +++ b/src/config.c @@ -7,17 +7,17 @@ #include "alloc.h" #include "common.h" +#include "config/boolean.h" +#include "config/incidences.h" +#include "config/str.h" +#include "config/uint.h" +#include "config/work_offline.h" #include "configure_ac.h" #include "daemon.h" #include "file.h" #include "init.h" #include "json_handler.h" #include "log.h" -#include "config/boolean.h" -#include "config/incidences.h" -#include "config/str.h" -#include "config/uint.h" -#include "config/work_offline.h" /** * To add a member to this structure, diff --git a/src/config/boolean.c b/src/config/boolean.c index 39a60444..1c2c0841 100644 --- a/src/config/boolean.c +++ b/src/config/boolean.c @@ -1,6 +1,7 @@ #include "config/boolean.h" #include + #include "log.h" #define DEREFERENCE(void_value) (*((bool *) void_value)) diff --git a/src/config/file_type.c b/src/config/file_type.c index 5c2535a0..f74e52b6 100644 --- a/src/config/file_type.c +++ b/src/config/file_type.c @@ -2,8 +2,8 @@ #include -#include "log.h" #include "config/str.h" +#include "log.h" #define VALUE_ROA "roa" #define VALUE_MFT "mft" diff --git a/src/config/filename_format.c b/src/config/filename_format.c index 35253f24..9dc4caa9 100644 --- a/src/config/filename_format.c +++ b/src/config/filename_format.c @@ -2,8 +2,8 @@ #include -#include "log.h" #include "config/str.h" +#include "log.h" #define FNF_VALUE_GLOBAL "global-url" #define FNF_VALUE_LOCAL "local-path" diff --git a/src/config/log_conf.c b/src/config/log_conf.c index a5fc14ce..29ecf301 100644 --- a/src/config/log_conf.c +++ b/src/config/log_conf.c @@ -7,8 +7,8 @@ #include #include -#include "log.h" #include "config/str.h" +#include "log.h" #define LOG_LEVEL_VALUE_ERROR "error" #define LOG_LEVEL_VALUE_WARNING "warning" diff --git a/src/config/mode.c b/src/config/mode.c index 12d379fb..8483cc1d 100644 --- a/src/config/mode.c +++ b/src/config/mode.c @@ -2,8 +2,8 @@ #include -#include "log.h" #include "config/str.h" +#include "log.h" #define VALUE_SERVER "server" #define VALUE_STANDALONE "standalone" diff --git a/src/config/output_format.c b/src/config/output_format.c index 471102b1..34d9365a 100644 --- a/src/config/output_format.c +++ b/src/config/output_format.c @@ -2,8 +2,8 @@ #include -#include "log.h" #include "config/str.h" +#include "log.h" #define OFM_VALUE_CSV "csv" #define OFM_VALUE_JSON "json" diff --git a/src/config/string_array.c b/src/config/string_array.c index 4bb2734e..7293b7f8 100644 --- a/src/config/string_array.c +++ b/src/config/string_array.c @@ -3,9 +3,9 @@ #include #include "alloc.h" +#include "config/str.h" #include "log.h" #include "str_token.h" -#include "config/str.h" void string_array_init(struct string_array *array, char const *const *values, diff --git a/src/config/uint.c b/src/config/uint.c index a7487a9f..1edee763 100644 --- a/src/config/uint.c +++ b/src/config/uint.c @@ -2,6 +2,7 @@ #include #include + #include "log.h" static void diff --git a/src/crypto/base64.c b/src/crypto/base64.c index 096a44f5..ee807e26 100644 --- a/src/crypto/base64.c +++ b/src/crypto/base64.c @@ -3,6 +3,7 @@ #include #include #include + #include "alloc.h" /* diff --git a/src/crypto/hash.c b/src/crypto/hash.c index a6e05b6a..fb967bfc 100644 --- a/src/crypto/hash.c +++ b/src/crypto/hash.c @@ -3,10 +3,10 @@ #include #include "alloc.h" +#include "asn1/oid.h" #include "common.h" #include "file.h" #include "log.h" -#include "asn1/oid.h" static int get_md(char const *algorithm, EVP_MD const **result) diff --git a/src/crypto/hash.h b/src/crypto/hash.h index f27fc336..b3ae47d4 100644 --- a/src/crypto/hash.h +++ b/src/crypto/hash.h @@ -1,8 +1,8 @@ #ifndef SRC_HASH_H_ #define SRC_HASH_H_ -#include "types/uri.h" #include "asn1/asn1c/BIT_STRING.h" +#include "types/uri.h" int hash_validate_mft_file(struct rpki_uri *uri, BIT_STRING_t const *); int hash_validate_file(struct rpki_uri *, unsigned char const *, size_t); diff --git a/src/daemon.c b/src/daemon.c index 11b0f0b1..e23f252a 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -10,6 +10,7 @@ #include #include #include + #include "log.h" /* diff --git a/src/data_structure/array_list.h b/src/data_structure/array_list.h index 96948a4a..7777ec25 100644 --- a/src/data_structure/array_list.h +++ b/src/data_structure/array_list.h @@ -1,8 +1,8 @@ #ifndef SRC_DATA_STRUCTURE_ARRAY_LIST_H_ #define SRC_DATA_STRUCTURE_ARRAY_LIST_H_ -#include "log.h" #include "data_structure/common.h" +#include "log.h" #define DEFINE_ARRAY_LIST_STRUCT(name, elem_type) \ struct name { \ diff --git a/src/data_structure/path_builder.c b/src/data_structure/path_builder.c index a9ab658c..4653379b 100644 --- a/src/data_structure/path_builder.c +++ b/src/data_structure/path_builder.c @@ -4,8 +4,8 @@ #include "alloc.h" #include "config.h" -#include "log.h" #include "crypto/hash.h" +#include "log.h" #define SHA256_LEN (256 >> 3) /* 256 / 8, bits -> bytes */ diff --git a/src/data_structure/path_builder.h b/src/data_structure/path_builder.h index 89989d83..a3c39cd8 100644 --- a/src/data_structure/path_builder.h +++ b/src/data_structure/path_builder.h @@ -1,6 +1,8 @@ #ifndef SRC_DATA_STRUCTURE_PATH_BUILDER_H_ #define SRC_DATA_STRUCTURE_PATH_BUILDER_H_ +#include + #include "types/uri.h" struct path_builder { diff --git a/src/extension.c b/src/extension.c index 19283252..99045fa9 100644 --- a/src/extension.c +++ b/src/extension.c @@ -1,17 +1,17 @@ #include "extension.h" #include +#include #include -#include #include "cert_stack.h" #include "common.h" +#include "crypto/hash.h" #include "json_util.h" #include "libcrypto_util.h" #include "log.h" #include "nid.h" #include "thread_var.h" -#include "crypto/hash.h" static json_t * unimplemented(void const *arg) diff --git a/src/extension.h b/src/extension.h index 91adbd42..7b9362e2 100644 --- a/src/extension.h +++ b/src/extension.h @@ -2,6 +2,7 @@ #define SRC_EXTENSION_H_ #include +#include #include #include #include diff --git a/src/file.c b/src/file.c index 1de8fc95..72c34b49 100644 --- a/src/file.c +++ b/src/file.c @@ -3,8 +3,8 @@ #include #include "alloc.h" -#include "log.h" #include "data_structure/uthash.h" +#include "log.h" int file_open(char const *file_name, FILE **result, struct stat *stat) diff --git a/src/file.h b/src/file.h index a8218fc2..0379a424 100644 --- a/src/file.h +++ b/src/file.h @@ -3,7 +3,6 @@ #include #include -#include #include #include #include diff --git a/src/http/http.c b/src/http/http.c index 7bf062de..bd4069b5 100644 --- a/src/http/http.c +++ b/src/http/http.c @@ -3,12 +3,12 @@ #include #include "alloc.h" +#include "cache/local_cache.h" #include "common.h" #include "config.h" +#include "data_structure/uthash.h" #include "file.h" #include "log.h" -#include "data_structure/uthash.h" -#include "cache/local_cache.h" struct http_handler { CURL *curl; diff --git a/src/incidence/incidence.c b/src/incidence/incidence.c index dc5e4980..7b0c13e1 100644 --- a/src/incidence/incidence.c +++ b/src/incidence/incidence.c @@ -1,10 +1,11 @@ #include "incidence/incidence.h" #include + #include "common.h" +#include "data_structure/common.h" #include "json_util.h" #include "log.h" -#include "data_structure/common.h" struct incidence { const enum incidence_id id; diff --git a/src/init.c b/src/init.c index 90181882..dbfb7bfd 100644 --- a/src/init.c +++ b/src/init.c @@ -2,8 +2,8 @@ #include "alloc.h" #include "config.h" -#include "log.h" #include "http/http.h" +#include "log.h" static int fetch_url(char const *url) diff --git a/src/json_handler.c b/src/json_handler.c index 19f3cd68..79504090 100644 --- a/src/json_handler.c +++ b/src/json_handler.c @@ -4,8 +4,8 @@ #include "alloc.h" #include "config.h" -#include "log.h" #include "config/types.h" +#include "log.h" static json_t * find_json(struct json_t *root, char const *full_name) diff --git a/src/json_util.c b/src/json_util.c index 7c60b903..858c3e0c 100644 --- a/src/json_util.c +++ b/src/json_util.c @@ -3,6 +3,7 @@ #include #include #include + #include "log.h" /* diff --git a/src/libcrypto_util.c b/src/libcrypto_util.c index 2608f5f7..db2e344b 100644 --- a/src/libcrypto_util.c +++ b/src/libcrypto_util.c @@ -1,14 +1,16 @@ #include "libcrypto_util.h" -#include -#include -#include +#include +#include +#include +#include #include +#include #include "alloc.h" +#include "asn1/asn1c/OBJECT_IDENTIFIER.h" #include "extension.h" #include "json_util.h" -#include "asn1/asn1c/OBJECT_IDENTIFIER.h" /* Swallows @bio. */ static json_t * @@ -147,7 +149,7 @@ fail: json_decref(root); } json_t * -gn2json(GENERAL_NAME const *gn) +gn2json(GENERAL_NAME *gn) { ASN1_IA5STRING *str; int type; diff --git a/src/libcrypto_util.h b/src/libcrypto_util.h index 4045021c..493640c8 100644 --- a/src/libcrypto_util.h +++ b/src/libcrypto_util.h @@ -3,7 +3,9 @@ #include #include -#include +#include +#include +#include #include json_t *oid2json(ASN1_OBJECT const *); @@ -11,7 +13,7 @@ json_t *asn1int2json(ASN1_INTEGER const *); json_t *asn1str2json(ASN1_STRING const *); /* octet string, bit string, etc */ json_t *asn1time2json(ASN1_TIME const *); json_t *name2json(X509_NAME const *); -json_t *gn2json(GENERAL_NAME const *); +json_t *gn2json(GENERAL_NAME *); json_t *gns2json(GENERAL_NAMES const *); json_t *pubkey2json(EVP_PKEY *); /* LibreSSL needs not const */ json_t *exts2json(const STACK_OF(X509_EXTENSION) *); diff --git a/src/log.c b/src/log.c index 9ea0fea3..ecff284e 100644 --- a/src/log.c +++ b/src/log.c @@ -1,10 +1,9 @@ #include "log.h" +#include #ifdef BACKTRACE_ENABLED #include #endif - -#include #include #include #include diff --git a/src/log.h b/src/log.h index 8b0c6cfa..a8ac304d 100644 --- a/src/log.h +++ b/src/log.h @@ -3,6 +3,7 @@ #include #include + #include "incidence/incidence.h" /* diff --git a/src/main.c b/src/main.c index 1f88bd14..64581afb 100644 --- a/src/main.c +++ b/src/main.c @@ -2,14 +2,14 @@ #include "config.h" #include "extension.h" -#include "log.h" -#include "nid.h" -#include "thread_var.h" #include "http/http.h" #include "incidence/incidence.h" +#include "log.h" +#include "nid.h" #include "print_file.h" -#include "rtr/rtr.h" #include "rtr/db/vrps.h" +#include "rtr/rtr.h" +#include "thread_var.h" #include "xml/relax_ng.h" static int diff --git a/src/nid.c b/src/nid.c index 74816d8c..b801b95e 100644 --- a/src/nid.c +++ b/src/nid.c @@ -1,6 +1,7 @@ #include "nid.h" #include +#include #include #include "log.h" diff --git a/src/object/bgpsec.c b/src/object/bgpsec.c index 7da60091..7847405d 100644 --- a/src/object/bgpsec.c +++ b/src/object/bgpsec.c @@ -2,8 +2,8 @@ #include "alloc.h" #include "log.h" -#include "validation_handler.h" #include "object/certificate.h" +#include "validation_handler.h" struct resource_params { unsigned char const *ski; diff --git a/src/object/certificate.c b/src/object/certificate.c index 51dc590f..50524882 100644 --- a/src/object/certificate.c +++ b/src/object/certificate.c @@ -2,37 +2,37 @@ #include #include +#if OPENSSL_VERSION_MAJOR >= 3 +#include +#endif #include +#include #include #include #include #include -#if OPENSSL_VERSION_MAJOR >= 3 -#include -#endif - #include "algorithm.h" #include "alloc.h" -#include "cert_stack.h" -#include "config.h" -#include "extension.h" -#include "log.h" -#include "nid.h" -#include "rrdp.h" -#include "str_token.h" -#include "thread_var.h" +#include "asn1/asn1c/IPAddrBlocks.h" #include "asn1/decode.h" #include "asn1/oid.h" -#include "asn1/asn1c/IPAddrBlocks.h" +#include "cache/local_cache.h" +#include "cert_stack.h" +#include "config.h" #include "crypto/hash.h" #include "data_structure/array_list.h" +#include "extension.h" #include "incidence/incidence.h" +#include "log.h" +#include "nid.h" #include "object/bgpsec.h" -#include "object/name.h" #include "object/manifest.h" +#include "object/name.h" #include "object/signed_object.h" -#include "cache/local_cache.h" +#include "rrdp.h" +#include "str_token.h" +#include "thread_var.h" /* * The X509V3_EXT_METHOD that references NID_sinfo_access uses the AIA item. diff --git a/src/object/certificate.h b/src/object/certificate.h index ad4c2a39..80454258 100644 --- a/src/object/certificate.h +++ b/src/object/certificate.h @@ -1,12 +1,12 @@ #ifndef SRC_OBJECT_CERTIFICATE_H_ #define SRC_OBJECT_CERTIFICATE_H_ +#include "asn1/asn1c/ANY.h" +#include "asn1/asn1c/SignatureValue.h" #include "certificate_refs.h" #include "resource.h" #include "rpp.h" #include "types/uri.h" -#include "asn1/asn1c/ANY.h" -#include "asn1/asn1c/SignatureValue.h" /* Certificate types in the RPKI */ enum cert_type { diff --git a/src/object/crl.c b/src/object/crl.c index aa0b3ba5..78e9bfbe 100644 --- a/src/object/crl.c +++ b/src/object/crl.c @@ -3,11 +3,12 @@ #include #include #include + #include "algorithm.h" #include "extension.h" #include "log.h" -#include "thread_var.h" #include "object/name.h" +#include "thread_var.h" static int __crl_load(struct rpki_uri *uri, X509_CRL **result) diff --git a/src/object/crl.h b/src/object/crl.h index 3c80d470..7aacffdf 100644 --- a/src/object/crl.h +++ b/src/object/crl.h @@ -2,6 +2,7 @@ #define SRC_OBJECT_CRL_H_ #include + #include "types/uri.h" int crl_load(struct rpki_uri *uri, X509_CRL **); diff --git a/src/object/ghostbusters.c b/src/object/ghostbusters.c index 19a1b1b6..b25cc084 100644 --- a/src/object/ghostbusters.c +++ b/src/object/ghostbusters.c @@ -1,10 +1,10 @@ #include "object/ghostbusters.h" -#include "log.h" -#include "thread_var.h" #include "asn1/oid.h" +#include "log.h" #include "object/signed_object.h" #include "object/vcard.h" +#include "thread_var.h" static int handle_vcard(struct signed_object *sobj) diff --git a/src/object/manifest.c b/src/object/manifest.c index d3267644..de150a72 100644 --- a/src/object/manifest.c +++ b/src/object/manifest.c @@ -1,18 +1,18 @@ #include "object/manifest.h" #include "algorithm.h" -#include "common.h" -#include "log.h" -#include "thread_var.h" -#include "asn1/decode.h" -#include "asn1/oid.h" #include "asn1/asn1c/GeneralizedTime.h" #include "asn1/asn1c/Manifest.h" +#include "asn1/decode.h" +#include "asn1/oid.h" +#include "common.h" #include "crypto/hash.h" +#include "log.h" #include "object/certificate.h" #include "object/crl.h" #include "object/roa.h" #include "object/signed_object.h" +#include "thread_var.h" static int cage(struct rpki_uri **uri, struct rpki_uri *notif) diff --git a/src/object/name.c b/src/object/name.c index fa59cf25..f1b66b39 100644 --- a/src/object/name.c +++ b/src/object/name.c @@ -1,6 +1,7 @@ #include "object/name.h" #include +#include #include #include diff --git a/src/object/roa.c b/src/object/roa.c index 99ff75f9..42e0379f 100644 --- a/src/object/roa.c +++ b/src/object/roa.c @@ -1,12 +1,12 @@ #include "object/roa.h" -#include "config.h" -#include "log.h" -#include "thread_var.h" +#include "asn1/asn1c/RouteOriginAttestation.h" #include "asn1/decode.h" #include "asn1/oid.h" -#include "asn1/asn1c/RouteOriginAttestation.h" +#include "config.h" +#include "log.h" #include "object/signed_object.h" +#include "thread_var.h" static int decode_roa(struct signed_object *sobj, struct RouteOriginAttestation **result) diff --git a/src/object/signed_object.c b/src/object/signed_object.c index 0efd1f0a..0ed8805f 100644 --- a/src/object/signed_object.c +++ b/src/object/signed_object.c @@ -1,7 +1,7 @@ #include "object/signed_object.h" -#include "log.h" #include "asn1/content_info.h" +#include "log.h" int signed_object_decode(struct signed_object *sobj, struct rpki_uri *uri) diff --git a/src/object/tal.c b/src/object/tal.c index ebc588f4..2a60f655 100644 --- a/src/object/tal.c +++ b/src/object/tal.c @@ -6,18 +6,18 @@ #include #include "alloc.h" +#include "cache/local_cache.h" #include "cert_stack.h" #include "common.h" #include "config.h" +#include "crypto/base64.h" #include "line_file.h" #include "log.h" +#include "object/certificate.h" +#include "rtr/db/vrps.h" #include "state.h" #include "thread_var.h" #include "validation_handler.h" -#include "crypto/base64.h" -#include "object/certificate.h" -#include "rtr/db/vrps.h" -#include "cache/local_cache.h" typedef int (*foreach_uri_cb)(struct tal *, struct rpki_uri *, void *); diff --git a/src/object/tal.h b/src/object/tal.h index dfa3af4d..cd909464 100644 --- a/src/object/tal.h +++ b/src/object/tal.h @@ -3,8 +3,8 @@ /* This is RFC 8630. */ -#include "types/uri.h" #include "rtr/db/db_table.h" +#include "types/uri.h" struct tal; diff --git a/src/output_printer.c b/src/output_printer.c index 946dbd14..c4f8fb8d 100644 --- a/src/output_printer.c +++ b/src/output_printer.c @@ -2,9 +2,9 @@ #include "common.h" #include "config.h" +#include "crypto/base64.h" #include "file.h" #include "log.h" -#include "crypto/base64.h" #include "types/vrp.h" typedef struct json_out { diff --git a/src/print_file.c b/src/print_file.c index 57eb6048..423e68e7 100644 --- a/src/print_file.c +++ b/src/print_file.c @@ -1,16 +1,15 @@ #include "print_file.h" -#include -#include - +#include "asn1/asn1c/CRL.h" +#include "asn1/asn1c/Certificate.h" +#include "asn1/asn1c/ber_decoder.h" +#include "asn1/asn1c/json_encoder.h" +#include "asn1/content_info.h" #include "common.h" #include "config.h" +#include "data_structure/path_builder.h" #include "file.h" #include "log.h" -#include "asn1/content_info.h" -#include "asn1/asn1c/Certificate.h" -#include "asn1/asn1c/CRL.h" -#include "data_structure/path_builder.h" #include "rsync/rsync.h" #include "types/bio_seq.h" #include "types/uri.h" diff --git a/src/resource.c b/src/resource.c index 3c353648..33ee85e6 100644 --- a/src/resource.c +++ b/src/resource.c @@ -5,11 +5,11 @@ #include "alloc.h" #include "cert_stack.h" #include "log.h" +#include "resource/ip4.h" +#include "resource/ip6.h" #include "sorted_array.h" #include "thread_var.h" #include "types/address.h" -#include "resource/ip4.h" -#include "resource/ip6.h" /* The resources we extracted from one certificate. */ struct resources { diff --git a/src/resource.h b/src/resource.h index f40877a9..661e3b7b 100644 --- a/src/resource.h +++ b/src/resource.h @@ -1,10 +1,10 @@ #ifndef SRC_RESOURCE_H_ #define SRC_RESOURCE_H_ -#include "resource/asn.h" -#include "types/address.h" #include "asn1/asn1c/ASIdentifiers.h" #include "asn1/asn1c/IPAddressFamily.h" +#include "resource/asn.h" +#include "types/address.h" enum rpki_policy { /** diff --git a/src/resource/asn.h b/src/resource/asn.h index 665f4002..058cbd33 100644 --- a/src/resource/asn.h +++ b/src/resource/asn.h @@ -2,6 +2,7 @@ #define SRC_RESOURCE_ASN_H_ #include + #include "as_number.h" #include "asn1/asn1c/ASId.h" diff --git a/src/rpp.c b/src/rpp.c index e8d795f9..42b0e4af 100644 --- a/src/rpp.c +++ b/src/rpp.c @@ -2,14 +2,14 @@ #include "alloc.h" #include "cert_stack.h" -#include "log.h" -#include "thread_var.h" -#include "types/uri.h" #include "data_structure/array_list.h" +#include "log.h" #include "object/certificate.h" #include "object/crl.h" #include "object/ghostbusters.h" #include "object/roa.h" +#include "thread_var.h" +#include "types/uri.h" /** A Repository Publication Point (RFC 6481), as described by some manifest. */ struct rpp { diff --git a/src/rpp.h b/src/rpp.h index f8eb4dde..f328b911 100644 --- a/src/rpp.h +++ b/src/rpp.h @@ -3,6 +3,7 @@ #include #include + #include "types/uri.h" struct rpp; diff --git a/src/rrdp.c b/src/rrdp.c index efd18dbf..4e2a74eb 100644 --- a/src/rrdp.c +++ b/src/rrdp.c @@ -3,15 +3,16 @@ #include #include #include +#include #include "alloc.h" +#include "cache/local_cache.h" #include "common.h" +#include "crypto/base64.h" +#include "crypto/hash.h" #include "file.h" #include "log.h" #include "thread_var.h" -#include "cache/local_cache.h" -#include "crypto/base64.h" -#include "crypto/hash.h" #include "xml/relax_ng.h" /* RRDP's XML namespace */ diff --git a/src/rtr/db/db_table.c b/src/rtr/db/db_table.c index 2f8bbb73..f2736e4a 100644 --- a/src/rtr/db/db_table.c +++ b/src/rtr/db/db_table.c @@ -3,8 +3,8 @@ #include #include "alloc.h" -#include "log.h" #include "data_structure/uthash.h" +#include "log.h" struct hashable_roa { struct vrp data; diff --git a/src/rtr/db/db_table.h b/src/rtr/db/db_table.h index e6ac9e37..af86cdfd 100644 --- a/src/rtr/db/db_table.h +++ b/src/rtr/db/db_table.h @@ -1,9 +1,9 @@ #ifndef SRC_RTR_DB_DB_TABLE_H_ #define SRC_RTR_DB_DB_TABLE_H_ +#include "rtr/db/delta.h" #include "types/address.h" #include "types/vrp.h" -#include "rtr/db/delta.h" struct db_table; diff --git a/src/rtr/db/delta.c b/src/rtr/db/delta.c index d7d5fae3..1689e3f5 100644 --- a/src/rtr/db/delta.c +++ b/src/rtr/db/delta.c @@ -1,9 +1,10 @@ #include "rtr/db/delta.h" #include + #include "alloc.h" -#include "types/address.h" #include "data_structure/array_list.h" +#include "types/address.h" struct delta_v4 { uint32_t as; diff --git a/src/rtr/db/deltas_array.h b/src/rtr/db/deltas_array.h index 085b5078..65e687cd 100644 --- a/src/rtr/db/deltas_array.h +++ b/src/rtr/db/deltas_array.h @@ -1,8 +1,8 @@ #ifndef SRC_RTR_DB_DELTAS_ARRAY_H_ #define SRC_RTR_DB_DELTAS_ARRAY_H_ -#include "types/serial.h" #include "rtr/db/delta.h" +#include "types/serial.h" struct deltas_array; diff --git a/src/rtr/db/vrps.c b/src/rtr/db/vrps.c index 3bfe42f6..97a95175 100644 --- a/src/rtr/db/vrps.c +++ b/src/rtr/db/vrps.c @@ -6,14 +6,14 @@ #include "alloc.h" #include "common.h" #include "config.h" -#include "output_printer.h" -#include "validation_handler.h" -#include "types/router_key.h" #include "data_structure/array_list.h" #include "object/tal.h" -#include "rtr/rtr.h" +#include "output_printer.h" #include "rtr/db/db_table.h" +#include "rtr/rtr.h" #include "slurm/slurm_loader.h" +#include "types/router_key.h" +#include "validation_handler.h" struct vrp_node { struct delta_vrp delta; diff --git a/src/rtr/db/vrps.h b/src/rtr/db/vrps.h index 73a66dba..0020f6d1 100644 --- a/src/rtr/db/vrps.h +++ b/src/rtr/db/vrps.h @@ -8,8 +8,8 @@ */ #include "as_number.h" -#include "types/address.h" #include "rtr/db/deltas_array.h" +#include "types/address.h" int vrps_init(void); void vrps_destroy(void); diff --git a/src/rtr/err_pdu.c b/src/rtr/err_pdu.c index bb2d5ae1..bf032def 100644 --- a/src/rtr/err_pdu.c +++ b/src/rtr/err_pdu.c @@ -1,9 +1,10 @@ #include "rtr/err_pdu.h" #include + #include "alloc.h" -#include "rtr/pdu_sender.h" #include "log.h" +#include "rtr/pdu_sender.h" typedef enum rtr_error_code { ERR_PDU_CORRUPT_DATA = 0, diff --git a/src/rtr/pdu.h b/src/rtr/pdu.h index f8e42e7d..b25c1dda 100644 --- a/src/rtr/pdu.h +++ b/src/rtr/pdu.h @@ -1,9 +1,16 @@ #ifndef RTR_PDU_H_ #define RTR_PDU_H_ +#include +#include +#include +#include +#include +#include + #include "common.h" -#include "types/router_key.h" #include "rtr/rtr.h" +#include "types/router_key.h" enum rtr_version { RTR_V0 = 0, diff --git a/src/rtr/pdu_handler.c b/src/rtr/pdu_handler.c index 62dadde9..dd82eb01 100644 --- a/src/rtr/pdu_handler.c +++ b/src/rtr/pdu_handler.c @@ -1,6 +1,7 @@ #include "rtr/pdu_handler.h" #include + #include "log.h" #include "rtr/err_pdu.h" #include "rtr/pdu_sender.h" diff --git a/src/rtr/pdu_sender.h b/src/rtr/pdu_sender.h index cecb95d7..a3009be1 100644 --- a/src/rtr/pdu_sender.h +++ b/src/rtr/pdu_sender.h @@ -1,9 +1,9 @@ #ifndef SRC_RTR_PDU_SENDER_H_ #define SRC_RTR_PDU_SENDER_H_ +#include "rtr/db/vrps.h" #include "rtr/pdu.h" #include "types/router_key.h" -#include "rtr/db/vrps.h" int send_serial_notify_pdu(int, uint8_t, serial_t); int send_cache_reset_pdu(int, uint8_t); diff --git a/src/rtr/pdu_stream.c b/src/rtr/pdu_stream.c index a3dffff5..f28906f3 100644 --- a/src/rtr/pdu_stream.c +++ b/src/rtr/pdu_stream.c @@ -2,10 +2,10 @@ #include -#include "log.h" #include "alloc.h" -#include "rtr/pdu.h" +#include "log.h" #include "rtr/err_pdu.h" +#include "rtr/pdu.h" enum buffer_state { /* We've read all available bytes for now. */ diff --git a/src/rtr/pdu_stream.h b/src/rtr/pdu_stream.h index e0f279e9..46222914 100644 --- a/src/rtr/pdu_stream.h +++ b/src/rtr/pdu_stream.h @@ -1,9 +1,9 @@ #ifndef SRC_RTR_PDU_STREAM_H_ #define SRC_RTR_PDU_STREAM_H_ +#include "data_structure/array_list.h" #include "rtr/pdu.h" #include "rtr/rtr.h" -#include "data_structure/array_list.h" struct pdu_stream; /* It's an *input* stream. */ diff --git a/src/rtr/rtr.c b/src/rtr/rtr.c index eef1cb61..69d9e96a 100644 --- a/src/rtr/rtr.c +++ b/src/rtr/rtr.c @@ -6,15 +6,15 @@ #include "alloc.h" #include "config.h" -#include "types/address.h" #include "data_structure/array_list.h" +#include "rtr/db/vrps.h" #include "rtr/err_pdu.h" #include "rtr/pdu.h" #include "rtr/pdu_handler.h" #include "rtr/pdu_sender.h" #include "rtr/pdu_stream.h" -#include "rtr/db/vrps.h" #include "thread/thread_pool.h" +#include "types/address.h" #include "types/serial.h" struct rtr_server { diff --git a/src/slurm/db_slurm.h b/src/slurm/db_slurm.h index 5dd988fb..2eefde3b 100644 --- a/src/slurm/db_slurm.h +++ b/src/slurm/db_slurm.h @@ -3,8 +3,9 @@ #include #include -#include "types/vrp.h" + #include "types/router_key.h" +#include "types/vrp.h" /* Flags to get data from structs */ #define SLURM_COM_FLAG_NONE 0x00 diff --git a/src/slurm/slurm_loader.c b/src/slurm/slurm_loader.c index 6562a469..91ace54b 100644 --- a/src/slurm/slurm_loader.c +++ b/src/slurm/slurm_loader.c @@ -1,11 +1,12 @@ #include "slurm/slurm_loader.h" #include + #include "alloc.h" -#include "log.h" -#include "config.h" #include "common.h" +#include "config.h" #include "crypto/hash.h" +#include "log.h" #include "slurm/slurm_parser.h" #define SLURM_FILE_EXTENSION ".slurm" diff --git a/src/slurm/slurm_parser.c b/src/slurm/slurm_parser.c index 0c5ce11b..e03f3d28 100644 --- a/src/slurm/slurm_parser.c +++ b/src/slurm/slurm_parser.c @@ -3,14 +3,14 @@ #include #include -#include "crypto/base64.h" #include "algorithm.h" #include "alloc.h" +#include "crypto/base64.h" #include "json_util.h" #include "log.h" +#include "slurm/db_slurm.h" #include "types/address.h" #include "types/router_key.h" -#include "slurm/db_slurm.h" /* JSON members */ #define SLURM_VERSION "slurmVersion" diff --git a/src/state.c b/src/state.c index a21f4bb4..5b1d30f0 100644 --- a/src/state.c +++ b/src/state.c @@ -1,10 +1,10 @@ #include "state.h" #include "alloc.h" +#include "cache/local_cache.h" #include "cert_stack.h" #include "log.h" #include "thread_var.h" -#include "cache/local_cache.h" /** * The current state of the validation cycle. diff --git a/src/state.h b/src/state.h index 47374f74..1da419a7 100644 --- a/src/state.h +++ b/src/state.h @@ -1,8 +1,8 @@ #ifndef SRC_STATE_H_ #define SRC_STATE_H_ -#include "validation_handler.h" #include "object/tal.h" +#include "validation_handler.h" struct validation; diff --git a/src/thread/thread_pool.c b/src/thread/thread_pool.c index 186a2845..7ec30d10 100644 --- a/src/thread/thread_pool.c +++ b/src/thread/thread_pool.c @@ -1,6 +1,7 @@ #include "thread/thread_pool.h" #include + #include "alloc.h" #include "common.h" #include "log.h" diff --git a/src/types/address.h b/src/types/address.h index 749a6565..188c89b2 100644 --- a/src/types/address.h +++ b/src/types/address.h @@ -1,8 +1,10 @@ #ifndef SRC_TYPES_ADDRESS_H_ #define SRC_TYPES_ADDRESS_H_ +#include #include #include + #include "asn1/asn1c/IPAddress.h" #include "asn1/asn1c/IPAddressRange.h" diff --git a/src/types/bio_seq.c b/src/types/bio_seq.c index c11c377e..3f68c986 100644 --- a/src/types/bio_seq.c +++ b/src/types/bio_seq.c @@ -1,7 +1,7 @@ #include "types/bio_seq.h" -#include "log.h" #include "alloc.h" +#include "log.h" static BIO_METHOD *method; diff --git a/src/types/uri.c b/src/types/uri.c index 85ac41e5..cdc0f4dd 100644 --- a/src/types/uri.c +++ b/src/types/uri.c @@ -3,13 +3,13 @@ #include "alloc.h" #include "common.h" #include "config.h" +#include "config/filename_format.h" +#include "data_structure/path_builder.h" #include "log.h" #include "rrdp.h" #include "state.h" #include "str_token.h" #include "thread_var.h" -#include "config/filename_format.h" -#include "data_structure/path_builder.h" /** * Design notes: diff --git a/src/validation_handler.h b/src/validation_handler.h index e70ca1ad..9beec0a0 100644 --- a/src/validation_handler.h +++ b/src/validation_handler.h @@ -2,9 +2,9 @@ #define SRC_VALIDATION_HANDLER_H_ #include "as_number.h" +#include "object/name.h" #include "types/address.h" #include "types/router_key.h" -#include "object/name.h" /** * Functions that handle validation results.