blob: 9ac130b7373cc354effd24058027ea85ca3a9e59 [file] [log] [blame]
Harald Welte92c45f32010-06-12 18:59:38 +02001/*-
2 * Copyright (c) 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
4 */
5#ifndef _PER_ENCODER_H_
6#define _PER_ENCODER_H_
7
8#include <asn_application.h>
9#include <per_support.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15struct asn_TYPE_descriptor_s; /* Forward declaration */
16
17/*
18 * Unaligned PER encoder of any ASN.1 type. May be invoked by the application.
19 */
20asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor,
21 void *struct_ptr, /* Structure to be encoded */
22 asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */
23 void *app_key /* Arbitrary callback argument */
24);
25
26/* A variant of uper_encode() which encodes data into the existing buffer */
27asn_enc_rval_t uper_encode_to_buffer(
28 struct asn_TYPE_descriptor_s *type_descriptor,
29 void *struct_ptr, /* Structure to be encoded */
30 void *buffer, /* Pre-allocated buffer */
31 size_t buffer_size /* Initial buffer size (max) */
32);
33
34
35/*
36 * Type of the generic PER encoder function.
37 */
38typedef asn_enc_rval_t (per_type_encoder_f)(
39 struct asn_TYPE_descriptor_s *type_descriptor,
40 asn_per_constraints_t *constraints,
41 void *struct_ptr,
42 asn_per_outp_t *per_output
43);
44
45#ifdef __cplusplus
46}
47#endif
48
49#endif /* _PER_ENCODER_H_ */