tAdd possibility to load info dictionary from memory - libeech - bittorrent library
(HTM) git clone git://z3bra.org/libeech.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 06340e51868101e64aa9275708e54b89b3c498f5
(DIR) parent 27f38a6292d4d6c6de8ea1712dc5060024b44189
(HTM) Author: z3bra <contactatz3bradotorg>
Date: Wed, 18 Oct 2017 12:32:06 +0200
Add possibility to load info dictionary from memory
Diffstat:
M libeech.c | 14 ++++++++++++++
M libeech.h | 1 +
2 files changed, 15 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/libeech.c b/libeech.c
t@@ -105,6 +105,20 @@ loadpeerid(struct torrent *t)
}
int
+glch_loadinfo(struct torrent *t, char *b, size_t s)
+{
+ if (beinit(&t->be, b, s) < 0)
+ return -1;
+
+ if (loadinfohash(t) < 0)
+ return -1;
+
+ if (loadpeerid(t) < 0)
+ return -1;
+ return 0;
+}
+
+int
glch_loadtorrent(struct torrent *t, char *f)
{
if (loadfile(t, f) < 0)
(DIR) diff --git a/libeech.h b/libeech.h
t@@ -14,4 +14,5 @@ struct torrent {
unsigned char infohash[20];
};
+int glch_loadinfo(struct torrent *, char *, size_t);
int glch_loadtorrent(struct torrent *, char *);