1 |
/* |
2 |
* Copyright (c) 2006 Christophe Fillot. |
3 |
* E-mail: cf@utc.fr |
4 |
* |
5 |
* gen_eth: module used to send/receive Ethernet packets. |
6 |
* |
7 |
* Use libpcap (0.9+) to receive and send packets. |
8 |
*/ |
9 |
|
10 |
#ifndef __GEN_ETH_H__ |
11 |
#define __GEN_ETH_H__ 1 |
12 |
|
13 |
#include <sys/types.h> |
14 |
#include <pcap.h> |
15 |
|
16 |
/* Initialize a generic ethernet driver */ |
17 |
pcap_t *gen_eth_init(char *device); |
18 |
|
19 |
/* Free resources of a generic ethernet driver */ |
20 |
void gen_eth_close(pcap_t *p); |
21 |
|
22 |
/* Send an ethernet frame */ |
23 |
ssize_t gen_eth_send(pcap_t *p,char *buffer,size_t len); |
24 |
|
25 |
/* Receive an ethernet frame */ |
26 |
ssize_t gen_eth_recv(pcap_t *p,char *buffer,size_t len); |
27 |
|
28 |
/* Display Ethernet interfaces of the system */ |
29 |
int gen_eth_show_dev_list(void); |
30 |
|
31 |
#endif |