git ssb

0+

cel / sslh



Tree: 389ab9fbfff529ad82a4e44b91e6169872775dd3

Files: 389ab9fbfff529ad82a4e44b91e6169872775dd3 / probe.h

2130 bytesRaw
1/* API for probe.c */
2
3#ifndef __PROBE_H_
4#define __PROBE_H_
5
6#include "common.h"
7#include "tls.h"
8
9typedef 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
15struct proto;
16typedef int T_PROBE(const char*, int, struct proto*);
17
18/* For each protocol we need: */
19struct 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
24 /* function to probe that protocol; parameters are buffer and length
25 * containing the data to probe, and a pointer to the protocol structure */
26 T_PROBE* probe;
27 void* data; /* opaque pointer ; used to pass list of regex to regex probe, or sni hostnames to sni probe */
28 struct proto *next; /* pointer to next protocol in list, NULL if last */
29};
30
31/* Returns a pointer to the array of builtin protocols */
32struct proto * get_builtins(void);
33
34/* Returns the number of builtin protocols */
35int get_num_builtins(void);
36
37/* Returns the probe for specified protocol */
38T_PROBE* get_probe(const char* description);
39
40/* Returns the head of the configured protocols */
41struct proto* get_first_protocol(void);
42
43/* Set the list of configured protocols */
44void set_protocol_list(struct proto*);
45
46/* probe_client_protocol
47 *
48 * Read the beginning of data coming from the client connection and check if
49 * it's a known protocol. Then leave the data on the deferred
50 * write buffer of the connection and returns a pointer to the protocol
51 * structure
52 */
53int probe_client_protocol(struct connection *cnx);
54
55/* set the protocol to connect to in case of timeout */
56void set_ontimeout(const char* name);
57
58/* timeout_protocol
59 *
60 * Returns the protocol to connect to in case of timeout
61 */
62struct proto* timeout_protocol(void);
63
64void hexdump(const char*, unsigned int);
65
66#endif
67

Built with git-ssb-web