-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathportlist.h
More file actions
54 lines (36 loc) · 1.09 KB
/
portlist.h
File metadata and controls
54 lines (36 loc) · 1.09 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
#ifndef PORTLIST_H
#define PORTLIST_H
#include <stdlib.h>
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
#define USING_THREAD_NUM (40)
typedef enum _scan_type_e
{
SCANNER_TCP,
SCANNER_UDP,
}scan_type_e;
typedef struct PortInfo
{
int port; //端口
int isOpen; //检测结果
char desc[64]; //端口描述
}PortInfo, *PortInfoList;
typedef struct HostInfo
{
char ip[32]; //端口
int isalive; //检测结果
char desc[64]; //端口描述
}HostInfo, *HostInfoList;
//! TCP
PortInfoList new_tcpportlist();
int get_tcpportlist_count();
void delete_tcpportlist(PortInfoList lst);
//! UDP
PortInfoList new_udpportlist();
int get_udpportlist_count();
void delete_udpportlist(PortInfoList lst);
int scanner_port(const char *ip, PortInfoList lst, int count, scan_type_e scantype, int timeout_ms);
//! show
void show_port_result(const char *tittle, PortInfoList lst, int count);
int scanner_host(HostInfoList lst, int count, int timeout_ms);
void show_host_result(const char *tittle, HostInfoList lst, int count);
#endif // PORTLIST_H