diff --git a/src/llc.cpp b/src/llc.cpp index 3a50bc78..2997ec14 100644 --- a/src/llc.cpp +++ b/src/llc.cpp @@ -31,13 +31,13 @@ extern "C" { /* reset LLC frame */ void gprs_llc::reset() { - index = 0; + m_index = 0; m_length = 0; } void gprs_llc::reset_frame_space() { - index = 0; + m_index = 0; } void gprs_llc::enqueue(struct msgb *llc_msg) @@ -48,14 +48,14 @@ void gprs_llc::enqueue(struct msgb *llc_msg) void gprs_llc::put_frame(const uint8_t *data, size_t len) { /* only put frames when we are empty */ - OSMO_ASSERT(index == 0 && m_length == 0); + OSMO_ASSERT(m_index == 0 && m_length == 0); append_frame(data, len); } void gprs_llc::append_frame(const uint8_t *data, size_t len) { /* TODO: bounds check */ - memcpy(frame + index, data, len); + memcpy(frame + m_index, data, len); m_length += len; } diff --git a/src/llc.h b/src/llc.h index b22b1c20..f83b9f95 100644 --- a/src/llc.h +++ b/src/llc.h @@ -50,19 +50,19 @@ struct gprs_llc { bool fits_in_current_frame(uint8_t size) const; uint8_t frame[LLC_MAX_LEN]; /* current DL or UL frame */ - uint16_t index; /* current write/read position of frame */ + uint16_t m_index; /* current write/read position of frame */ uint16_t m_length; /* len of current DL LLC_frame, 0 == no frame */ struct llist_head queue; /* queued LLC DL data */ }; inline uint16_t gprs_llc::chunk_size() const { - return m_length - index; + return m_length - m_index; } inline uint16_t gprs_llc::remaining_space() const { - return LLC_MAX_LEN - index; + return LLC_MAX_LEN - m_index; } inline uint16_t gprs_llc::frame_length() const @@ -72,17 +72,17 @@ inline uint16_t gprs_llc::frame_length() const inline void gprs_llc::consume(size_t len) { - index += len; + m_index += len; } inline void gprs_llc::consume(uint8_t *data, size_t len) { /* copy and increment index */ - memcpy(data, frame + index, len); - index += len; + memcpy(data, frame + m_index, len); + consume(len); } inline bool gprs_llc::fits_in_current_frame(uint8_t chunk_size) const { - return index + chunk_size <= LLC_MAX_LEN; + return m_index + chunk_size <= LLC_MAX_LEN; }