git ssb

0+

cel / sslh



Tree: 718fe0e2e9f339a022d9bc13285017fdd76a32e1

Files: 718fe0e2e9f339a022d9bc13285017fdd76a32e1 / probe.h

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

Built with git-ssb-web