core: do parsing in the main, put all in struct general fix: code support port > 1024
33 lines
693 B
C
33 lines
693 B
C
#pragma once
|
|
|
|
#include <netinet/ip_icmp.h>
|
|
#include <netinet/tcp.h>
|
|
#include <netinet/udp.h>
|
|
#include <stdint.h>
|
|
|
|
#include "scan.h"
|
|
|
|
#define TIMEOUT 5
|
|
|
|
typedef enum {
|
|
CLOSED,
|
|
OPENED,
|
|
FILTERED,
|
|
UNFILTERED,
|
|
OPENFILTERED,
|
|
} e_state;
|
|
|
|
[[__maybe_unused__]] static const char *states_str[] = {
|
|
"CLOSED", "OPENED", "FILTERED", "UNFILTERED", "OPENFILTERED",
|
|
};
|
|
|
|
struct response {
|
|
e_state states[SCAN_ALL];
|
|
char *service;
|
|
};
|
|
|
|
void tcp_response(const struct tcphdr *tcphdr, const struct scan *data);
|
|
void udp_response(const struct udphdr *udphdr, const struct scan *data);
|
|
void icmp_response(const struct icmphdr *icmphdr, const struct scan *data);
|
|
void no_response(const struct scan *data);
|