Commit 1b2defc1 authored by Denis Filatov's avatar Denis Filatov
Browse files

show choice values in certificate view

parent 214bddfe
......@@ -234,6 +234,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="mkgmtime.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="asncodec\AaEntry.h" />
......@@ -440,6 +441,7 @@
<ClInclude Include="asncodec\xer_encoder.h" />
<ClInclude Include="asncodec\xer_support.h" />
<ClInclude Include="ecc_api.h" />
<ClInclude Include="mkgmtime.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\cshared\cshared.vcxproj">
......
......@@ -6,6 +6,7 @@
*/
#include "Time32.h"
#include "../mkgmtime.h"
int
Time32_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
......@@ -33,10 +34,37 @@ static asn_oer_constraints_t asn_OER_type_Time32_constr_1 CC_NOTUSED = {
static const ber_tlv_tag_t asn_DEF_Time32_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_operation_t asn_OP_Time32 = {
NativeInteger_free,
Time32_print,
NativeInteger_compare,
NativeInteger_decode_ber,
NativeInteger_encode_der,
NativeInteger_decode_xer,
NativeInteger_encode_xer,
#ifdef ASN_DISABLE_OER_SUPPORT
0,
0,
#else
NativeInteger_decode_oer, /* OER decoder */
NativeInteger_encode_oer, /* Canonical OER encoder */
#endif /* ASN_DISABLE_OER_SUPPORT */
#ifdef ASN_DISABLE_PER_SUPPORT
0,
0,
#else
NativeInteger_decode_uper, /* Unaligned PER decoder */
NativeInteger_encode_uper, /* Unaligned PER encoder */
#endif /* ASN_DISABLE_PER_SUPPORT */
NativeInteger_random_fill,
0 /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_Time32 = {
"Time32",
"Time32",
&asn_OP_NativeInteger,
&asn_OP_Time32,
asn_DEF_Time32_tags_1,
sizeof(asn_DEF_Time32_tags_1)
/sizeof(asn_DEF_Time32_tags_1[0]), /* 1 */
......@@ -48,3 +76,17 @@ asn_TYPE_descriptor_t asn_DEF_Time32 = {
&asn_SPC_Uint32_specs_1 /* Additional specs */
};
int Time32_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const asn_INTEGER_specifics_t *specs =
(const asn_INTEGER_specifics_t *)td->specifics;
int ret = NativeInteger_print(td, sptr, ilevel, cb, app_key);
if (ret == 0){
const long *native = (const long *)sptr;
const char * s = stritsdate32(*native);
if (cb(" -- ", 4, app_key) < 0) return -1;
if (cb(s, strlen(s), app_key) < 0) return -1;
}
return ret;
}
......@@ -6,6 +6,7 @@
*/
#include "Time64.h"
#include "../mkgmtime.h"
int
Time64_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
......@@ -48,10 +49,37 @@ static asn_oer_constraints_t asn_OER_type_Time64_constr_1 CC_NOTUSED = {
static const ber_tlv_tag_t asn_DEF_Time64_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_operation_t asn_OP_Time64 = {
INTEGER_free,
Time64_print,
INTEGER_compare,
ber_decode_primitive,
INTEGER_encode_der,
INTEGER_decode_xer,
INTEGER_encode_xer,
#ifdef ASN_DISABLE_OER_SUPPORT
0,
0,
#else
INTEGER_decode_oer, /* OER decoder */
INTEGER_encode_oer, /* Canonical OER encoder */
#endif /* ASN_DISABLE_OER_SUPPORT */
#ifdef ASN_DISABLE_PER_SUPPORT
0,
0,
#else
INTEGER_decode_uper, /* Unaligned PER decoder */
INTEGER_encode_uper, /* Unaligned PER encoder */
#endif /* ASN_DISABLE_PER_SUPPORT */
INTEGER_random_fill,
0 /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_Time64 = {
"Time64",
"Time64",
&asn_OP_INTEGER,
&asn_OP_Time64,
asn_DEF_Time64_tags_1,
sizeof(asn_DEF_Time64_tags_1)
/sizeof(asn_DEF_Time64_tags_1[0]), /* 1 */
......@@ -63,3 +91,25 @@ asn_TYPE_descriptor_t asn_DEF_Time64 = {
0 /* No specifics */
};
int Time64_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const asn_INTEGER_specifics_t *specs =
(const asn_INTEGER_specifics_t *)td->specifics;
const INTEGER_t *st = (const INTEGER_t *)sptr;
int ret = INTEGER_print(td, sptr, ilevel, cb, app_key);
if (ret == 0){
if (st && st->buf){
intmax_t value;
if (specs && specs->field_unsigned)
ret = asn_INTEGER2umax(st, (uintmax_t *)&value);
else
ret = asn_INTEGER2imax(st, &value);
if (ret == 0) {
const char * s = stritsdate32(value);
if (cb(" -- ", 4, app_key) < 0) return -1;
if (cb(s, strlen(s), app_key) < 0) return -1;
}
}
}
return ret;
}
......@@ -1039,14 +1039,12 @@ CHOICE_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
/* Print member's name and stuff */
if(0) {
if(cb(elm->name, strlen(elm->name), app_key) < 0
|| cb(": ", 2, app_key) < 0)
if(cb(elm->name, strlen(elm->name), app_key) < 0
|| cb(" : ", 3, app_key) < 0)
return -1;
}
return elm->type->op->print_struct(elm->type, memb_ptr, ilevel, cb, app_key);
return elm->type->op->print_struct(elm->type, memb_ptr, ilevel,
cb, app_key);
} else {
return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
}
......
This diff is collapsed.
......@@ -20,7 +20,7 @@ static cxml_entity_t * cxml_entity_new(void * const p, const char * const name,
e = cxml_alloc(p, sizeof(cxml_entity_t) + value_len + 1);
e->next = NULL;
e->name = name;
e->nlen = strlen(name);
e->nlen = (int)strlen(name);
if(value && value_len) {
memcpy(e->value, value, value_len);
e->value[value_len] = 0;
......@@ -114,7 +114,7 @@ int cxml_handler_add_entity_from_tag(void * const h, cxml_tag_t * const tag)
if(tag->attributes){
v = (char*)tag->attributes->value;
if(v){
vlen = strlen(v);
vlen = (int)strlen(v);
}
}
return cxml_handler_add_entity(h, tag->name, v, vlen);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment