:::warning
# <center><i class="fa fa-edit"></i>read pdcp</center>
:::
Here is a function read_pdcp_sm
```c
void read_pdcp_sm(pdcp_ind_msg_t* data)
{
assert(data != NULL);
//assert(0!=0 && "Calling PDCP");
// for the moment and while we don't have a split base station, we use the
// MAC structures to obtain the RNTIs which we use to query the PDCP
const NR_UE_info_t* UE_info = &RC.nrmac[mod_id]->UE_info;
uint32_t const act_rb = num_act_rb(UE_info);
data->len = act_rb;
data->tstamp = time_now_us();
// data->slot = 0;
if(data->len > 0){
data->rb = calloc(data->len , sizeof(pdcp_radio_bearer_stats_t));
assert(data->rb != NULL && "Memory exhausted!");
}
size_t i = 0;
const NR_list_t* ue_list = &UE_info->list;
for (int ue_id = ue_list->head; ue_id >= 0; ue_id = ue_list->next[ue_id]) {
const int rnti = UE_info->rnti[ue_id];
for(size_t rb_id = 1; rb_id < 6; ++rb_id){
nr_pdcp_statistics_t pdcp = {0};
const int srb_flag = 0;
const int rc = nr_pdcp_get_statistics(rnti, srb_flag, rb_id, &pdcp);
if(rc == 0) continue;
pdcp_radio_bearer_stats_t* rd = &data->rb[i];
rd->txpdu_pkts = pdcp.txpdu_pkts ; /* aggregated number of tx packets */
rd->txpdu_bytes = pdcp.txpdu_bytes; /* aggregated bytes of tx packets */
rd->txpdu_sn = pdcp.txpdu_sn ; /* current sequence number of last tx packet (or TX_NEXT) */
rd->rxpdu_pkts = pdcp.rxpdu_pkts ; /* aggregated number of rx packets */
rd->rxpdu_bytes = pdcp.rxpdu_bytes ; /* aggregated bytes of rx packets */
rd->rxpdu_sn = pdcp.rxpdu_sn ; /* current sequence number of last rx packet (or RX_NEXT) */
rd->rxpdu_oo_pkts = pdcp.rxpdu_oo_pkts ; /* aggregated number of out-of-order rx pkts (or RX_REORD) */
rd->rxpdu_oo_bytes = pdcp.rxpdu_oo_bytes ; /* aggregated amount of out-of-order rx bytes */
rd->rxpdu_dd_pkts = pdcp.rxpdu_dd_pkts ; /* aggregated number of duplicated discarded packets (or dropped packets because of other reasons such as integrity failure) (or RX_DELIV) */
rd->rxpdu_dd_bytes = pdcp.rxpdu_dd_bytes; /* aggregated amount of discarded packets' bytes */
rd->rxpdu_ro_count = pdcp.rxpdu_ro_count ; /* this state variable indicates the COUNT value following the COUNT value associated with the PDCP Data PDU which triggered t-Reordering. (RX_REORD) */
rd->txsdu_pkts = pdcp.txsdu_pkts ; /* number of SDUs delivered */
rd->txsdu_bytes = pdcp.txsdu_bytes ; /* number of bytes of SDUs delivered */
rd->rxsdu_pkts = pdcp.rxsdu_pkts ; /* number of SDUs received */
rd->rxsdu_bytes = pdcp.rxsdu_bytes ; /* number of bytes of SDUs received */
rd->rnti = rnti;
rd->mode = pdcp.mode; /* 0: PDCP AM, 1: PDCP UM, 2: PDCP TM */
rd->rbid = rb_id;
++i;
}
}
}
```
- [***pdcp_ind_msg_t***](https://hackmd.io/SqmbHhThQ5W2JRb1KSJc4g) - pdcp indication message
- [***NR_UE_info_t***](https://hackmd.io/sJ-ASeK6Q9KcG3pQgrYtzg) - UE list used by gNB to order UEs/CC for scheduling
- [***num_act_rb***](https://hackmd.io/45r7fUEkRK2X1sf6p_vhOQ) - number of active resource blocks
- [***time_now_us***](https://hackmd.io/g68PY1naRlG0TTqOEsh_dQ) - function which gives information about time in real time
- [***pdcp_radio_bearer_stats_t***]() - function with all PDCP radio bearer options
- [***nr_pdcp_statistics_t***](https://hackmd.io/6125XePKSSu0zFepWSInMA) - funtion which gave us info about pdcp statistic