vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | /*- |
| 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 | |
| 10 | typedef struct INTEGER { |
| 11 | uint8_t *buf; /* Buffer with consecutive INTEGER bits (big-endian) */ |
| 12 | int size; /* Size of the buffer */ |
| 13 | } INTEGER_t; |
| 14 | |
| 15 | extern asn1_TYPE_descriptor_t asn1_DEF_INTEGER; |
| 16 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 17 | asn_struct_free_f INTEGER_free; |
| 18 | asn_struct_print_f INTEGER_print; |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 19 | ber_type_decoder_f INTEGER_decode_ber; |
| 20 | der_type_encoder_f INTEGER_encode_der; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 21 | xer_type_encoder_f INTEGER_encode_xer; |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 22 | |
| 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 | */ |
| 32 | int asn1_INTEGER2long(const INTEGER_t *i, long *l); |
| 33 | |
| 34 | #endif /* _INTEGER_H_ */ |