X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fe2-interface.git;a=blobdiff_plain;f=e2sim%2Fe2sm_examples%2Fkpm_e2sm%2FASN1c%2Fper_support.h;fp=e2sim%2Fe2sm_examples%2Fkpm_e2sm%2FASN1c%2Fper_support.h;h=0000000000000000000000000000000000000000;hp=23079c94f29e254a7a2b7375ac046c3e35b811f0;hb=f5900596513e4359fc839ba361da085674e90b68;hpb=215d350dbe06a4c7ee370815f26128a7f7e160cb diff --git a/e2sim/e2sm_examples/kpm_e2sm/ASN1c/per_support.h b/e2sim/e2sm_examples/kpm_e2sm/ASN1c/per_support.h deleted file mode 100644 index 23079c9..0000000 --- a/e2sim/e2sm_examples/kpm_e2sm/ASN1c/per_support.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2005-2017 Lev Walkin . All rights reserved. - * Redistribution and modifications are permitted subject to BSD license. - */ -#ifndef _PER_SUPPORT_H_ -#define _PER_SUPPORT_H_ - -#include /* Platform-specific types */ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Pre-computed PER constraints. - */ -typedef struct asn_per_constraint_s { - enum asn_per_constraint_flags { - APC_UNCONSTRAINED = 0x0, /* No PER visible constraints */ - APC_SEMI_CONSTRAINED = 0x1, /* Constrained at "lb" */ - APC_CONSTRAINED = 0x2, /* Fully constrained */ - APC_EXTENSIBLE = 0x4 /* May have extension */ - } flags; - int range_bits; /* Full number of bits in the range */ - int effective_bits; /* Effective bits */ - long lower_bound; /* "lb" value */ - long upper_bound; /* "ub" value */ -} asn_per_constraint_t; -typedef struct asn_per_constraints_s { - asn_per_constraint_t value; - asn_per_constraint_t size; - int (*value2code)(unsigned int value); - int (*code2value)(unsigned int code); -} asn_per_constraints_t; - -/* Temporary compatibility layer. Will get removed. */ -typedef struct asn_bit_data_s asn_per_data_t; -#define per_get_few_bits(data, bits) asn_get_few_bits(data, bits) -#define per_get_undo(data, bits) asn_get_undo(data, bits) -#define per_get_many_bits(data, dst, align, bits) \ - asn_get_many_bits(data, dst, align, bits) - -/* - * X.691 (08/2015) #11.9 "General rules for encoding a length determinant" - * Get the length "n" from the Unaligned PER stream. - */ -ssize_t uper_get_length(asn_per_data_t *pd, int effective_bound_bits, - size_t lower_bound, int *repeat); - -ssize_t aper_get_length(asn_per_data_t *pd, int range, - int effective_bound_bits, int *repeat); - -/* - * Get the normally small length "n". - */ -ssize_t uper_get_nslength(asn_per_data_t *pd); -ssize_t aper_get_nslength(asn_per_data_t *pd); - -/* - * Get the normally small non-negative whole number. - */ -ssize_t uper_get_nsnnwn(asn_per_data_t *pd); -ssize_t aper_get_nsnnwn(asn_per_data_t *pd, int range); - -/* X.691-2008/11, #11.5.6 */ -int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *v, int nbits); - - -/* Temporary compatibility layer. Will get removed. */ -typedef struct asn_bit_outp_s asn_per_outp_t; -#define per_put_few_bits(out, bits, obits) asn_put_few_bits(out, bits, obits) -#define per_put_many_bits(out, src, nbits) asn_put_many_bits(out, src, nbits) -#define per_put_aligned_flush(out) asn_put_aligned_flush(out) - - -/* - * Rebase the given value as an offset into the range specified by the - * lower bound (lb) and upper bound (ub). - * RETURN VALUES: - * -1: Conversion failed due to range problems. - * 0: Conversion was successful. - */ -int per_long_range_rebase(long v, long lb, long ub, unsigned long *output); -/* The inverse operation: restores the value by the offset and its bounds. */ -int per_long_range_unrebase(unsigned long inp, long lb, long ub, long *outp); - -/* X.691-2008/11, #11.5 */ -int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits); - -/* - * X.691 (08/2015) #11.9 "General rules for encoding a length determinant" - * Put the length "whole_length" to the Unaligned PER stream. - * If (opt_need_eom) is given, it will be set to 1 if final 0-length is needed. - * In that case, invoke uper_put_length(po, 0, 0) after encoding the last block. - * This function returns the number of units which may be flushed - * in the next units saving iteration. - */ -ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length, - int *opt_need_eom); - -ssize_t aper_put_length(asn_per_outp_t *po, int range, size_t length); - -/* Align the current bit position to octet bundary */ -int aper_put_align(asn_per_outp_t *po); -int32_t aper_get_align(asn_per_data_t *pd); - -/* - * Put the normally small length "n" to the Unaligned PER stream. - * Returns 0 or -1. - */ -int uper_put_nslength(asn_per_outp_t *po, size_t length); - -int aper_put_nslength(asn_per_outp_t *po, size_t length); - -/* - * Put the normally small non-negative whole number. - */ -int uper_put_nsnnwn(asn_per_outp_t *po, int n); - -int aper_put_nsnnwn(asn_per_outp_t *po, int range, int number); - -#ifdef __cplusplus -} -#endif - -#endif /* _PER_SUPPORT_H_ */