llc: Make the index 'private' by appending a m_ to it.
At some point in the future we can start using the private/protected
keywords in this struct.
diff --git a/src/llc.h b/src/llc.h
index b22b1c2..f83b9f9 100644
--- a/src/llc.h
+++ b/src/llc.h
@@ -50,19 +50,19 @@
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 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;
}