blob: 5f9bbf2cbbd74a1138336df61d153cda6389362e [file] [log] [blame]
vlm39ba4c42004-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
vlmd1579582004-09-24 21:00:50 +00008#include <asn_application.h>
vlm39ba4c42004-09-22 16:06:28 +00009
vlmef6355b2004-09-29 13:26:15 +000010struct asn_TYPE_descriptor_s; /* Forward declaration */
vlm39ba4c42004-09-22 16:06:28 +000011
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) */
vlm6678cb12004-09-26 13:10:40 +000016 XER_F_CANONICAL = 0x02 /* Canonical XER (strict rules, unreadable) */
vlm39ba4c42004-09-22 16:06:28 +000017};
18
19/*
20 * The XER encoder of any type. May be invoked by the application.
21 */
vlmef6355b2004-09-29 13:26:15 +000022asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor,
vlm39ba4c42004-09-22 16:06:28 +000023 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 */
vlmef6355b2004-09-29 13:26:15 +000037int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr);
vlm39ba4c42004-09-22 16:06:28 +000038
39/*
40 * Type of the generic XER encoder.
41 */
42typedef asn_enc_rval_t (xer_type_encoder_f)(
vlmef6355b2004-09-29 13:26:15 +000043 struct asn_TYPE_descriptor_s *type_descriptor,
vlm39ba4c42004-09-22 16:06:28 +000044 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_ */