summaryrefslogblamecommitdiffstats
path: root/scan_asn1BOOLEAN.c
blob: 8a3958f848ed26672fbb475e64ab91d5319e4f22 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                             
#include "asn1.h"

size_t scan_asn1BOOLEAN(const char* src,const char* max,unsigned long* val) {
  size_t tmp;
  unsigned long tag;
  enum asn1_tagclass tc;
  enum asn1_tagtype tt;
  long ltmp;
  if ((tmp=scan_asn1int(src,max,&tc,&tt,&tag,&ltmp)))
    if (tc==UNIVERSAL && tt==PRIMITIVE && tag==BOOLEAN) {
      if (ltmp!=0 && ltmp!=1) return 0;
      *val=(unsigned long)ltmp;
      return tmp;
    }
  return 0;
}