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