Harald Welte | d523a69 | 2015-08-30 23:11:19 +0200 | [diff] [blame] | 1 | /*- |
| 2 | * Copyright (c) 2004, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved. |
| 3 | * Redistribution and modifications are permitted subject to BSD license. |
| 4 | */ |
| 5 | /* |
| 6 | * Application-level ASN.1 callbacks. |
| 7 | */ |
| 8 | #ifndef _ASN_APPLICATION_H_ |
| 9 | #define _ASN_APPLICATION_H_ |
| 10 | |
| 11 | #include "asn_system.h" /* for platform-dependent types */ |
| 12 | #include "asn_codecs.h" /* for ASN.1 codecs specifics */ |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | /* |
| 19 | * Generic type of an application-defined callback to return various |
| 20 | * types of data to the application. |
| 21 | * EXPECTED RETURN VALUES: |
| 22 | * -1: Failed to consume bytes. Abort the mission. |
| 23 | * Non-negative return values indicate success, and ignored. |
| 24 | */ |
| 25 | typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size, |
| 26 | void *application_specific_key); |
| 27 | |
| 28 | /* |
| 29 | * A callback of this type is called whenever constraint validation fails |
| 30 | * on some ASN.1 type. See "constraints.h" for more details on constraint |
| 31 | * validation. |
| 32 | * This callback specifies a descriptor of the ASN.1 type which failed |
| 33 | * the constraint check, as well as human readable message on what |
| 34 | * particular constraint has failed. |
| 35 | */ |
| 36 | typedef void (asn_app_constraint_failed_f)(void *application_specific_key, |
| 37 | struct asn_TYPE_descriptor_s *type_descriptor_which_failed, |
| 38 | const void *structure_which_failed_ptr, |
| 39 | const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5); |
| 40 | |
| 41 | #ifdef __cplusplus |
| 42 | } |
| 43 | #endif |
| 44 | |
| 45 | #include "constr_TYPE.h" /* for asn_TYPE_descriptor_t */ |
| 46 | |
| 47 | #endif /* _ASN_APPLICATION_H_ */ |