Blame src/asn1c/xer_encoder.h

Packit 728676
/*-
Packit 728676
 * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
Packit 728676
 * Redistribution and modifications are permitted subject to BSD license.
Packit 728676
 */
Packit 728676
#ifndef	_XER_ENCODER_H_
Packit 728676
#define	_XER_ENCODER_H_
Packit 728676
Packit 728676
#include <asn_application.h>
Packit 728676
Packit 728676
#ifdef __cplusplus
Packit 728676
extern "C" {
Packit 728676
#endif
Packit 728676
Packit 728676
struct asn_TYPE_descriptor_s;	/* Forward declaration */
Packit 728676
Packit 728676
/* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */
Packit 728676
enum xer_encoder_flags_e {
Packit 728676
	/* Mode of encoding */
Packit 728676
	XER_F_BASIC	= 0x01,	/* BASIC-XER (pretty-printing) */
Packit 728676
	XER_F_CANONICAL	= 0x02	/* Canonical XER (strict rules) */
Packit 728676
};
Packit 728676
Packit 728676
/*
Packit 728676
 * The XER encoder of any type. May be invoked by the application.
Packit 728676
 */
Packit 728676
asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor,
Packit 728676
		void *struct_ptr,	/* Structure to be encoded */
Packit 728676
		enum xer_encoder_flags_e xer_flags,
Packit 728676
		asn_app_consume_bytes_f *consume_bytes_cb,
Packit 728676
		void *app_key		/* Arbitrary callback argument */
Packit 728676
	);
Packit 728676
Packit 728676
/*
Packit 728676
 * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
Packit 728676
 * output into the chosen file pointer.
Packit 728676
 * RETURN VALUES:
Packit 728676
 * 	 0: The structure is printed.
Packit 728676
 * 	-1: Problem printing the structure.
Packit 728676
 * WARNING: No sensible errno value is returned.
Packit 728676
 */
Packit 728676
int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr);
Packit 728676
Packit 728676
/*
Packit 728676
 * Type of the generic XER encoder.
Packit 728676
 */
Packit 728676
typedef asn_enc_rval_t (xer_type_encoder_f)(
Packit 728676
		struct asn_TYPE_descriptor_s *type_descriptor,
Packit 728676
		void *struct_ptr,	/* Structure to be encoded */
Packit 728676
		int ilevel,		/* Level of indentation */
Packit 728676
		enum xer_encoder_flags_e xer_flags,
Packit 728676
		asn_app_consume_bytes_f *consume_bytes_cb,	/* Callback */
Packit 728676
		void *app_key		/* Arbitrary callback argument */
Packit 728676
	);
Packit 728676
Packit 728676
#ifdef __cplusplus
Packit 728676
}
Packit 728676
#endif
Packit 728676
Packit 728676
#endif	/* _XER_ENCODER_H_ */