27 #ifdef  ASN_DISABLE_PER_SUPPORT    54         cb?
"Encoding":
"Estimating", td->
name, tag_mode);
    61         uint8_t *buf = st->
buf;
    62         uint8_t *end1 = buf + st->
size - 1;
    66         for(; buf < end1; buf++) {
    75             case 0x00: 
if((buf[1] & 0x80) == 0)
    78             case 0xff: 
if((buf[1] & 0x80))
    86         shift = buf - st->
buf;
    88             uint8_t *nb = st->
buf;
    94             for(; nb < end; nb++, buf++)
   112     uint8_t *buf = st->
buf;
   113     uint8_t *buf_end = st->
buf + st->
size;
   134             scr = (
char *)alloca(scrsize);
   136                 ret = snprintf(scr, scrsize,
   139                 ret = snprintf(scr, scrsize,
   143                 "unknown value of ENUMERATED type");
   147             scrsize = 
sizeof(scratch);
   149             ret = snprintf(scr, scrsize,
   151                 ?
"%lu":
"%ld", value);
   153         assert(ret > 0 && (
size_t)ret < scrsize);
   154         return (cb(scr, ret, app_key) < 0) ? -1 : ret;
   161             "unknown value of ENUMERATED type");
   168     for(p = scratch; buf < buf_end; buf++) {
   169         static const char *h2c = 
"0123456789ABCDEF";
   170         if((p - scratch) >= (ssize_t)(
sizeof(scratch) - 4)) {
   172             if(cb(scratch, p - scratch, app_key) < 0)
   174             wrote += p - scratch;
   177         *p++ = h2c[*buf >> 4];
   178         *p++ = h2c[*buf & 0x0F];
   184     wrote += p - scratch;
   185     return (cb(scratch, p - scratch, app_key) < 0) ? -1 : wrote;
   201         ret = cb(
"<absent>", 8, app_key);
   205     return (ret < 0) ? -1 : 0;
   218     const char *ptr, *end, *name;
   225             ptr < end; ptr++, name++) {
   227             return *(
const unsigned char *)ptr
   228                 - *(
const unsigned char *)name;
   230     return name[0] ? -1 : 0;
   236     int count = specs ? specs->
map_count : 0;
   240     if(!count) 
return NULL;
   244     for(lstart++, lp = lstart; lp < lstop; lp++) {
   246         case 9: 
case 10: 
case 11: 
case 12: 
case 13: 
case 32: 
   247         case 0x2f:  
case 0x3e: 
   254     if(lp == lstop) 
return NULL;    
   273     long a = *(
const long *)kp;
   277     else if(a == b) 
return 0;
   283     int count = specs ? specs->
map_count : 0;
   292     void *p = 
MALLOC(min_size + 1);
   313     const char *lstart = (
const char *)chunk_buf;
   314     const char *lstop = lstart + chunk_size;
   320         ST_DIGITS_TRAILSPACE,
   323         ST_HEXDIGITS_TRAILSPACE,
   327     } state = ST_LEADSPACE;
   328     const char *dec_value_start = 0; 
   329     const char *dec_value_end = 0;
   332         ASN_DEBUG(
"INTEGER body %ld 0x%2x..0x%2x",
   333             (
long)chunk_size, *lstart, lstop[-1]);
   342     for(lp = lstart; lp < lstop; lp++) {
   345         case 0x09: 
case 0x0a: 
case 0x0d: 
case 0x20:
   348             case ST_DIGITS_TRAILSPACE:
   349             case ST_HEXDIGITS_TRAILSPACE:
   354                 state = ST_DIGITS_TRAILSPACE;
   357                 state = ST_HEXDIGITS_TRAILSPACE;
   364             if(state == ST_LEADSPACE) {
   366                 dec_value_start = lp;
   367                 state = ST_WAITDIGITS;
   372             if(state == ST_LEADSPACE) {
   374                 dec_value_start = lp;
   375                 state = ST_WAITDIGITS;
   379         case 0x30: 
case 0x31: 
case 0x32: 
case 0x33: 
case 0x34:
   380         case 0x35: 
case 0x36: 
case 0x37: 
case 0x38: 
case 0x39:
   382             case ST_DIGITS: 
continue;
   385                 hex_value = (lv - 0x30) << 4;
   386                 state = ST_HEXDIGIT2;
   389                 hex_value += (lv - 0x30);
   391                 st->
buf[st->
size++] = (uint8_t)hex_value;
   397                 dec_value_start = lp;
   407             if(state == ST_LEADSPACE) {
   420                 ASN_DEBUG(
"Unknown identifier for INTEGER");
   424             if(state == ST_HEXCOLON) {
   426                 state = ST_HEXDIGIT1;
   428             } 
else if(state == ST_DIGITS) {
   433                 ASN_DEBUG(
"INTEGER re-evaluate as hex form");
   434                 state = ST_SKIPSPHEX;
   439                 ASN_DEBUG(
"state %d at %ld", state, (
long)(lp - lstart));
   443         case 0x41:
case 0x42:
case 0x43:
case 0x44:
case 0x45:
case 0x46:
   444         case 0x61:
case 0x62:
case 0x63:
case 0x64:
case 0x65:
case 0x66:
   449                 hex_value = lv - ((lv < 0x61) ? 0x41 : 0x61);
   452                 state = ST_HEXDIGIT2;
   455                 hex_value += lv - ((lv < 0x61) ? 0x41 : 0x61);
   457                 st->
buf[st->
size++] = (uint8_t)hex_value;
   461                 ASN_DEBUG(
"INTEGER re-evaluate as hex form");
   462                 state = ST_SKIPSPHEX;
   473         ASN_DEBUG(
"INTEGER :: Found non-numeric 0x%2x at %ld",
   474             lv, (
long)(lp - lstart));
   475         state = ST_UNEXPECTED;
   484         dec_value_end = lstop;
   486     case ST_DIGITS_TRAILSPACE:
   488         switch(
asn_strtol_lim(dec_value_start, &dec_value_end, &dec_value)) {
   500     case ST_HEXDIGITS_TRAILSPACE:
   512         ASN_DEBUG(
"INTEGER: No useful digits (state %d)", state);
   529         const void *buf_ptr, 
size_t size) {
   555 #ifndef ASN_DISABLE_PER_SUPPORT   573     if(!constraints) constraints = td->per_constraints;
   574     ct = constraints ? &constraints->value : 0;
   576     if(ct && ct->
flags & APC_EXTENSIBLE) {
   586         if(ct->
flags & APC_SEMI_CONSTRAINED) {
   592             st->
buf = (uint8_t *)
MALLOC(1 + size + 1);
   599     if(ct && ct->
flags != APC_UNCONSTRAINED) {
   603             if((
size_t)ct->
range_bits > 8 * 
sizeof(
unsigned long))
   606             if(specs && specs->field_unsigned) {
   607                 unsigned long uvalue;
   617                 unsigned long svalue;
   630         ASN_DEBUG(
"Decoding unconstrained integer %s", td->name);
   645         st->
buf = (uint8_t *)p;
   682     ct = constraints ? &constraints->
value : 0;
   693             if(ct->
flags & APC_SEMI_CONSTRAINED) {
   701             ASN_DEBUG(
"Value %lu (%02x/%d) lb %lu ub %lu %s",
   704                 inext ? 
"ext" : 
"fix");
   710             if(ct->
flags & APC_SEMI_CONSTRAINED) {
   711                 if(value < ct->lower_bound)
   714                 if(value < ct->lower_bound
   718             ASN_DEBUG(
"Value %ld (%02x/%d) lb %ld ub %ld %s",
   721                 inext ? 
"ext" : 
"fix");
   723         if(ct->
flags & APC_EXTENSIBLE) {
   736         ASN_DEBUG(
"Encoding integer %ld (%lu) with range %d bits",
   750     for(buf = st->
buf, end = st->
buf + st->
size; buf < end;) {
   771     if(!iptr || !iptr->
buf || !lptr) {
   781     if(size > 
sizeof(
long)) {
   782         uint8_t *end1 = end - 1;
   790         for(; b < end1; b++) {
   792             case 0x00: 
if((b[1] & 0x80) == 0) 
continue; 
break;
   793             case 0xff: 
if((b[1] & 0x80) != 0) 
continue; 
break;
   799         if(size > 
sizeof(
long)) {
   814     if((*b >> 7)) l = -1; 
else l = 0;
   830     if(!iptr || !iptr->
buf || !lptr) {
   840     for(; size > 
sizeof(
unsigned long); b++, size--) {
   849     for(l = 0; b < end; b++)
   863     if(value <= LONG_MAX)
   866     buf = (uint8_t *)
MALLOC(1 + 
sizeof(value));
   869     end = buf + (
sizeof(value) + 1);
   871     for(b = buf + 1, shr = (
sizeof(
long)-1)*8; b < end; shr -= 8, b++)
   872         *b = (uint8_t)(value >> shr);
   876     st->
size = 1 + 
sizeof(value);
   887     int littleEndian = 1;   
   895     buf = (uint8_t *)
MALLOC(
sizeof(value));
   898     if(*(
char *)&littleEndian) {
   899         pstart = (uint8_t *)&value + 
sizeof(value) - 1;
   900         pend1 = (uint8_t *)&value;
   903         pstart = (uint8_t *)&value;
   904         pend1 = pstart + 
sizeof(value) - 1;
   914     for(p = pstart; p != pend1; p += add) {
   916         case 0x00: 
if((*(p+add) & 0x80) == 0)
   919         case 0xff: 
if((*(p+add) & 0x80))
   926     for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add)
   941     const char *endp = end;
   970     const long upper_boundary = LONG_MAX / 10;
   971     long last_digit_max = LONG_MAX % 10;
   987     for(l = 0; str < (*end); str++) {
   989         case 0x30: 
case 0x31: 
case 0x32: 
case 0x33: 
case 0x34:
   990         case 0x35: 
case 0x36: 
case 0x37: 
case 0x38: 
case 0x39: {
   992             if(l < upper_boundary) {
   994             } 
else if(l == upper_boundary) {
   995                 if(d <= last_digit_max) {
 
asn_TYPE_descriptor_t asn_DEF_INTEGER
 
asn_INTEGER_enum_map_t * vemap
 
int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits)
 
const asn_INTEGER_enum_map_t * INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value)
 
asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *type_descriptor, void **struct_ptr, size_t struct_size, const char *opt_mname, const void *buf_ptr, size_t size, xer_primitive_body_decoder_f *prim_body_decoder)
 
#define _ASN_DECODE_STARVED
 
enum asn_per_constraint_s::asn_per_constraint_flags flags
 
#define REALLOC(oldptr, size)
 
int asn_INTEGER2long(const INTEGER_t *iptr, long *lptr)
 
int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits)
 
static int INTEGER__compar_enum2value(const void *kp, const void *am)
 
asn_constr_check_f asn_generic_no_constraint
 
asn_dec_rval_t INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd)
 
asn_enc_rval_t INTEGER_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po)
 
ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length)
 
int INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key)
 
int asn_long2INTEGER(INTEGER_t *st, long value)
 
asn_per_constraint_t value
 
#define CALLOC(nmemb, size)
 
unsigned int * enum2value
 
static ber_tlv_tag_t asn_DEF_INTEGER_tags[]
 
#define _ASN_ENCODED_OK(rval)
 
#define _ASN_ENCODE_FAILED
 
der_type_encoder_f der_encode_primitive
 
int asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr)
 
int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int right_align, int get_nbits)
 
asn_enc_rval_t INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key)
 
enum asn_strtol_result_e asn_strtol(const char *str, const char *end, long *lp)
 
static int INTEGER__compar_value2enum(const void *kp, const void *am)
 
int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *v, int nbits)
 
int() asn_app_consume_bytes_f(const void *buffer, size_t size, void *application_specific_key)
 
asn_enc_rval_t INTEGER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key)
 
enum asn_strtol_result_e asn_strtol_lim(const char *str, const char **end, long *lp)
 
int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits)
 
asn_dec_rval_t INTEGER_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size)
 
static enum xer_pbd_rval INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size)
 
ssize_t uper_get_length(asn_per_data_t *pd, int effective_bound_bits, int *repeat)
 
static void ASN_DEBUG(const char *fmt,...)
 
ber_type_decoder_f ber_decode_primitive
 
static ssize_t INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER)
 
static const asn_INTEGER_enum_map_t * INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop)
 
asn_per_constraints_t * per_constraints
 
asn_struct_free_f ASN__PRIMITIVE_TYPE_free
 
int asn_ulong2INTEGER(INTEGER_t *st, unsigned long value)
 
asn_INTEGER_enum_map_t * value2enum
 
int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits)
 
#define _ASN_DECODE_FAILED
 
static int INTEGER_st_prealloc(INTEGER_t *st, int min_size)