static int fill_paging_type_2(uint8_t *out_buf, const uint8_t *tmsi1_lv, uint8_t cneed1, const uint8_t *tmsi2_lv, uint8_t cneed2, const uint8_t *identity3_lv) { struct gsm48_paging2 *pt2 = (struct gsm48_paging2 *) out_buf; uint32_t tmsi; uint8_t *cur; int rc; memset(out_buf, 0, sizeof(*pt2)); pt2->proto_discr = GSM48_PDISC_RR; pt2->msg_type = GSM48_MT_RR_PAG_REQ_2; pt2->pag_mode = GSM48_PM_NORMAL; pt2->cneed1 = cneed1; pt2->cneed2 = cneed2; rc = tmsi_mi_to_uint(&tmsi, tmsi1_lv); if (rc == 0) pt2->tmsi1 = tmsi; rc = tmsi_mi_to_uint(&tmsi, tmsi2_lv); if (rc == 0) pt2->tmsi2 = tmsi; cur = out_buf + sizeof(*pt2); if (identity3_lv) cur = tlv_put(pt2->data, GSM48_IE_MOBILE_ID, identity3_lv[0], identity3_lv+1); pt2->l2_plen = L2_PLEN(cur - out_buf); return cur - out_buf; }
static int create_trx1(struct gsm_bts *bts) { uint8_t bbsig1_attr[sizeof(obj_bbsig0_attr)+12]; uint8_t *cur = bbsig1_attr; struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, 1); if (!trx) trx = gsm_bts_trx_alloc(bts); fprintf(stdout, "Crating Objects for TRX1\n"); abis_nm_bs11_set_trx1_pw(bts, trx1_password); sleep(1); cur = tlv_put(cur, NM_ATT_BS11_PASSWORD, 10, (uint8_t *)trx1_password); memcpy(cur, obj_bbsig0_attr, sizeof(obj_bbsig0_attr)); abis_nm_bs11_create_object(bts, BS11_OBJ_BBSIG, 1, sizeof(bbsig1_attr), bbsig1_attr); abis_nm_bs11_create_object(bts, BS11_OBJ_PA, 1, sizeof(obj_pa0_attr), obj_pa0_attr); abis_nm_bs11_set_trx_power(trx, BS11_TRX_POWER_GSM_30mW); return 0; }
static int fill_paging_type_1(uint8_t *out_buf, const uint8_t *identity1_lv, uint8_t chan1, const uint8_t *identity2_lv, uint8_t chan2) { struct gsm48_paging1 *pt1 = (struct gsm48_paging1 *) out_buf; uint8_t *cur; memset(out_buf, 0, sizeof(*pt1)); pt1->proto_discr = GSM48_PDISC_RR; pt1->msg_type = GSM48_MT_RR_PAG_REQ_1; pt1->pag_mode = GSM48_PM_NORMAL; pt1->cneed1 = chan1 & 3; pt1->cneed2 = chan2 & 3; cur = lv_put(pt1->data, identity1_lv[0], identity1_lv+1); if (identity2_lv) cur = tlv_put(cur, GSM48_IE_MOBILE_ID, identity2_lv[0], identity2_lv+1); pt1->l2_plen = L2_PLEN(cur - out_buf); return cur - out_buf; }