summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Ramūnas Mažeikis <ramunasnezinomas@gmail.com> 2019-05-29 13:33:16 +0300
committerGravatar Ramūnas Mažeikis <ramunasnezinomas@gmail.com> 2019-05-29 13:33:16 +0300
commitb8d55024bee48c614003a62a716ff8af92861d05 (patch)
tree0a312f92cf0df9bab9cf86edcb418c80a1516a63 /include
parentfbecca4da87b47da4d72ea2ec4571d6c9287961d (diff)
downloadusurpation-b8d55024bee48c614003a62a716ff8af92861d05.tar.gz
usurpation-b8d55024bee48c614003a62a716ff8af92861d05.tar.bz2
usurpation-b8d55024bee48c614003a62a716ff8af92861d05.zip
Protocol: updated tutorial.
Diffstat (limited to 'include')
-rw-r--r--include/protocol.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/include/protocol.h b/include/protocol.h
index 387424f..7bfb275 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -23,8 +23,8 @@
#if 0
- How do we use this API(?), I hear you say. Well, here is a self-contained
- example complete with tedious comments:
+How do we use this API(?), I hear you say. Well, here is a self-contained
+example complete with tedious comments, allocation of buffers and cleanup:
-------------------------------------------------------------------------------
1 | void functy_the_function(void)
@@ -46,13 +46,18 @@
19 | udp_push(packet, packet_size); /* Push packet via UDP */
20 | udp_flush(); /* Flush to the other side*/
21 |
- 22 | tlv_destroy(&text); /* Free text tlv */
- 23 | tlv_destroy(&tlv_packet); /* Free tlv_packet */
- 24 | free(packet); /* Free packet itself */
- 25 | return; /* GTFO and save stack space */
- 26 | }
+ 22 | tlv_destroy(&tlv_packet); /* Free tlv_packet */
+ 23 | free(packet); /* Free packet itself */
+ 24 | return; /* GTFO and save stack space */
+ 25 | }
-------------------------------------------------------------------------------
+A few things to note:
+ * Calling tlv_destroy() on a tlv of type REGURAL or HEARTBEAT destorys
+ all sub-tlv's too.
+ * Tlv's get copies of data, which means the original buffer can be
+ freed immediately.
+
#endif