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
This commit is contained in:
Pau Espin 2021-02-15 16:25:33 +01:00
parent 20b763d0af
commit 85a0f1143d
1 changed files with 46 additions and 46 deletions

View File

@ -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.