constr_SEQUENCE_OF.c
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2003, 2004, 2006 Lev Walkin <vlm@lionet.info>.
3  * All rights reserved.
4  * Redistribution and modifications are permitted subject to BSD license.
5  */
9 
12 #if !defined(ASN_DISABLE_PRINT_SUPPORT)
14 #else
15  0,
16 #endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */
19 #if !defined(ASN_DISABLE_BER_SUPPORT)
22 #else
23  0,
24  0,
25 #endif /* !defined(ASN_DISABLE_BER_SUPPORT) */
26 #if !defined(ASN_DISABLE_XER_SUPPORT)
29 #else
30  0,
31  0,
32 #endif /* !defined(ASN_DISABLE_XER_SUPPORT) */
33 #if !defined(ASN_DISABLE_JER_SUPPORT)
36 #else
37  0,
38  0,
39 #endif /* !defined(ASN_DISABLE_JER_SUPPORT) */
40 #if !defined(ASN_DISABLE_OER_SUPPORT)
41  SEQUENCE_OF_decode_oer, /* Same as SET OF decoder. */
42  SEQUENCE_OF_encode_oer, /* Same as SET OF encoder */
43 #else
44  0,
45  0,
46 #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
47 #if !defined(ASN_DISABLE_UPER_SUPPORT)
48  SEQUENCE_OF_decode_uper, /* Same as SET OF decoder */
50 #else
51  0,
52  0,
53 #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */
54 #if !defined(ASN_DISABLE_APER_SUPPORT)
57 #else
58  0,
59  0,
60 #endif /* !defined(ASN_DISABLE_APER_SUPPORT) */
61 #if !defined(ASN_DISABLE_RFILL_SUPPORT)
63 #else
64  0,
65 #endif /* !defined(ASN_DISABLE_RFILL_SUPPORT) */
66  0 /* Use generic outmost tag fetcher */
67 };
68 
69 int
70 SEQUENCE_OF_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
71  const void *bptr) {
72  const asn_anonymous_sequence_ *a = _A_CSEQUENCE_FROM_VOID(aptr);
73  const asn_anonymous_sequence_ *b = _A_CSEQUENCE_FROM_VOID(bptr);
74  ssize_t idx;
75 
76  if(a && b) {
77  ssize_t common_length = (a->count < b->count ? a->count : b->count);
78  for(idx = 0; idx < common_length; idx++) {
79  int ret = td->elements->type->op->compare_struct(
80  td->elements->type, a->array[idx], b->array[idx]);
81  if(ret) return ret;
82  }
83 
84  if(idx < b->count) /* more elements in b */
85  return -1; /* a is shorter, so put it first */
86  if(idx < a->count) return 1;
87 
88  } else if(!a) {
89  return -1;
90  } else if(!b) {
91  return 1;
92  }
93 
94  return 0;
95 }
asn_TYPE_operation_s
Definition: constr_TYPE.h:184
SEQUENCE_OF_decode_ber
#define SEQUENCE_OF_decode_ber
Definition: constr_SEQUENCE_OF.h:31
SEQUENCE_OF_print
#define SEQUENCE_OF_print
Definition: constr_SEQUENCE_OF.h:22
SEQUENCE_OF_encode_der
der_type_encoder_f SEQUENCE_OF_encode_der
Definition: constr_SEQUENCE_OF.h:32
_A_CSEQUENCE_FROM_VOID
#define _A_CSEQUENCE_FROM_VOID(ptr)
Definition: asn_SEQUENCE_OF.h:46
SEQUENCE_OF_encode_jer
jer_type_encoder_f SEQUENCE_OF_encode_jer
Definition: constr_SEQUENCE_OF.h:42
SEQUENCE_OF_decode_uper
#define SEQUENCE_OF_decode_uper
Definition: constr_SEQUENCE_OF.h:51
SEQUENCE_OF_encode_aper
per_type_encoder_f SEQUENCE_OF_encode_aper
Definition: constr_SEQUENCE_OF.h:56
SEQUENCE_OF_random_fill
#define SEQUENCE_OF_random_fill
Definition: constr_SEQUENCE_OF.h:60
asn_TYPE_descriptor_s
Definition: constr_TYPE.h:224
SEQUENCE_OF_decode_jer
#define SEQUENCE_OF_decode_jer
Definition: constr_SEQUENCE_OF.h:41
asn_TYPE_member_s::type
asn_TYPE_descriptor_t * type
Definition: constr_TYPE.h:278
SEQUENCE_OF_decode_aper
#define SEQUENCE_OF_decode_aper
Definition: constr_SEQUENCE_OF.h:55
asn_TYPE_descriptor_s::op
asn_TYPE_operation_t * op
Definition: constr_TYPE.h:232
asn_TYPE_operation_s::compare_struct
asn_struct_compare_f * compare_struct
Definition: constr_TYPE.h:187
SEQUENCE_OF_free
#define SEQUENCE_OF_free
Definition: constr_SEQUENCE_OF.h:19
SEQUENCE_OF_encode_uper
per_type_encoder_f SEQUENCE_OF_encode_uper
Definition: constr_SEQUENCE_OF.h:52
constr_SEQUENCE_OF.h
asn_internal.h
asn_TYPE_descriptor_s::elements
struct asn_TYPE_member_s * elements
Definition: constr_TYPE.h:252
asn_OP_SEQUENCE_OF
asn_TYPE_operation_t asn_OP_SEQUENCE_OF
Definition: constr_SEQUENCE_OF.c:10
SEQUENCE_OF_copy
#define SEQUENCE_OF_copy
Definition: constr_SEQUENCE_OF.h:26
SEQUENCE_OF_encode_xer
xer_type_encoder_f SEQUENCE_OF_encode_xer
Definition: constr_SEQUENCE_OF.h:37
SEQUENCE_OF_decode_oer
#define SEQUENCE_OF_decode_oer
Definition: constr_SEQUENCE_OF.h:46
asn_SEQUENCE_OF.h
SEQUENCE_OF_compare
int SEQUENCE_OF_compare(const asn_TYPE_descriptor_t *td, const void *aptr, const void *bptr)
Definition: constr_SEQUENCE_OF.c:70
SEQUENCE_OF_decode_xer
#define SEQUENCE_OF_decode_xer
Definition: constr_SEQUENCE_OF.h:36
SEQUENCE_OF_encode_oer
#define SEQUENCE_OF_encode_oer
Definition: constr_SEQUENCE_OF.h:47


etsi_its_cam_ts_coding
Author(s): Jean-Pierre Busch , Guido Küppers , Lennart Reiher
autogenerated on Sun May 18 2025 02:21:23