forked from linuxdeepin-packages/birl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdlfunc.h
More file actions
69 lines (61 loc) · 1.99 KB
/
dlfunc.h
File metadata and controls
69 lines (61 loc) · 1.99 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* -*- Mode: C; tab-width: 4; -*- */
/*
* 文件名称:dlfunc.h
* 摘 要:动态载入库函数
*/
#ifndef DLFUNC_H
#define DLFUNC_H
#include <stdio.h>
#include <sys/time.h>
#define PCAP_ERRBUF_SIZE 256
#define PCAP_IF_LOOPBACK 0x00000001
typedef unsigned int bpf_u_int32;
typedef void pcap_t;
typedef struct pcap_if
{
struct pcap_if *next;
char *name;
char *description;
void *addresses;
bpf_u_int32 flags;
} pcap_if_t;
struct bpf_program
{
unsigned int bf_len;
void *bf_insns;
};
struct pcap_pkthdr
{
struct timeval ts;
bpf_u_int32 caplen;
bpf_u_int32 len;
};
typedef void (*pcap_handler)(unsigned char *, const struct pcap_pkthdr *, const unsigned char *);
#ifdef NO_DYLOAD
int pcap_findalldevs(pcap_if_t **, char *);
void pcap_freealldevs(pcap_if_t *);
pcap_t *pcap_open_live(const char *, int, int, int, char *);
int pcap_compile(pcap_t *, struct bpf_program *, const char *, int, bpf_u_int32);
int pcap_setfilter(pcap_t *, struct bpf_program *);
char *pcap_geterr(pcap_t *);
void pcap_freecode(struct bpf_program *);
int pcap_loop(pcap_t *, int, pcap_handler, unsigned char *);
void pcap_close(pcap_t *);
void pcap_breakloop(pcap_t *);
int pcap_sendpacket(pcap_t *, const unsigned char *, int);
#else
extern int (*pcap_findalldevs)(pcap_if_t **, char *);
extern void (*pcap_freealldevs)(pcap_if_t *);
extern pcap_t *(*pcap_open_live)(const char *, int, int, int, char *);
extern int (*pcap_compile)(pcap_t *, struct bpf_program *, const char *, int, bpf_u_int32);
extern int (*pcap_setfilter)(pcap_t *, struct bpf_program *);
extern char *(*pcap_geterr)(pcap_t *);
extern void (*pcap_freecode)(struct bpf_program *);
extern int (*pcap_loop)(pcap_t *, int, pcap_handler, unsigned char *);
extern void (*pcap_close)(pcap_t *);
extern void (*pcap_breakloop)(pcap_t *);
extern int (*pcap_sendpacket)(pcap_t *, const unsigned char *, int);
int load_libpcap(void); /* 载入libpcap.so */
void free_libpcap(void); /* 释放libpcap.so */
#endif /* NO_DYLOAD */
#endif /* HUSTMOON_DLFUNC_H */