git ssb

0+

cel / sslh



Tree: 2cb424c6464be24045c9f41b66811c3992970189

Files: 2cb424c6464be24045c9f41b66811c3992970189 / probe.h

2255 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 int log_level; /* 0: No logging of connection
24 * 1: Log incoming connection
25 */
26
27 /* function to probe that protocol; parameters are buffer and length
28 * containing the data to probe, and a pointer to the protocol structure */
29 T_PROBE* probe;
30 void* data; /* opaque pointer ; used to pass list of regex to regex probe, or sni hostnames to sni probe */
31 struct proto *next; /* pointer to next protocol in list, NULL if last */
32};
33
34/* Returns a pointer to the array of builtin protocols */
35struct proto * get_builtins(void);
36
37/* Returns the number of builtin protocols */
38int get_num_builtins(void);
39
40/* Returns the probe for specified protocol */
41T_PROBE* get_probe(const char* description);
42
43/* Returns the head of the configured protocols */
44struct proto* get_first_protocol(void);
45
46/* Set the list of configured protocols */
47void set_protocol_list(struct proto*);
48
49/* probe_client_protocol
50 *
51 * Read the beginning of data coming from the client connection and check if
52 * it's a known protocol. Then leave the data on the deferred
53 * write buffer of the connection and returns a pointer to the protocol
54 * structure
55 */
56int probe_client_protocol(struct connection *cnx);
57
58/* set the protocol to connect to in case of timeout */
59void set_ontimeout(const char* name);
60
61/* timeout_protocol
62 *
63 * Returns the protocol to connect to in case of timeout
64 */
65struct proto* timeout_protocol(void);
66
67void hexdump(const char*, unsigned int);
68
69#endif
70

Built with git-ssb-web