Vanetza
Loading...
Searching...
No Matches
Hostname.c
1/*
2 * Generated by asn1c
3 * From ASN.1 module "Ieee1609Dot2BaseTypes"
4 * found in "Ieee1609Dot2BaseTypes.asn"
5 * `asn1c -fcompound-names -fincludes-quoted -no-gen-example -fprefix=Vanetza_Security_ -R`
6 */
7
8#include "Hostname.h"
9
10int
11Vanetza_Security_Hostname_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
12 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
13 const UTF8String_t *st = (const UTF8String_t *)sptr;
14 size_t size;
15
16 if(!sptr) {
17 ASN__CTFAIL(app_key, td, sptr,
18 "%s: value not given (%s:%d)",
19 td->name, __FILE__, __LINE__);
20 return -1;
21 }
22
23 size = UTF8String_length(st);
24 if((ssize_t)size < 0) {
25 ASN__CTFAIL(app_key, td, sptr,
26 "%s: UTF-8: broken encoding (%s:%d)",
27 td->name, __FILE__, __LINE__);
28 return -1;
29 }
30
31 if((size <= 255UL)) {
32 /* Constraint check succeeded */
33 return 0;
34 } else {
35 ASN__CTFAIL(app_key, td, sptr,
36 "%s: constraint failed (%s:%d)",
37 td->name, __FILE__, __LINE__);
38 return -1;
39 }
40}
41
42/*
43 * This type is implemented using UTF8String,
44 * so here we adjust the DEF accordingly.
45 */
46#if !defined(ASN_DISABLE_OER_SUPPORT)
47asn_oer_constraints_t asn_OER_type_Vanetza_Security_Hostname_constr_1 CC_NOTUSED = {
48 { 0, 0 },
49 -1 /* (SIZE(0..MAX)) */};
50#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
51#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
52asn_per_constraints_t asn_PER_type_Vanetza_Security_Hostname_constr_1 CC_NOTUSED = {
53 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
54 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
55 0, 0 /* No PER value map */
56};
57#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
58static const ber_tlv_tag_t asn_DEF_Vanetza_Security_Hostname_tags_1[] = {
59 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
60};
61asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_Hostname = {
62 "Hostname",
63 "Hostname",
64 &asn_OP_UTF8String,
65 asn_DEF_Vanetza_Security_Hostname_tags_1,
66 sizeof(asn_DEF_Vanetza_Security_Hostname_tags_1)
67 /sizeof(asn_DEF_Vanetza_Security_Hostname_tags_1[0]), /* 1 */
68 asn_DEF_Vanetza_Security_Hostname_tags_1, /* Same as above */
69 sizeof(asn_DEF_Vanetza_Security_Hostname_tags_1)
70 /sizeof(asn_DEF_Vanetza_Security_Hostname_tags_1[0]), /* 1 */
71 {
72#if !defined(ASN_DISABLE_OER_SUPPORT)
73 &asn_OER_type_Vanetza_Security_Hostname_constr_1,
74#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
75#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
76 &asn_PER_type_Vanetza_Security_Hostname_constr_1,
77#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
78#if !defined(ASN_DISABLE_JER_SUPPORT)
79 0,
80#endif /* !defined(ASN_DISABLE_JER_SUPPORT) */
81 Vanetza_Security_Hostname_constraint
82 },
83 0, 0, /* No members */
84 0 /* No specifics */
85};