start declaring other sorts of block structures
This commit is contained in:
parent
d386a9984b
commit
f17cdfeea2
2 changed files with 62 additions and 6 deletions
|
@ -4,6 +4,9 @@
|
|||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* pcapng reader error states
|
||||
*/
|
||||
enum {
|
||||
HEXAGRAM_PCAPNG_ERROR_OK = 0,
|
||||
HEXAGRAM_PCAPNG_ERROR_IO = 1,
|
||||
|
@ -12,14 +15,67 @@ enum {
|
|||
HEXAGRAM_PCAPNG_ERROR_HANDLER = 4
|
||||
} hexagram_pcapng_error;
|
||||
|
||||
typedef struct _hexagram_pcapng_header {
|
||||
/*
|
||||
* pcapng block option types and structure
|
||||
*/
|
||||
enum {
|
||||
HEXAGRAM_PCAPNG_OPTION_END = 0,
|
||||
HEXAGRAM_PCAPNG_OPTION_COMMENT = 1,
|
||||
HEXAGRAM_PCAPNG_OPTION_CUSTOM1 = 0x0bac,
|
||||
HEXAGRAM_PCAPNG_OPTION_CUSTOM2 = 0x0bad,
|
||||
HEXAGRAM_PCAPNG_OPTION_CUSTOM3 = 0x4bac,
|
||||
HEXAGRAM_PCAPNG_OPTION_CUSTOM4 = 0x4bad
|
||||
} hexagram_pcapng_option_type;
|
||||
|
||||
typedef struct _hexagram_pcapng_option {
|
||||
uint16_t code,
|
||||
length;
|
||||
} hexagram_pcapng_option;
|
||||
|
||||
/*
|
||||
* pcapng block types and structure
|
||||
*/
|
||||
enum {
|
||||
HEXAGRAM_PCAPNG_BLOCK_SECTION = 0x0a0d0d0a,
|
||||
HEXAGRAM_PCAPNG_BLOCK_INTERFACE = 0x1,
|
||||
HEXAGRAM_PCAPNG_BLOCK_PACKET = 0x6
|
||||
} hexagram_pcapng_block_type;
|
||||
|
||||
typedef struct _hexagram_pcapng_block_header {
|
||||
uint32_t type,
|
||||
length;
|
||||
} hexagram_pcapng_header;
|
||||
} hexagram_pcapng_block_header;
|
||||
|
||||
typedef struct _hexagram_pcapng_footer {
|
||||
typedef struct _hexagram_pcapng_block_footer {
|
||||
uint32_t length;
|
||||
} hexagram_pcapng_footer;
|
||||
} hexagram_pcapng_block_footer;
|
||||
|
||||
/*
|
||||
* pcapng section block structure and byte order magic
|
||||
*/
|
||||
#define HEXAGRAM_PCAPNG_SECTION_BYTEORDER 0x1a2b3c4d
|
||||
|
||||
typedef struct _hexagram_pcapng_section {
|
||||
uint32_t magic;
|
||||
uint16_t major, minor;
|
||||
uint64_t length;
|
||||
} hexagram_pcapng_section;
|
||||
|
||||
/*
|
||||
* pcapng interface block structure
|
||||
*/
|
||||
typedef struct _hexagram_pcapng_interface {
|
||||
uint16_t linktype,
|
||||
reserved;
|
||||
uint32_t snaplen;
|
||||
} hexagram_pcapng_interface;
|
||||
|
||||
/*
|
||||
* pcapng packet block structure
|
||||
*/
|
||||
typedef struct _hexagram_pcapng_packet {
|
||||
|
||||
} hexagram_pcapng_packet;
|
||||
|
||||
typedef int (hexagram_pcapng_block_handler)(int fd,
|
||||
uint32_t type,
|
||||
|
|
|
@ -11,8 +11,8 @@ ssize_t hexagram_pcapng_stream_read(fd, handler, error)
|
|||
hexagram_pcapng_block_handler *handler;
|
||||
int *error;
|
||||
{
|
||||
hexagram_pcapng_header header;
|
||||
hexagram_pcapng_footer footer;
|
||||
hexagram_pcapng_block_header header;
|
||||
hexagram_pcapng_block_footer footer;
|
||||
ssize_t total = 0;
|
||||
|
||||
while (1) {
|
||||
|
|
Loading…
Add table
Reference in a new issue