diff options
author | FreeArtMan <dos21h@gmail.com> | 2019-05-20 17:28:25 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2019-05-20 17:28:25 +0100 |
commit | c9050b110457266488c3b51a38029138da2281aa (patch) | |
tree | cc6bc47c7fc27f176a5d97c7dd5b9a835015658c /buf_misc.c | |
parent | 2e06ffc51227fb9d613f6e068ffe04e0c4a23cb9 (diff) | |
download | libbuf-c9050b110457266488c3b51a38029138da2281aa.tar.gz libbuf-c9050b110457266488c3b51a38029138da2281aa.zip |
Diffstat (limited to 'buf_misc.c')
-rw-r--r-- | buf_misc.c | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -64,7 +64,7 @@ BufLine::BufLine(int size) BufLine::~BufLine() { - + delete buf; } int BufLine::setpattern(char *pattern) @@ -108,6 +108,28 @@ int BufLine::print() } /* +RETURN_IF_PATTERN_FOUND(*detect_pattern)(char *INPUT_BUFFER, int INPUT_SIZE) +*/ +int BufLine::pop_pattern(int (*detect_pattern)(char *, int, int*), char **val, int *size) +{ + int detected=0; + + char *buf; + int buf_size = 0; + int data_size = 0; + + this->buf->get_ptr(&buf, &buf_size); + if ((detected = detect_pattern(buf, buf_size, &data_size)) != 1) + { + return -1; + } + + this->buf->popsubstring(data_size, val, size); + + return 0; +} + +/* int bbuf_circ_new(bbuf_circ **circ, int size) { bbuf *buf = NULL; |