/* * Fills the incoming PDU buffer with with given control PDU * * @param pdu_buffer The buffer that PDU will be serialized into * @param pdu A status report header * @return TRUE on success, FALSE otherwise */ boolean_t pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \ uint8_t bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu) { if (pdu_buffer == NULL || pdu == NULL) { return FALSE; } /* * Data or Control field and PDU type (already 0x00, noop) * * Set leftmost bit to set this PDU as `Control PDU' */ util_mark_nth_bit_of_octet(((uint8_t*)&pdu_buffer[0]), 1); /* * Fill `First Missing PDU SN' field */ pdu_buffer[0] |= ((pdu->first_missing_sn >> 8) & 0xFF); pdu_buffer[1] |= (pdu->first_missing_sn & 0xFF); /* * Append `bitmap' */ memcpy(pdu_buffer + 2, bitmap, 512); return TRUE; }
boolean_t pdcp_mark_current_pdu_as_received(uint16_t seq_num, pdcp_t* pdcp_entity) { /* * Incoming sequence number and PDCP entity were already * validated in pdcp_is_rx_seq_number_valid() so we don't * check here */ /* * Find relevant octet */ uint16_t octet_index = seq_num / 8; /* * Set relevant bit */ #if 0 LOG_D(PDCP, "Marking %d. bit of %d. octet of status bitmap\n", (seq_num % 8) + 1, octet_index); #endif util_mark_nth_bit_of_octet(&pdcp_entity->missing_pdu_bitmap[octet_index], seq_num % 8); #if 0 util_print_binary_representation((uint8_t*)"Current state of relevant octet: ", pdcp_entity->missing_pdu_bitmap[octet_index]); #endif return TRUE; }