Files: aa06261d70509eb5a571937d5e3d5c41e11f193d / probe.h
2339 bytesRaw
1 | /* API for probe.c */ |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | typedef enum { |
10 | PROBE_NEXT, /* Enough data, probe failed -- it's some other protocol */ |
11 | PROBE_MATCH, /* Enough data, probe successful -- it's the current protocol */ |
12 | PROBE_AGAIN, /* Not enough data for this probe, try again with more data */ |
13 | } probe_result; |
14 | |
15 | struct proto; |
16 | typedef int T_PROBE(const char*, int, struct proto*); |
17 | |
18 | /* For each protocol we need: */ |
19 | struct proto { |
20 | const char* description; /* a string that says what it is (for logging and command-line parsing) */ |
21 | const char* service; /* service name to do libwrap checks */ |
22 | struct addrinfo *saddr; /* list of addresses to try and switch that protocol */ |
23 | int log_level; /* 0: No logging of connection |
24 | * 1: Log incoming connection |
25 | */ |
26 | int keepalive; /* 0: No keepalive ; 1: Set Keepalive for this connection */ |
27 | |
28 | /* function to probe that protocol; parameters are buffer and length |
29 | * containing the data to probe, and a pointer to the protocol structure */ |
30 | T_PROBE* probe; |
31 | /* opaque pointer ; used to pass list of regex to regex probe, or TLSProtocol struct to sni/alpn probe */ |
32 | void* data; |
33 | struct proto *next; /* pointer to next protocol in list, NULL if last */ |
34 | }; |
35 | |
36 | /* Returns a pointer to the array of builtin protocols */ |
37 | struct proto * get_builtins(void); |
38 | |
39 | /* Returns the number of builtin protocols */ |
40 | int get_num_builtins(void); |
41 | |
42 | /* Returns the probe for specified protocol */ |
43 | T_PROBE* get_probe(const char* description); |
44 | |
45 | /* Returns the head of the configured protocols */ |
46 | struct proto* get_first_protocol(void); |
47 | |
48 | /* Set the list of configured protocols */ |
49 | void set_protocol_list(struct proto*); |
50 | |
51 | /* probe_client_protocol |
52 | * |
53 | * Read the beginning of data coming from the client connection and check if |
54 | * it's a known protocol. Then leave the data on the deferred |
55 | * write buffer of the connection and returns a pointer to the protocol |
56 | * structure |
57 | */ |
58 | int probe_client_protocol(struct connection *cnx); |
59 | |
60 | /* set the protocol to connect to in case of timeout */ |
61 | void set_ontimeout(const char* name); |
62 | |
63 | /* timeout_protocol |
64 | * |
65 | * Returns the protocol to connect to in case of timeout |
66 | */ |
67 | struct proto* timeout_protocol(void); |
68 | |
69 | void hexdump(const char*, unsigned int); |
70 | |
71 | |
72 |
Built with git-ssb-web