git ssb

0+

cel / sslh



Tree: 7c35ef8528d47b97894a6495275b57dc1ae3f8c7

Files: 7c35ef8528d47b97894a6495275b57dc1ae3f8c7 / probe.h

2082 bytesRaw
1/* API for probe.c */
2
3#ifndef __PROBE_H_
4#define __PROBE_H_
5
6#include "common.h"
7
8typedef 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
14struct proto;
15typedef int T_PROBE(const char*, int, struct proto*);
16
17/* For each protocol we need: */
18struct 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 */
31struct proto * get_builtins(void);
32
33/* Returns the number of builtin protocols */
34int get_num_builtins(void);
35
36/* Returns the probe for specified protocol */
37T_PROBE* get_probe(const char* description);
38
39/* Returns the head of the configured protocols */
40struct proto* get_first_protocol(void);
41
42/* Set the list of configured protocols */
43void 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 */
52int probe_client_protocol(struct connection *cnx);
53
54/* set the protocol to connect to in case of timeout */
55void set_ontimeout(const char* name);
56
57/* timeout_protocol
58 *
59 * Returns the protocol to connect to in case of timeout
60 */
61struct proto* timeout_protocol(void);
62
63void hexdump(const char*, unsigned int);
64
65#endif
66

Built with git-ssb-web