[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Neels Hofmeyr, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#17). support for more cell ID list types in libosmocore Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. While here, fix a small bug in a test: test_gsm0808_enc_dec_cell_id_list_bss() set the cell ID type to 'LAC' but obviously wants to use type 'BSS'. Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 8 files changed, 360 insertions(+), 34 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/17 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 8c276f5..9153d99 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -30,6 +30,7 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list2; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); @@ -70,9 +71,13 @@ *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, + const struct gsm0808_cell_id_list2 *cil, + const uint8_t *chan_needed); struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, - const uint8_t *chan_needed); + const uint8_t *chan_needed) + OSMO_DEPRECATED("use gsm0808_create_paging2 instead"); struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id); void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..363fc39 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,27 @@ struct sockaddr_storage; #include +#include + + /*! (225-1)/2 is the maximum number of elements in a cell identifier list. */ +#define GSM0808_CELL_ID_LIST2_MAXLEN 127 + +/*! Parsed representation of a cell identifier list IE. */ +struct gsm0808_cell_id_list2 { + enum CELL_IDENT id_discr; + union { + /*! +* All elements of these arrays contain parsed representations of the +* data in the corresponding IE, in host-byte order. +*/ + struct osmo_cell_global_id global; + struct osmo_lac_and_ci_id lac_and_ci; + uint16_tci; + struct osmo_location_area_idlai_and_lac; + uint16_tlac; + } id_list[GSM0808_CELL_ID_LIST2_MAXLEN]; + unsigned int id_list_len; +}; uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -48,10 +69,14 @@ const struct gsm0808_encrypt_info *ei); int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct gsm0808_cell_id_list2 *cil); uint8_t gsm0808_enc_cell_id_list(struct msgb *msg, -const struct gsm0808_cell_id_list *cil); +const struct gsm0808_cell_id_list *cil) +OSMO_DEPRECATED("use gsm0808_enc_cell_id_list2 instead"); +int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t *elem, uint8_t len); int gsm0808_dec_cell_id_list(struct
[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#16). support for more cell ID list types in libosmocore Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. While here, fix a small bug in a test: test_gsm0808_enc_dec_cell_id_list_bss() set the cell ID type to 'LAC' but obviously wants to use type 'BSS'. Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 8 files changed, 355 insertions(+), 34 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/16 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 8c276f5..9153d99 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -30,6 +30,7 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list2; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); @@ -70,9 +71,13 @@ *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, + const struct gsm0808_cell_id_list2 *cil, + const uint8_t *chan_needed); struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, - const uint8_t *chan_needed); + const uint8_t *chan_needed) + OSMO_DEPRECATED("use gsm0808_create_paging2 instead"); struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id); void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..363fc39 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,27 @@ struct sockaddr_storage; #include +#include + + /*! (225-1)/2 is the maximum number of elements in a cell identifier list. */ +#define GSM0808_CELL_ID_LIST2_MAXLEN 127 + +/*! Parsed representation of a cell identifier list IE. */ +struct gsm0808_cell_id_list2 { + enum CELL_IDENT id_discr; + union { + /*! +* All elements of these arrays contain parsed representations of the +* data in the corresponding IE, in host-byte order. +*/ + struct osmo_cell_global_id global; + struct osmo_lac_and_ci_id lac_and_ci; + uint16_tci; + struct osmo_location_area_idlai_and_lac; + uint16_tlac; + } id_list[GSM0808_CELL_ID_LIST2_MAXLEN]; + unsigned int id_list_len; +}; uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -48,10 +69,14 @@ const struct gsm0808_encrypt_info *ei); int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct gsm0808_cell_id_list2 *cil); uint8_t gsm0808_enc_cell_id_list(struct msgb *msg, -const struct gsm0808_cell_id_list *cil); +const struct gsm0808_cell_id_list *cil) +OSMO_DEPRECATED("use gsm0808_enc_cell_id_list2 instead"); +int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t *elem, uint8_t len); int gsm0808_dec_cell_id_list(struct gsm0808_cell_i
[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#15). support for more cell ID list types in libosmocore Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. While here, fix a small bug in a test: test_gsm0808_enc_dec_cell_id_list_bss() set the cell ID type to 'LAC' but obviously wants to use type 'BSS'. Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 8 files changed, 356 insertions(+), 34 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/15 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 8c276f5..92c931e 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -30,6 +30,8 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list; +struct gsm0808_cell_id_list2; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); @@ -70,9 +72,13 @@ *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, + const struct gsm0808_cell_id_list2 *cil, + const uint8_t *chan_needed); struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, - const uint8_t *chan_needed); + const uint8_t *chan_needed) + OSMO_DEPRECATED("use gsm0808_create_paging2 instead"); struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id); void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..363fc39 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,27 @@ struct sockaddr_storage; #include +#include + + /*! (225-1)/2 is the maximum number of elements in a cell identifier list. */ +#define GSM0808_CELL_ID_LIST2_MAXLEN 127 + +/*! Parsed representation of a cell identifier list IE. */ +struct gsm0808_cell_id_list2 { + enum CELL_IDENT id_discr; + union { + /*! +* All elements of these arrays contain parsed representations of the +* data in the corresponding IE, in host-byte order. +*/ + struct osmo_cell_global_id global; + struct osmo_lac_and_ci_id lac_and_ci; + uint16_tci; + struct osmo_location_area_idlai_and_lac; + uint16_tlac; + } id_list[GSM0808_CELL_ID_LIST2_MAXLEN]; + unsigned int id_list_len; +}; uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -48,10 +69,14 @@ const struct gsm0808_encrypt_info *ei); int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct gsm0808_cell_id_list2 *cil); uint8_t gsm0808_enc_cell_id_list(struct msgb *msg, -const struct gsm0808_cell_id_list *cil); +const struct gsm0808_cell_id_list *cil) +OSMO_DEPRECATED("use gsm0808_enc_cell_id_list2 instead"); +int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t *elem, uint8_t len); int gsm0808_dec_cell
[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#14). support for more cell ID list types in libosmocore Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. While here, fix a small bug in a test: test_gsm0808_enc_dec_cell_id_list_bss() set the cell ID type to 'LAC' but obviously wants to use type 'BSS'. Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 8 files changed, 356 insertions(+), 34 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/14 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 8c276f5..92c931e 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -30,6 +30,8 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list; +struct gsm0808_cell_id_list2; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); @@ -70,9 +72,13 @@ *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, + const struct gsm0808_cell_id_list2 *cil, + const uint8_t *chan_needed); struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, - const uint8_t *chan_needed); + const uint8_t *chan_needed) + OSMO_DEPRECATED("use gsm0808_create_paging2 instead"); struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id); void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..edb221d 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,27 @@ struct sockaddr_storage; #include +#include + + /*! (225-1)/2 is the maximum number of elements in a cell identifier list. */ +#define GSM0808_CELL_ID_LIST2_MAXLEN 127 + +/*! Parsed representation of a cell identifier list IE. */ +struct gsm0808_cell_id_list2 { + enum CELL_IDENT id_discr; + union { + /*! +* All elements of these arrays contain parsed representations of the +* data in the corresponding IE, in host-byte order. +*/ + struct osmo_cell_global_id id_list_global; + struct osmo_lac_and_ci_id id_list_lac_and_ci; + uint16_tid_list_ci; + struct osmo_location_area_idid_list_lai_and_lac; + uint16_tid_list_lac; + } id_list[GSM0808_CELL_ID_LIST2_MAXLEN]; + unsigned int id_list_len; +}; uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -48,10 +69,14 @@ const struct gsm0808_encrypt_info *ei); int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct gsm0808_cell_id_list2 *cil); uint8_t gsm0808_enc_cell_id_list(struct msgb *msg, -const struct gsm0808_cell_id_list *cil); +const struct gsm0808_cell_id_list *cil) +OSMO_DEPRECATED("use gsm0808_enc_cell_id_list2 instead"); +int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t *e
[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#13). support for more cell ID list types in libosmocore Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. While here, fix a small bug in a test: test_gsm0808_enc_dec_cell_id_list_bss() set the cell ID type to 'LAC' but obviously wants to use type 'BSS . Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 8 files changed, 356 insertions(+), 34 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/13 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 8c276f5..92c931e 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -30,6 +30,8 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list; +struct gsm0808_cell_id_list2; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); @@ -70,9 +72,13 @@ *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, + const struct gsm0808_cell_id_list2 *cil, + const uint8_t *chan_needed); struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, - const uint8_t *chan_needed); + const uint8_t *chan_needed) + OSMO_DEPRECATED("use gsm0808_create_paging2 instead"); struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id); void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..edb221d 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,27 @@ struct sockaddr_storage; #include +#include + + /*! (225-1)/2 is the maximum number of elements in a cell identifier list. */ +#define GSM0808_CELL_ID_LIST2_MAXLEN 127 + +/*! Parsed representation of a cell identifier list IE. */ +struct gsm0808_cell_id_list2 { + enum CELL_IDENT id_discr; + union { + /*! +* All elements of these arrays contain parsed representations of the +* data in the corresponding IE, in host-byte order. +*/ + struct osmo_cell_global_id id_list_global; + struct osmo_lac_and_ci_id id_list_lac_and_ci; + uint16_tid_list_ci; + struct osmo_location_area_idid_list_lai_and_lac; + uint16_tid_list_lac; + } id_list[GSM0808_CELL_ID_LIST2_MAXLEN]; + unsigned int id_list_len; +}; uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -48,10 +69,14 @@ const struct gsm0808_encrypt_info *ei); int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct gsm0808_cell_id_list2 *cil); uint8_t gsm0808_enc_cell_id_list(struct msgb *msg, -const struct gsm0808_cell_id_list *cil); +const struct gsm0808_cell_id_list *cil) +OSMO_DEPRECATED("use gsm0808_enc_cell_id_list2 instead"); +int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t *e
[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#12). support for more cell ID list types in libosmocore Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 8 files changed, 356 insertions(+), 34 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/12 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 8c276f5..92c931e 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -30,6 +30,8 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list; +struct gsm0808_cell_id_list2; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); @@ -70,9 +72,13 @@ *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, + const struct gsm0808_cell_id_list2 *cil, + const uint8_t *chan_needed); struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, - const uint8_t *chan_needed); + const uint8_t *chan_needed) + OSMO_DEPRECATED("use gsm0808_create_paging2 instead"); struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id); void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..edb221d 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,27 @@ struct sockaddr_storage; #include +#include + + /*! (225-1)/2 is the maximum number of elements in a cell identifier list. */ +#define GSM0808_CELL_ID_LIST2_MAXLEN 127 + +/*! Parsed representation of a cell identifier list IE. */ +struct gsm0808_cell_id_list2 { + enum CELL_IDENT id_discr; + union { + /*! +* All elements of these arrays contain parsed representations of the +* data in the corresponding IE, in host-byte order. +*/ + struct osmo_cell_global_id id_list_global; + struct osmo_lac_and_ci_id id_list_lac_and_ci; + uint16_tid_list_ci; + struct osmo_location_area_idid_list_lai_and_lac; + uint16_tid_list_lac; + } id_list[GSM0808_CELL_ID_LIST2_MAXLEN]; + unsigned int id_list_len; +}; uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -48,10 +69,14 @@ const struct gsm0808_encrypt_info *ei); int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct gsm0808_cell_id_list2 *cil); uint8_t gsm0808_enc_cell_id_list(struct msgb *msg, -const struct gsm0808_cell_id_list *cil); +const struct gsm0808_cell_id_list *cil) +OSMO_DEPRECATED("use gsm0808_enc_cell_id_list2 instead"); +int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t *elem, uint8_t len); int gsm0808_dec_cell_id_list(struct gsm0808_cell_id_list *cil, -const uint8_t *elem, uint8_t len); +
[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#11). support for more cell ID list types in libosmocore Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 8 files changed, 353 insertions(+), 31 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/11 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 3deee70..62ff06e 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -28,6 +28,8 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list; +struct gsm0808_cell_id_list2; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); @@ -66,6 +68,10 @@ *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, + const struct gsm0808_cell_id_list2 *cil, + const uint8_t *chan_needed); +/* deprecated */ struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, const uint8_t *chan_needed); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..f0b27bd 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,27 @@ struct sockaddr_storage; #include +#include + + /*! (225-1)/2 is the maximum number of elements in a cell identifier list. */ +#define GSM0808_CELL_ID_LIST2_MAXLEN 127 + +/*! Parsed representation of a cell identifier list IE. */ +struct gsm0808_cell_id_list2 { + enum CELL_IDENT id_discr; + union { + /*! +* All elements of these arrays contain parsed representations of the +* data in the corresponding IE, in host-byte order. +*/ + struct osmo_cell_global_id id_list_global; + struct osmo_lac_and_ci_id id_list_lac_and_ci; + uint16_tid_list_ci; + struct osmo_location_area_idid_list_lai_and_lac; + uint16_tid_list_lac; + } id_list[GSM0808_CELL_ID_LIST2_MAXLEN]; + unsigned int id_list_len; +}; uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -48,8 +69,12 @@ const struct gsm0808_encrypt_info *ei); int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct gsm0808_cell_id_list2 *cil); +/* deprecated */ uint8_t gsm0808_enc_cell_id_list(struct msgb *msg, const struct gsm0808_cell_id_list *cil); +int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t *elem, uint8_t len); +/* deprecated */ int gsm0808_dec_cell_id_list(struct gsm0808_cell_id_list *cil, const uint8_t *elem, uint8_t len); int gsm0808_chan_type_to_speech_codec(uint8_t perm_spch); diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h index dd41bc5..9623a05 100644 --- a/include/osmocom/gsm/gsm23003.h +++ b/include/osmocom/gsm/gsm23003.h @@ -29,6 +29,13 @@ uint16_t cell_identity; }; +/* Actually defined in 3GPP TS 48.008 3.2.2.27 Cell Identifier List, + * but conceptually belongs with the above
[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#10). support for more cell ID list types in libosmocore Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 8 files changed, 353 insertions(+), 31 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/10 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 3deee70..62ff06e 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -28,6 +28,8 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list; +struct gsm0808_cell_id_list2; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); @@ -66,6 +68,10 @@ *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, + const struct gsm0808_cell_id_list2 *cil, + const uint8_t *chan_needed); +/* deprecated */ struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, const uint8_t *chan_needed); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..f0b27bd 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,27 @@ struct sockaddr_storage; #include +#include + + /*! (225-1)/2 is the maximum number of elements in a cell identifier list. */ +#define GSM0808_CELL_ID_LIST2_MAXLEN 127 + +/*! Parsed representation of a cell identifier list IE. */ +struct gsm0808_cell_id_list2 { + enum CELL_IDENT id_discr; + union { + /*! +* All elements of these arrays contain parsed representations of the +* data in the corresponding IE, in host-byte order. +*/ + struct osmo_cell_global_id id_list_global; + struct osmo_lac_and_ci_id id_list_lac_and_ci; + uint16_tid_list_ci; + struct osmo_location_area_idid_list_lai_and_lac; + uint16_tid_list_lac; + } id_list[GSM0808_CELL_ID_LIST2_MAXLEN]; + unsigned int id_list_len; +}; uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -48,8 +69,12 @@ const struct gsm0808_encrypt_info *ei); int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct gsm0808_cell_id_list2 *cil); +/* deprecated */ uint8_t gsm0808_enc_cell_id_list(struct msgb *msg, const struct gsm0808_cell_id_list *cil); +int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t *elem, uint8_t len); +/* deprecated */ int gsm0808_dec_cell_id_list(struct gsm0808_cell_id_list *cil, const uint8_t *elem, uint8_t len); int gsm0808_chan_type_to_speech_codec(uint8_t perm_spch); diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h index dd41bc5..9623a05 100644 --- a/include/osmocom/gsm/gsm23003.h +++ b/include/osmocom/gsm/gsm23003.h @@ -29,6 +29,13 @@ uint16_t cell_identity; }; +/* Actually defined in 3GPP TS 48.008 3.2.2.27 Cell Identifier List, + * but conceptually belongs with the above
[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#9). support for more cell ID list types in libosmocore Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 8 files changed, 354 insertions(+), 31 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/9 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 3deee70..62ff06e 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -28,6 +28,8 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list; +struct gsm0808_cell_id_list2; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); @@ -66,6 +68,10 @@ *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, + const struct gsm0808_cell_id_list2 *cil, + const uint8_t *chan_needed); +/* deprecated */ struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, const uint8_t *chan_needed); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..61f980e 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,27 @@ struct sockaddr_storage; #include +#include + +/*! Maximum number of elements in a cell identifier list. */ +#define GSM0808_CELL_ID_LIST2_MAXLEN 128 + +/*! Parsed representation of a cell identifier list IE. */ +struct gsm0808_cell_id_list2 { + enum CELL_IDENT id_discr; + union { + /*! +* All elements of these arrays contain parsed representations of the +* data in the corresponding IE, in host-byte order. +*/ + struct osmo_cell_global_id id_list_global[GSM0808_CELL_ID_LIST2_MAXLEN]; + struct osmo_lac_and_ci_id id_list_lac_and_ci[GSM0808_CELL_ID_LIST2_MAXLEN]; + uint16_t id_list_ci[GSM0808_CELL_ID_LIST2_MAXLEN]; + struct osmo_location_area_id id_list_lai_and_lac[GSM0808_CELL_ID_LIST2_MAXLEN]; + uint16_t id_list_lac[GSM0808_CELL_ID_LIST2_MAXLEN]; + } id_list; + unsigned int id_list_len; +}; uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -48,8 +69,12 @@ const struct gsm0808_encrypt_info *ei); int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct gsm0808_cell_id_list2 *cil); +/* deprecated */ uint8_t gsm0808_enc_cell_id_list(struct msgb *msg, const struct gsm0808_cell_id_list *cil); +int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t *elem, uint8_t len); +/* deprecated */ int gsm0808_dec_cell_id_list(struct gsm0808_cell_id_list *cil, const uint8_t *elem, uint8_t len); int gsm0808_chan_type_to_speech_codec(uint8_t perm_spch); diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h index dd41bc5..9623a05 100644 --- a/include/osmocom/gsm/gsm23003.h +++ b/include/osmocom/gsm/gsm23003.h @@ -29,6 +29,13 @@ uint16_t cell_identity; }; +/* Actu
[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#7). support for more cell ID list types in libosmocore Extend gsm0808_dec_cell_id_list() with support for additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, extend gsm0808_enc_cell_id_list() with support for the same additional types of cell identifier lists. There is an API change in struct gsm0808_cell_id_list. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. This API user is fixed by https://gerrit.osmocom.org/#/c/6518/ Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/gsm23003.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808.c M src/gsm/gsm0808_utils.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c 8 files changed, 354 insertions(+), 31 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/7 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 3deee70..62ff06e 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -28,6 +28,8 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list; +struct gsm0808_cell_id_list2; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); @@ -66,6 +68,10 @@ *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); +struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, + const struct gsm0808_cell_id_list2 *cil, + const uint8_t *chan_needed); +/* deprecated */ struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi, const struct gsm0808_cell_id_list *cil, const uint8_t *chan_needed); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..61f980e 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,27 @@ struct sockaddr_storage; #include +#include + +/*! Maximum number of elements in a cell identifier list. */ +#define GSM0808_CELL_ID_LIST2_MAXLEN 128 + +/*! Parsed representation of a cell identifier list IE. */ +struct gsm0808_cell_id_list2 { + enum CELL_IDENT id_discr; + union { + /*! +* All elements of these arrays contain parsed representations of the +* data in the corresponding IE, in host-byte order. +*/ + struct osmo_cell_global_id id_list_global[GSM0808_CELL_ID_LIST2_MAXLEN]; + struct osmo_lac_and_ci_id id_list_lac_and_ci[GSM0808_CELL_ID_LIST2_MAXLEN]; + uint16_t id_list_ci[GSM0808_CELL_ID_LIST2_MAXLEN]; + struct osmo_location_area_id id_list_lai_and_lac[GSM0808_CELL_ID_LIST2_MAXLEN]; + uint16_t id_list_lac[GSM0808_CELL_ID_LIST2_MAXLEN]; + } id_list; + unsigned int id_list_len; +}; uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); @@ -48,8 +69,12 @@ const struct gsm0808_encrypt_info *ei); int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei, const uint8_t *elem, uint8_t len); +uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct gsm0808_cell_id_list2 *cil); +/* deprecated */ uint8_t gsm0808_enc_cell_id_list(struct msgb *msg, const struct gsm0808_cell_id_list *cil); +int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t *elem, uint8_t len); +/* deprecated */ int gsm0808_dec_cell_id_list(struct gsm0808_cell_id_list *cil, const uint8_t *elem, uint8_t len); int gsm0808_chan_type_to_speech_codec(uint8_t perm_spch); diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h index dd41bc5..9623a05 100644 --- a/include/osmocom/gsm/gsm23003.h +++ b/include/osmocom/gsm/gsm23003.h @@ -29,6 +29,13 @@ uint16_t cell_identity; }; +/* A
[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#6). support for more cell ID list types in libosmocore Extend gsm0808_dec_cell_id_list() with support for additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, extend gsm0808_enc_cell_id_list() with support for the same additional types of cell identifier lists. There is an API change in struct gsm0808_cell_id_list. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. This API user is fixed by https://gerrit.osmocom.org/#/c/6518/ Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/gsm0808.h M include/osmocom/gsm/gsm0808_utils.h M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808_utils.c M tests/gsm0808/gsm0808_test.c 5 files changed, 255 insertions(+), 29 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/6 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index 3deee70..219e339 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -28,6 +28,7 @@ struct sockaddr_storage; struct msgb; +struct gsm0808_cell_id_list; struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci); diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 7432164..3efadf8 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -26,6 +26,62 @@ struct sockaddr_storage; #include +#include + +/* 3GPP TS 48.008 3.2.2.27 Cell Identifier List */ + +/* + * The structs below are parsed representations of data in the corresponding IE. + * All fields are in host byte-order. + * + * The functions gsm0808_dec_cell_id_list() and gsm0808_enc_cell_id_list() + * convert these structs from/to a network byte-order data stream. + */ + +/* Parsed Cell Global Identification (CELL_IDENT_WHOLE_GLOBAL) + * uses struct osmo_cell_global_id. */ + +/* Parsed Location Area Code and Cell Identity (CELL_IDENT_LAC_AND_CI) */ +struct gsm0808_cell_id_lac_and_ci { + uint16_t lac; + uint16_t ci; +}; + +/* Parsed Cell Identity (CELL_IDENT_CI) */ +struct gsm0808_cell_id_ci { + uint16_t ci; +}; + +/* Parsed Location Area Identification and Location Area Code (CELL_IDENT_LAI_AND_LAC) + * uses struct osmo_location_area_id. */ + +/* Parsed Location Area Code (CELL_IDENT_LAC) */ +struct gsm0808_cell_id_lac { + uint16_t lac; +}; + +#define CELL_ID_LIST_MAXLEN254 /* implementation-defined limit, in bytes */ +#define CELL_ID_LIST_GLOBAL_MAXLEN (CELL_ID_LIST_MAXLEN / sizeof(struct osmo_cell_global_id)) +#define CELL_ID_LIST_LAC_AND_CI_MAXLEN (CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_lac_and_ci)) +#define CELL_ID_LIST_CI_MAXLEN (CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_ci)) +#define CELL_ID_LIST_LAI_AND_LAC_MAXLEN(CELL_ID_LIST_MAXLEN / sizeof(struct osmo_location_area_id)) +#define CELL_ID_LIST_LAC_MAXLEN(CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_lac)) +struct gsm0808_cell_id_list { + uint8_t id_discr; + union { + /* +* All struct fields in elements of these arrays are in host-byte order, +* ie. contain parsed representations of the data in the corresponding IE. +*/ + struct osmo_cell_global_id id_list_global[CELL_ID_LIST_GLOBAL_MAXLEN]; + struct gsm0808_cell_id_lac_and_ci id_list_lac_and_ci[CELL_ID_LIST_LAC_AND_CI_MAXLEN]; + struct gsm0808_cell_id_ci id_list_ci[CELL_ID_LIST_CI_MAXLEN]; + struct osmo_location_area_id id_list_lai_and_lac[CELL_ID_LIST_LAI_AND_LAC_MAXLEN]; + struct gsm0808_cell_id_lac id_list_lac[CELL_ID_LIST_LAC_MAXLEN]; + } id_list; + unsigned int id_list_len; +}; + uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg, const struct sockaddr_storage *ss); diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index ba347ef..e8d6911 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -500,11 +500,3 @@ uint8_t key[ENCRY_INFO_KEY_MAXLEN]; unsigned int key_len; }; - -/* 3GPP TS 48.008 3.2.2.27 Cell Identifier List */ -#define CELL_ID
[PATCH] libosmocore[master]: Support for more cell ID list types in libosmocore.
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#5). Support for more cell ID list types in libosmocore. Extend gsm0808_dec_cell_id_list() with support for additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, extend gsm0808_enc_cell_id_list() with support for the same additional types of cell identifier lists. There is an API change in struct gsm0808_cell_id_list. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. This API user is fixed by https://gerrit.osmocom.org/#/c/6518/ Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808_utils.c M tests/gsm0808/gsm0808_test.c 3 files changed, 249 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/5 diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index ba347ef..a8da2b0 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -7,6 +7,7 @@ #include #include #include +#include /* * this is from GSM 03.03 CGI but is copied in GSM 08.08 @@ -502,9 +503,58 @@ }; /* 3GPP TS 48.008 3.2.2.27 Cell Identifier List */ -#define CELL_ID_LIST_LAC_MAXLEN 127 + +/* + * The structs below are parsed representations of data in the corresponding IE. + * All fields are in host byte-order. + * + * The functions gsm0808_dec_cell_id_list() and gsm0808_enc_cell_id_list() + * convert these structs from/to a network byte-order data stream. + * + * XXX TODO: These declarations belong in gsm_0808_utils.h, not here. + * However, moving them there currently breaks the build. + */ + +/* Parsed Cell Global Identification (CELL_IDENT_WHOLE_GLOBAL) + * uses struct osmo_cell_global_id. */ + +/* Parsed Location Area Code and Cell Identity (CELL_IDENT_LAC_AND_CI) */ +struct gsm0808_cell_id_lac_and_ci { + uint16_t lac; + uint16_t ci; +}; + +/* Parsed Cell Identity (CELL_IDENT_CI) */ +struct gsm0808_cell_id_ci { + uint16_t ci; +}; + +/* Parsed Location Area Identification and Location Area Code (CELL_IDENT_LAI_AND_LAC) + * uses struct osmo_location_area_id. */ + +/* Parsed Location Area Code (CELL_IDENT_LAC) */ +struct gsm0808_cell_id_lac { + uint16_t lac; +}; + +#define CELL_ID_LIST_MAXLEN254 /* implementation-defined limit, in bytes */ +#define CELL_ID_LIST_GLOBAL_MAXLEN (CELL_ID_LIST_MAXLEN / sizeof(struct osmo_cell_global_id)) +#define CELL_ID_LIST_LAC_AND_CI_MAXLEN (CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_lac_and_ci)) +#define CELL_ID_LIST_CI_MAXLEN (CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_ci)) +#define CELL_ID_LIST_LAI_AND_LAC_MAXLEN(CELL_ID_LIST_MAXLEN / sizeof(struct osmo_location_area_id)) +#define CELL_ID_LIST_LAC_MAXLEN(CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_lac)) struct gsm0808_cell_id_list { uint8_t id_discr; - uint16_t id_list_lac[CELL_ID_LIST_LAC_MAXLEN]; + union { + /* +* All struct fields in elements of these arrays are in host-byte order, +* ie. contain parsed representations of the data in the corresponding IE. +*/ + struct osmo_cell_global_id id_list_global[CELL_ID_LIST_GLOBAL_MAXLEN]; + struct gsm0808_cell_id_lac_and_ci id_list_lac_and_ci[CELL_ID_LIST_LAC_AND_CI_MAXLEN]; + struct gsm0808_cell_id_ci id_list_ci[CELL_ID_LIST_CI_MAXLEN]; + struct osmo_location_area_id id_list_lai_and_lac[CELL_ID_LIST_LAI_AND_LAC_MAXLEN]; + struct gsm0808_cell_id_lac id_list_lac[CELL_ID_LIST_LAC_MAXLEN]; + } id_list; unsigned int id_list_len; }; diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 93e6074..c962afc 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -27,6 +27,7 @@ #include #include #include +#include #define IP_V4_ADDR_LEN 4 #define IP_V6_ADDR_LEN 16 @@ -588,22 +589,180 @@ msgb_put_u8(msg, cil->id_discr & 0x0f); switch (cil->id_discr) { + case CELL_IDENT_WHOLE_GLOBAL: + OSMO_ASSERT(cil->id_list_len <= CELL_ID_LIST_GLOBAL_MAXLEN) + for (i = 0; i < cil->id_list_len; i++) { + const struct osmo_cell_global_id *id = &cil->id_list.id_list_global[i]; + struct gsm48_loc_area_id lai; + gsm48_generate_lai(&lai, id->lai.plmn.mcc, id->lai.plmn.mnc, id->lai.l
[PATCH] libosmocore[master]: Support for more cell ID list types in libosmocore.
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6509 to look at the new patch set (#4). Support for more cell ID list types in libosmocore. Extend gsm0808_dec_cell_id_list() with support for additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, extend gsm0808_enc_cell_id_list() with support for the same additional types of cell identifier lists. There is an API change in struct gsm0808_cell_id_list. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. This API user is fixed by https://gerrit.osmocom.org/#/c/6518/ Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847 --- M include/osmocom/gsm/protocol/gsm_08_08.h M src/gsm/gsm0808_utils.c M tests/gsm0808/gsm0808_test.c 3 files changed, 257 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/4 diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h index ba347ef..75c3c61 100644 --- a/include/osmocom/gsm/protocol/gsm_08_08.h +++ b/include/osmocom/gsm/protocol/gsm_08_08.h @@ -502,9 +502,67 @@ }; /* 3GPP TS 48.008 3.2.2.27 Cell Identifier List */ -#define CELL_ID_LIST_LAC_MAXLEN 127 + +/* + * The structs below are parsed representations of data in the corresponding IE. + * All fields are in host byte-order. + * + * The functions gsm0808_dec_cell_id_list() and gsm0808_enc_cell_id_list() + * convert these structs from/to a network byte-order data stream. + * + * XXX TODO: These declarations belong in gsm_0808_utils.h, not here. + * However, moving them there currently breaks the build. + */ + +/* Parsed Cell Global Identification (CELL_IDENT_WHOLE_GLOBAL) */ +struct gsm0808_cell_id_global { + uint16_t mcc; + uint16_t mnc; + uint16_t lac; + uint16_t ci; +}a; + +/* Parsed Location Area Code and Cell Identity (CELL_IDENT_LAC_AND_CI) */ +struct gsm0808_cell_id_lac_and_ci { + uint16_t lac; + uint16_t ci; +}; + +/* Parsed Cell Identity (CELL_IDENT_CI) */ +struct gsm0808_cell_id_ci { + uint16_t ci; +}; + +/* Parsed Location Area Identification and Location Area Code (CELL_IDENT_LAI_AND_LAC) */ +struct gsm0808_cell_id_lai_and_lac { + uint16_t mcc; + uint16_t mnc; + uint16_t lac; +}; + +/* Parsed Location Area Code (CELL_IDENT_LAC) */ +struct gsm0808_cell_id_lac { + uint16_t lac; +}; + +#define CELL_ID_LIST_MAXLEN254 /* implementation-defined limit, in bytes */ +#define CELL_ID_LIST_GLOBAL_MAXLEN (CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_global)) +#define CELL_ID_LIST_LAC_AND_CI_MAXLEN (CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_lac_and_ci)) +#define CELL_ID_LIST_CI_MAXLEN (CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_ci)) +#define CELL_ID_LIST_LAI_AND_LAC_MAXLEN(CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_lai_and_lac)) +#define CELL_ID_LIST_LAC_MAXLEN(CELL_ID_LIST_MAXLEN / sizeof(struct gsm0808_cell_id_lac)) struct gsm0808_cell_id_list { uint8_t id_discr; - uint16_t id_list_lac[CELL_ID_LIST_LAC_MAXLEN]; + union { + /* +* All struct fields in elements of these arrays are in host-byte order, +* ie. contain parsed representations of the data in the corresponding IE. +*/ + struct gsm0808_cell_id_global id_list_global[CELL_ID_LIST_GLOBAL_MAXLEN]; + struct gsm0808_cell_id_lac_and_ci id_list_lac_and_ci[CELL_ID_LIST_LAC_AND_CI_MAXLEN]; + struct gsm0808_cell_id_ci id_list_ci[CELL_ID_LIST_CI_MAXLEN]; + struct gsm0808_cell_id_lai_and_lac id_list_lai_and_lac[CELL_ID_LIST_LAI_AND_LAC_MAXLEN]; + struct gsm0808_cell_id_lac id_list_lac[CELL_ID_LIST_LAC_MAXLEN]; + } id_list; unsigned int id_list_len; }; diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c index 93e6074..80b203d 100644 --- a/src/gsm/gsm0808_utils.c +++ b/src/gsm/gsm0808_utils.c @@ -27,6 +27,7 @@ #include #include #include +#include #define IP_V4_ADDR_LEN 4 #define IP_V6_ADDR_LEN 16 @@ -588,22 +589,180 @@ msgb_put_u8(msg, cil->id_discr & 0x0f); switch (cil->id_discr) { + case CELL_IDENT_WHOLE_GLOBAL: + OSMO_ASSERT(cil->id_list_len <= CELL_ID_LIST_GLOBAL_MAXLEN) + for (i = 0; i < cil->id_list_len; i++) { + const struct gsm0808_cell_id_global *id = &cil->id_list.id_list_global[i]; + struct gsm48_loc_area_id lai; + gsm48_generate_lai(&lai, i