-
Notifications
You must be signed in to change notification settings - Fork 4
/
raw.h
32 lines (25 loc) · 685 Bytes
/
raw.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
#ifndef RAW_H
#define RAW_H
#include <stddef.h>
#include <stdint.h>
#include <unistd.h>
#define RAWDEV_TYPE_AUTO 0
#define RAWDEV_TYPE_TAP 1
#define RAWDEV_TYPE_SOCKET 2
struct rawdev;
struct rawdev_ops {
int (*open)(struct rawdev *dev);
void (*close)(struct rawdev *dev);
void (*rx)(struct rawdev *dev, void (*callback)(uint8_t *, size_t, void *),
void *arg, int timeout);
ssize_t (*tx)(struct rawdev *dev, const uint8_t *buf, size_t len);
int (*addr)(struct rawdev *dev, uint8_t *dst, size_t size);
};
struct rawdev {
uint8_t type;
char *name;
struct rawdev_ops *ops;
void *priv;
};
struct rawdev *rawdev_alloc(uint8_t type, char *name);
#endif