OCTET_STRING_jer.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
3  * All rights reserved.
4  * Redistribution and modifications are permitted subject to BSD license.
5  */
8 #include <etsi_its_spatem_ts_coding/BIT_STRING.h> /* for .bits_unused member */
9 
12  const asn_jer_constraints_t *constraints,
13  const void *sptr, int ilevel,
14  enum jer_encoder_flags_e flags,
15  asn_app_consume_bytes_f *cb, void *app_key) {
16  const char * const h2c = "0123456789ABCDEF";
17  const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
18  asn_enc_rval_t er = { 0, 0, 0 };
19  char scratch[16 * 3 + 4];
20  char *p = scratch;
21  uint8_t *buf;
22  uint8_t *end;
23  size_t i;
24 
25  (void)ilevel;
26  (void)flags;
27 
28  if(!st || (!st->buf && st->size))
30 
31  er.encoded = 0;
32 
33  /*
34  * Dump the contents of the buffer in hexadecimal.
35  */
36  buf = st->buf;
37  end = buf + st->size;
38  ASN__CALLBACK("\"", 1);
39  for(i = 0; buf < end; buf++, i++) {
40  if(!(i % 16) && (i || st->size > 16)) {
41  ASN__CALLBACK(scratch, p-scratch);
42  p = scratch;
43  }
44  *p++ = h2c[(*buf >> 4) & 0x0F];
45  *p++ = h2c[*buf & 0x0F];
46  }
47  if(p - scratch) {
48  ASN__CALLBACK(scratch, p-scratch); /* Dump the rest */
49  }
50  ASN__CALLBACK("\"", 1);
51 
52  ASN__ENCODED_OK(er);
53 cb_failed:
55 }
56 
57 static const struct OCTET_STRING__jer_escape_table_s {
58  const char *string;
59  int size;
61 #define OSXBT(s) { "\\"s"", sizeof(s) + 1 - 1 }
62 #define OSXUT(s) { "\\u00"s"", sizeof(s) + 4 - 1 }
63  OSXUT("00"), /* NULL */
64  OSXUT("01"), /* Start of header */
65  OSXUT("02"), /* Start of text */
66  OSXUT("03"), /* End of text */
67  OSXUT("04"), /* End of transmission */
68  OSXUT("05"), /* Enquiry */
69  OSXUT("06"), /* Ack */
70  OSXUT("07"), /* Bell */
71  OSXBT("b"), /* \b */
72  OSXBT("t"), /* \t */
73  OSXBT("n"), /* \n */
74  OSXUT("0b"), /* Vertical tab */
75  OSXBT("f"), /* \f */
76  OSXBT("r"), /* \r */
77  OSXUT("0e"), /* Shift out */
78  OSXUT("0f"), /* Shift in */
79  OSXUT("10"), /* Data link escape */
80  OSXUT("11"), /* Device control 1 */
81  OSXUT("12"), /* Device control 2 */
82  OSXUT("13"), /* Device control 3 */
83  OSXUT("14"), /* Device control 4 */
84  OSXUT("15"), /* Negative ack */
85  OSXUT("16"), /* Synchronous idle */
86  OSXUT("17"), /* End of transmission block */
87  OSXUT("18"), /* Cancel */
88  OSXUT("19"), /* End of medium */
89  OSXUT("1a"), /* Substitute */
90  OSXUT("1b"), /* Escape */
91  OSXUT("1c"), /* File separator */
92  OSXUT("1d"), /* Group separator */
93  OSXUT("1e"), /* Record separator */
94  OSXUT("1f"), /* Unit separator */
95  { 0, 0 }, /* " " */
96  { 0, 0 }, /* ! */
97  OSXBT("\""), /* \" */
98  { 0, 0 }, /* # */
99  { 0, 0 }, /* $ */
100  { 0, 0 }, /* % */
101  { 0, 0 }, /* &amp; */
102  { 0, 0 }, /* ' */
103  {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* ()*+,-./ */
104  {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* 01234567 */
105  {0,0},{0,0},{0,0},{0,0}, /* 89:; */
106  { 0, 0 }, /* &lt; */
107  { 0, 0 }, /* = */
108  { 0, 0 }, /* &gt; */
109  { 0, 0 }, /* ? */
110  { 0, 0 }, /* @ */
111  {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* ABCDEFGH */
112  {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* IJKLMNOP */
113  {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* QRSTUVWX */
114  {0,0},{0,0}, /* YZ */
115  { 0, 0 }, /* [ */
116  OSXBT("\\"), /* \\ */
117 };
118 
119 static int
120 OS__check_escaped_control_char(const void *buf, int size) {
121  size_t i;
122  /*
123  * Inefficient algorithm which translates the escape sequences
124  * defined above into characters. Returns -1 if not found.
125  * TODO: replace by a faster algorithm (bsearch(), hash or
126  * nested table lookups).
127  */
128  for(i = 0; i < 32 /* Don't spend time on the bottom half */; i++) {
129  const struct OCTET_STRING__jer_escape_table_s *el;
131  if(el->size == size && memcmp(buf, el->string, size) == 0)
132  return i;
133  }
134  return -1;
135 }
136 
137 static int
138 OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size_t chunk_size) {
139  /*
140  * This might be one of the escape sequences
141  * for control characters. Check it out.
142  * #11.15.5
143  */
144  int control_char = OS__check_escaped_control_char(chunk_buf,chunk_size);
145  if(control_char >= 0) {
146  OCTET_STRING_t *st = (OCTET_STRING_t *)struct_ptr;
147  void *p = REALLOC(st->buf, st->size + 2);
148  if(p) {
149  st->buf = (uint8_t *)p;
150  st->buf[st->size++] = control_char;
151  st->buf[st->size] = '\0'; /* nul-termination */
152  return 0;
153  }
154  }
155 
156  return -1; /* No, it's not */
157 }
158 
161  const asn_jer_constraints_t *constraints,
162  const void *sptr, int ilevel,
163  enum jer_encoder_flags_e flags,
164  asn_app_consume_bytes_f *cb, void *app_key) {
165  const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
166  asn_enc_rval_t er = { 0, 0, 0 };
167  uint8_t *buf, *end;
168  uint8_t *ss; /* Sequence start */
169  ssize_t encoded_len = 0;
170 
171  (void)ilevel; /* Unused argument */
172  (void)flags; /* Unused argument */
173 
174  if(!st || (!st->buf && st->size))
176 
177  buf = st->buf;
178  end = buf + st->size;
179  ASN__CALLBACK("\"", 1);
180  for(ss = buf; buf < end; buf++) {
181  unsigned int ch = *buf;
182  int s_len; /* Special encoding sequence length */
183 
184  /*
185  * Escape certain characters
186  */
187  if(ch < sizeof(OCTET_STRING__jer_escape_table)
188  / sizeof(OCTET_STRING__jer_escape_table[0])
189  && (s_len = OCTET_STRING__jer_escape_table[ch].size)) {
190  if(((buf - ss) && cb(ss, buf - ss, app_key) < 0)
191  || cb(OCTET_STRING__jer_escape_table[ch].string, s_len, app_key) < 0)
193  encoded_len += (buf - ss) + s_len;
194  ss = buf + 1;
195  }
196  }
197 
198  encoded_len += (buf - ss);
199  if((buf - ss) && cb(ss, buf - ss, app_key) < 0)
200  goto cb_failed;
201 
202  er.encoded += encoded_len;
203 
204  ASN__CALLBACK("\"", 1);
205  ASN__ENCODED_OK(er);
206 
207 cb_failed:
209 }
210 
211 #define CQUOTE 0x22
212 
213 /*
214  * Convert from hexadecimal format (cstring): "AB CD EF"
215  */
216 static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) {
217  OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
218  const char *chunk_stop = (const char *)chunk_buf;
219  const char *p = chunk_stop;
220  const char *pend = p + chunk_size;
221  unsigned int clv = 0;
222  int half = 0; /* Half bit */
223  uint8_t *buf;
224 
225  /* Strip quotes */
226  for (; p < pend; ++p) {
227  if (*p == CQUOTE) {
228  ++p;
229  break;
230  }
231  }
232  --pend;
233  for (; pend >= p; --pend) {
234  if (*pend == CQUOTE)
235  break;
236  }
237  if (pend - p < 0) return -1;
238  chunk_size = pend - p;
239 
240  /* Reallocate buffer according to high cap estimation */
241  size_t new_size = st->size + (chunk_size + 1) / 2;
242  void *nptr = REALLOC(st->buf, new_size + 1);
243  if(!nptr) return -1;
244  st->buf = (uint8_t *)nptr;
245  buf = st->buf + st->size;
246 
247  /*
248  * If something like " a b c " appears here, the " a b":3 will be
249  * converted, and the rest skipped. That is, unless buf_size is greater
250  * than chunk_size, then it'll be equivalent to "ABC0".
251  */
252  for(; p < pend; p++) {
253  int ch = *(const unsigned char *)p;
254  switch(ch) {
255  /* allow LF, FF, CR, space */
256  case 0x0a: case 0x0c: case 0x0d: case 0x20:
257  continue;
258  case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/
259  case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/
260  clv = (clv << 4) + (ch - 0x30);
261  break;
262  case 0x41: case 0x42: case 0x43: /* ABC */
263  case 0x44: case 0x45: case 0x46: /* DEF */
264  clv = (clv << 4) + (ch - 0x41 + 10);
265  break;
266  case 0x61: case 0x62: case 0x63: /* abc */
267  case 0x64: case 0x65: case 0x66: /* def */
268  clv = (clv << 4) + (ch - 0x61 + 10);
269  break;
270  default:
271  *buf = 0; /* JIC */
272  return -1;
273  }
274  if(half++) {
275  half = 0;
276  *buf++ = clv;
277  chunk_stop = p + 1;
278  }
279  }
280 
281  /*
282  * Check partial decoding.
283  */
284  if(half) {
285  if(have_more) {
286  /*
287  * Partial specification is fine,
288  * because no more more PJER_TEXT data is available.
289  */
290  *buf++ = clv << 4;
291  chunk_stop = p;
292  }
293  } else {
294  ++p;
295  chunk_stop = p;
296  }
297 
298  st->size = buf - st->buf; /* Adjust the buffer size */
299  assert(st->size <= new_size);
300  st->buf[st->size] = 0; /* Courtesy termination */
301 
302  return (chunk_stop - (const char *)chunk_buf); /* Converted size */
303 }
304 
305 /*
306  * Something like strtod(), but with stricter rules.
307  */
308 static int
309 OS__strtoent(const char *buf, const char *end, int32_t *ret_value) {
310  const int32_t last_unicode_codepoint = 0x10ffff;
311  int32_t val = 0;
312  const char *p;
313 
314  for(p = buf; p < end; p++) {
315  int ch = *p;
316 
317  switch(ch) {
318  case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/
319  case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/
320  val = val * 16 + (ch - 0x30);
321  break;
322  case 0x41: case 0x42: case 0x43: /* ABC */
323  case 0x44: case 0x45: case 0x46: /* DEF */
324  val = val * 16 + (ch - 0x41 + 10);
325  break;
326  case 0x61: case 0x62: case 0x63: /* abc */
327  case 0x64: case 0x65: case 0x66: /* def */
328  val = val * 16 + (ch - 0x61 + 10);
329  break;
330  default:
331  return -1; /* Character set error */
332  }
333 
334  /* Value exceeds the Unicode range. */
335  if(val > last_unicode_codepoint) {
336  return -1;
337  }
338  }
339 
340  *ret_value = val;
341  return (p - buf);
342 }
343 
344 /*
345  * Convert from the plain UTF-8 format
346  */
347 static ssize_t
348 OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf,
349  size_t chunk_size, int have_more) {
350  OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
351  const char *p = (const char *)chunk_buf;
352  const char *pend = p + chunk_size;
353  uint8_t *buf;
354 
355  /* Strip quotes */
356  for(; p < pend; ++p) {
357  if (*p == CQUOTE) {
358  ++p;
359  break;
360  }
361  }
362  --pend;
363  for(; pend >= p; --pend) {
364  if (*pend == CQUOTE)
365  break;
366  }
367  if(pend - p < 0)
368  return -1;
369 
370  /* Reallocate buffer */
371  size_t new_size = st->size + (pend - p);
372  void *nptr = REALLOC(st->buf, new_size + 1);
373  if(!nptr) return -1;
374  st->buf = (uint8_t *)nptr;
375  buf = st->buf + st->size;
376 
377  /*
378  * Convert into the octet string.
379  */
380  for(; p < pend; p++) {
381  int ch = *(const unsigned char *)p;
382  int len; /* Length of the rest of the chunk */
383 
384  if(ch != 0x5c /* '\' */) {
385  *buf++ = ch;
386  continue; /* That was easy... */
387  }
388 
389  /*
390  * Process entity reference.
391  */
392  len = chunk_size - (p - (const char *)chunk_buf);
393  if(len == 1 /* "\" */) goto want_more;
394  switch(p[1]) {
395  case 0x75: /* 'u' */
396  ;
397  const char *pval; /* Pointer to start of digits */
398  int32_t val = 0; /* Entity reference value */
399 
400  if(len - 6 < 0) goto want_more;
401  pval = p + 2;
402  len = OS__strtoent(pval, pval + 4, &val);
403  if(len == -1) {
404  /* Invalid charset. Just copy verbatim. */
405  *buf++ = ch;
406  continue;
407  }
408  if(!len) goto want_more;
409  p += (pval - p) + len - 1; /* Advance past entref */
410 
411  if(val < 0x80) {
412  *buf++ = (char)val;
413  } else if(val < 0x800) {
414  *buf++ = 0xc0 | ((val >> 6));
415  *buf++ = 0x80 | ((val & 0x3f));
416  } else if(val < 0x10000) {
417  *buf++ = 0xe0 | ((val >> 12));
418  *buf++ = 0x80 | ((val >> 6) & 0x3f);
419  *buf++ = 0x80 | ((val & 0x3f));
420  } else if(val < 0x200000) {
421  *buf++ = 0xf0 | ((val >> 18));
422  *buf++ = 0x80 | ((val >> 12) & 0x3f);
423  *buf++ = 0x80 | ((val >> 6) & 0x3f);
424  *buf++ = 0x80 | ((val & 0x3f));
425  } else if(val < 0x4000000) {
426  *buf++ = 0xf8 | ((val >> 24));
427  *buf++ = 0x80 | ((val >> 18) & 0x3f);
428  *buf++ = 0x80 | ((val >> 12) & 0x3f);
429  *buf++ = 0x80 | ((val >> 6) & 0x3f);
430  *buf++ = 0x80 | ((val & 0x3f));
431  } else {
432  *buf++ = 0xfc | ((val >> 30) & 0x1);
433  *buf++ = 0x80 | ((val >> 24) & 0x3f);
434  *buf++ = 0x80 | ((val >> 18) & 0x3f);
435  *buf++ = 0x80 | ((val >> 12) & 0x3f);
436  *buf++ = 0x80 | ((val >> 6) & 0x3f);
437  *buf++ = 0x80 | ((val & 0x3f));
438  }
439  break;
440  case 0x22: /* " */
441  *buf++ = 0x22;
442  ++p;
443  break;
444  case 0x5c: /* \ */
445  *buf++ = 0x5c;
446  ++p;
447  break;
448  case 0x62: /* b */
449  *buf++ = 0x08;
450  ++p;
451  break;
452  case 0x66: /* f */
453  *buf++ = 0x0c;
454  ++p;
455  break;
456  case 0x6e: /* n */
457  *buf++ = 0x0a;
458  ++p;
459  break;
460  case 0x72: /* r */
461  *buf++ = 0x0d;
462  ++p;
463  break;
464  case 0x74: /* t */
465  *buf++ = 0x09;
466  ++p;
467  break;
468  default:
469  /* Unsupported entity reference */
470  *buf++ = ch;
471  ++p;
472  continue;
473  }
474  continue;
475  want_more:
476  if(have_more) {
477  /*
478  * We know that no more data (of the same type)
479  * is coming. Copy the rest verbatim.
480  */
481  *buf++ = ch;
482  continue;
483  }
484  chunk_size = (p - (const char *)chunk_buf);
485  /* Processing stalled: need more data */
486  break;
487  }
488 
489  st->size = buf - st->buf;
490  assert(st->size <= new_size);
491  st->buf[st->size] = 0; /* Courtesy termination */
492 
493  return chunk_size; /* Converted in full */
494 }
495 
496 /*
497  * Decode OCTET STRING from the JSON element's value.
498  */
499 static asn_dec_rval_t
501  const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td,
502  void **sptr, const void *buf_ptr, size_t size,
503  int (*opt_unexpected_tag_decoder)(void *struct_ptr, const void *chunk_buf,
504  size_t chunk_size),
505  ssize_t (*body_receiver)(void *struct_ptr, const void *chunk_buf,
506  size_t chunk_size, int have_more)) {
507  OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr;
508  const asn_OCTET_STRING_specifics_t *specs = td->specifics
511  asn_struct_ctx_t *ctx; /* Per-structure parser context */
512  asn_dec_rval_t rval; /* Return value from the decoder */
513  int st_allocated;
514 
515  /*
516  * Create the string if does not exist.
517  */
518  if(!st) {
519  st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size);
520  *sptr = (void *)st;
521  if(!st) goto sta_failed;
522  st_allocated = 1;
523  } else {
524  st_allocated = 0;
525  }
526  if(!st->buf) {
527  /* This is separate from above section */
528  st->buf = (uint8_t *)CALLOC(1, 1);
529  if(!st->buf) {
530  if(st_allocated) {
531  *sptr = 0;
532  goto stb_failed;
533  } else {
534  goto sta_failed;
535  }
536  }
537  }
538 
539  /* Restore parsing context */
540  ctx = (asn_struct_ctx_t *)(((char *)*sptr) + specs->ctx_offset);
541 
542  return jer_decode_general(opt_codec_ctx, ctx, *sptr,
543  buf_ptr, size,
544  opt_unexpected_tag_decoder,
545  body_receiver);
546 
547 stb_failed:
548  FREEMEM(st);
549 sta_failed:
550  rval.code = RC_FAIL;
551  rval.consumed = 0;
552  return rval;
553 }
554 
555 /*
556  * Decode OCTET STRING from the hexadecimal data.
557  */
560  const asn_TYPE_descriptor_t *td,
561  const asn_jer_constraints_t *constraints,
562  void **sptr,
563  const void *buf_ptr, size_t size) {
564  return OCTET_STRING__decode_jer(opt_codec_ctx, td, sptr,
565  buf_ptr, size, 0,
567 }
568 
569 /*
570  * Decode OCTET STRING from the string (ASCII/UTF-8) data.
571  */
574  const asn_TYPE_descriptor_t *td,
575  const asn_jer_constraints_t *constraints,
576  void **sptr, const void *buf_ptr, size_t size) {
577  return OCTET_STRING__decode_jer(opt_codec_ctx, td, sptr,
578  buf_ptr, size,
581 }
asn_struct_ctx_s
Definition: constr_TYPE.h:29
OCTET_STRING__jer_escape_table_s::string
const char * string
Definition: OCTET_STRING_jer.c:58
OCTET_STRING__handle_control_chars
static int OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size_t chunk_size)
Definition: OCTET_STRING_jer.c:138
ASN__ENCODED_OK
#define ASN__ENCODED_OK(rval)
Definition: asn_codecs.h:67
asn_jer_constraints_s
Definition: jer_support.h:18
asn_enc_rval_s
Definition: asn_codecs.h:41
jer_encoder_flags_e
jer_encoder_flags_e
Definition: jer_encoder.h:20
OCTET_STRING__jer_escape_table
static const struct OCTET_STRING__jer_escape_table_s OCTET_STRING__jer_escape_table[]
CALLOC
#define CALLOC(nmemb, size)
Definition: asn_internal.h:37
asn_OCTET_STRING_specifics_s::struct_size
unsigned struct_size
Definition: OCTET_STRING.h:131
jer_decode_general
asn_dec_rval_t jer_decode_general(const asn_codec_ctx_t *opt_codec_ctx, asn_struct_ctx_t *ctx, void *struct_key, const void *buf_ptr, size_t size, int(*opt_unexpected_tag_decoder)(void *struct_key, const void *chunk_buf, size_t chunk_size), ssize_t(*body_receiver)(void *struct_key, const void *chunk_buf, size_t chunk_size, int have_more))
Definition: jer_decoder.c:210
OCTET_STRING::buf
uint8_t * buf
Definition: OCTET_STRING.h:15
ASN__CALLBACK
#define ASN__CALLBACK(buf, size)
Definition: asn_internal.h:108
asn_OCTET_STRING_specifics_s::ctx_offset
unsigned ctx_offset
Definition: OCTET_STRING.h:132
asn_OCTET_STRING_specifics_s
Definition: OCTET_STRING.h:125
asn_SPC_OCTET_STRING_specs
asn_OCTET_STRING_specifics_t asn_SPC_OCTET_STRING_specs
Definition: OCTET_STRING.c:16
REALLOC
#define REALLOC(oldptr, size)
Definition: asn_internal.h:39
OCTET_STRING__jer_escape_table_s::size
int size
Definition: OCTET_STRING_jer.c:59
FREEMEM
#define FREEMEM(ptr)
Definition: asn_internal.h:40
OCTET_STRING__convert_entrefs
static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more)
Definition: OCTET_STRING_jer.c:348
OS__strtoent
static int OS__strtoent(const char *buf, const char *end, int32_t *ret_value)
Definition: OCTET_STRING_jer.c:309
OS__check_escaped_control_char
static int OS__check_escaped_control_char(const void *buf, int size)
Definition: OCTET_STRING_jer.c:120
ASN__ENCODE_FAILED
#define ASN__ENCODE_FAILED
Definition: asn_codecs.h:59
asn_TYPE_descriptor_s
Definition: constr_TYPE.h:224
asn_TYPE_descriptor_s::specifics
const void * specifics
Definition: constr_TYPE.h:259
OCTET_STRING__jer_escape_table_s
Definition: OCTET_STRING_jer.c:57
OCTET_STRING__decode_jer
static asn_dec_rval_t OCTET_STRING__decode_jer(const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td, void **sptr, const void *buf_ptr, size_t size, int(*opt_unexpected_tag_decoder)(void *struct_ptr, const void *chunk_buf, size_t chunk_size), ssize_t(*body_receiver)(void *struct_ptr, const void *chunk_buf, size_t chunk_size, int have_more))
Definition: OCTET_STRING_jer.c:500
OCTET_STRING_decode_jer_hex
asn_dec_rval_t OCTET_STRING_decode_jer_hex(const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td, const asn_jer_constraints_t *constraints, void **sptr, const void *buf_ptr, size_t size)
Definition: OCTET_STRING_jer.c:559
CQUOTE
#define CQUOTE
Definition: OCTET_STRING_jer.c:211
OCTET_STRING_decode_jer_utf8
asn_dec_rval_t OCTET_STRING_decode_jer_utf8(const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td, const asn_jer_constraints_t *constraints, void **sptr, const void *buf_ptr, size_t size)
Definition: OCTET_STRING_jer.c:573
OCTET_STRING_encode_jer
asn_enc_rval_t OCTET_STRING_encode_jer(const asn_TYPE_descriptor_t *td, const asn_jer_constraints_t *constraints, const void *sptr, int ilevel, enum jer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key)
Definition: OCTET_STRING_jer.c:11
OSXBT
#define OSXBT(s)
OSXUT
#define OSXUT(s)
OCTET_STRING
Definition: OCTET_STRING.h:14
asn_app_consume_bytes_f
int() asn_app_consume_bytes_f(const void *buffer, size_t size, void *application_specific_key)
Definition: asn_application.h:124
asn_internal.h
asn_codec_ctx_s
Definition: asn_codecs.h:23
OCTET_STRING_encode_jer_utf8
asn_enc_rval_t OCTET_STRING_encode_jer_utf8(const asn_TYPE_descriptor_t *td, const asn_jer_constraints_t *constraints, const void *sptr, int ilevel, enum jer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key)
Definition: OCTET_STRING_jer.c:160
asn_dec_rval_s
Definition: asn_codecs.h:86
asn_enc_rval_s::encoded
ssize_t encoded
Definition: asn_codecs.h:47
OCTET_STRING__convert_hexadecimal
static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more)
Definition: OCTET_STRING_jer.c:216
BIT_STRING.h
OCTET_STRING.h
RC_FAIL
@ RC_FAIL
Definition: asn_codecs.h:84
OCTET_STRING::size
size_t size
Definition: OCTET_STRING.h:16


etsi_its_spatem_ts_coding
Author(s): Jean-Pierre Busch , Guido Küppers , Lennart Reiher
autogenerated on Sun May 18 2025 02:29:28