-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbufscap.h
35 lines (23 loc) · 788 Bytes
/
bufscap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef BUFSCAP_H
#define BUFSCAP_H
///////////////////////////////
// SCAP file reader
//
// Reads an scap file from a memory buffer
#include <stdint.h>
#include <scap_reader.h>
struct bufscap_handle
{
const uint8_t* buf;
int64_t offset;
int64_t len;
};
extern int bufscap_read(struct scap_reader* r, void* target, uint32_t len);
extern int64_t bufscap_offset(struct scap_reader* r);
extern int64_t bufscap_tell(struct scap_reader* r);
extern int64_t bufscap_seek(struct scap_reader* r, int64_t offset, int whence);
extern const char* bufscap_error(struct scap_reader* r, int* errnum);
extern int bufscap_close(struct scap_reader* r);
extern scap_reader_t* build_reader_from_buffer(const uint8_t* const buf, int64_t len);
extern void free_reader(scap_reader_t* r);
#endif