Add macros to deep copy and compare optional E1 IEs
This commit is contained in:
@@ -66,4 +66,36 @@
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/* deep copy of optional E1AP IE */
|
||||||
|
#define _E1_CP_OPTIONAL_IE(dest, src, field) \
|
||||||
|
do { \
|
||||||
|
if ((src)->field) { \
|
||||||
|
(dest)->field = malloc_or_fail(sizeof(*(dest)->field)); \
|
||||||
|
*(dest)->field = *(src)->field; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define _E1_EQ_CHECK_OPTIONAL_IE(a, b, field, EQ_MACRO) \
|
||||||
|
do { \
|
||||||
|
if (((a)->field && !(b)->field) || (!(a)->field && (b)->field)) { \
|
||||||
|
return false; /* One of the two is not allocated */ \
|
||||||
|
} \
|
||||||
|
if ((a)->field && (b)->field) { \
|
||||||
|
EQ_MACRO(*(a)->field, *(b)->field) \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define _E1_EQ_CHECK_OPTIONAL_PTR(a, b, field) \
|
||||||
|
do { \
|
||||||
|
if (((a)->field && !(b)->field) || (!(a)->field && (b)->field)) { \
|
||||||
|
PRINT_ERROR("%s:%d: optional IE '%s' not allocated: %p, %p\n", \
|
||||||
|
__FILE__, \
|
||||||
|
__LINE__, \
|
||||||
|
#field, \
|
||||||
|
(void *)(a)->field, \
|
||||||
|
(void *)(b)->field); \
|
||||||
|
return false; /* One of the two is not allocated */ \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#endif /* E1AP_LIB_COMMON_H_ */
|
#endif /* E1AP_LIB_COMMON_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user