]> git.lizzy.rs Git - dragonnet.git/blobdiff - send.c
Fix missing includes
[dragonnet.git] / send.c
diff --git a/send.c b/send.c
index 89408e49ba7cfe2f34439fdbfa9d5df1f1ec470e..b6fb70b88e658e374d174dbd66f90add09007d07 100644 (file)
--- a/send.c
+++ b/send.c
@@ -1,9 +1,10 @@
+#include <dragonnet/send.h>
 #include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
-#include <dragonnet/send.h>
-
-void send_raw(DragonnetPeer *p, bool submit, const void *buf, size_t n)
+void dragonnet_send_raw(DragonnetPeer *p, bool submit, const void *buf, size_t n)
 {
        pthread_rwlock_rdlock(&p->mu);
        int sock = p->sock;
@@ -20,3 +21,10 @@ void send_raw(DragonnetPeer *p, bool submit, const void *buf, size_t n)
                dragonnet_peer_delete(p);
        }
 }
+
+void dragonnet_write_raw(u8 **buf, size_t *n, const void *data, size_t len)
+{
+       *buf = realloc(*buf, len + *n);
+       memcpy(&((*buf)[*n]), data, len);
+       *n += len;
+}