Lev Walkin | f15320b | 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 | |
Lev Walkin | 11c3e17 | 2004-09-24 21:00:50 +0000 | [diff] [blame] | 8 | #include <asn_application.h> |
Lev Walkin | d703ff4 | 2004-10-21 11:21:25 +0000 | [diff] [blame] | 9 | #include <asn_codecs_prim.h> |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 10 | |
Lev Walkin | 8e8078a | 2004-09-26 13:10:40 +0000 | [diff] [blame] | 11 | typedef ASN__PRIMITIVE_TYPE_t INTEGER_t; |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 12 | |
Lev Walkin | 5e03376 | 2004-09-29 13:26:15 +0000 | [diff] [blame] | 13 | extern asn_TYPE_descriptor_t asn_DEF_INTEGER; |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 14 | |
Lev Walkin | a9cc46e | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 15 | asn_struct_print_f INTEGER_print; |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 16 | ber_type_decoder_f INTEGER_decode_ber; |
| 17 | der_type_encoder_f INTEGER_encode_der; |
Lev Walkin | d703ff4 | 2004-10-21 11:21:25 +0000 | [diff] [blame] | 18 | xer_type_decoder_f INTEGER_decode_xer; |
Lev Walkin | a9cc46e | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 19 | xer_type_encoder_f INTEGER_encode_xer; |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 20 | |
| 21 | /*********************************** |
| 22 | * Some handy conversion routines. * |
| 23 | ***********************************/ |
| 24 | |
| 25 | /* |
| 26 | * Returns 0 if it was possible to convert, -1 otherwise. |
| 27 | * -1/EINVAL: Mandatory argument missing |
| 28 | * -1/ERANGE: Value encoded is out of range for long representation |
Lev Walkin | d703ff4 | 2004-10-21 11:21:25 +0000 | [diff] [blame] | 29 | * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 30 | */ |
Lev Walkin | 5e03376 | 2004-09-29 13:26:15 +0000 | [diff] [blame] | 31 | int asn_INTEGER2long(const INTEGER_t *i, long *l); |
Lev Walkin | d703ff4 | 2004-10-21 11:21:25 +0000 | [diff] [blame] | 32 | int asn_long2INTEGER(INTEGER_t *i, long l); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 33 | |
| 34 | #endif /* _INTEGER_H_ */ |