[Forensics-changes] [yara] 03/160: Add a simple read-only stream abstraction that supports a fread(3)-like interface
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:29:11 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.4.0
in repository yara.
commit 022221c6ea461a2d6b7b36ce399e2c8ded65d797
Author: Hilko Bengen <bengen at debian.org>
Date: Fri Feb 6 01:48:23 2015 +0100
Add a simple read-only stream abstraction that supports a fread(3)-like interface
---
libyara/Makefile.am | 3 +++
libyara/include/yara.h | 1 +
libyara/include/{yara.h => yara/stream.h} | 35 ++++++++++++++++++++++---------
libyara/{include/yara.h => stream.c} | 23 ++++++++++----------
4 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/libyara/Makefile.am b/libyara/Makefile.am
index 94e32f0..d9bd3b2 100644
--- a/libyara/Makefile.am
+++ b/libyara/Makefile.am
@@ -50,6 +50,7 @@ yarainclude_HEADERS = \
include/yara/modules.h \
include/yara/object.h \
include/yara/strutils.h \
+ include/yara/stream.h \
include/yara/libyara.h
lib_LTLIBRARIES = libyara.la
@@ -98,6 +99,8 @@ libyara_la_SOURCES = \
sizedstr.h \
strutils.c \
strutils.h \
+ stream.c \
+ stream.h \
utils.h
pkgconfigdir = $(libdir)/pkgconfig
diff --git a/libyara/include/yara.h b/libyara/include/yara.h
index 0a176bb..03466e9 100644
--- a/libyara/include/yara.h
+++ b/libyara/include/yara.h
@@ -24,5 +24,6 @@ limitations under the License.
#include "yara/object.h"
#include "yara/libyara.h"
#include "yara/error.h"
+#include "yara/stream.h"
#endif
diff --git a/libyara/include/yara.h b/libyara/include/yara/stream.h
similarity index 56%
copy from libyara/include/yara.h
copy to libyara/include/yara/stream.h
index 0a176bb..d54a9d3 100644
--- a/libyara/include/yara.h
+++ b/libyara/include/yara/stream.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2007-2013. The YARA Authors. All Rights Reserved.
+Copyright (c) 2015. The YARA Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,15 +14,30 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-#ifndef YR_YARA_H
-#define YR_YARA_H
+#ifndef YR_STREAM_H
+#define YR_STREAM_H
+
+#include <stddef.h>
+
+typedef size_t (*YR_STREAM_READ_FUNC)(
+ void* ptr,
+ size_t size,
+ size_t nmemb,
+ void* user_data);
+
+
+typedef struct _YR_STREAM
+{
+ void* user_data;
+ YR_STREAM_READ_FUNC read;
+} YR_STREAM;
+
+
+size_t yr_stream_read(
+ void* ptr,
+ size_t size,
+ size_t nmemb,
+ YR_STREAM* stream);
-#include "yara/utils.h"
-#include "yara/filemap.h"
-#include "yara/compiler.h"
-#include "yara/modules.h"
-#include "yara/object.h"
-#include "yara/libyara.h"
-#include "yara/error.h"
#endif
diff --git a/libyara/include/yara.h b/libyara/stream.c
similarity index 65%
copy from libyara/include/yara.h
copy to libyara/stream.c
index 0a176bb..61dff99 100644
--- a/libyara/include/yara.h
+++ b/libyara/stream.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2007-2013. The YARA Authors. All Rights Reserved.
+Copyright (c) 2015. The YARA Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,15 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-#ifndef YR_YARA_H
-#define YR_YARA_H
+#include <stddef.h>
+#include <yara/stream.h>
-#include "yara/utils.h"
-#include "yara/filemap.h"
-#include "yara/compiler.h"
-#include "yara/modules.h"
-#include "yara/object.h"
-#include "yara/libyara.h"
-#include "yara/error.h"
-
-#endif
+size_t yr_stream_read(
+ void* ptr,
+ size_t size,
+ size_t nmemb,
+ YR_STREAM* stream)
+{
+ return stream->read(ptr, size, nmemb, stream->user_data);
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list