git ssb

0+

cel / sslh



Tree: f4d2a8d2adb32056e656a73ce3d1d1d155f81046

Files: f4d2a8d2adb32056e656a73ce3d1d1d155f81046 / probe.h

2339 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
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 */
37struct proto * get_builtins(void);
38
39/* Returns the number of builtin protocols */
40int get_num_builtins(void);
41
42/* Returns the probe for specified protocol */
43T_PROBE* get_probe(const char* description);
44
45/* Returns the head of the configured protocols */
46struct proto* get_first_protocol(void);
47
48/* Set the list of configured protocols */
49void 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 */
58int probe_client_protocol(struct connection *cnx);
59
60/* set the protocol to connect to in case of timeout */
61void set_ontimeout(const char* name);
62
63/* timeout_protocol
64 *
65 * Returns the protocol to connect to in case of timeout
66 */
67struct proto* timeout_protocol(void);
68
69void hexdump(const char*, unsigned int);
70
71#endif
72

Built with git-ssb-web