tbf: Add check_polling/set_polling
Currently the checks for and the actual polling is done in several
places by copy & paste of several lines of code. This hinders changes
of they polling is handled internally and also is likely source of
programming mistakes.
Separate this into a check_polling function, that checks whether
polling is possible and returns the FN and the RRBP to be used in
that case. Otherwise the cause is logged (LOGL_DEBUG) and a negative
error value is returned. There are no other side effect beside the
logging.
If the call is successful, the set_polling method can be used to
actually register the polling.
Extend the encoder functions' parameters lists by an rrbp parameter.
Sponsored-by: On-Waves ehf
diff --git a/src/encoding.h b/src/encoding.h
index 4c35757..6ee30ac 100644
--- a/src/encoding.h
+++ b/src/encoding.h
@@ -49,21 +49,23 @@
static void write_packet_uplink_assignment(
struct gprs_rlcmac_bts *bts,
bitvec * dest, uint8_t old_tfi,
- uint8_t old_downlink, uint32_t tlli, uint8_t use_tlli,
- struct gprs_rlcmac_ul_tbf *tbf, uint8_t poll, uint8_t alpha,
- uint8_t gamma, int8_t ta_idx, int8_t use_egprs);
+ uint8_t old_downlink, uint32_t tlli, uint8_t use_tlli,
+ struct gprs_rlcmac_ul_tbf *tbf, uint8_t poll, uint8_t rrbp,
+ uint8_t alpha, uint8_t gamma, int8_t ta_idx,
+ int8_t use_egprs);
static void write_packet_downlink_assignment(RlcMacDownlink_t * block,
uint8_t old_tfi, uint8_t old_downlink,
- struct gprs_rlcmac_tbf *tbf, uint8_t poll, uint8_t alpha,
- uint8_t gamma, int8_t ta_idx, uint8_t ta_ts,
- bool use_egprs);
+ struct gprs_rlcmac_tbf *tbf, uint8_t poll, uint8_t rrbp,
+ uint8_t alpha, uint8_t gamma,
+ int8_t ta_idx, uint8_t ta_ts, bool use_egprs);
static void encode_rbb(const char *show_rbb, uint8_t *rbb);
static void write_packet_uplink_ack(
struct gprs_rlcmac_bts *bts, bitvec * dest,
- struct gprs_rlcmac_ul_tbf *tbf, bool is_final);
+ struct gprs_rlcmac_ul_tbf *tbf, bool is_final,
+ uint8_t rrbp);
static int write_paging_request(bitvec * dest, uint8_t *ptmsi, uint16_t ptmsi_len);