Change in libosmocore[master]: gprs_bssgp: add utilities to send and parse BSSGP rim PDUs

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Fri Jan 8 17:06:22 UTC 2021


pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/22046 )

Change subject: gprs_bssgp: add utilities to send and parse BSSGP rim PDUs
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/c/libosmocore/+/22046/2/include/osmocom/gprs/gprs_bssgp.h 
File include/osmocom/gprs/gprs_bssgp.h:

https://gerrit.osmocom.org/c/libosmocore/+/22046/2/include/osmocom/gprs/gprs_bssgp.h@45 
PS2, Line 45: struct bssgp_ran_information_pdu {
I'm not really liking the current approach with one struct having pointers to already encoded IEs, it's kind of cumbersome because you have to iteratively encode stuff and store it in temporary buffers in code using it. See for instance the draft I wrote for osmo-pcu:

"""
static void fill_rim_ri(struct bssgp_rim_routing_info *info, const struct osmo_cell_global_id_ps *cgi_ps)
{
	*info = {
		.discr = BSSGP_RIM_ROUTING_INFO_GERAN,
		.geran = {
			.raid = {
				.mcc = cgi_ps->rai.lac.plmn.mcc,
				.mnc = cgi_ps->rai.lac.plmn.mnc,
				.mnc_3_digits = cgi_ps->rai.lac.plmn.mnc_3_digits,
				.lac = cgi_ps->rai.lac.lac,
				.rac = cgi_ps->rai.rac,
			},
			.cid = cgi_ps->cell_identity,
		},
	};
}

static struct ran_information_pdu *gen_rim_ran_info_req(struct nacc_fsm_ctx *ctx)
{
	struct ran_information_pdu *req = talloc_zero(ctx, struct ran_information_pdu);
	struct gprs_rlcmac_bts *bts = bts_data(ctx->ms->bts);
	struct bssgp_rim_routing_info src, dst;
	uint8_t *src_buf = talloc_size(ctx, 64);
	uint8_t *dst_buf = talloc_size(ctx, 64);
	uint8_t *cont_buf = talloc_size(ctx, 64);
	int rc, src_len, dst_len, cont_len;

	fill_rim_ri(&dst, ctx->cgi_ps);
	dst_len = bssgp_create_rim_ri(dst_buf, &dst);
	if (dst_len <= 0)
		goto err_ret;

	memset(&src, 0, sizeof(src)); //TODO: fill correctly from BTS data
	src->discr = BSSGP_RIM_ROUTING_INFO_GERAN;
	src_len = bssgp_create_rim_ri(src_buf, &src);
	if (src_len <= 0)
		goto err_ret;

	struct bssgp_ran_inf_req_rim_cont cont = {
		.app_id = BSSGP_RAN_INF_APP_ID_NACC;
		.seq_num = 1;
		.pdu_ind.ack_requested = 0;
		.pdu_ind.pdu_type_ext = 1;
		.prot_ver = 1;
		.son_trans_app_id = NULL;
		.son_trans_app_id_len = 0;
		.u = {
			.app_cont_nacc = {
				.reprt_cell = {
					.raid = {
						.mcc = ctx->cgi_ps.rai.lac.plmn.mcc,
						.mnc = ctx->cgi_ps.rai.lac.plmn.mnc,
						.mnc_3_digits = false, //FIXME, how to say true/false here?
						.lac = ctx->cgi_ps.rai.lac.lac,
						.rac= ctx->cgi_ps.rai.rac,
					},
					.cid = bts->cell_id,
				},
			},
		},
	};
	cont_len = bssgp_enc_ran_inf_req_rim_cont(cont_buf, 64, &cont);
	if (cont_len <= 0)
		goto err_ret;

	struct ran_information_pdu rim = {
		.bssgp_pdu_type = BSSGP_PDUT_RAN_INFO_REQ,
		.d_cid = dst_buf,
		.d_cid_len = dst_len,
		.s_cid = src_buf,
		.s_cid_len = src_len,
		.rim_cont = cont,
		.rim_cont_len = cont_len,
		.rim_cont_iei = 0x57,
	}

	return req;

err_ret:
	talloc_free(req);
	return NULL;
}
"""


So why not having the relevant decoded structs (such as struct bssgp_rim_routing_info) into the struct and do the encoding in 1 pass insterad of having several passes?

Same as per decoding. I would expect the decode function to already provide me with 1 full struct with all protocol related parts decoded.



-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22046
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I18134fd9938040d2facb6beee3732628b167ce8c
Gerrit-Change-Number: 22046
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Comment-Date: Fri, 08 Jan 2021 17:06:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210108/863f2365/attachment.htm>


More information about the gerrit-log mailing list