blob: fbb7a8171705142a7efaaa03caf6b8e3fb3b1b87 [file] [log] [blame]
Lev Walkina9cc46e2004-09-22 16:06:28 +00001/*-
2 * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
4 */
5#ifndef _XER_ENCODER_H_
6#define _XER_ENCODER_H_
7
Lev Walkin11c3e172004-09-24 21:00:50 +00008#include <asn_application.h>
Lev Walkina9cc46e2004-09-22 16:06:28 +00009
10struct asn1_TYPE_descriptor_s; /* Forward declaration */
11
12/* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */
13enum xer_encoder_flags_e {
14 /* Mode of encoding */
15 XER_F_BASIC = 0x01, /* BASIC-XER (pretty-printing) */
16 XER_F_CANONICAL = 0x02, /* Canonical XER (strict rules, unreadable) */
17};
18
19/*
20 * The XER encoder of any type. May be invoked by the application.
21 */
22asn_enc_rval_t xer_encode(struct asn1_TYPE_descriptor_s *type_descriptor,
23 void *struct_ptr, /* Structure to be encoded */
24 enum xer_encoder_flags_e xer_flags,
25 asn_app_consume_bytes_f *consume_bytes_cb,
26 void *app_key /* Arbitrary callback argument */
27 );
28
29/*
30 * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
31 * output into the chosen file pointer.
32 * RETURN VALUES:
33 * 0: The structure is printed.
34 * -1: Problem printing the structure.
35 * WARNING: No sensible errno value is returned.
36 */
37int xer_fprint(FILE *stream, struct asn1_TYPE_descriptor_s *td, void *sptr);
38
39/*
40 * Type of the generic XER encoder.
41 */
42typedef asn_enc_rval_t (xer_type_encoder_f)(
43 struct asn1_TYPE_descriptor_s *type_descriptor,
44 void *struct_ptr, /* Structure to be encoded */
45 int ilevel, /* Level of indentation */
46 enum xer_encoder_flags_e xer_flags,
47 asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
48 void *app_key /* Arbitrary callback argument */
49 );
50
51#endif /* _XER_ENCODER_H_ */