qcdm: fix QCDM packet decapsulation
Rename and document the encapsulate/decapsulate functions, CRC-check the incoming packet, and make callers aware of the difference in how big the decapsulated packet is versus how many bytes they should discard from the buffer (since the decapsulated packet is at least 3 bytes shorter than the incoming packet due to the CRC + framing).
This commit is contained in:
+13
-5
@@ -36,11 +36,19 @@ gsize dm_unescape (const char *inbuf,
|
||||
gsize outbuf_len,
|
||||
gboolean *escaping);
|
||||
|
||||
gsize dm_prepare_buffer (char *inbuf,
|
||||
gsize cmd_len,
|
||||
gsize inbuf_len,
|
||||
char *outbuf,
|
||||
gsize outbuf_len);
|
||||
gsize dm_encapsulate_buffer (char *inbuf,
|
||||
gsize cmd_len,
|
||||
gsize inbuf_len,
|
||||
char *outbuf,
|
||||
gsize outbuf_len);
|
||||
|
||||
gboolean dm_decapsulate_buffer (const char *inbuf,
|
||||
gsize inbuf_len,
|
||||
char *outbuf,
|
||||
gsize outbuf_len,
|
||||
gsize *out_decap_len,
|
||||
gsize *out_used,
|
||||
gboolean *out_need_more);
|
||||
|
||||
#endif /* UTILS_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user