blob: 71e9ba61b2e8f69682d5147bdd8963ff648b89e6 [file] [log] [blame]
Lev Walkin52559a22004-09-24 20:58:37 +00001/*-
Lev Walkin1eded352006-07-13 11:19:01 +00002 * Copyright (c) 2004, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
Lev Walkin52559a22004-09-24 20:58:37 +00003 * Redistribution and modifications are permitted subject to BSD license.
4 */
5/*
Lev Walkin1eded352006-07-13 11:19:01 +00006 * Application-level ASN.1 callbacks.
Lev Walkin52559a22004-09-24 20:58:37 +00007 */
Lev Walkinc6cac8e2016-03-14 02:57:07 -07008#ifndef ASN_APPLICATION_H
9#define ASN_APPLICATION_H
Lev Walkin52559a22004-09-24 20:58:37 +000010
Lev Walkin1eded352006-07-13 11:19:01 +000011#include "asn_system.h" /* for platform-dependent types */
12#include "asn_codecs.h" /* for ASN.1 codecs specifics */
Lev Walkin52559a22004-09-24 20:58:37 +000013
Lev Walkin21b41ac2005-07-24 09:03:44 +000014#ifdef __cplusplus
15extern "C" {
16#endif
17
Lev Walkin52559a22004-09-24 20:58:37 +000018/*
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 */
25typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size,
26 void *application_specific_key);
27
Lev Walkin1eded352006-07-13 11:19:01 +000028/*
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 */
36typedef 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,
Lev Walkin3f6afc12006-09-15 18:52:36 +000039 const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5);
Lev Walkin52559a22004-09-24 20:58:37 +000040
Lev Walkin21b41ac2005-07-24 09:03:44 +000041#ifdef __cplusplus
42}
43#endif
44
Lev Walkin1eded352006-07-13 11:19:01 +000045#include "constr_TYPE.h" /* for asn_TYPE_descriptor_t */
46
Lev Walkinc6cac8e2016-03-14 02:57:07 -070047#endif /* ASN_APPLICATION_H */