libeech

BitTorrent library
git clone git://z3bra.org/libeech.git
Log | Files | Refs | README | LICENSE

commit 06340e51868101e64aa9275708e54b89b3c498f5
parent 27f38a6292d4d6c6de8ea1712dc5060024b44189
Author: z3bra <contactatz3bradotorg>
Date:   Wed Oct 18 12:32:06 +0200

Add possibility to load info dictionary from memory

Diffstat:
libeech.c | 14++++++++++++++
libeech.h | 1+
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/libeech.c b/libeech.c @@ -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) diff --git a/libeech.h b/libeech.h @@ -14,4 +14,5 @@ struct torrent { unsigned char infohash[20]; }; +int glch_loadinfo(struct torrent *, char *, size_t); int glch_loadtorrent(struct torrent *, char *);