blob: 8e3c5458b9963a8e18bf5b32dd3ceea78020e7fe [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*-
2 * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
4 */
5#ifndef _INTEGER_H_
6#define _INTEGER_H_
7
8#include <constr_TYPE.h>
9
10typedef struct INTEGER {
11 uint8_t *buf; /* Buffer with consecutive INTEGER bits (big-endian) */
12 int size; /* Size of the buffer */
13} INTEGER_t;
14
15extern asn1_TYPE_descriptor_t asn1_DEF_INTEGER;
16
Lev Walkina9cc46e2004-09-22 16:06:28 +000017asn_struct_free_f INTEGER_free;
18asn_struct_print_f INTEGER_print;
Lev Walkinf15320b2004-06-03 03:38:44 +000019ber_type_decoder_f INTEGER_decode_ber;
20der_type_encoder_f INTEGER_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +000021xer_type_encoder_f INTEGER_encode_xer;
Lev Walkinf15320b2004-06-03 03:38:44 +000022
23/***********************************
24 * Some handy conversion routines. *
25 ***********************************/
26
27/*
28 * Returns 0 if it was possible to convert, -1 otherwise.
29 * -1/EINVAL: Mandatory argument missing
30 * -1/ERANGE: Value encoded is out of range for long representation
31 */
32int asn1_INTEGER2long(const INTEGER_t *i, long *l);
33
34#endif /* _INTEGER_H_ */