diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-02-15 16:25:33 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-02-15 16:25:35 +0100 |
commit | 85a0f1143d0e2bb9ad34c675bcca384e8e84badf (patch) | |
tree | b16e0563615eb5fba0e153ba613f637f6a97551b | |
parent | 20b763d0aff78d04c38728d8ac5975e14baa036c (diff) |
gsm0808_utils: Move static function further up in file
It's a static internal function, so it makes sense to have it at start
of its related section.
It will be used by other functions in follow up patches.
Change-Id: I60f61f8f7bb6543feb068bdcee76d3b752565c95
-rw-r--r-- | src/gsm/gsm0808_utils.c | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 292b2481..e0f0c28b 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -767,6 +767,52 @@ int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, return (int)(elem - old_elem); } +/* Store individual Cell Identifier information in a CGI, without clearing the remaining ones. + * This is useful to supplement one CGI with information from more than one Cell Identifier, + * which in turn is useful to match Cell Identifiers of differing kinds to each other. + * Before first invocation, clear the *dst struct externally, this function does only write those members + * that are present in parameter u. + */ +static void cell_id_to_cgi(struct osmo_cell_global_id *dst, + enum CELL_IDENT discr, const union gsm0808_cell_id_u *u) +{ + switch (discr) { + case CELL_IDENT_WHOLE_GLOBAL: + *dst = u->global; + return; + + case CELL_IDENT_WHOLE_GLOBAL_PS: + dst->lai = u->global_ps.rai.lac; + dst->cell_identity = u->global_ps.cell_identity; + return; + + case CELL_IDENT_LAC_AND_CI: + dst->lai.lac = u->lac_and_ci.lac; + dst->cell_identity = u->lac_and_ci.ci; + return; + + case CELL_IDENT_CI: + dst->cell_identity = u->ci; + return; + + case CELL_IDENT_LAI_AND_LAC: + dst->lai = u->lai_and_lac; + return; + + case CELL_IDENT_LAC: + dst->lai.lac = u->lac; + return; + + case CELL_IDENT_NO_CELL: + case CELL_IDENT_BSS: + case CELL_IDENT_UTRAN_PLMN_LAC_RNC: + case CELL_IDENT_UTRAN_RNC: + case CELL_IDENT_UTRAN_LAC_RNC: + /* No values to set. */ + return; + } +} + /* Return the size of the value part of a cell identifier of given type */ int gsm0808_cell_id_size(enum CELL_IDENT discr) { @@ -1619,52 +1665,6 @@ int gsm0808_cell_id_u_name(char *buf, size_t buflen, } } -/* Store individual Cell Identifier information in a CGI, without clearing the remaining ones. - * This is useful to supplement one CGI with information from more than one Cell Identifier, - * which in turn is useful to match Cell Identifiers of differing kinds to each other. - * Before first invocation, clear the *dst struct externally, this function does only write those members - * that are present in parameter u. - */ -static void cell_id_to_cgi(struct osmo_cell_global_id *dst, - enum CELL_IDENT discr, const union gsm0808_cell_id_u *u) -{ - switch (discr) { - case CELL_IDENT_WHOLE_GLOBAL: - *dst = u->global; - return; - - case CELL_IDENT_WHOLE_GLOBAL_PS: - dst->lai = u->global_ps.rai.lac; - dst->cell_identity = u->global_ps.cell_identity; - return; - - case CELL_IDENT_LAC_AND_CI: - dst->lai.lac = u->lac_and_ci.lac; - dst->cell_identity = u->lac_and_ci.ci; - return; - - case CELL_IDENT_CI: - dst->cell_identity = u->ci; - return; - - case CELL_IDENT_LAI_AND_LAC: - dst->lai = u->lai_and_lac; - return; - - case CELL_IDENT_LAC: - dst->lai.lac = u->lac; - return; - - case CELL_IDENT_NO_CELL: - case CELL_IDENT_BSS: - case CELL_IDENT_UTRAN_PLMN_LAC_RNC: - case CELL_IDENT_UTRAN_RNC: - case CELL_IDENT_UTRAN_LAC_RNC: - /* No values to set. */ - return; - } -} - /*! Return true if the common information between the two Cell Identifiers match. * For example, if a LAC+CI is compared to LAC, return true if the LAC are the same. * Note that CELL_IDENT_NO_CELL will always return false. |